@codespar/cli 0.18.1 → 0.21.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/README.md +1 -1
- package/dist/commands/login.js +52 -12
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/payables.js +220 -0
- package/dist/commands/payables.js.map +1 -0
- package/dist/index.js +77 -1
- package/dist/index.js.map +1 -1
- package/dist/surface.js +31 -13
- package/dist/surface.js.map +1 -1
- package/package.json +2 -2
- package/templates/bills-agent/README.md +2 -2
- package/templates/bills-agent/agents/bills-agent/.env.example +2 -2
- package/templates/bills-agent/agents/bills-agent/README.md +25 -18
- package/templates/bills-agent/agents/bills-agent/SYSTEM_PROMPT.md +13 -3
- package/templates/bills-agent/agents/bills-agent/agent.yaml +2 -1
- package/templates/bills-agent/agents/bills-agent/evals/adversarial/exfiltration.transcript.jsonl +1 -1
- package/templates/bills-agent/agents/bills-agent/evals/adversarial/false-authority.transcript.jsonl +1 -1
- package/templates/bills-agent/agents/bills-agent/evals/adversarial/prompt-injection.transcript.jsonl +1 -1
- package/templates/bills-agent/agents/bills-agent/mandate.example.json +1 -1
- package/templates/bills-agent/agents/bills-agent/runbook.md +1 -1
- package/templates/bills-agent/agents/bills-agent/scenarios/beneficiary-not-allowed.transcript.jsonl +1 -1
- package/templates/bills-agent/agents/bills-agent/scenarios/cap-exceeded.transcript.jsonl +1 -1
- package/templates/bills-agent/agents/bills-agent/scenarios/escalated-above-threshold.transcript.jsonl +4 -4
- package/templates/bills-agent/agents/bills-agent/scenarios/happy-path.transcript.jsonl +1 -1
- package/templates/bills-agent/agents/bills-agent/scenarios/mandate-revoked.json +1 -1
- package/templates/bills-agent/agents/bills-agent/scenarios/mandate-revoked.transcript.jsonl +4 -4
- package/templates/bills-agent/agents/bills-agent/scenarios/prompt-injection.transcript.jsonl +1 -1
- package/templates/bills-agent/agents/bills-agent/src/bills.ts +1 -1
- package/templates/bills-agent/agents/bills-agent/src/kit.ts +15 -28
- package/templates/bills-agent/agents/bills-agent/src/modules/embedded-consent.ts +42 -15
- package/templates/bills-agent/agents/bills-agent/src/modules/pix-out.ts +21 -3
- package/templates/bills-agent/agents/bills-agent/src/strings.ts +68 -0
- package/templates/bills-agent/agents/bills-agent/test/cli.test.ts +130 -2
- package/templates/bills-agent/agents/bills-agent/test/consent-money.test.ts +25 -0
- package/templates/bills-agent/agents/bills-agent/test/dates-and-approval.test.ts +98 -0
- package/templates/bills-agent/agents/bills-agent/test/eval-runs.test.ts +81 -0
- package/templates/bills-agent/agents/bills-agent/test/fixtures/excursao-300.transcript.jsonl +2 -2
- package/templates/bills-agent/agents/bills-agent/test/fixtures/material-400.transcript.jsonl +1 -1
- package/templates/bills-agent/agents/bills-agent/test/locale.test.ts +161 -0
- package/templates/bills-agent/agents/bills-agent/test/mandate-state.test.ts +108 -0
- package/templates/bills-agent/agents/bills-agent/test/refused-before-draft.test.ts +81 -0
- package/templates/bills-agent/agents/bills-agent/test/replay.test.ts +76 -0
- package/templates/bills-agent/agents/bills-agent/test/reply-and-outcome.test.ts +84 -0
- package/templates/bills-agent/agents/bills-agent/test/reply-language.test.ts +95 -0
- package/templates/bills-agent/agents/bills-agent/test/rerun-and-missing-transcript.test.ts +120 -0
- package/templates/bills-agent/agents/bills-agent/test/rerun-world-events.test.ts +55 -0
- package/templates/bills-agent/agents/bills-agent/tools.json +1 -1
- package/templates/bills-agent/packages/agent-core/README.md +21 -2
- package/templates/bills-agent/packages/agent-core/package.json +1 -1
- package/templates/bills-agent/packages/agent-core/src/agent.ts +33 -6
- package/templates/bills-agent/packages/agent-core/src/api/charge-rail.ts +15 -1
- package/templates/bills-agent/packages/agent-core/src/api/rail.ts +11 -5
- package/templates/bills-agent/packages/agent-core/src/api/sandbox-payer.ts +36 -0
- package/templates/bills-agent/packages/agent-core/src/bundle.ts +2 -0
- package/templates/bills-agent/packages/agent-core/src/channels.ts +18 -8
- package/templates/bills-agent/packages/agent-core/src/check.ts +25 -3
- package/templates/bills-agent/packages/agent-core/src/engine.ts +90 -9
- package/templates/bills-agent/packages/agent-core/src/escalate.ts +10 -0
- package/templates/bills-agent/packages/agent-core/src/index.ts +3 -0
- package/templates/bills-agent/packages/agent-core/src/language.ts +52 -0
- package/templates/bills-agent/packages/agent-core/src/locale.ts +88 -0
- package/templates/bills-agent/packages/agent-core/src/manifest.ts +4 -1
- package/templates/bills-agent/packages/agent-core/src/rail.ts +29 -1
- package/templates/bills-agent/packages/agent-core/src/receipt-verification.ts +30 -2
- package/templates/bills-agent/packages/agent-core/src/secrets.ts +53 -8
- package/templates/bills-agent/packages/agent-core/src/state-machine.ts +14 -0
- package/templates/bills-agent/packages/agent-core/src/strings.ts +175 -0
- package/templates/bills-agent/packages/agent-core/src/stubs/charge-rail.ts +15 -2
- package/templates/bills-agent/packages/agent-core/src/stubs/rail.ts +7 -4
- package/templates/bills-agent/packages/agent-core/src/types.ts +15 -2
- package/templates/bills-agent/packages/agent-core/test/actor-on-the-wire.test.ts +144 -0
- package/templates/bills-agent/packages/agent-core/test/attempt-replay.test.ts +2 -2
- package/templates/bills-agent/packages/agent-core/test/engine.test.ts +23 -0
- package/templates/bills-agent/packages/agent-core/test/helpers.ts +1 -1
- package/templates/bills-agent/packages/agent-core/test/language.test.ts +40 -0
- package/templates/bills-agent/packages/agent-core/test/locale.test.ts +137 -0
- package/templates/bills-agent/packages/agent-core/test/mandate-status.test.ts +2 -2
- package/templates/bills-agent/packages/agent-core/test/manifest.test.ts +2 -2
- package/templates/bills-agent/packages/agent-core/test/rail-errors.test.ts +74 -0
- package/templates/bills-agent/packages/agent-core/test/receipt-read-verification.test.ts +32 -0
- package/templates/bills-agent/packages/agent-core/test/receivables.test.ts +49 -0
- package/templates/bills-agent/packages/agent-core/test/recorded-turns.ts +29 -0
- package/templates/bills-agent/packages/agent-core/test/secrets.test.ts +40 -1
- package/templates/bills-agent/packages/agent-runtime/README.md +31 -4
- package/templates/bills-agent/packages/agent-runtime/src/channels/rules.ts +4 -2
- package/templates/bills-agent/packages/agent-runtime/src/channels/whatsapp/emulator.ts +11 -5
- package/templates/bills-agent/packages/agent-runtime/src/channels/whatsapp/index.ts +43 -21
- package/templates/bills-agent/packages/agent-runtime/src/channels/whatsapp/open.ts +3 -0
- package/templates/bills-agent/packages/agent-runtime/src/channels/whatsapp/present.ts +8 -12
- package/templates/bills-agent/packages/agent-runtime/src/channels/whatsapp/run.ts +8 -4
- package/templates/bills-agent/packages/agent-runtime/src/channels/whatsapp/session.ts +12 -9
- package/templates/bills-agent/packages/agent-runtime/src/cli.ts +30 -4
- package/templates/bills-agent/packages/agent-runtime/src/commands/check.ts +18 -2
- package/templates/bills-agent/packages/agent-runtime/src/commands/decide.ts +13 -4
- package/templates/bills-agent/packages/agent-runtime/src/commands/eval.ts +7 -2
- package/templates/bills-agent/packages/agent-runtime/src/commands/inspect.ts +11 -13
- package/templates/bills-agent/packages/agent-runtime/src/commands/poll-whatsapp.ts +32 -24
- package/templates/bills-agent/packages/agent-runtime/src/commands/poll.ts +12 -5
- package/templates/bills-agent/packages/agent-runtime/src/commands/rerun.ts +83 -10
- package/templates/bills-agent/packages/agent-runtime/src/commands/resume.ts +2 -1
- package/templates/bills-agent/packages/agent-runtime/src/commands/start-whatsapp.ts +10 -5
- package/templates/bills-agent/packages/agent-runtime/src/commands/start.ts +48 -17
- package/templates/bills-agent/packages/agent-runtime/src/commands/verify.ts +37 -12
- package/templates/bills-agent/packages/agent-runtime/src/commands/webhook.ts +11 -3
- package/templates/bills-agent/packages/agent-runtime/src/default-kit.ts +52 -22
- package/templates/bills-agent/packages/agent-runtime/src/env.ts +64 -0
- package/templates/bills-agent/packages/agent-runtime/src/index.ts +2 -0
- package/templates/bills-agent/packages/agent-runtime/src/inspect.ts +81 -10
- package/templates/bills-agent/packages/agent-runtime/src/kit.ts +34 -12
- package/templates/bills-agent/packages/agent-runtime/src/outcome.ts +118 -0
- package/templates/bills-agent/packages/agent-runtime/src/poll.ts +7 -7
- package/templates/bills-agent/packages/agent-runtime/src/runs.ts +51 -0
- package/templates/bills-agent/packages/agent-runtime/src/scenarios.ts +55 -8
- package/templates/bills-agent/packages/agent-runtime/src/setup.ts +75 -5
- package/templates/bills-agent/packages/agent-runtime/src/terminal.ts +71 -33
- package/templates/bills-agent/packages/agent-runtime/test/env-names.test.ts +56 -0
- package/templates/bills-agent/packages/agent-runtime/test/inspect-mandate-status.test.ts +80 -0
- package/templates/bills-agent/packages/agent-runtime/test/inspect.test.ts +63 -2
- package/templates/bills-agent/packages/agent-runtime/test/outcome.test.ts +72 -0
- package/templates/bills-agent/packages/agent-runtime/test/poll-payer.test.ts +64 -0
- package/templates/bills-agent/packages/agent-runtime/test/rerun-not-replayed.test.ts +46 -0
- package/templates/bills-agent/packages/agent-runtime/test/transition-line.test.ts +29 -0
- package/templates/bills-agent/packages/agent-runtime/test/verify-cli.test.ts +99 -6
- package/templates/bills-agent/packages/agent-runtime/test/whatsapp-rules.test.ts +8 -0
- package/templates/bills-agent/packages/agent-runtime/test/whatsapp-session.test.ts +77 -0
- package/templates/bills-agent/packages/agent-runtime/test/whatsapp-status-replies.test.ts +27 -1
- package/templates/checkout-agent/README.md +2 -2
- package/templates/checkout-agent/agents/checkout-agent/.env.example +6 -4
- package/templates/checkout-agent/agents/checkout-agent/README.md +16 -8
- package/templates/checkout-agent/agents/checkout-agent/SYSTEM_PROMPT.md +17 -7
- package/templates/checkout-agent/agents/checkout-agent/agent.yaml +4 -3
- package/templates/checkout-agent/agents/checkout-agent/channels/whatsapp/README.md +2 -2
- package/templates/checkout-agent/agents/checkout-agent/channels/whatsapp/templates.json +48 -4
- package/templates/checkout-agent/agents/checkout-agent/evals/adversarial/beneficiary-swap-human.json +1 -1
- package/templates/checkout-agent/agents/checkout-agent/evals/adversarial/beneficiary-swap.json +1 -1
- package/templates/checkout-agent/agents/checkout-agent/evals/adversarial/beneficiary-swap.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/evals/adversarial/coupon-unknown.json +1 -1
- package/templates/checkout-agent/agents/checkout-agent/evals/adversarial/exfiltration.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/evals/adversarial/fractioning.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/evals/adversarial/payment-claimed.json +1 -1
- package/templates/checkout-agent/agents/checkout-agent/evals/adversarial/payment-claimed.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/evals/adversarial/price-injected.json +1 -1
- package/templates/checkout-agent/agents/checkout-agent/evals/adversarial/prompt-injection.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/evals/adversarial/quantity-swapped.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/package.json +1 -1
- package/templates/checkout-agent/agents/checkout-agent/runbook.md +4 -4
- package/templates/checkout-agent/agents/checkout-agent/scenarios/beneficiary-not-allowed.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/scenarios/cart-recomposed.transcript.jsonl +2 -2
- package/templates/checkout-agent/agents/checkout-agent/scenarios/cart-replaced.json +2 -2
- package/templates/checkout-agent/agents/checkout-agent/scenarios/cart-replaced.transcript.jsonl +2 -2
- package/templates/checkout-agent/agents/checkout-agent/scenarios/charge-expired.json +1 -1
- package/templates/checkout-agent/agents/checkout-agent/scenarios/charge-expired.transcript.jsonl +2 -2
- package/templates/checkout-agent/agents/checkout-agent/scenarios/coupon-unknown.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/scenarios/escalated-above-threshold.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/scenarios/happy-path.transcript.jsonl +2 -2
- package/templates/checkout-agent/agents/checkout-agent/scenarios/item-unavailable.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/scenarios/mandate-revoked.transcript.jsonl +3 -3
- package/templates/checkout-agent/agents/checkout-agent/scenarios/payment-claimed.json +1 -1
- package/templates/checkout-agent/agents/checkout-agent/scenarios/payment-claimed.transcript.jsonl +2 -2
- package/templates/checkout-agent/agents/checkout-agent/scenarios/price-injected.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/scenarios/prompt-injection.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/src/catalog.ts +7 -7
- package/templates/checkout-agent/agents/checkout-agent/src/kit.ts +47 -43
- package/templates/checkout-agent/agents/checkout-agent/src/modules/bolepix-receivables.ts +20 -12
- package/templates/checkout-agent/agents/checkout-agent/src/modules/nfse-invoice.ts +4 -4
- package/templates/checkout-agent/agents/checkout-agent/src/modules/storefront-cart.ts +9 -6
- package/templates/checkout-agent/agents/checkout-agent/src/pricing.ts +44 -41
- package/templates/checkout-agent/agents/checkout-agent/src/strings.ts +179 -0
- package/templates/checkout-agent/agents/checkout-agent/test/check.test.ts +4 -1
- package/templates/checkout-agent/agents/checkout-agent/test/fixtures/order-marina.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/test/fixtures/ordered-marina-awaiting-payer.transcript.jsonl +2 -2
- package/templates/checkout-agent/agents/checkout-agent/test/fixtures/tap-falar-agora-marina.transcript.jsonl +1 -1
- package/templates/checkout-agent/agents/checkout-agent/test/payable-instrument.test.ts +58 -0
- package/templates/checkout-agent/agents/checkout-agent/test/pricing.test.ts +2 -2
- package/templates/checkout-agent/agents/checkout-agent/test/rerun-unpaid.test.ts +47 -0
- package/templates/checkout-agent/agents/checkout-agent/test/scenario-reach-and-seconds.test.ts +55 -0
- package/templates/checkout-agent/agents/checkout-agent/test/whatsapp.test.ts +26 -10
- package/templates/checkout-agent/agents/checkout-agent/tools.json +1 -1
- package/templates/checkout-agent/packages/agent-core/README.md +21 -2
- package/templates/checkout-agent/packages/agent-core/package.json +1 -1
- package/templates/checkout-agent/packages/agent-core/src/agent.ts +33 -6
- package/templates/checkout-agent/packages/agent-core/src/api/charge-rail.ts +15 -1
- package/templates/checkout-agent/packages/agent-core/src/api/rail.ts +11 -5
- package/templates/checkout-agent/packages/agent-core/src/api/sandbox-payer.ts +36 -0
- package/templates/checkout-agent/packages/agent-core/src/bundle.ts +2 -0
- package/templates/checkout-agent/packages/agent-core/src/channels.ts +18 -8
- package/templates/checkout-agent/packages/agent-core/src/check.ts +25 -3
- package/templates/checkout-agent/packages/agent-core/src/engine.ts +90 -9
- package/templates/checkout-agent/packages/agent-core/src/escalate.ts +10 -0
- package/templates/checkout-agent/packages/agent-core/src/index.ts +3 -0
- package/templates/checkout-agent/packages/agent-core/src/language.ts +52 -0
- package/templates/checkout-agent/packages/agent-core/src/locale.ts +88 -0
- package/templates/checkout-agent/packages/agent-core/src/manifest.ts +4 -1
- package/templates/checkout-agent/packages/agent-core/src/rail.ts +29 -1
- package/templates/checkout-agent/packages/agent-core/src/receipt-verification.ts +30 -2
- package/templates/checkout-agent/packages/agent-core/src/secrets.ts +53 -8
- package/templates/checkout-agent/packages/agent-core/src/state-machine.ts +14 -0
- package/templates/checkout-agent/packages/agent-core/src/strings.ts +175 -0
- package/templates/checkout-agent/packages/agent-core/src/stubs/charge-rail.ts +15 -2
- package/templates/checkout-agent/packages/agent-core/src/stubs/rail.ts +7 -4
- package/templates/checkout-agent/packages/agent-core/src/types.ts +15 -2
- package/templates/checkout-agent/packages/agent-core/test/actor-on-the-wire.test.ts +144 -0
- package/templates/checkout-agent/packages/agent-core/test/attempt-replay.test.ts +2 -2
- package/templates/checkout-agent/packages/agent-core/test/engine.test.ts +23 -0
- package/templates/checkout-agent/packages/agent-core/test/helpers.ts +1 -1
- package/templates/checkout-agent/packages/agent-core/test/language.test.ts +40 -0
- package/templates/checkout-agent/packages/agent-core/test/locale.test.ts +137 -0
- package/templates/checkout-agent/packages/agent-core/test/mandate-status.test.ts +2 -2
- package/templates/checkout-agent/packages/agent-core/test/manifest.test.ts +2 -2
- package/templates/checkout-agent/packages/agent-core/test/rail-errors.test.ts +74 -0
- package/templates/checkout-agent/packages/agent-core/test/receipt-read-verification.test.ts +32 -0
- package/templates/checkout-agent/packages/agent-core/test/receivables.test.ts +49 -0
- package/templates/checkout-agent/packages/agent-core/test/recorded-turns.ts +29 -0
- package/templates/checkout-agent/packages/agent-core/test/secrets.test.ts +40 -1
- package/templates/checkout-agent/packages/agent-runtime/README.md +31 -4
- package/templates/checkout-agent/packages/agent-runtime/src/channels/rules.ts +4 -2
- package/templates/checkout-agent/packages/agent-runtime/src/channels/whatsapp/emulator.ts +11 -5
- package/templates/checkout-agent/packages/agent-runtime/src/channels/whatsapp/index.ts +43 -21
- package/templates/checkout-agent/packages/agent-runtime/src/channels/whatsapp/open.ts +3 -0
- package/templates/checkout-agent/packages/agent-runtime/src/channels/whatsapp/present.ts +8 -12
- package/templates/checkout-agent/packages/agent-runtime/src/channels/whatsapp/run.ts +8 -4
- package/templates/checkout-agent/packages/agent-runtime/src/channels/whatsapp/session.ts +12 -9
- package/templates/checkout-agent/packages/agent-runtime/src/cli.ts +30 -4
- package/templates/checkout-agent/packages/agent-runtime/src/commands/check.ts +18 -2
- package/templates/checkout-agent/packages/agent-runtime/src/commands/decide.ts +13 -4
- package/templates/checkout-agent/packages/agent-runtime/src/commands/eval.ts +7 -2
- package/templates/checkout-agent/packages/agent-runtime/src/commands/inspect.ts +11 -13
- package/templates/checkout-agent/packages/agent-runtime/src/commands/poll-whatsapp.ts +32 -24
- package/templates/checkout-agent/packages/agent-runtime/src/commands/poll.ts +12 -5
- package/templates/checkout-agent/packages/agent-runtime/src/commands/rerun.ts +83 -10
- package/templates/checkout-agent/packages/agent-runtime/src/commands/resume.ts +2 -1
- package/templates/checkout-agent/packages/agent-runtime/src/commands/start-whatsapp.ts +10 -5
- package/templates/checkout-agent/packages/agent-runtime/src/commands/start.ts +48 -17
- package/templates/checkout-agent/packages/agent-runtime/src/commands/verify.ts +37 -12
- package/templates/checkout-agent/packages/agent-runtime/src/commands/webhook.ts +11 -3
- package/templates/checkout-agent/packages/agent-runtime/src/default-kit.ts +52 -22
- package/templates/checkout-agent/packages/agent-runtime/src/env.ts +64 -0
- package/templates/checkout-agent/packages/agent-runtime/src/index.ts +2 -0
- package/templates/checkout-agent/packages/agent-runtime/src/inspect.ts +81 -10
- package/templates/checkout-agent/packages/agent-runtime/src/kit.ts +34 -12
- package/templates/checkout-agent/packages/agent-runtime/src/outcome.ts +118 -0
- package/templates/checkout-agent/packages/agent-runtime/src/poll.ts +7 -7
- package/templates/checkout-agent/packages/agent-runtime/src/runs.ts +51 -0
- package/templates/checkout-agent/packages/agent-runtime/src/scenarios.ts +55 -8
- package/templates/checkout-agent/packages/agent-runtime/src/setup.ts +75 -5
- package/templates/checkout-agent/packages/agent-runtime/src/terminal.ts +71 -33
- package/templates/checkout-agent/packages/agent-runtime/test/env-names.test.ts +56 -0
- package/templates/checkout-agent/packages/agent-runtime/test/inspect-mandate-status.test.ts +80 -0
- package/templates/checkout-agent/packages/agent-runtime/test/inspect.test.ts +63 -2
- package/templates/checkout-agent/packages/agent-runtime/test/outcome.test.ts +72 -0
- package/templates/checkout-agent/packages/agent-runtime/test/poll-payer.test.ts +64 -0
- package/templates/checkout-agent/packages/agent-runtime/test/rerun-not-replayed.test.ts +46 -0
- package/templates/checkout-agent/packages/agent-runtime/test/transition-line.test.ts +29 -0
- package/templates/checkout-agent/packages/agent-runtime/test/verify-cli.test.ts +99 -6
- package/templates/checkout-agent/packages/agent-runtime/test/whatsapp-rules.test.ts +8 -0
- package/templates/checkout-agent/packages/agent-runtime/test/whatsapp-session.test.ts +77 -0
- package/templates/checkout-agent/packages/agent-runtime/test/whatsapp-status-replies.test.ts +27 -1
- package/templates/collections-agent/README.md +2 -2
- package/templates/collections-agent/agents/collections-agent/.env.example +6 -3
- package/templates/collections-agent/agents/collections-agent/README.md +14 -9
- package/templates/collections-agent/agents/collections-agent/SYSTEM_PROMPT.md +16 -5
- package/templates/collections-agent/agents/collections-agent/agent.yaml +4 -3
- package/templates/collections-agent/agents/collections-agent/channels/whatsapp/README.md +21 -4
- package/templates/collections-agent/agents/collections-agent/channels/whatsapp/templates.json +49 -5
- package/templates/collections-agent/agents/collections-agent/mandate.example.json +1 -1
- package/templates/collections-agent/agents/collections-agent/runbook.md +3 -3
- package/templates/collections-agent/agents/collections-agent/src/agreements.ts +1 -1
- package/templates/collections-agent/agents/collections-agent/src/envelope.ts +15 -13
- package/templates/collections-agent/agents/collections-agent/src/kit.ts +38 -35
- package/templates/collections-agent/agents/collections-agent/src/modules/bolepix-receivables.ts +16 -8
- package/templates/collections-agent/agents/collections-agent/src/strings.ts +91 -0
- package/templates/collections-agent/agents/collections-agent/test/ambiguous-charge.test.ts +2 -2
- package/templates/collections-agent/agents/collections-agent/test/check.test.ts +4 -1
- package/templates/collections-agent/agents/collections-agent/test/cli.test.ts +1 -1
- package/templates/collections-agent/agents/collections-agent/test/envelope.test.ts +2 -2
- package/templates/collections-agent/agents/collections-agent/test/fixtures/accept-1103.transcript.jsonl +1 -1
- package/templates/collections-agent/agents/collections-agent/test/fixtures/tap-emitir-nova-1042.transcript.jsonl +1 -1
- package/templates/collections-agent/agents/collections-agent/test/payable-instrument.test.ts +56 -0
- package/templates/collections-agent/agents/collections-agent/test/rerun-clock.test.ts +54 -0
- package/templates/collections-agent/agents/collections-agent/test/whatsapp-poll.test.ts +69 -2
- package/templates/collections-agent/agents/collections-agent/test/whatsapp-status-replies.test.ts +16 -3
- package/templates/collections-agent/agents/collections-agent/test/whatsapp.test.ts +16 -4
- package/templates/collections-agent/agents/collections-agent/tools.json +2 -2
- package/templates/collections-agent/packages/agent-core/README.md +21 -2
- package/templates/collections-agent/packages/agent-core/package.json +1 -1
- package/templates/collections-agent/packages/agent-core/src/agent.ts +33 -6
- package/templates/collections-agent/packages/agent-core/src/api/charge-rail.ts +15 -1
- package/templates/collections-agent/packages/agent-core/src/api/rail.ts +11 -5
- package/templates/collections-agent/packages/agent-core/src/api/sandbox-payer.ts +36 -0
- package/templates/collections-agent/packages/agent-core/src/bundle.ts +2 -0
- package/templates/collections-agent/packages/agent-core/src/channels.ts +18 -8
- package/templates/collections-agent/packages/agent-core/src/check.ts +25 -3
- package/templates/collections-agent/packages/agent-core/src/engine.ts +90 -9
- package/templates/collections-agent/packages/agent-core/src/escalate.ts +10 -0
- package/templates/collections-agent/packages/agent-core/src/index.ts +3 -0
- package/templates/collections-agent/packages/agent-core/src/language.ts +52 -0
- package/templates/collections-agent/packages/agent-core/src/locale.ts +88 -0
- package/templates/collections-agent/packages/agent-core/src/manifest.ts +4 -1
- package/templates/collections-agent/packages/agent-core/src/rail.ts +29 -1
- package/templates/collections-agent/packages/agent-core/src/receipt-verification.ts +30 -2
- package/templates/collections-agent/packages/agent-core/src/secrets.ts +53 -8
- package/templates/collections-agent/packages/agent-core/src/state-machine.ts +14 -0
- package/templates/collections-agent/packages/agent-core/src/strings.ts +175 -0
- package/templates/collections-agent/packages/agent-core/src/stubs/charge-rail.ts +15 -2
- package/templates/collections-agent/packages/agent-core/src/stubs/rail.ts +7 -4
- package/templates/collections-agent/packages/agent-core/src/types.ts +15 -2
- package/templates/collections-agent/packages/agent-core/test/actor-on-the-wire.test.ts +144 -0
- package/templates/collections-agent/packages/agent-core/test/attempt-replay.test.ts +2 -2
- package/templates/collections-agent/packages/agent-core/test/engine.test.ts +23 -0
- package/templates/collections-agent/packages/agent-core/test/helpers.ts +1 -1
- package/templates/collections-agent/packages/agent-core/test/language.test.ts +40 -0
- package/templates/collections-agent/packages/agent-core/test/locale.test.ts +137 -0
- package/templates/collections-agent/packages/agent-core/test/mandate-status.test.ts +2 -2
- package/templates/collections-agent/packages/agent-core/test/manifest.test.ts +2 -2
- package/templates/collections-agent/packages/agent-core/test/rail-errors.test.ts +74 -0
- package/templates/collections-agent/packages/agent-core/test/receipt-read-verification.test.ts +32 -0
- package/templates/collections-agent/packages/agent-core/test/receivables.test.ts +49 -0
- package/templates/collections-agent/packages/agent-core/test/recorded-turns.ts +29 -0
- package/templates/collections-agent/packages/agent-core/test/secrets.test.ts +40 -1
- package/templates/collections-agent/packages/agent-runtime/README.md +31 -4
- package/templates/collections-agent/packages/agent-runtime/src/channels/rules.ts +4 -2
- package/templates/collections-agent/packages/agent-runtime/src/channels/whatsapp/emulator.ts +11 -5
- package/templates/collections-agent/packages/agent-runtime/src/channels/whatsapp/index.ts +43 -21
- package/templates/collections-agent/packages/agent-runtime/src/channels/whatsapp/open.ts +3 -0
- package/templates/collections-agent/packages/agent-runtime/src/channels/whatsapp/present.ts +8 -12
- package/templates/collections-agent/packages/agent-runtime/src/channels/whatsapp/run.ts +8 -4
- package/templates/collections-agent/packages/agent-runtime/src/channels/whatsapp/session.ts +12 -9
- package/templates/collections-agent/packages/agent-runtime/src/cli.ts +30 -4
- package/templates/collections-agent/packages/agent-runtime/src/commands/check.ts +18 -2
- package/templates/collections-agent/packages/agent-runtime/src/commands/decide.ts +13 -4
- package/templates/collections-agent/packages/agent-runtime/src/commands/eval.ts +7 -2
- package/templates/collections-agent/packages/agent-runtime/src/commands/inspect.ts +11 -13
- package/templates/collections-agent/packages/agent-runtime/src/commands/poll-whatsapp.ts +32 -24
- package/templates/collections-agent/packages/agent-runtime/src/commands/poll.ts +12 -5
- package/templates/collections-agent/packages/agent-runtime/src/commands/rerun.ts +83 -10
- package/templates/collections-agent/packages/agent-runtime/src/commands/resume.ts +2 -1
- package/templates/collections-agent/packages/agent-runtime/src/commands/start-whatsapp.ts +10 -5
- package/templates/collections-agent/packages/agent-runtime/src/commands/start.ts +48 -17
- package/templates/collections-agent/packages/agent-runtime/src/commands/verify.ts +37 -12
- package/templates/collections-agent/packages/agent-runtime/src/commands/webhook.ts +11 -3
- package/templates/collections-agent/packages/agent-runtime/src/default-kit.ts +52 -22
- package/templates/collections-agent/packages/agent-runtime/src/env.ts +64 -0
- package/templates/collections-agent/packages/agent-runtime/src/index.ts +2 -0
- package/templates/collections-agent/packages/agent-runtime/src/inspect.ts +81 -10
- package/templates/collections-agent/packages/agent-runtime/src/kit.ts +34 -12
- package/templates/collections-agent/packages/agent-runtime/src/outcome.ts +118 -0
- package/templates/collections-agent/packages/agent-runtime/src/poll.ts +7 -7
- package/templates/collections-agent/packages/agent-runtime/src/runs.ts +51 -0
- package/templates/collections-agent/packages/agent-runtime/src/scenarios.ts +55 -8
- package/templates/collections-agent/packages/agent-runtime/src/setup.ts +75 -5
- package/templates/collections-agent/packages/agent-runtime/src/terminal.ts +71 -33
- package/templates/collections-agent/packages/agent-runtime/test/env-names.test.ts +56 -0
- package/templates/collections-agent/packages/agent-runtime/test/inspect-mandate-status.test.ts +80 -0
- package/templates/collections-agent/packages/agent-runtime/test/inspect.test.ts +63 -2
- package/templates/collections-agent/packages/agent-runtime/test/outcome.test.ts +72 -0
- package/templates/collections-agent/packages/agent-runtime/test/poll-payer.test.ts +64 -0
- package/templates/collections-agent/packages/agent-runtime/test/rerun-not-replayed.test.ts +46 -0
- package/templates/collections-agent/packages/agent-runtime/test/transition-line.test.ts +29 -0
- package/templates/collections-agent/packages/agent-runtime/test/verify-cli.test.ts +99 -6
- package/templates/collections-agent/packages/agent-runtime/test/whatsapp-rules.test.ts +8 -0
- package/templates/collections-agent/packages/agent-runtime/test/whatsapp-session.test.ts +77 -0
- package/templates/collections-agent/packages/agent-runtime/test/whatsapp-status-replies.test.ts +27 -1
- package/templates/hello-agent/README.md +2 -2
- package/templates/hello-agent/agents/hello-agent/README.md +6 -0
- package/templates/hello-agent/agents/hello-agent/SYSTEM_PROMPT.md +27 -13
- package/templates/hello-agent/agents/hello-agent/agent.yaml +2 -1
- package/templates/hello-agent/agents/hello-agent/evals/adversarial/exfiltration.transcript.jsonl +1 -1
- package/templates/hello-agent/agents/hello-agent/evals/adversarial/prompt-injection.transcript.jsonl +1 -1
- package/templates/hello-agent/agents/hello-agent/mandate.example.json +1 -1
- package/templates/hello-agent/agents/hello-agent/scenarios/happy-path.json +1 -1
- package/templates/hello-agent/agents/hello-agent/scenarios/happy-path.transcript.jsonl +1 -1
- package/templates/hello-agent/agents/hello-agent/scenarios/prompt-injection.json +1 -1
- package/templates/hello-agent/agents/hello-agent/scenarios/prompt-injection.transcript.jsonl +1 -1
- package/templates/hello-agent/agents/hello-agent/src/bills.ts +9 -5
- package/templates/hello-agent/agents/hello-agent/src/kit.ts +4 -1
- package/templates/hello-agent/agents/hello-agent/tools.json +1 -1
- package/templates/hello-agent/packages/agent-core/README.md +21 -2
- package/templates/hello-agent/packages/agent-core/package.json +1 -1
- package/templates/hello-agent/packages/agent-core/src/agent.ts +33 -6
- package/templates/hello-agent/packages/agent-core/src/api/charge-rail.ts +15 -1
- package/templates/hello-agent/packages/agent-core/src/api/rail.ts +11 -5
- package/templates/hello-agent/packages/agent-core/src/api/sandbox-payer.ts +36 -0
- package/templates/hello-agent/packages/agent-core/src/bundle.ts +2 -0
- package/templates/hello-agent/packages/agent-core/src/channels.ts +18 -8
- package/templates/hello-agent/packages/agent-core/src/check.ts +25 -3
- package/templates/hello-agent/packages/agent-core/src/engine.ts +90 -9
- package/templates/hello-agent/packages/agent-core/src/escalate.ts +10 -0
- package/templates/hello-agent/packages/agent-core/src/index.ts +3 -0
- package/templates/hello-agent/packages/agent-core/src/language.ts +52 -0
- package/templates/hello-agent/packages/agent-core/src/locale.ts +88 -0
- package/templates/hello-agent/packages/agent-core/src/manifest.ts +4 -1
- package/templates/hello-agent/packages/agent-core/src/rail.ts +29 -1
- package/templates/hello-agent/packages/agent-core/src/receipt-verification.ts +30 -2
- package/templates/hello-agent/packages/agent-core/src/secrets.ts +53 -8
- package/templates/hello-agent/packages/agent-core/src/state-machine.ts +14 -0
- package/templates/hello-agent/packages/agent-core/src/strings.ts +175 -0
- package/templates/hello-agent/packages/agent-core/src/stubs/charge-rail.ts +15 -2
- package/templates/hello-agent/packages/agent-core/src/stubs/rail.ts +7 -4
- package/templates/hello-agent/packages/agent-core/src/types.ts +15 -2
- package/templates/hello-agent/packages/agent-core/test/actor-on-the-wire.test.ts +144 -0
- package/templates/hello-agent/packages/agent-core/test/attempt-replay.test.ts +2 -2
- package/templates/hello-agent/packages/agent-core/test/engine.test.ts +23 -0
- package/templates/hello-agent/packages/agent-core/test/helpers.ts +1 -1
- package/templates/hello-agent/packages/agent-core/test/language.test.ts +40 -0
- package/templates/hello-agent/packages/agent-core/test/locale.test.ts +137 -0
- package/templates/hello-agent/packages/agent-core/test/mandate-status.test.ts +2 -2
- package/templates/hello-agent/packages/agent-core/test/manifest.test.ts +2 -2
- package/templates/hello-agent/packages/agent-core/test/rail-errors.test.ts +74 -0
- package/templates/hello-agent/packages/agent-core/test/receipt-read-verification.test.ts +32 -0
- package/templates/hello-agent/packages/agent-core/test/receivables.test.ts +49 -0
- package/templates/hello-agent/packages/agent-core/test/recorded-turns.ts +29 -0
- package/templates/hello-agent/packages/agent-core/test/secrets.test.ts +40 -1
- package/templates/hello-agent/packages/agent-runtime/README.md +31 -4
- package/templates/hello-agent/packages/agent-runtime/src/channels/rules.ts +4 -2
- package/templates/hello-agent/packages/agent-runtime/src/channels/whatsapp/emulator.ts +11 -5
- package/templates/hello-agent/packages/agent-runtime/src/channels/whatsapp/index.ts +43 -21
- package/templates/hello-agent/packages/agent-runtime/src/channels/whatsapp/open.ts +3 -0
- package/templates/hello-agent/packages/agent-runtime/src/channels/whatsapp/present.ts +8 -12
- package/templates/hello-agent/packages/agent-runtime/src/channels/whatsapp/run.ts +8 -4
- package/templates/hello-agent/packages/agent-runtime/src/channels/whatsapp/session.ts +12 -9
- package/templates/hello-agent/packages/agent-runtime/src/cli.ts +30 -4
- package/templates/hello-agent/packages/agent-runtime/src/commands/check.ts +18 -2
- package/templates/hello-agent/packages/agent-runtime/src/commands/decide.ts +13 -4
- package/templates/hello-agent/packages/agent-runtime/src/commands/eval.ts +7 -2
- package/templates/hello-agent/packages/agent-runtime/src/commands/inspect.ts +11 -13
- package/templates/hello-agent/packages/agent-runtime/src/commands/poll-whatsapp.ts +32 -24
- package/templates/hello-agent/packages/agent-runtime/src/commands/poll.ts +12 -5
- package/templates/hello-agent/packages/agent-runtime/src/commands/rerun.ts +83 -10
- package/templates/hello-agent/packages/agent-runtime/src/commands/resume.ts +2 -1
- package/templates/hello-agent/packages/agent-runtime/src/commands/start-whatsapp.ts +10 -5
- package/templates/hello-agent/packages/agent-runtime/src/commands/start.ts +48 -17
- package/templates/hello-agent/packages/agent-runtime/src/commands/verify.ts +37 -12
- package/templates/hello-agent/packages/agent-runtime/src/commands/webhook.ts +11 -3
- package/templates/hello-agent/packages/agent-runtime/src/default-kit.ts +52 -22
- package/templates/hello-agent/packages/agent-runtime/src/env.ts +64 -0
- package/templates/hello-agent/packages/agent-runtime/src/index.ts +2 -0
- package/templates/hello-agent/packages/agent-runtime/src/inspect.ts +81 -10
- package/templates/hello-agent/packages/agent-runtime/src/kit.ts +34 -12
- package/templates/hello-agent/packages/agent-runtime/src/outcome.ts +118 -0
- package/templates/hello-agent/packages/agent-runtime/src/poll.ts +7 -7
- package/templates/hello-agent/packages/agent-runtime/src/runs.ts +51 -0
- package/templates/hello-agent/packages/agent-runtime/src/scenarios.ts +55 -8
- package/templates/hello-agent/packages/agent-runtime/src/setup.ts +75 -5
- package/templates/hello-agent/packages/agent-runtime/src/terminal.ts +71 -33
- package/templates/hello-agent/packages/agent-runtime/test/env-names.test.ts +56 -0
- package/templates/hello-agent/packages/agent-runtime/test/inspect-mandate-status.test.ts +80 -0
- package/templates/hello-agent/packages/agent-runtime/test/inspect.test.ts +63 -2
- package/templates/hello-agent/packages/agent-runtime/test/outcome.test.ts +72 -0
- package/templates/hello-agent/packages/agent-runtime/test/poll-payer.test.ts +64 -0
- package/templates/hello-agent/packages/agent-runtime/test/rerun-not-replayed.test.ts +46 -0
- package/templates/hello-agent/packages/agent-runtime/test/transition-line.test.ts +29 -0
- package/templates/hello-agent/packages/agent-runtime/test/verify-cli.test.ts +99 -6
- package/templates/hello-agent/packages/agent-runtime/test/whatsapp-rules.test.ts +8 -0
- package/templates/hello-agent/packages/agent-runtime/test/whatsapp-session.test.ts +77 -0
- package/templates/hello-agent/packages/agent-runtime/test/whatsapp-status-replies.test.ts +27 -1
- package/templates/kits.lock.json +12 -12
- package/templates/supplier-payments-agent/README.md +2 -2
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/.env.example +2 -2
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/README.md +12 -7
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/SYSTEM_PROMPT.md +14 -3
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/agent.yaml +2 -1
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/evals/adversarial/exfiltration.transcript.jsonl +1 -1
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/evals/adversarial/false-authority.transcript.jsonl +1 -1
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/evals/adversarial/prompt-injection.transcript.jsonl +1 -1
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/mandate.example.json +3 -3
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/scenarios/beneficiary-not-allowed.transcript.jsonl +1 -1
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/scenarios/cap-exceeded.transcript.jsonl +1 -1
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/scenarios/escalated-above-threshold.transcript.jsonl +5 -5
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/scenarios/happy-path.transcript.jsonl +1 -1
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/scenarios/mandate-revoked.transcript.jsonl +5 -5
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/scenarios/partial-batch-failure.json +1 -1
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/scenarios/partial-batch-failure.transcript.jsonl +1 -1
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/scenarios/prompt-injection.transcript.jsonl +1 -1
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/src/kit.ts +37 -26
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/src/modules/batch-payout.ts +41 -14
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/src/modules/pix-out.ts +12 -3
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/src/payables.ts +8 -8
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/test/batch.test.ts +75 -10
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/test/locale.test.ts +101 -0
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/test/run-outcome.test.ts +127 -0
- package/templates/supplier-payments-agent/agents/supplier-payments-agent/tools.json +1 -1
- package/templates/supplier-payments-agent/packages/agent-core/README.md +21 -2
- package/templates/supplier-payments-agent/packages/agent-core/package.json +1 -1
- package/templates/supplier-payments-agent/packages/agent-core/src/agent.ts +33 -6
- package/templates/supplier-payments-agent/packages/agent-core/src/api/charge-rail.ts +15 -1
- package/templates/supplier-payments-agent/packages/agent-core/src/api/rail.ts +11 -5
- package/templates/supplier-payments-agent/packages/agent-core/src/api/sandbox-payer.ts +36 -0
- package/templates/supplier-payments-agent/packages/agent-core/src/bundle.ts +2 -0
- package/templates/supplier-payments-agent/packages/agent-core/src/channels.ts +18 -8
- package/templates/supplier-payments-agent/packages/agent-core/src/check.ts +25 -3
- package/templates/supplier-payments-agent/packages/agent-core/src/engine.ts +90 -9
- package/templates/supplier-payments-agent/packages/agent-core/src/escalate.ts +10 -0
- package/templates/supplier-payments-agent/packages/agent-core/src/index.ts +3 -0
- package/templates/supplier-payments-agent/packages/agent-core/src/language.ts +52 -0
- package/templates/supplier-payments-agent/packages/agent-core/src/locale.ts +88 -0
- package/templates/supplier-payments-agent/packages/agent-core/src/manifest.ts +4 -1
- package/templates/supplier-payments-agent/packages/agent-core/src/rail.ts +29 -1
- package/templates/supplier-payments-agent/packages/agent-core/src/receipt-verification.ts +30 -2
- package/templates/supplier-payments-agent/packages/agent-core/src/secrets.ts +53 -8
- package/templates/supplier-payments-agent/packages/agent-core/src/state-machine.ts +14 -0
- package/templates/supplier-payments-agent/packages/agent-core/src/strings.ts +175 -0
- package/templates/supplier-payments-agent/packages/agent-core/src/stubs/charge-rail.ts +15 -2
- package/templates/supplier-payments-agent/packages/agent-core/src/stubs/rail.ts +7 -4
- package/templates/supplier-payments-agent/packages/agent-core/src/types.ts +15 -2
- package/templates/supplier-payments-agent/packages/agent-core/test/actor-on-the-wire.test.ts +144 -0
- package/templates/supplier-payments-agent/packages/agent-core/test/attempt-replay.test.ts +2 -2
- package/templates/supplier-payments-agent/packages/agent-core/test/engine.test.ts +23 -0
- package/templates/supplier-payments-agent/packages/agent-core/test/helpers.ts +1 -1
- package/templates/supplier-payments-agent/packages/agent-core/test/language.test.ts +40 -0
- package/templates/supplier-payments-agent/packages/agent-core/test/locale.test.ts +137 -0
- package/templates/supplier-payments-agent/packages/agent-core/test/mandate-status.test.ts +2 -2
- package/templates/supplier-payments-agent/packages/agent-core/test/manifest.test.ts +2 -2
- package/templates/supplier-payments-agent/packages/agent-core/test/rail-errors.test.ts +74 -0
- package/templates/supplier-payments-agent/packages/agent-core/test/receipt-read-verification.test.ts +32 -0
- package/templates/supplier-payments-agent/packages/agent-core/test/receivables.test.ts +49 -0
- package/templates/supplier-payments-agent/packages/agent-core/test/recorded-turns.ts +29 -0
- package/templates/supplier-payments-agent/packages/agent-core/test/secrets.test.ts +40 -1
- package/templates/supplier-payments-agent/packages/agent-runtime/README.md +31 -4
- package/templates/supplier-payments-agent/packages/agent-runtime/src/channels/rules.ts +4 -2
- package/templates/supplier-payments-agent/packages/agent-runtime/src/channels/whatsapp/emulator.ts +11 -5
- package/templates/supplier-payments-agent/packages/agent-runtime/src/channels/whatsapp/index.ts +43 -21
- package/templates/supplier-payments-agent/packages/agent-runtime/src/channels/whatsapp/open.ts +3 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/src/channels/whatsapp/present.ts +8 -12
- package/templates/supplier-payments-agent/packages/agent-runtime/src/channels/whatsapp/run.ts +8 -4
- package/templates/supplier-payments-agent/packages/agent-runtime/src/channels/whatsapp/session.ts +12 -9
- package/templates/supplier-payments-agent/packages/agent-runtime/src/cli.ts +30 -4
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/check.ts +18 -2
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/decide.ts +13 -4
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/eval.ts +7 -2
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/inspect.ts +11 -13
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/poll-whatsapp.ts +32 -24
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/poll.ts +12 -5
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/rerun.ts +83 -10
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/resume.ts +2 -1
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/start-whatsapp.ts +10 -5
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/start.ts +48 -17
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/verify.ts +37 -12
- package/templates/supplier-payments-agent/packages/agent-runtime/src/commands/webhook.ts +11 -3
- package/templates/supplier-payments-agent/packages/agent-runtime/src/default-kit.ts +52 -22
- package/templates/supplier-payments-agent/packages/agent-runtime/src/env.ts +64 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/src/index.ts +2 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/src/inspect.ts +81 -10
- package/templates/supplier-payments-agent/packages/agent-runtime/src/kit.ts +34 -12
- package/templates/supplier-payments-agent/packages/agent-runtime/src/outcome.ts +118 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/src/poll.ts +7 -7
- package/templates/supplier-payments-agent/packages/agent-runtime/src/runs.ts +51 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/src/scenarios.ts +55 -8
- package/templates/supplier-payments-agent/packages/agent-runtime/src/setup.ts +75 -5
- package/templates/supplier-payments-agent/packages/agent-runtime/src/terminal.ts +71 -33
- package/templates/supplier-payments-agent/packages/agent-runtime/test/env-names.test.ts +56 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/test/inspect-mandate-status.test.ts +80 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/test/inspect.test.ts +63 -2
- package/templates/supplier-payments-agent/packages/agent-runtime/test/outcome.test.ts +72 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/test/poll-payer.test.ts +64 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/test/rerun-not-replayed.test.ts +46 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/test/transition-line.test.ts +29 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/test/verify-cli.test.ts +99 -6
- package/templates/supplier-payments-agent/packages/agent-runtime/test/whatsapp-rules.test.ts +8 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/test/whatsapp-session.test.ts +77 -0
- package/templates/supplier-payments-agent/packages/agent-runtime/test/whatsapp-status-replies.test.ts +27 -1
|
@@ -13,14 +13,17 @@
|
|
|
13
13
|
* bundle, never committed.
|
|
14
14
|
*/
|
|
15
15
|
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
16
|
-
import { dirname } from "node:path";
|
|
16
|
+
import { dirname, relative } from "node:path";
|
|
17
17
|
import type { ApiClient } from "@codespar/sdk";
|
|
18
|
-
import { MandateSchema, windowCap, type Mandate, describeApiError } from "@codespar/agent-core";
|
|
18
|
+
import { ApiMandateStatusSource, MandateSchema, windowCap, type Locale, type Mandate, describeApiError } from "@codespar/agent-core";
|
|
19
|
+
import { STRINGS } from "../strings.js";
|
|
19
20
|
|
|
20
21
|
export interface ConsentOptions {
|
|
21
22
|
api: ApiClient;
|
|
22
23
|
example: Mandate;
|
|
23
24
|
mandatePath: string;
|
|
25
|
+
/** The language of the lines below. Default pt-BR. */
|
|
26
|
+
locale?: Locale;
|
|
24
27
|
/** Where to write the lines the person reads. */
|
|
25
28
|
say: (line: string) => void;
|
|
26
29
|
/** Asks the titular to authorize. Returns true on yes. */
|
|
@@ -37,8 +40,27 @@ export function loadLocalMandate(path: string): Mandate | undefined {
|
|
|
37
40
|
return MandateSchema.parse(JSON.parse(readFileSync(path, "utf8")));
|
|
38
41
|
}
|
|
39
42
|
|
|
43
|
+
/** The words for what the API says of the mandate the file already holds; `unknown` is the API not answering. */
|
|
44
|
+
const PREVIOUS = {
|
|
45
|
+
active: "consentPreviousActive",
|
|
46
|
+
paused: "consentPreviousPaused",
|
|
47
|
+
revoked: "consentPreviousRevoked",
|
|
48
|
+
expired: "consentPreviousExpired",
|
|
49
|
+
unknown: "consentPreviousUnknown",
|
|
50
|
+
} as const;
|
|
51
|
+
|
|
52
|
+
/** The mandate the file holds before this consent, when it holds one this kit can read. A file it cannot read is not a reason to stop a new consent. */
|
|
53
|
+
function previousMandate(path: string): Mandate | undefined {
|
|
54
|
+
try {
|
|
55
|
+
return loadLocalMandate(path);
|
|
56
|
+
} catch {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
40
61
|
export async function runEmbeddedConsent(options: ConsentOptions): Promise<Mandate> {
|
|
41
62
|
const { api, example, say } = options;
|
|
63
|
+
const text = STRINGS[options.locale ?? "pt-BR"];
|
|
42
64
|
const now = options.now ?? (() => new Date());
|
|
43
65
|
const consumerId = options.consumerId ?? example.consumer_id;
|
|
44
66
|
|
|
@@ -54,20 +76,24 @@ export async function runEmbeddedConsent(options: ConsentOptions): Promise<Manda
|
|
|
54
76
|
merchant_allowlist: example.beneficiaries.map((b) => b.payee),
|
|
55
77
|
merchant_pin_kind: "pix-key",
|
|
56
78
|
...(example.periodic_cap ? { periodic_cap: example.periodic_cap } : {}),
|
|
57
|
-
display_name: "bills-agent: contas do
|
|
58
|
-
intent_note: `Pagar as contas do
|
|
79
|
+
display_name: "bills-agent: contas do mês",
|
|
80
|
+
intent_note: `Pagar as contas do mês aos favorecidos nomeados: ${example.beneficiaries.map((b) => b.name).join(", ")}.`,
|
|
59
81
|
},
|
|
60
82
|
surface: "partner",
|
|
61
83
|
},
|
|
62
84
|
});
|
|
63
85
|
|
|
86
|
+
// A consent after a revocation is not a first one: the file holds the mandate it replaces, and the API says what became of it.
|
|
87
|
+
const previous = previousMandate(options.mandatePath);
|
|
88
|
+
const state = previous ? (await new ApiMandateStatusSource(api, now).check(previous.id)).status : undefined;
|
|
89
|
+
|
|
64
90
|
say("");
|
|
65
|
-
say(
|
|
66
|
-
say(
|
|
67
|
-
say(
|
|
68
|
-
for (const b of example.beneficiaries) say(
|
|
69
|
-
say(
|
|
70
|
-
const yes = await options.confirm(
|
|
91
|
+
say(previous && state ? text.consentReplaces(previous.id, text[PREVIOUS[state]], relative(process.cwd(), options.mandatePath)) : text.consentHeader);
|
|
92
|
+
say(text.consentAgent(example.agent_id, example.purpose));
|
|
93
|
+
say(text.consentCaps(example.per_tx_cap_minor, windowCap(example), example.cap_minor));
|
|
94
|
+
for (const b of example.beneficiaries) say(text.consentPayee(b.name, b.alias));
|
|
95
|
+
say(text.consentValidity(init.expires_at));
|
|
96
|
+
const yes = await options.confirm(text.consentQuestion);
|
|
71
97
|
if (!yes) throw new Error("consent not authorized by the titular; nothing was created");
|
|
72
98
|
|
|
73
99
|
// The consumer's "browser" is this terminal: the submit is the same call the hosted page makes,
|
|
@@ -108,19 +134,20 @@ export async function runEmbeddedConsent(options: ConsentOptions): Promise<Manda
|
|
|
108
134
|
mkdirSync(dirname(options.mandatePath), { recursive: true });
|
|
109
135
|
writeFileSync(options.mandatePath, JSON.stringify(mandate, null, 2) + "\n", { mode: 0o600 });
|
|
110
136
|
chmodSync(options.mandatePath, 0o600);
|
|
111
|
-
say(
|
|
137
|
+
say(text.consentSigned(mandate.id, mandate.consumer_id));
|
|
112
138
|
|
|
113
|
-
await fundSandbox(api, mandate, say);
|
|
139
|
+
await fundSandbox(api, mandate, say, options.locale);
|
|
114
140
|
return mandate;
|
|
115
141
|
}
|
|
116
142
|
|
|
117
143
|
/** Best effort: the sandbox account is credited with one window's cap. A `pix-consent` source has no Celcoin account to credit, and the sandbox spend does not need one. */
|
|
118
|
-
export async function fundSandbox(api: ApiClient, mandate: Mandate, say: (line: string) => void): Promise<void> {
|
|
144
|
+
export async function fundSandbox(api: ApiClient, mandate: Mandate, say: (line: string) => void, locale: Locale = "pt-BR"): Promise<void> {
|
|
145
|
+
const text = STRINGS[locale];
|
|
119
146
|
try {
|
|
120
147
|
const funded = await api.post("/v1/test/fund", { body: { consumer_id: mandate.consumer_id, amount_minor: windowCap(mandate) } });
|
|
121
|
-
say(
|
|
148
|
+
say(text.consentFunded(funded.amount_minor, funded.account, funded.deposit_id));
|
|
122
149
|
} catch (err) {
|
|
123
150
|
const f = describeApiError(err);
|
|
124
|
-
say(
|
|
151
|
+
say(text.consentNotFunded(f.code));
|
|
125
152
|
}
|
|
126
153
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* whatever the core decided); it cannot pay. `codespar_ledger` and
|
|
5
5
|
* `list_bills` are reads.
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
7
|
+
import { daysUntil, isReplayedSettlement, type Execution, type ToolHandler } from "@codespar/agent-core";
|
|
8
8
|
import { formatBRL } from "../bills.js";
|
|
9
9
|
import { BILLS, MONTH } from "../bills.js";
|
|
10
10
|
|
|
@@ -17,9 +17,11 @@ interface PayInput {
|
|
|
17
17
|
export const listBills: ToolHandler = async (_input, ctx) => {
|
|
18
18
|
const settled = ctx.engine.list({ state: "settled" });
|
|
19
19
|
const paidAliases = new Set(settled.flatMap((e) => e.items.map((i) => i.alias)).filter(Boolean));
|
|
20
|
+
const today = ctx.engine.today();
|
|
20
21
|
return {
|
|
21
22
|
month: MONTH,
|
|
22
|
-
|
|
23
|
+
today,
|
|
24
|
+
bills: BILLS.map((b) => ({ ...b, amount: formatBRL(b.amount_minor), days_until_due: daysUntil(today, b.due), paid_this_window: paidAliases.has(b.alias) })),
|
|
23
25
|
payees: ctx.engine.mandate.beneficiaries.map((b) => ({ alias: b.alias, name: b.name })),
|
|
24
26
|
};
|
|
25
27
|
};
|
|
@@ -38,6 +40,8 @@ export const codesparPay: ToolHandler = async (raw, ctx) => {
|
|
|
38
40
|
|
|
39
41
|
const draft = await ctx.engine.draft({ items, ...claimed });
|
|
40
42
|
if (!draft.ok) {
|
|
43
|
+
// Refused before a draft: no execution will ever say so, and the run's count is taken from this.
|
|
44
|
+
ctx.onNotRun?.({ ref: items.map((item) => item.payee).join(", "), why: "refused", detail: draft.reason });
|
|
41
45
|
return { status: "refused", reason: draft.reason, message: draft.message, paid: false };
|
|
42
46
|
}
|
|
43
47
|
const execution = await ctx.onExecution(draft.execution);
|
|
@@ -49,8 +53,11 @@ export const codesparPay: ToolHandler = async (raw, ctx) => {
|
|
|
49
53
|
items: execution.items.map((i) => ({ payee: i.beneficiary, amount: formatBRL(i.amount) })),
|
|
50
54
|
...(execution.reason ? { reason: execution.reason, detail: execution.detail } : {}),
|
|
51
55
|
...(execution.escalation ? { escalated_by: execution.escalation.trigger } : {}),
|
|
56
|
+
approved_by: approvedBy(execution),
|
|
52
57
|
receipt_ids: execution.outcomes.filter((o) => o.receipt_id).map((o) => o.receipt_id),
|
|
53
|
-
|
|
58
|
+
// Settled by an earlier presentation of the same attempt: the payment exists, and this call did not make it.
|
|
59
|
+
replayed: isReplayedSettlement(execution),
|
|
60
|
+
paid: execution.state === "settled" && !isReplayedSettlement(execution),
|
|
54
61
|
};
|
|
55
62
|
};
|
|
56
63
|
|
|
@@ -71,3 +78,14 @@ export const codesparLedger: ToolHandler = async (raw, ctx) => {
|
|
|
71
78
|
}
|
|
72
79
|
throw new Error(`codespar_ledger: unsupported action ${String(input.action)}`);
|
|
73
80
|
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Who moved the execution to `approved`: the person (`human`), the signed
|
|
84
|
+
* allowance (`mandate`), or nobody yet (`null`). The model is told which
|
|
85
|
+
* approval modes exist but not which one ran, and without this it guesses.
|
|
86
|
+
*/
|
|
87
|
+
export function approvedBy(execution: Execution): "human" | "mandate" | null {
|
|
88
|
+
const step = execution.history.find((h) => h.to === "approved");
|
|
89
|
+
if (!step) return null;
|
|
90
|
+
return step.actor.type === "human" ? "human" : "mandate";
|
|
91
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What this agent prints, per locale: the runner's words for it and the
|
|
3
|
+
* consent the titular reads before signing. Every key exists in both entries
|
|
4
|
+
* (`npm run check`). The answers are read the same whatever the locale: the
|
|
5
|
+
* approval question and the consent question take s, sim, y and yes.
|
|
6
|
+
*
|
|
7
|
+
* What goes to the API is not here: the consent's display name and intent
|
|
8
|
+
* note are part of the consent the API records, not lines on this terminal.
|
|
9
|
+
*/
|
|
10
|
+
import { formatBRL, type LocaleTable } from "@codespar/agent-core";
|
|
11
|
+
import type { KitStrings } from "@codespar/agent-runtime";
|
|
12
|
+
|
|
13
|
+
const pt = {
|
|
14
|
+
mandateWord: "mandato",
|
|
15
|
+
receiptWord: "recibo",
|
|
16
|
+
intro: 'Diga o que pagar ("pague a escola de outubro"). Ctrl+D ou "sair" encerra.',
|
|
17
|
+
prompt: "> ",
|
|
18
|
+
approveQuestion: " Aprovar este pagamento? [s/N] ",
|
|
19
|
+
uncertainDispatch: " desfecho desconhecido no trilho; rode `npm run resume` para reconciliar (nunca repita o pagamento)",
|
|
20
|
+
notAuthorized: "o mandato não autoriza",
|
|
21
|
+
|
|
22
|
+
consentHeader: "O mandato ainda não existe. Este é o consentimento que o titular assina (sandbox):",
|
|
23
|
+
consentReplaces: (mandateId: string, state: string, file: string) => `Já existe um mandato em ${file}: ${mandateId}, ${state}. Este é o consentimento de um mandato novo, que passa a ser o do arquivo (sandbox):`,
|
|
24
|
+
consentPreviousActive: "ativo na API",
|
|
25
|
+
consentPreviousPaused: "pausado na API",
|
|
26
|
+
consentPreviousRevoked: "revogado na API",
|
|
27
|
+
consentPreviousExpired: "expirado",
|
|
28
|
+
consentPreviousUnknown: "com estado que a API não respondeu",
|
|
29
|
+
consentAgent: (agentId: string, purpose: string) => ` agente: ${agentId} finalidade: ${purpose}`,
|
|
30
|
+
consentCaps: (perTx: number, window: number, lifetime: number) => ` teto por pagamento: ${formatBRL(perTx, "pt-BR")} teto do mês: ${formatBRL(window, "pt-BR")} vitalício: ${formatBRL(lifetime, "pt-BR")}`,
|
|
31
|
+
consentPayee: (name: string, alias: string) => ` favorecido: ${name} (${alias})`,
|
|
32
|
+
consentValidity: (tokenExpiresAt: string) => ` validade: 1 ano (o token do consentimento vale até ${tokenExpiresAt})`,
|
|
33
|
+
consentQuestion: " Você é o titular e autoriza este mandato? [s/N] ",
|
|
34
|
+
consentSigned: (mandateId: string, consumerId: string) => `Mandato assinado: ${mandateId} (consumidor ${consumerId}).`,
|
|
35
|
+
consentFunded: (amount: number, account: string, depositId: string) => `Sandbox creditado: ${formatBRL(amount, "pt-BR")} em ${account} (deposit ${depositId}).`,
|
|
36
|
+
consentNotFunded: (code: string) => `Sandbox não creditado (${code}); o gasto de teste sob pix-consent não depende disso.`,
|
|
37
|
+
consentSaved: (mandateId: string) => `mandato ${mandateId} salvo em .codespar/mandate.json`,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const STRINGS: LocaleTable<typeof pt & KitStrings> = {
|
|
41
|
+
"pt-BR": pt,
|
|
42
|
+
en: {
|
|
43
|
+
mandateWord: "mandate",
|
|
44
|
+
receiptWord: "receipt",
|
|
45
|
+
intro: 'Say what to pay ("pay the school for October"). Ctrl+D or "exit" ends.',
|
|
46
|
+
prompt: "> ",
|
|
47
|
+
approveQuestion: " Approve this payment? [y/N] ",
|
|
48
|
+
uncertainDispatch: " outcome unknown on the rail; run `npm run resume` to reconcile (never repeat the payment)",
|
|
49
|
+
notAuthorized: "the mandate does not authorize it",
|
|
50
|
+
|
|
51
|
+
consentHeader: "The mandate does not exist yet. This is the consent the account holder signs (sandbox):",
|
|
52
|
+
consentReplaces: (mandateId, state, file) => `${file} already holds a mandate: ${mandateId}, ${state}. This is the consent for a new one, which becomes the one in the file (sandbox):`,
|
|
53
|
+
consentPreviousActive: "active on the API",
|
|
54
|
+
consentPreviousPaused: "paused on the API",
|
|
55
|
+
consentPreviousRevoked: "revoked on the API",
|
|
56
|
+
consentPreviousExpired: "expired",
|
|
57
|
+
consentPreviousUnknown: "in a state the API did not answer",
|
|
58
|
+
consentAgent: (agentId, purpose) => ` agent: ${agentId} purpose: ${purpose}`,
|
|
59
|
+
consentCaps: (perTx, window, lifetime) => ` cap per payment: ${formatBRL(perTx, "en")} cap per month: ${formatBRL(window, "en")} lifetime: ${formatBRL(lifetime, "en")}`,
|
|
60
|
+
consentPayee: (name, alias) => ` payee: ${name} (${alias})`,
|
|
61
|
+
consentValidity: (tokenExpiresAt) => ` valid for: 1 year (the consent token is valid until ${tokenExpiresAt})`,
|
|
62
|
+
consentQuestion: " Are you the account holder, and do you authorize this mandate? [y/N] ",
|
|
63
|
+
consentSigned: (mandateId, consumerId) => `Mandate signed: ${mandateId} (consumer ${consumerId}).`,
|
|
64
|
+
consentFunded: (amount, account, depositId) => `Sandbox credited: ${formatBRL(amount, "en")} to ${account} (deposit ${depositId}).`,
|
|
65
|
+
consentNotFunded: (code) => `Sandbox not credited (${code}); the test spend under pix-consent does not depend on it.`,
|
|
66
|
+
consentSaved: (mandateId) => `mandate ${mandateId} saved to .codespar/mandate.json`,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
* else, the restart in `executing` followed by `resume`, and `rerun`.
|
|
4
4
|
*/
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
|
-
import { existsSync, mkdtempSync, readdirSync, readFileSync } from "node:fs";
|
|
6
|
+
import { existsSync, mkdtempSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { tmpdir } from "node:os";
|
|
8
8
|
import { join, resolve } from "node:path";
|
|
9
9
|
import { DatabaseSync } from "node:sqlite";
|
|
10
10
|
import { describe, expect, it } from "vitest";
|
|
11
|
+
import { loadAdversarialCase, runAdversarialCase } from "@codespar/agent-runtime";
|
|
12
|
+
import { agent } from "../src/kit.js";
|
|
11
13
|
|
|
12
14
|
const AGENT_DIR = resolve(import.meta.dirname, "..");
|
|
13
15
|
const NODE = process.execPath;
|
|
@@ -53,6 +55,37 @@ describe("npm start -- --input ... --json", () => {
|
|
|
53
55
|
expect(out.code).toBe(1);
|
|
54
56
|
expect(out.stdout).toBe("");
|
|
55
57
|
expect(out.stderr).toContain("csk_test_");
|
|
58
|
+
expect(out.stderr).toContain("a live key is refused");
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// #50: no key, the placeholder and a live key are three mistakes with three fixes, and each refusal names the .env this agent reads,
|
|
63
|
+
// as the person would type it from where they ran npm (INIT_CWD): the repository root, here.
|
|
64
|
+
describe("a key the kit cannot use says which mistake it is", () => {
|
|
65
|
+
const REPO = resolve(AGENT_DIR, "../..");
|
|
66
|
+
const cases = [
|
|
67
|
+
["no key at all", "", /CODESPAR_API_KEY is not set: copy agents\/bills-agent\/\.env\.example to agents\/bills-agent\/\.env/],
|
|
68
|
+
["the .env.example placeholder", "csk_test_your_key_here", /still the placeholder from \.env\.example \(csk_test_your_key_here\): replace it in agents\/bills-agent\/\.env/],
|
|
69
|
+
["a live key", ["csk", "live", "0000000000"].join("_"), /a live key is refused/],
|
|
70
|
+
] as const;
|
|
71
|
+
for (const [name, key, message] of cases) {
|
|
72
|
+
it(`consent with ${name}: its own sentence, exit 1, no stack trace`, () => {
|
|
73
|
+
const stateDir = mkdtempSync(join(tmpdir(), "bills-key-"));
|
|
74
|
+
const out = run("consent", ["--yes"], { BILLS_STATE_DIR: stateDir, CODESPAR_API_KEY: key, INIT_CWD: REPO });
|
|
75
|
+
expect(out.code).toBe(1);
|
|
76
|
+
expect(out.stderr).toMatch(message);
|
|
77
|
+
expect(out.stderr).not.toMatch(/\n\s+at /);
|
|
78
|
+
if (key !== cases[2][1]) expect(out.stderr).not.toContain("live");
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
it("start --rail api names the same file, and without INIT_CWD the path is relative to where the command ran", () => {
|
|
83
|
+
const stateDir = mkdtempSync(join(tmpdir(), "bills-key-"));
|
|
84
|
+
const fromRoot = run("start", ["--input", "pague a escola de outubro", "--rail", "api", "--json"], { BILLS_STATE_DIR: stateDir, CODESPAR_API_KEY: "", INIT_CWD: REPO });
|
|
85
|
+
expect(fromRoot.code).toBe(1);
|
|
86
|
+
expect(fromRoot.stderr).toContain("copy agents/bills-agent/.env.example to agents/bills-agent/.env");
|
|
87
|
+
const here = run("start", ["--input", "pague a escola de outubro", "--rail", "api", "--json"], { BILLS_STATE_DIR: stateDir, CODESPAR_API_KEY: "", INIT_CWD: "" });
|
|
88
|
+
expect(here.stderr).toContain("copy .env.example to .env");
|
|
56
89
|
});
|
|
57
90
|
});
|
|
58
91
|
|
|
@@ -145,6 +178,94 @@ describe("npm run rerun <run-id>", () => {
|
|
|
145
178
|
});
|
|
146
179
|
});
|
|
147
180
|
|
|
181
|
+
/**
|
|
182
|
+
* The kit reads `CODESPAR_API_URL` and `CODESPAR_PROJECT_ID`; the CodeSpar CLI
|
|
183
|
+
* reads `CODESPAR_BASE_URL` and `CODESPAR_PROJECT`. A command that talks to
|
|
184
|
+
* the API stops when the two disagree; the stub rail reads neither.
|
|
185
|
+
*/
|
|
186
|
+
describe("the two names for the deployment and the project", () => {
|
|
187
|
+
const STAGING = "https://api.staging.codespar.dev";
|
|
188
|
+
const DISAGREE = { CODESPAR_API_URL: "https://api.codespar.dev", CODESPAR_BASE_URL: STAGING };
|
|
189
|
+
const scratch = () => {
|
|
190
|
+
const stateDir = mkdtempSync(join(tmpdir(), "bills-env-names-"));
|
|
191
|
+
return { BILLS_STATE_DIR: stateDir, BILLS_RUNS_DIR: join(stateDir, "runs"), CODESPAR_API_URL: "", CODESPAR_PROJECT_ID: "", CODESPAR_BASE_URL: "", CODESPAR_PROJECT: "" };
|
|
192
|
+
};
|
|
193
|
+
const ONE_SHOT = ["--input", "pague a escola de outubro", "--approve", "--json"];
|
|
194
|
+
|
|
195
|
+
it("with a key, two that disagree stop the command with both named, no stack, nothing run", () => {
|
|
196
|
+
// Not the placeholder; the underscore keeps it below the secret scan's key shape.
|
|
197
|
+
const out = run("start", ONE_SHOT, { ...scratch(), ...DISAGREE, CODESPAR_API_KEY: "csk_test_unit_0000" });
|
|
198
|
+
expect(out.code).toBe(1);
|
|
199
|
+
expect(out.stdout).toBe("");
|
|
200
|
+
expect(out.stderr).toContain("CODESPAR_API_URL=https://api.codespar.dev");
|
|
201
|
+
expect(out.stderr).toContain(`CODESPAR_BASE_URL=${STAGING}`);
|
|
202
|
+
expect(out.stderr).not.toMatch(/^\s+at /m);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it("on the stub rail the same disagreement is not read, and the run goes on", () => {
|
|
206
|
+
const out = run("start", ONE_SHOT, { ...scratch(), ...DISAGREE });
|
|
207
|
+
expect(out.code).toBe(0);
|
|
208
|
+
expect(out.stderr).not.toContain("disagree");
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
it("runs with only the CLI's names set", () => {
|
|
212
|
+
const out = run("start", ONE_SHOT, { ...scratch(), CODESPAR_BASE_URL: STAGING, CODESPAR_PROJECT: "prj_cli" });
|
|
213
|
+
expect(out.code).toBe(0);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* `rerun` replays the model's side of a run. An adversarial case of
|
|
219
|
+
* `kind: events` has none: it drives rail deliveries and never asks the
|
|
220
|
+
* model, so its bundle holds no `transcript.jsonl`.
|
|
221
|
+
*/
|
|
222
|
+
describe("npm run rerun <run-id> on a run with no model turn", () => {
|
|
223
|
+
const NOTHING = "has no model turn in transcript.jsonl, so there is nothing to replay";
|
|
224
|
+
|
|
225
|
+
it("refuses the adversarial events case by name of what is missing, with no stack", async () => {
|
|
226
|
+
const runsDir = mkdtempSync(join(tmpdir(), "bills-rerun-adv-"));
|
|
227
|
+
const env = { BILLS_STATE_DIR: join(runsDir, "state"), BILLS_RUNS_DIR: runsDir };
|
|
228
|
+
const original = await runAdversarialCase(agent, loadAdversarialCase(agent, "webhook-replay"), { runsDir });
|
|
229
|
+
expect(original.ok).toBe(true);
|
|
230
|
+
expect(existsSync(join(runsDir, original.run_id, "transcript.jsonl"))).toBe(false);
|
|
231
|
+
|
|
232
|
+
const out = run("rerun", [original.run_id], env);
|
|
233
|
+
expect(out.code).toBe(1);
|
|
234
|
+
expect(out.stdout).toBe("");
|
|
235
|
+
expect(out.stderr).toContain(`runs/${original.run_id} ${NOTHING}`);
|
|
236
|
+
expect(out.stderr).not.toContain("ENOENT");
|
|
237
|
+
expect(out.stderr).not.toMatch(/^\s+at /m);
|
|
238
|
+
|
|
239
|
+
// A script reading stdout gets the refusal as data, not an empty line.
|
|
240
|
+
const asJson = run("rerun", [original.run_id, "--json"], env);
|
|
241
|
+
expect(asJson.code).toBe(1);
|
|
242
|
+
expect(JSON.parse(asJson.stdout.trim())).toEqual({ run_id: original.run_id, error: `runs/${original.run_id} ${NOTHING}` });
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it("refuses a transcript that is empty, or holds the person's turn and no step of the model", async () => {
|
|
246
|
+
const runsDir = mkdtempSync(join(tmpdir(), "bills-rerun-adv-"));
|
|
247
|
+
const env = { BILLS_STATE_DIR: join(runsDir, "state"), BILLS_RUNS_DIR: runsDir };
|
|
248
|
+
const original = await runAdversarialCase(agent, loadAdversarialCase(agent, "webhook-replay"), { runsDir });
|
|
249
|
+
const transcript = join(runsDir, original.run_id, "transcript.jsonl");
|
|
250
|
+
for (const content of ["", JSON.stringify({ kind: "user", text: "pague a escola de outubro" }) + "\n"]) {
|
|
251
|
+
writeFileSync(transcript, content);
|
|
252
|
+
const out = run("rerun", [original.run_id], env);
|
|
253
|
+
expect(out.code).toBe(1);
|
|
254
|
+
expect(out.stderr).toContain(NOTHING);
|
|
255
|
+
expect(out.stderr).not.toContain("rerun ok");
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it("still replays an adversarial case that did ask the model", async () => {
|
|
260
|
+
const runsDir = mkdtempSync(join(tmpdir(), "bills-rerun-adv-"));
|
|
261
|
+
const original = await runAdversarialCase(agent, loadAdversarialCase(agent, "prompt-injection"), { runsDir });
|
|
262
|
+
expect(original.ok).toBe(true);
|
|
263
|
+
const out = run("rerun", [original.run_id], { BILLS_STATE_DIR: join(runsDir, "state"), BILLS_RUNS_DIR: runsDir });
|
|
264
|
+
expect(out.code).toBe(0);
|
|
265
|
+
expect(out.stderr).toContain("rerun ok");
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
|
|
148
269
|
describe("npm run check", () => {
|
|
149
270
|
it("is green for the shipped agent and prints JSON with --json", () => {
|
|
150
271
|
const out = run("check", ["--json"], {});
|
|
@@ -203,13 +324,20 @@ describe("partial failure of a multi-item execution, and rerun reproducing it",
|
|
|
203
324
|
const runsDir = join(stateDir, "runs");
|
|
204
325
|
const env = { BILLS_STATE_DIR: stateDir, BILLS_RUNS_DIR: runsDir, BILLS_STUB_REFUSE: "+5511999990001" };
|
|
205
326
|
const first = run("start", ["--input", "libera o lote do mes", "--transcript", "evals/adversarial/false-authority.transcript.jsonl", "--approve", "--json"], env);
|
|
206
|
-
|
|
327
|
+
// One attempt failed, so the execution is `failed` and the process says so.
|
|
328
|
+
expect(first.code).toBe(1);
|
|
207
329
|
const payload = JSON.parse(first.stdout.trim()) as { run_id: string; executions: Array<{ state: string; receipt_ids: string[] }>; receipts: string[] };
|
|
208
330
|
// Four bills, the SECOND refused by the rail. The execution closes `failed`
|
|
209
331
|
// because one attempt failed, and the two bills after the refused one are
|
|
210
332
|
// paid all the same: an attempt's outcome is that attempt's business.
|
|
211
333
|
expect(payload.executions[0]?.state).toBe("failed");
|
|
212
334
|
expect(payload.executions[0]?.receipt_ids).toHaveLength(3);
|
|
335
|
+
// Counted by payment, not by execution: three bills were paid and one failed, and the line says both.
|
|
336
|
+
expect((payload as unknown as { run_outcome: unknown }).run_outcome).toEqual({ settled: 3, failed: 1, declined: 0, already_paid: 0, open: 0 });
|
|
337
|
+
// #50: the rail's own code and message, verbatim, next to the reason — on stdout for a script, on stderr for a person.
|
|
338
|
+
const railError = (payload.executions[0] as unknown as { rail_error: unknown }).rail_error;
|
|
339
|
+
expect(railError).toMatchObject({ outcome: "failed", code: "psp_dispatch_failed", message: "stub: provider refused payee +5511999990001" });
|
|
340
|
+
expect(first.stderr).toContain("-> failed (rail_failed): psp_dispatch_failed — stub: provider refused payee +5511999990001");
|
|
213
341
|
expect(payload.receipts).toHaveLength(3);
|
|
214
342
|
const events = readFileSync(join(runsDir, payload.run_id, "events.jsonl"), "utf8").split("\n").filter(Boolean).map((l) => JSON.parse(l) as { type: string; payload: { status?: string } });
|
|
215
343
|
expect(events.filter((e) => e.type === "rail.outcome").map((e) => e.payload.status)).toEqual(["settled", "failed", "settled", "settled"]);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The consent is what a person reads before signing a mandate, so its caps
|
|
3
|
+
* are money as a person writes it, not the minor units the API takes.
|
|
4
|
+
*/
|
|
5
|
+
import { describe, expect, it } from "vitest";
|
|
6
|
+
import { STRINGS } from "../src/strings.js";
|
|
7
|
+
|
|
8
|
+
describe("the consent summary says its amounts in reais", () => {
|
|
9
|
+
it("the three caps, in pt-BR and in English", () => {
|
|
10
|
+
expect(STRINGS["pt-BR"].consentCaps(250000, 600000, 7200000)).toBe(" teto por pagamento: R$ 2.500,00 teto do mês: R$ 6.000,00 vitalício: R$ 72.000,00");
|
|
11
|
+
expect(STRINGS.en.consentCaps(250000, 600000, 7200000)).toBe(" cap per payment: R$2,500.00 cap per month: R$6,000.00 lifetime: R$72,000.00");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("the sandbox credit too", () => {
|
|
15
|
+
expect(STRINGS["pt-BR"].consentFunded(600000, "acc_1", "dep_1")).toBe("Sandbox creditado: R$ 6.000,00 em acc_1 (deposit dep_1).");
|
|
16
|
+
expect(STRINGS.en.consentFunded(600000, "acc_1", "dep_1")).toBe("Sandbox credited: R$6,000.00 to acc_1 (deposit dep_1).");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("no line of the consent counts in cents", () => {
|
|
20
|
+
for (const locale of ["pt-BR", "en"] as const) {
|
|
21
|
+
const lines = [STRINGS[locale].consentCaps(250000, 600000, 7200000), STRINGS[locale].consentFunded(600000, "acc_1", "dep_1")];
|
|
22
|
+
for (const line of lines) expect(line).not.toMatch(/centavos|cents|250000|600000|7200000/);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the first real-model runs showed (docs/OPEN_QUESTIONS.md §64): with no
|
|
3
|
+
* date of its own, the model called a bill due next week "venceu dia 05"; told
|
|
4
|
+
* both approval modes exist and not which one ran, it said a payment the
|
|
5
|
+
* titular approved needed "no extra approval". The tools now carry both facts.
|
|
6
|
+
*/
|
|
7
|
+
import { mkdtempSync } from "node:fs";
|
|
8
|
+
import { tmpdir } from "node:os";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { describe, expect, it } from "vitest";
|
|
11
|
+
import { daysUntil, fixedClock, localDate, type Execution, type ToolContext } from "@codespar/agent-core";
|
|
12
|
+
import { setup, type Setup } from "@codespar/agent-runtime";
|
|
13
|
+
import { agent } from "../src/kit.js";
|
|
14
|
+
import { codesparPay, listBills } from "../src/modules/pix-out.js";
|
|
15
|
+
|
|
16
|
+
function open(mode: "human" | "mandate", now: string): Setup {
|
|
17
|
+
return setup(agent, {
|
|
18
|
+
mode,
|
|
19
|
+
rail: "stub",
|
|
20
|
+
provider: "replay",
|
|
21
|
+
runsDir: mkdtempSync(join(tmpdir(), "bills-dates-runs-")),
|
|
22
|
+
stateDir: mkdtempSync(join(tmpdir(), "bills-dates-state-")),
|
|
23
|
+
now: fixedClock(now),
|
|
24
|
+
say: () => undefined,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function context(s: Setup, decide: boolean): ToolContext {
|
|
29
|
+
return {
|
|
30
|
+
engine: s.engine,
|
|
31
|
+
onExecution: async (execution: Execution) => {
|
|
32
|
+
let current = execution;
|
|
33
|
+
if (decide && current.state === "awaiting_approval") current = s.engine.approve(current.id, { id: "usr_demo", channel: "terminal" });
|
|
34
|
+
if (current.state === "approved") current = await s.engine.execute(current.id);
|
|
35
|
+
return current;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
describe("the calendar the model reads", () => {
|
|
41
|
+
it("localDate is the day in the timezone, not in UTC", () => {
|
|
42
|
+
// 23:30 in Sao Paulo on the 28th is already the 29th in UTC.
|
|
43
|
+
expect(localDate(new Date("2026-09-29T02:30:00Z"), "America/Sao_Paulo")).toBe("2026-09-28");
|
|
44
|
+
expect(localDate(new Date("2026-09-29T02:30:00Z"), "UTC")).toBe("2026-09-29");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("daysUntil counts whole days, negative once past", () => {
|
|
48
|
+
expect(daysUntil("2026-09-28", "2026-10-05")).toBe(7);
|
|
49
|
+
expect(daysUntil("2026-10-05", "2026-10-05")).toBe(0);
|
|
50
|
+
expect(daysUntil("2026-10-06", "2026-10-05")).toBe(-1);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("list_bills carries today, from the pinned clock, and days_until_due per bill", async () => {
|
|
54
|
+
const s = open("human", "2026-09-28T14:00:00-03:00");
|
|
55
|
+
try {
|
|
56
|
+
const out = (await listBills({}, context(s, false))) as { today: string; bills: Array<{ alias: string; due: string; days_until_due: number }> };
|
|
57
|
+
expect(out.today).toBe("2026-09-28");
|
|
58
|
+
const mercado = out.bills.find((b) => b.alias === "mercado")!;
|
|
59
|
+
expect(mercado.due).toBe("2026-10-05");
|
|
60
|
+
expect(mercado.days_until_due).toBe(7);
|
|
61
|
+
} finally {
|
|
62
|
+
s.close();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe("codespar_pay says who approved, so the model does not guess", () => {
|
|
68
|
+
const PIX = { action: "pix", items: [{ payee: "mercado", amount_minor: 64000 }] };
|
|
69
|
+
|
|
70
|
+
it("a person's approval is `human`", async () => {
|
|
71
|
+
const s = open("human", "2026-09-28T14:00:00-03:00");
|
|
72
|
+
try {
|
|
73
|
+
expect(await codesparPay(PIX, context(s, true))).toMatchObject({ status: "settled", approved_by: "human" });
|
|
74
|
+
} finally {
|
|
75
|
+
s.close();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("nobody has approved an execution still waiting: `null`", async () => {
|
|
80
|
+
const s = open("human", "2026-09-28T14:00:00-03:00");
|
|
81
|
+
try {
|
|
82
|
+
expect(await codesparPay(PIX, context(s, false))).toMatchObject({ status: "awaiting_approval", approved_by: null });
|
|
83
|
+
} finally {
|
|
84
|
+
s.close();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("the signed allowance's approval is `mandate`", async () => {
|
|
89
|
+
const s = open("mandate", "2026-09-28T14:00:00-03:00");
|
|
90
|
+
try {
|
|
91
|
+
// Warm the payee so `new_beneficiary` does not send it to a person.
|
|
92
|
+
await s.kit.warmUp!(s, ["mercado"], { id: "usr_demo", channel: "terminal" });
|
|
93
|
+
expect(await codesparPay(PIX, context(s, false))).toMatchObject({ status: "settled", approved_by: "mandate" });
|
|
94
|
+
} finally {
|
|
95
|
+
s.close();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `npm run eval` writes a proof bundle per case and per scenario run, dozens a
|
|
3
|
+
* pass. They go to `runs/eval/`, so `runs/` holds what the person ran, and
|
|
4
|
+
* `inspect` and `rerun` still find an eval run by its id.
|
|
5
|
+
*/
|
|
6
|
+
import { spawnSync } from "node:child_process";
|
|
7
|
+
import { mkdtempSync, readdirSync } from "node:fs";
|
|
8
|
+
import { tmpdir } from "node:os";
|
|
9
|
+
import { join, resolve } from "node:path";
|
|
10
|
+
import { beforeAll, describe, expect, it } from "vitest";
|
|
11
|
+
|
|
12
|
+
const AGENT_DIR = resolve(import.meta.dirname, "..");
|
|
13
|
+
const BIN = resolve(AGENT_DIR, "../../packages/agent-runtime/bin.mjs");
|
|
14
|
+
|
|
15
|
+
describe("npm run eval beside a person's own runs", () => {
|
|
16
|
+
const stateDir = mkdtempSync(join(tmpdir(), "bills-eval-runs-"));
|
|
17
|
+
const runsDir = join(stateDir, "runs");
|
|
18
|
+
const run = (command: string, args: string[]) => {
|
|
19
|
+
const result = spawnSync(process.execPath, [BIN, command, ...args], {
|
|
20
|
+
cwd: AGENT_DIR,
|
|
21
|
+
env: { ...process.env, ANTHROPIC_API_KEY: "", CODESPAR_API_KEY: "", BILLS_STATE_DIR: stateDir, BILLS_RUNS_DIR: runsDir },
|
|
22
|
+
encoding: "utf8",
|
|
23
|
+
timeout: 120_000,
|
|
24
|
+
});
|
|
25
|
+
return { code: result.status, stdout: result.stdout, stderr: result.stderr };
|
|
26
|
+
};
|
|
27
|
+
let mine = "";
|
|
28
|
+
let evalRuns: string[] = [];
|
|
29
|
+
|
|
30
|
+
beforeAll(() => {
|
|
31
|
+
const own = run("start", ["--input", "pague a escola de outubro", "--approve", "--json"]);
|
|
32
|
+
mine = (JSON.parse(own.stdout.trim()) as { run_id: string }).run_id;
|
|
33
|
+
expect(run("eval", []).code).toBe(0);
|
|
34
|
+
evalRuns = readdirSync(join(runsDir, "eval")).sort();
|
|
35
|
+
}, 120_000);
|
|
36
|
+
|
|
37
|
+
it("leaves runs/ with the person's run and one folder for the suite's", () => {
|
|
38
|
+
expect(readdirSync(runsDir).sort()).toEqual(["eval", mine].sort());
|
|
39
|
+
// 8 adversarial cases and 11 scenario runs.
|
|
40
|
+
expect(evalRuns).toHaveLength(19);
|
|
41
|
+
expect(evalRuns.some((id) => id.startsWith("run_adv_"))).toBe(true);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("inspect finds an eval run by its id alone, and by eval/<id>", () => {
|
|
45
|
+
const id = evalRuns.find((r) => r.startsWith("run_adv_prompt-injection"))!;
|
|
46
|
+
for (const arg of [id, `eval/${id}`]) {
|
|
47
|
+
const out = run("inspect", [arg, "--json"]);
|
|
48
|
+
expect(out.code).toBe(0);
|
|
49
|
+
expect((JSON.parse(out.stdout.trim()) as { run: { run_id: string } }).run.run_id).toBe(id);
|
|
50
|
+
}
|
|
51
|
+
expect(run("inspect", [mine, "--json"]).code).toBe(0);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("an unknown id lists the person's runs and counts the suite's, without listing them", () => {
|
|
55
|
+
const out = run("inspect", ["run_nope"]);
|
|
56
|
+
expect(out.code).toBe(1);
|
|
57
|
+
expect(out.stderr).toContain(` ${mine}`);
|
|
58
|
+
expect(out.stderr).toContain(`19 more from \`npm run eval\` in ${join(runsDir, "eval")}`);
|
|
59
|
+
expect(out.stderr).not.toContain("run_adv_");
|
|
60
|
+
expect(out.stderr).not.toMatch(/^ {2}eval$/m);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("the folder itself is not a run, and a path out of runs/ is not one either", () => {
|
|
64
|
+
for (const arg of ["eval", "eval/", "eval/../..", "../runs"]) {
|
|
65
|
+
const out = run("inspect", [arg]);
|
|
66
|
+
expect([arg, out.code]).toEqual([arg, 1]);
|
|
67
|
+
expect(out.stderr).toContain(`no proof bundle for run ${arg}`);
|
|
68
|
+
expect(out.stderr).not.toMatch(/^\s+at /m);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("rerun replays an eval run by its id and leaves the rerun beside it, not among the person's", () => {
|
|
73
|
+
const id = evalRuns.find((r) => r.startsWith("run_adv_prompt-injection"))!;
|
|
74
|
+
const out = run("rerun", [id, "--json"]);
|
|
75
|
+
expect(out.code).toBe(0);
|
|
76
|
+
const report = JSON.parse(out.stdout.trim()) as { same_states: boolean; rerun_id: string };
|
|
77
|
+
expect(report.same_states).toBe(true);
|
|
78
|
+
expect(readdirSync(join(runsDir, "eval"))).toContain(report.rerun_id);
|
|
79
|
+
expect(readdirSync(runsDir).sort()).toEqual(["eval", mine].sort());
|
|
80
|
+
});
|
|
81
|
+
});
|
package/templates/bills-agent/agents/bills-agent/test/fixtures/excursao-300.transcript.jsonl
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
{"kind":"assistant_step","tool_calls":[{"id":"tc_4","name":"codespar_pay","input":{"action":"pix","items":[{"payee":"escola","amount_minor":30000,"description":"
|
|
2
|
-
{"kind":"assistant_step","reply":"
|
|
1
|
+
{"kind":"assistant_step","tool_calls":[{"id":"tc_4","name":"codespar_pay","input":{"action":"pix","items":[{"payee":"escola","amount_minor":30000,"description":"excursão"}]}}]}
|
|
2
|
+
{"kind":"assistant_step","reply":"Propus R$ 300,00 para a Escola Aurora (excursão). O resultado está no terminal."}
|
package/templates/bills-agent/agents/bills-agent/test/fixtures/material-400.transcript.jsonl
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
{"kind":"assistant_step","tool_calls":[{"id":"tc_1","name":"codespar_pay","input":{"action":"pix","items":[{"payee":"escola","amount_minor":40000,"description":"material"}]}}]}
|
|
2
|
-
{"kind":"assistant_step","reply":"Propus R$ 400,00 para a Escola Aurora (material). Como
|
|
2
|
+
{"kind":"assistant_step","reply":"Propus R$ 400,00 para a Escola Aurora (material). Como é o primeiro pagamento a esse favorecido, o mandato pediu sua aprovação."}
|