Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export default function App() {
<div>
<label className="text-xs font-bold text-slate-800 block mb-1">Target Paycheck (Bi-Weekly Payout)</label>
<div className="relative">
<span className="absolute left-3.5 top-2.5 text-slate-400 text-sm font-semibold">$</span>
<span className="absolute left-3.5 top-2.5 text-slate-400 text-sm font-semibold"></span>
<input
type="number"
required
Expand All @@ -299,14 +299,14 @@ export default function App() {
/>
</div>
<span className="text-[10px] text-slate-500 mt-1 block">
The salary buffer capacity will be scaled to 6x this paycheck size (${(parseFloat(paycheckInput) * 6 || 0).toLocaleString()}).
The salary buffer capacity will be scaled to 6x this paycheck size ({(parseFloat(paycheckInput) * 6 || 0).toLocaleString('en-IN')}).
</span>
</div>

<div>
<label className="text-xs font-bold text-slate-800 block mb-1">Reserve Floor Threshold Cushion</label>
<div className="relative">
<span className="absolute left-3.5 top-2.5 text-slate-400 text-sm font-semibold">$</span>
<span className="absolute left-3.5 top-2.5 text-slate-400 text-sm font-semibold"></span>
<input
type="number"
required
Expand Down
2 changes: 1 addition & 1 deletion src/ai/accountant.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function auditReceipt(receiptImageFileOrUrl, rawText, toolsRegistry = null
}

const cleanText = lowerText.replace(/,/g, '');
const amountMatch = cleanText.match(/(?:amount[:\s]*)?\$?([0-9]+(?:\.[0-9]{2})?)/i);
const amountMatch = cleanText.match(/(?:amount[:\s]*)?[₹\$]?([0-9]+(?:\.[0-9]{2})?)/i);
if (amountMatch) {
deterministicAmount = parseFloat(amountMatch[1]);
}
Expand Down
28 changes: 14 additions & 14 deletions src/ai/agentRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export async function runAgentLoop({

let amount = 100.00;
const cleanText = textLower.replace(/,/g, '');
const amountMatch = cleanText.match(/(?:amount[:\s]*)?\$?([0-9]+(?:\.[0-9]{2})?)/i);
const amountMatch = cleanText.match(/(?:amount[:\s]*)?[₹\$]?([0-9]+(?:\.[0-9]{2})?)/i);
if (amountMatch) {
amount = parseFloat(amountMatch[1]);
}
Expand Down Expand Up @@ -214,7 +214,7 @@ export async function runAgentLoop({
amount: releaseAmount,
description: `Tax release for ${category} write-off`
});
await simulateThought(toolsRegistry, `Released tax savings of $${releaseAmount} (tax bracket ${taxRate * 100}%) from Tax Pool to Salary Buffer.`);
await simulateThought(toolsRegistry, `Released tax savings of ${releaseAmount} (tax bracket ${taxRate * 100}%) from Tax Pool to Salary Buffer.`);
} else {
await simulateThought(toolsRegistry, "Tax pool is empty. Skipping tax release transfer.");
}
Expand All @@ -228,10 +228,10 @@ export async function runAgentLoop({

} else {
// Deposit Routing Event Simulation
const amountMatch = prompt.match(/payment of \$?([0-9,]+(?:\.[0-9]{2})?)/i);
const amountMatch = prompt.match(/payment of [₹\$]?([0-9,]+(?:\.[0-9]{2})?)/i);
const depositAmount = amountMatch ? parseFloat(amountMatch[1].replace(/,/g, '')) : 0;

await simulateThought(toolsRegistry, `Processing incoming deposit of $${depositAmount.toLocaleString()}. Reading freelancer profile and current balances...`);
await simulateThought(toolsRegistry, `Processing incoming deposit of ₹${depositAmount.toLocaleString('en-IN')}. Reading freelancer profile and current balances...`);

if (toolsRegistry.getProfile && toolsRegistry.getBalances && toolsRegistry.updateProfile && toolsRegistry.updateBalances && toolsRegistry.addTransaction) {
const profile = await toolsRegistry.getProfile();
Expand All @@ -241,7 +241,7 @@ export async function runAgentLoop({
const endIncome = startIncome + depositAmount;

// Progressive tax bracket check
await simulateThought(toolsRegistry, `Calculating progressive tax bracket for YTD income transition: $${startIncome.toLocaleString()} -> $${endIncome.toLocaleString()}...`);
await simulateThought(toolsRegistry, `Calculating progressive tax bracket for YTD income transition: ₹${startIncome.toLocaleString('en-IN')} -> ₹${endIncome.toLocaleString('en-IN')}...`);

let newBracket = 0.10;
if (endIncome > 250000) {
Expand Down Expand Up @@ -346,7 +346,7 @@ export async function runAgentLoop({
});
}

await simulateThought(toolsRegistry, `OmniFlow Routed: tax=$${taxAlloc}, salary=$${salaryAlloc}, reserve=$${reserveAlloc}, yield=$${yieldAlloc}`);
await simulateThought(toolsRegistry, `OmniFlow Routed: tax=₹${taxAlloc}, salary=₹${salaryAlloc}, reserve=₹${reserveAlloc}, yield=${yieldAlloc}`);

// Retroactive adjustment shoring if tax bracket shifted
let retroactiveAdjustment = 0;
Expand All @@ -370,7 +370,7 @@ export async function runAgentLoop({
description: `Recall for retroactive tax shoring`
});
}
await simulateThought(toolsRegistry, `Progressive retroactive shoring completed. Transferred $${retroactiveAdjustment} to Tax Pool.`);
await simulateThought(toolsRegistry, `Progressive retroactive shoring completed. Transferred ${retroactiveAdjustment} to Tax Pool.`);
}
}

Expand Down Expand Up @@ -410,7 +410,7 @@ export async function runAgentLoop({
actionTaken = recallAmount > 0;
}

await simulateThought(toolsRegistry, `Calculated Runway: ${runwayMonths} months based on monthly burn of $${monthlyBurn}. (Salary buffer: $${salaryBuffer}, Yield Pool: $${yieldPool})`);
await simulateThought(toolsRegistry, `Calculated Runway: ${runwayMonths} months based on monthly burn of ₹${monthlyBurn}. (Salary buffer: ₹${salaryBuffer}, Yield Pool: ${yieldPool})`);

await toolsRegistry.submitTreasuryEvaluation({
runwayMonths,
Expand Down Expand Up @@ -451,7 +451,7 @@ export async function runAgentLoop({
amount: recallAmount,
description: 'Yield recall for paycheck deficit shoring'
});
await simulateThought(toolsRegistry, `Deficit shored. Recalled $${recallAmount} from Ondo yield pool to liquid Salary Buffer.`);
await simulateThought(toolsRegistry, `Deficit shored. Recalled ${recallAmount} from Ondo yield pool to liquid Salary Buffer.`);
}
}
}
Expand All @@ -467,7 +467,7 @@ export async function runAgentLoop({
amount: targetPaycheck,
description: 'Bi-weekly paycheck payout'
});
await simulateThought(toolsRegistry, `Paycheck of $${targetPaycheck} successfully dispatched.`);
await simulateThought(toolsRegistry, `Paycheck of ${targetPaycheck} successfully dispatched.`);
} else {
// Partial paycheck dispatch
const partial = currentBuffer;
Expand All @@ -481,7 +481,7 @@ export async function runAgentLoop({
description: 'Partial paycheck payout'
});
}
await simulateThought(toolsRegistry, `CRITICAL: Insufficient funds in salary buffer! Dispatched partial paycheck of $${partial}.`);
await simulateThought(toolsRegistry, `CRITICAL: Insufficient funds in salary buffer! Dispatched partial paycheck of ${partial}.`);
}

const monthlyBurn = targetPaycheck * 2;
Expand All @@ -497,10 +497,10 @@ export async function runAgentLoop({
}
} else if (prompt.includes('manual') || prompt.includes('recall') || prompt.includes('Recall')) {
// Manual recall yield
const amountMatch = prompt.match(/recall of \$?([0-9,]+(?:\.[0-9]{2})?)/i);
const amountMatch = prompt.match(/recall of [₹\$]?([0-9,]+(?:\.[0-9]{2})?)/i);
const recallVal = amountMatch ? parseFloat(amountMatch[1].replace(/,/g, '')) : 0;

await simulateThought(toolsRegistry, `Executing manual recall of $${recallVal} from Ondo USDY yield pool...`);
await simulateThought(toolsRegistry, `Executing manual recall of ${recallVal} from Ondo USDY yield pool...`);

if (toolsRegistry.getBalances && toolsRegistry.updateBalances && toolsRegistry.addTransaction && toolsRegistry.submitTreasuryEvaluation) {
const balances = await toolsRegistry.getBalances();
Expand All @@ -517,7 +517,7 @@ export async function runAgentLoop({
amount: actualRecall,
description: 'Manual Ondo Yield Recall'
});
await simulateThought(toolsRegistry, `Recalled $${actualRecall} to liquid checking buffer.`);
await simulateThought(toolsRegistry, `Recalled ${actualRecall} to liquid checking buffer.`);
}

await toolsRegistry.submitTreasuryEvaluation({
Expand Down
10 changes: 5 additions & 5 deletions src/ai/treasury.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ Call the database tools to inspect profile/balances, update balances, and log re
You MUST submit your findings by calling the tool "submitTreasuryEvaluation".`;

const prompt = `Please evaluate the runway status and check for paycheck cycles:
Salary Buffer: $${salaryBuffer}
Yield Pool: $${yieldPool}
Reserve Floor: $${reserveFloor}
Target Paycheck: $${targetPaycheck}
Salary Buffer: ${salaryBuffer}
Yield Pool: ${yieldPool}
Reserve Floor: ${reserveFloor}
Target Paycheck: ${targetPaycheck}
Proposed Runway: ${runwayMonths} months
Proposed Recall Amount: $${recallAmount} (Action Taken: ${actionTaken})`;
Proposed Recall Amount: ${recallAmount} (Action Taken: ${actionTaken})`;

await runAgentLoop({
agentName: 'Treasury',
Expand Down
Loading