agentmall 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +21 -13
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -596,11 +596,15 @@ async function getBuyerToken(purchaseId) {
|
|
|
596
596
|
|
|
597
597
|
// src/cli/index.ts
|
|
598
598
|
var EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
599
|
-
async function runCommandCapture(command2, args2) {
|
|
599
|
+
async function runCommandCapture(command2, args2, envOverrides) {
|
|
600
600
|
return await new Promise((resolve, reject) => {
|
|
601
601
|
const child = spawn(command2, args2, {
|
|
602
602
|
stdio: ["ignore", "pipe", "pipe"],
|
|
603
|
-
shell: process.platform === "win32"
|
|
603
|
+
shell: process.platform === "win32",
|
|
604
|
+
env: {
|
|
605
|
+
...process.env,
|
|
606
|
+
...envOverrides
|
|
607
|
+
}
|
|
604
608
|
});
|
|
605
609
|
let stdout = "";
|
|
606
610
|
let stderr = "";
|
|
@@ -670,17 +674,21 @@ function formatUsdAmount(cents) {
|
|
|
670
674
|
}
|
|
671
675
|
async function createPurchaseWithTempo(body) {
|
|
672
676
|
const totalChargeCents = body.max_budget + SERVICE_FEE_CENTS;
|
|
673
|
-
const result = await runCommandCapture(
|
|
674
|
-
"
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
677
|
+
const result = await runCommandCapture(
|
|
678
|
+
"tempo",
|
|
679
|
+
[
|
|
680
|
+
"request",
|
|
681
|
+
"-s",
|
|
682
|
+
"-X",
|
|
683
|
+
"POST",
|
|
684
|
+
"--json",
|
|
685
|
+
JSON.stringify(body),
|
|
686
|
+
`${BASE_URL}/api/purchases`
|
|
687
|
+
],
|
|
688
|
+
{
|
|
689
|
+
TEMPO_MAX_SPEND: formatUsdAmount(totalChargeCents)
|
|
690
|
+
}
|
|
691
|
+
);
|
|
684
692
|
if (result.code !== 0) {
|
|
685
693
|
const message = result.stderr.trim() || result.stdout.trim() || "Tempo request failed";
|
|
686
694
|
throw new Error(message);
|