@skillrecordings/cli 0.1.0 → 0.2.1
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/bin/skill.mjs +21 -0
- package/dist/chunk-2NCCVTEE.js +22342 -0
- package/dist/chunk-2NCCVTEE.js.map +1 -0
- package/dist/chunk-3E3GYSZR.js +7071 -0
- package/dist/chunk-3E3GYSZR.js.map +1 -0
- package/dist/chunk-F4EM72IH.js +86 -0
- package/dist/chunk-F4EM72IH.js.map +1 -0
- package/dist/chunk-FGP7KUQW.js +432 -0
- package/dist/chunk-FGP7KUQW.js.map +1 -0
- package/dist/chunk-H3D6VCME.js +55 -0
- package/dist/chunk-H3D6VCME.js.map +1 -0
- package/dist/chunk-HK3PEWFD.js +208 -0
- package/dist/chunk-HK3PEWFD.js.map +1 -0
- package/dist/chunk-KEV3QKXP.js +4495 -0
- package/dist/chunk-KEV3QKXP.js.map +1 -0
- package/dist/chunk-MG37YDAK.js +882 -0
- package/dist/chunk-MG37YDAK.js.map +1 -0
- package/dist/chunk-MLNDSBZ4.js +482 -0
- package/dist/chunk-MLNDSBZ4.js.map +1 -0
- package/dist/chunk-N2WIV2JV.js +22 -0
- package/dist/chunk-N2WIV2JV.js.map +1 -0
- package/dist/chunk-PWWRCN5W.js +2067 -0
- package/dist/chunk-PWWRCN5W.js.map +1 -0
- package/dist/chunk-SKHBM3XP.js +7746 -0
- package/dist/chunk-SKHBM3XP.js.map +1 -0
- package/dist/chunk-WFANXVQG.js +64 -0
- package/dist/chunk-WFANXVQG.js.map +1 -0
- package/dist/chunk-WYKL32C3.js +275 -0
- package/dist/chunk-WYKL32C3.js.map +1 -0
- package/dist/chunk-ZNF7XD2S.js +134 -0
- package/dist/chunk-ZNF7XD2S.js.map +1 -0
- package/dist/config-AUAIYDSI.js +20 -0
- package/dist/config-AUAIYDSI.js.map +1 -0
- package/dist/fileFromPath-XN7LXIBI.js +134 -0
- package/dist/fileFromPath-XN7LXIBI.js.map +1 -0
- package/dist/getMachineId-bsd-KW2E7VK3.js +42 -0
- package/dist/getMachineId-bsd-KW2E7VK3.js.map +1 -0
- package/dist/getMachineId-darwin-ROXJUJX5.js +42 -0
- package/dist/getMachineId-darwin-ROXJUJX5.js.map +1 -0
- package/dist/getMachineId-linux-KVZEHQSU.js +34 -0
- package/dist/getMachineId-linux-KVZEHQSU.js.map +1 -0
- package/dist/getMachineId-unsupported-PPRILPPA.js +25 -0
- package/dist/getMachineId-unsupported-PPRILPPA.js.map +1 -0
- package/dist/getMachineId-win-IIF36LEJ.js +44 -0
- package/dist/getMachineId-win-IIF36LEJ.js.map +1 -0
- package/dist/index.js +112703 -0
- package/dist/index.js.map +1 -0
- package/dist/lib-R6DEEJCP.js +7623 -0
- package/dist/lib-R6DEEJCP.js.map +1 -0
- package/dist/pipeline-IAVVAKTU.js +120 -0
- package/dist/pipeline-IAVVAKTU.js.map +1 -0
- package/dist/query-NTP5NVXN.js +25 -0
- package/dist/query-NTP5NVXN.js.map +1 -0
- package/dist/routing-BAEPFB7V.js +390 -0
- package/dist/routing-BAEPFB7V.js.map +1 -0
- package/dist/stripe-lookup-charge-EPRUMZDL.js +56 -0
- package/dist/stripe-lookup-charge-EPRUMZDL.js.map +1 -0
- package/dist/stripe-payment-history-SJPKA63N.js +67 -0
- package/dist/stripe-payment-history-SJPKA63N.js.map +1 -0
- package/dist/stripe-subscription-status-L4Z65GB3.js +58 -0
- package/dist/stripe-subscription-status-L4Z65GB3.js.map +1 -0
- package/dist/stripe-verify-refund-FZDKCIUQ.js +54 -0
- package/dist/stripe-verify-refund-FZDKCIUQ.js.map +1 -0
- package/dist/support-memory-WSG7SDKG.js +10 -0
- package/dist/support-memory-WSG7SDKG.js.map +1 -0
- package/package.json +10 -7
- package/.env.encrypted +0 -0
- package/CHANGELOG.md +0 -35
- package/data/tt-archive-dataset.json +0 -1
- package/data/validate-test-dataset.json +0 -97
- package/docs/CLI-AUTH.md +0 -504
- package/preload.ts +0 -18
- package/src/__tests__/init.test.ts +0 -74
- package/src/alignment-test.ts +0 -64
- package/src/check-apps.ts +0 -16
- package/src/commands/auth/decrypt.ts +0 -123
- package/src/commands/auth/encrypt.ts +0 -81
- package/src/commands/auth/index.ts +0 -50
- package/src/commands/auth/keygen.ts +0 -41
- package/src/commands/auth/status.ts +0 -164
- package/src/commands/axiom/forensic.ts +0 -868
- package/src/commands/axiom/index.ts +0 -697
- package/src/commands/build-dataset.ts +0 -311
- package/src/commands/db-status.ts +0 -47
- package/src/commands/deploys.ts +0 -219
- package/src/commands/eval-local/compare.ts +0 -171
- package/src/commands/eval-local/health.ts +0 -212
- package/src/commands/eval-local/index.ts +0 -76
- package/src/commands/eval-local/real-tools.ts +0 -416
- package/src/commands/eval-local/run.ts +0 -1168
- package/src/commands/eval-local/score-production.ts +0 -256
- package/src/commands/eval-local/seed.ts +0 -276
- package/src/commands/eval-pipeline/index.ts +0 -53
- package/src/commands/eval-pipeline/real-tools.ts +0 -492
- package/src/commands/eval-pipeline/run.ts +0 -1316
- package/src/commands/eval-pipeline/seed.ts +0 -395
- package/src/commands/eval-prompt.ts +0 -496
- package/src/commands/eval.test.ts +0 -253
- package/src/commands/eval.ts +0 -108
- package/src/commands/faq-classify.ts +0 -460
- package/src/commands/faq-cluster.ts +0 -135
- package/src/commands/faq-extract.ts +0 -249
- package/src/commands/faq-mine.ts +0 -432
- package/src/commands/faq-review.ts +0 -426
- package/src/commands/front/index.ts +0 -351
- package/src/commands/front/pull-conversations.ts +0 -275
- package/src/commands/front/tags.ts +0 -825
- package/src/commands/front-cache.ts +0 -1277
- package/src/commands/front-stats.ts +0 -75
- package/src/commands/health.test.ts +0 -82
- package/src/commands/health.ts +0 -362
- package/src/commands/init.test.ts +0 -89
- package/src/commands/init.ts +0 -106
- package/src/commands/inngest/client.ts +0 -294
- package/src/commands/inngest/events.ts +0 -296
- package/src/commands/inngest/investigate.ts +0 -382
- package/src/commands/inngest/runs.ts +0 -149
- package/src/commands/inngest/signal.ts +0 -143
- package/src/commands/kb-sync.ts +0 -498
- package/src/commands/memory/find.ts +0 -135
- package/src/commands/memory/get.ts +0 -87
- package/src/commands/memory/index.ts +0 -97
- package/src/commands/memory/stats.ts +0 -163
- package/src/commands/memory/store.ts +0 -49
- package/src/commands/memory/vote.ts +0 -159
- package/src/commands/pipeline.ts +0 -127
- package/src/commands/responses.ts +0 -856
- package/src/commands/tools.ts +0 -293
- package/src/commands/wizard.ts +0 -319
- package/src/index.ts +0 -172
- package/src/lib/crypto.ts +0 -56
- package/src/lib/env-loader.ts +0 -206
- package/src/lib/onepassword.ts +0 -137
- package/src/test-agent-local.ts +0 -115
- package/tsconfig.json +0 -11
- package/vitest.config.ts +0 -10
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
stripe_esm_node_default
|
|
3
|
+
} from "./chunk-SKHBM3XP.js";
|
|
4
|
+
import {
|
|
5
|
+
createTool
|
|
6
|
+
} from "./chunk-F4EM72IH.js";
|
|
7
|
+
import {
|
|
8
|
+
init_esm_shims
|
|
9
|
+
} from "./chunk-WFANXVQG.js";
|
|
10
|
+
|
|
11
|
+
// ../core/src/tools/stripe-payment-history.ts
|
|
12
|
+
init_esm_shims();
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
var getPaymentHistory = createTool({
|
|
15
|
+
name: "get_payment_history",
|
|
16
|
+
description: "Query payment/charge history for a customer from Stripe Connect. Read-only - provides context for support conversations. Returns charge list with amounts, dates, refund status.",
|
|
17
|
+
parameters: z.object({
|
|
18
|
+
/**
|
|
19
|
+
* Customer email to lookup charges
|
|
20
|
+
*/
|
|
21
|
+
customerEmail: z.string().email("Valid email required"),
|
|
22
|
+
/**
|
|
23
|
+
* Maximum number of charges to return (default: 25, max: 100)
|
|
24
|
+
*/
|
|
25
|
+
limit: z.number().int().positive().max(100, "Limit cannot exceed 100").optional().default(25)
|
|
26
|
+
}),
|
|
27
|
+
execute: async ({ customerEmail, limit = 25 }, context) => {
|
|
28
|
+
if (!context.appConfig.stripeAccountId) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
`Stripe account not connected for app: ${context.appConfig.id}`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const stripe = new stripe_esm_node_default(process.env.STRIPE_SECRET_KEY, {
|
|
34
|
+
apiVersion: "2025-02-24.acacia"
|
|
35
|
+
});
|
|
36
|
+
try {
|
|
37
|
+
const charges = await stripe.charges.list(
|
|
38
|
+
{
|
|
39
|
+
customer: customerEmail,
|
|
40
|
+
limit
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
stripeAccount: context.appConfig.stripeAccountId
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
const formattedCharges = charges.data.map((charge) => ({
|
|
47
|
+
id: charge.id,
|
|
48
|
+
amount: charge.amount,
|
|
49
|
+
currency: charge.currency,
|
|
50
|
+
status: charge.status,
|
|
51
|
+
refunded: charge.refunded,
|
|
52
|
+
created: charge.created,
|
|
53
|
+
description: charge.description
|
|
54
|
+
}));
|
|
55
|
+
return {
|
|
56
|
+
charges: formattedCharges
|
|
57
|
+
};
|
|
58
|
+
} catch (error) {
|
|
59
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
60
|
+
throw new Error(`Failed to fetch payment history: ${message}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
export {
|
|
65
|
+
getPaymentHistory
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=stripe-payment-history-SJPKA63N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../core/src/tools/stripe-payment-history.ts"],"sourcesContent":["import Stripe from 'stripe'\nimport { z } from 'zod'\nimport { createTool } from './create-tool'\n\n/**\n * Formatted charge information for payment history.\n */\nexport interface PaymentCharge {\n /**\n * Stripe charge ID\n */\n id: string\n /**\n * Amount in cents\n */\n amount: number\n /**\n * Currency code (e.g., 'usd')\n */\n currency: string\n /**\n * Charge status\n */\n status: string\n /**\n * Whether the charge has been refunded\n */\n refunded: boolean\n /**\n * Unix timestamp of charge creation\n */\n created: number\n /**\n * Charge description\n */\n description: string | null\n}\n\n/**\n * Payment history result.\n */\nexport interface PaymentHistoryResult {\n /**\n * List of formatted charges\n */\n charges: PaymentCharge[]\n}\n\n/**\n * Get payment/charge history for a customer via Stripe Connect.\n *\n * IMPORTANT: This is a QUERY-ONLY tool. It does NOT execute financial actions.\n * We use Stripe Connect to query payment data from the app's connected account.\n *\n * Architecture: Platform queries for context → Apps execute actions\n *\n * Use cases:\n * - Agent needs payment context for support conversation\n * - Verifying purchase history\n * - Checking refund status\n *\n * @example\n * ```typescript\n * const history = await getPaymentHistory.execute(\n * { customerEmail: '[EMAIL]', limit: 10 },\n * context\n * )\n * ```\n */\nexport const getPaymentHistory = createTool({\n name: 'get_payment_history',\n description:\n 'Query payment/charge history for a customer from Stripe Connect. Read-only - provides context for support conversations. Returns charge list with amounts, dates, refund status.',\n parameters: z.object({\n /**\n * Customer email to lookup charges\n */\n customerEmail: z.string().email('Valid email required'),\n /**\n * Maximum number of charges to return (default: 25, max: 100)\n */\n limit: z\n .number()\n .int()\n .positive()\n .max(100, 'Limit cannot exceed 100')\n .optional()\n .default(25),\n }),\n\n execute: async ({ customerEmail, limit = 25 }, context) => {\n // Verify Stripe account is connected\n if (!context.appConfig.stripeAccountId) {\n throw new Error(\n `Stripe account not connected for app: ${context.appConfig.id}`\n )\n }\n\n // Initialize Stripe client\n const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {\n apiVersion: '2025-02-24.acacia',\n })\n\n try {\n // Query charges from connected account\n // Using stripeAccount header to query the connected app's Stripe account\n const charges = await stripe.charges.list(\n {\n customer: customerEmail,\n limit,\n },\n {\n stripeAccount: context.appConfig.stripeAccountId,\n }\n )\n\n // Format charges for agent context\n const formattedCharges: PaymentCharge[] = charges.data.map((charge) => ({\n id: charge.id,\n amount: charge.amount,\n currency: charge.currency,\n status: charge.status,\n refunded: charge.refunded,\n created: charge.created,\n description: charge.description,\n }))\n\n return {\n charges: formattedCharges,\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new Error(`Failed to fetch payment history: ${message}`)\n }\n },\n})\n"],"mappings":";;;;;;;;;;;AAAA;AACA,SAAS,SAAS;AAoEX,IAAM,oBAAoB,WAAW;AAAA,EAC1C,MAAM;AAAA,EACN,aACE;AAAA,EACF,YAAY,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,IAInB,eAAe,EAAE,OAAO,EAAE,MAAM,sBAAsB;AAAA;AAAA;AAAA;AAAA,IAItD,OAAO,EACJ,OAAO,EACP,IAAI,EACJ,SAAS,EACT,IAAI,KAAK,yBAAyB,EAClC,SAAS,EACT,QAAQ,EAAE;AAAA,EACf,CAAC;AAAA,EAED,SAAS,OAAO,EAAE,eAAe,QAAQ,GAAG,GAAG,YAAY;AAEzD,QAAI,CAAC,QAAQ,UAAU,iBAAiB;AACtC,YAAM,IAAI;AAAA,QACR,yCAAyC,QAAQ,UAAU,EAAE;AAAA,MAC/D;AAAA,IACF;AAGA,UAAM,SAAS,IAAI,wBAAO,QAAQ,IAAI,mBAAoB;AAAA,MACxD,YAAY;AAAA,IACd,CAAC;AAED,QAAI;AAGF,YAAM,UAAU,MAAM,OAAO,QAAQ;AAAA,QACnC;AAAA,UACE,UAAU;AAAA,UACV;AAAA,QACF;AAAA,QACA;AAAA,UACE,eAAe,QAAQ,UAAU;AAAA,QACnC;AAAA,MACF;AAGA,YAAM,mBAAoC,QAAQ,KAAK,IAAI,CAAC,YAAY;AAAA,QACtE,IAAI,OAAO;AAAA,QACX,QAAQ,OAAO;AAAA,QACf,UAAU,OAAO;AAAA,QACjB,QAAQ,OAAO;AAAA,QACf,UAAU,OAAO;AAAA,QACjB,SAAS,OAAO;AAAA,QAChB,aAAa,OAAO;AAAA,MACtB,EAAE;AAEF,aAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF,SAAS,OAAO;AACd,YAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AACzD,YAAM,IAAI,MAAM,oCAAoC,OAAO,EAAE;AAAA,IAC/D;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
stripe_esm_node_default
|
|
3
|
+
} from "./chunk-SKHBM3XP.js";
|
|
4
|
+
import {
|
|
5
|
+
createTool
|
|
6
|
+
} from "./chunk-F4EM72IH.js";
|
|
7
|
+
import {
|
|
8
|
+
init_esm_shims
|
|
9
|
+
} from "./chunk-WFANXVQG.js";
|
|
10
|
+
|
|
11
|
+
// ../core/src/tools/stripe-subscription-status.ts
|
|
12
|
+
init_esm_shims();
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
var GetSubscriptionStatusParams = z.object({
|
|
15
|
+
/**
|
|
16
|
+
* Stripe customer ID
|
|
17
|
+
*/
|
|
18
|
+
customerId: z.string(),
|
|
19
|
+
/**
|
|
20
|
+
* Stripe Connect account ID
|
|
21
|
+
*/
|
|
22
|
+
stripeAccountId: z.string()
|
|
23
|
+
});
|
|
24
|
+
var getSubscriptionStatus = createTool({
|
|
25
|
+
name: "get_subscription_status",
|
|
26
|
+
description: "Check subscription status for a customer via Stripe Connect. Returns subscription details or null if no subscription found.",
|
|
27
|
+
parameters: GetSubscriptionStatusParams,
|
|
28
|
+
execute: async (params, context) => {
|
|
29
|
+
const stripe = new stripe_esm_node_default(process.env.STRIPE_SECRET_KEY || "", {
|
|
30
|
+
apiVersion: "2025-02-24.acacia"
|
|
31
|
+
});
|
|
32
|
+
const subscriptions = await stripe.subscriptions.list(
|
|
33
|
+
{
|
|
34
|
+
customer: params.customerId,
|
|
35
|
+
status: "all"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
stripeAccount: params.stripeAccountId
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
const subscription = subscriptions.data[0];
|
|
42
|
+
if (!subscription) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const planName = subscription.items.data[0]?.plan?.nickname || "Unknown";
|
|
46
|
+
return {
|
|
47
|
+
id: subscription.id,
|
|
48
|
+
status: subscription.status,
|
|
49
|
+
currentPeriodEnd: subscription.current_period_end,
|
|
50
|
+
cancelAtPeriodEnd: subscription.cancel_at_period_end,
|
|
51
|
+
planName
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
getSubscriptionStatus
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=stripe-subscription-status-L4Z65GB3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../core/src/tools/stripe-subscription-status.ts"],"sourcesContent":["import Stripe from 'stripe'\nimport { z } from 'zod'\nimport { createTool } from './create-tool'\nimport type { ExecutionContext } from './types'\n\n/**\n * Parameters for subscription status query\n */\nconst GetSubscriptionStatusParams = z.object({\n /**\n * Stripe customer ID\n */\n customerId: z.string(),\n /**\n * Stripe Connect account ID\n */\n stripeAccountId: z.string(),\n})\n\n/**\n * Subscription status result\n */\nexport interface SubscriptionStatus {\n id: string\n status: string\n currentPeriodEnd: number\n cancelAtPeriodEnd: boolean\n planName: string\n}\n\n/**\n * Agent tool to check subscription status via Stripe Connect.\n *\n * Queries the connected Stripe account for customer subscriptions and returns\n * the status, plan details, and cancellation info. Returns null if no subscription found.\n *\n * @example\n * ```typescript\n * const status = await getSubscriptionStatus.execute({\n * customerId: 'cus_123',\n * stripeAccountId: 'acct_1LFP5yAozSgJZBRP',\n * }, context)\n * ```\n */\nexport const getSubscriptionStatus = createTool({\n name: 'get_subscription_status',\n description:\n 'Check subscription status for a customer via Stripe Connect. Returns subscription details or null if no subscription found.',\n parameters: GetSubscriptionStatusParams,\n\n execute: async (\n params,\n context: ExecutionContext\n ): Promise<SubscriptionStatus | null> => {\n // Initialize Stripe client\n const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || '', {\n apiVersion: '2025-02-24.acacia',\n })\n\n // Query subscriptions for the customer on the connected account\n const subscriptions = await stripe.subscriptions.list(\n {\n customer: params.customerId,\n status: 'all',\n },\n {\n stripeAccount: params.stripeAccountId,\n }\n )\n\n // Return null if no subscriptions found\n const subscription = subscriptions.data[0]\n if (!subscription) {\n return null\n }\n\n // Extract plan name from subscription items\n const planName = subscription.items.data[0]?.plan?.nickname || 'Unknown'\n\n return {\n id: subscription.id,\n status: subscription.status,\n currentPeriodEnd: subscription.current_period_end,\n cancelAtPeriodEnd: subscription.cancel_at_period_end,\n planName,\n }\n },\n})\n"],"mappings":";;;;;;;;;;;AAAA;AACA,SAAS,SAAS;AAOlB,IAAM,8BAA8B,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,EAI3C,YAAY,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,EAIrB,iBAAiB,EAAE,OAAO;AAC5B,CAAC;AA2BM,IAAM,wBAAwB,WAAW;AAAA,EAC9C,MAAM;AAAA,EACN,aACE;AAAA,EACF,YAAY;AAAA,EAEZ,SAAS,OACP,QACA,YACuC;AAEvC,UAAM,SAAS,IAAI,wBAAO,QAAQ,IAAI,qBAAqB,IAAI;AAAA,MAC7D,YAAY;AAAA,IACd,CAAC;AAGD,UAAM,gBAAgB,MAAM,OAAO,cAAc;AAAA,MAC/C;AAAA,QACE,UAAU,OAAO;AAAA,QACjB,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,QACE,eAAe,OAAO;AAAA,MACxB;AAAA,IACF;AAGA,UAAM,eAAe,cAAc,KAAK,CAAC;AACzC,QAAI,CAAC,cAAc;AACjB,aAAO;AAAA,IACT;AAGA,UAAM,WAAW,aAAa,MAAM,KAAK,CAAC,GAAG,MAAM,YAAY;AAE/D,WAAO;AAAA,MACL,IAAI,aAAa;AAAA,MACjB,QAAQ,aAAa;AAAA,MACrB,kBAAkB,aAAa;AAAA,MAC/B,mBAAmB,aAAa;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
stripe_esm_node_default
|
|
3
|
+
} from "./chunk-SKHBM3XP.js";
|
|
4
|
+
import {
|
|
5
|
+
createTool
|
|
6
|
+
} from "./chunk-F4EM72IH.js";
|
|
7
|
+
import {
|
|
8
|
+
init_esm_shims
|
|
9
|
+
} from "./chunk-WFANXVQG.js";
|
|
10
|
+
|
|
11
|
+
// ../core/src/tools/stripe-verify-refund.ts
|
|
12
|
+
init_esm_shims();
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
var verifyRefund = createTool({
|
|
15
|
+
name: "verify_refund",
|
|
16
|
+
description: "Verify refund status from Stripe Connect. Read-only - provides context for support conversations. Returns refund details including status, amount, charge ID, and reason.",
|
|
17
|
+
parameters: z.object({
|
|
18
|
+
/**
|
|
19
|
+
* Stripe refund ID to verify (e.g., re_1ABC123)
|
|
20
|
+
*/
|
|
21
|
+
refundId: z.string().min(1, "Refund ID required")
|
|
22
|
+
}),
|
|
23
|
+
execute: async ({ refundId }, context) => {
|
|
24
|
+
if (!context.appConfig.stripeAccountId) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`Stripe account not connected for app: ${context.appConfig.id}`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
const stripe = new stripe_esm_node_default(process.env.STRIPE_SECRET_KEY, {
|
|
30
|
+
apiVersion: "2025-02-24.acacia"
|
|
31
|
+
});
|
|
32
|
+
try {
|
|
33
|
+
const refund = await stripe.refunds.retrieve(refundId, {
|
|
34
|
+
stripeAccount: context.appConfig.stripeAccountId
|
|
35
|
+
});
|
|
36
|
+
const refundDetails = {
|
|
37
|
+
id: refund.id,
|
|
38
|
+
status: refund.status ?? "unknown",
|
|
39
|
+
amount: refund.amount,
|
|
40
|
+
chargeId: typeof refund.charge === "string" ? refund.charge : null,
|
|
41
|
+
reason: refund.reason,
|
|
42
|
+
created: refund.created
|
|
43
|
+
};
|
|
44
|
+
return refundDetails;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
47
|
+
throw new Error(`Failed to verify refund: ${message}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
export {
|
|
52
|
+
verifyRefund
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=stripe-verify-refund-FZDKCIUQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../core/src/tools/stripe-verify-refund.ts"],"sourcesContent":["import Stripe from 'stripe'\nimport { z } from 'zod'\nimport { createTool } from './create-tool'\n\n/**\n * Refund details from Stripe.\n */\nexport interface RefundDetails {\n /**\n * Stripe refund ID\n */\n id: string\n /**\n * Refund status (succeeded, pending, failed, canceled)\n */\n status: string\n /**\n * Amount refunded in cents\n */\n amount: number\n /**\n * ID of the charge that was refunded\n */\n chargeId: string | null\n /**\n * Reason for refund (requested_by_customer, duplicate, fraudulent, etc.)\n */\n reason: string | null\n /**\n * Unix timestamp of refund creation\n */\n created: number\n}\n\n/**\n * Verify refund status via Stripe Connect.\n *\n * IMPORTANT: This is a QUERY-ONLY tool. It does NOT execute financial actions.\n * We use Stripe Connect to query refund data from the app's connected account.\n *\n * Architecture: Platform queries for context → Apps execute actions\n *\n * Use cases:\n * - Agent needs to verify a refund was processed\n * - Checking refund status for support conversation\n * - Confirming refund details (amount, reason, timing)\n *\n * @example\n * ```typescript\n * const refund = await verifyRefund.execute(\n * { refundId: 're_1ABC123' },\n * context\n * )\n * ```\n */\nexport const verifyRefund = createTool({\n name: 'verify_refund',\n description:\n 'Verify refund status from Stripe Connect. Read-only - provides context for support conversations. Returns refund details including status, amount, charge ID, and reason.',\n parameters: z.object({\n /**\n * Stripe refund ID to verify (e.g., re_1ABC123)\n */\n refundId: z.string().min(1, 'Refund ID required'),\n }),\n\n execute: async ({ refundId }, context) => {\n // Verify Stripe account is connected\n if (!context.appConfig.stripeAccountId) {\n throw new Error(\n `Stripe account not connected for app: ${context.appConfig.id}`\n )\n }\n\n // Initialize Stripe client\n const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {\n apiVersion: '2025-02-24.acacia',\n })\n\n try {\n // Query refund from connected account\n // Using stripeAccount header to query the connected app's Stripe account\n const refund = await stripe.refunds.retrieve(refundId, {\n stripeAccount: context.appConfig.stripeAccountId,\n })\n\n // Format refund details for agent context\n const refundDetails: RefundDetails = {\n id: refund.id,\n status: refund.status ?? 'unknown',\n amount: refund.amount,\n chargeId: typeof refund.charge === 'string' ? refund.charge : null,\n reason: refund.reason,\n created: refund.created,\n }\n\n return refundDetails\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new Error(`Failed to verify refund: ${message}`)\n }\n },\n})\n"],"mappings":";;;;;;;;;;;AAAA;AACA,SAAS,SAAS;AAsDX,IAAM,eAAe,WAAW;AAAA,EACrC,MAAM;AAAA,EACN,aACE;AAAA,EACF,YAAY,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,IAInB,UAAU,EAAE,OAAO,EAAE,IAAI,GAAG,oBAAoB;AAAA,EAClD,CAAC;AAAA,EAED,SAAS,OAAO,EAAE,SAAS,GAAG,YAAY;AAExC,QAAI,CAAC,QAAQ,UAAU,iBAAiB;AACtC,YAAM,IAAI;AAAA,QACR,yCAAyC,QAAQ,UAAU,EAAE;AAAA,MAC/D;AAAA,IACF;AAGA,UAAM,SAAS,IAAI,wBAAO,QAAQ,IAAI,mBAAoB;AAAA,MACxD,YAAY;AAAA,IACd,CAAC;AAED,QAAI;AAGF,YAAM,SAAS,MAAM,OAAO,QAAQ,SAAS,UAAU;AAAA,QACrD,eAAe,QAAQ,UAAU;AAAA,MACnC,CAAC;AAGD,YAAM,gBAA+B;AAAA,QACnC,IAAI,OAAO;AAAA,QACX,QAAQ,OAAO,UAAU;AAAA,QACzB,QAAQ,OAAO;AAAA,QACf,UAAU,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS;AAAA,QAC9D,QAAQ,OAAO;AAAA,QACf,SAAS,OAAO;AAAA,MAClB;AAEA,aAAO;AAAA,IACT,SAAS,OAAO;AACd,YAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AACzD,YAAM,IAAI,MAAM,4BAA4B,OAAO,EAAE;AAAA,IACvD;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skillrecordings/cli",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
|
-
"skill": "./bin/skill.
|
|
6
|
+
"skill": "./bin/skill.mjs"
|
|
7
7
|
},
|
|
8
|
+
"files": ["dist", "bin"],
|
|
8
9
|
"scripts": {
|
|
9
10
|
"dev": "bun src/index.ts",
|
|
11
|
+
"build": "tsup",
|
|
10
12
|
"check-types": "tsc --noEmit",
|
|
11
13
|
"test": "vitest --run"
|
|
12
14
|
},
|
|
13
15
|
"devDependencies": {
|
|
14
16
|
"@repo/typescript-config": "*",
|
|
17
|
+
"@skillrecordings/core": "workspace:*",
|
|
18
|
+
"@skillrecordings/database": "workspace:*",
|
|
19
|
+
"@skillrecordings/front-sdk": "workspace:*",
|
|
20
|
+
"@skillrecordings/memory": "workspace:*",
|
|
21
|
+
"@skillrecordings/sdk": "workspace:*",
|
|
15
22
|
"@types/node": "^22.15.3",
|
|
23
|
+
"tsup": "^8.5.0",
|
|
16
24
|
"typescript": "5.9.2"
|
|
17
25
|
},
|
|
18
26
|
"dependencies": {
|
|
19
27
|
"@axiomhq/js": "^1.3.1",
|
|
20
28
|
"@inquirer/prompts": "^8.2.0",
|
|
21
|
-
"@skillrecordings/core": "workspace:*",
|
|
22
|
-
"@skillrecordings/database": "workspace:*",
|
|
23
|
-
"@skillrecordings/front-sdk": "workspace:*",
|
|
24
|
-
"@skillrecordings/memory": "workspace:*",
|
|
25
|
-
"@skillrecordings/sdk": "workspace:*",
|
|
26
29
|
"age-encryption": "^0.3.0",
|
|
27
30
|
"ai": "^6.0.49",
|
|
28
31
|
"commander": "^12.1.0",
|
package/.env.encrypted
DELETED
|
Binary file
|
package/CHANGELOG.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# @skillrecordings/cli
|
|
2
|
-
|
|
3
|
-
## 0.1.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- 5734b19: Make CLI public for npm publishing
|
|
8
|
-
|
|
9
|
-
## 0.0.4
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- Updated dependencies [7ae3e99]
|
|
14
|
-
- @skillrecordings/sdk@0.6.0
|
|
15
|
-
|
|
16
|
-
## 0.0.3
|
|
17
|
-
|
|
18
|
-
### Patch Changes
|
|
19
|
-
|
|
20
|
-
- Updated dependencies [36efccf]
|
|
21
|
-
- @skillrecordings/sdk@0.5.0
|
|
22
|
-
|
|
23
|
-
## 0.0.2
|
|
24
|
-
|
|
25
|
-
### Patch Changes
|
|
26
|
-
|
|
27
|
-
- Updated dependencies [7c5c5d8]
|
|
28
|
-
- @skillrecordings/sdk@0.4.0
|
|
29
|
-
|
|
30
|
-
## 0.0.1
|
|
31
|
-
|
|
32
|
-
### Patch Changes
|
|
33
|
-
|
|
34
|
-
- Updated dependencies [2820cb9]
|
|
35
|
-
- @skillrecordings/core@0.0.1
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[]
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": "validate_clean_response",
|
|
4
|
-
"name": "Clean response - should pass validation",
|
|
5
|
-
"draft": "Here's a login link for your account: https://example.com/login?token=abc123\n\nYou should have full access to the course now.",
|
|
6
|
-
"assertions": {
|
|
7
|
-
"noFabrication": true,
|
|
8
|
-
"noMetaCommentary": true,
|
|
9
|
-
"noInternalLeak": true,
|
|
10
|
-
"noBannedPhrases": true
|
|
11
|
-
},
|
|
12
|
-
"context": {
|
|
13
|
-
"customer": "recent-purchase"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"id": "validate_internal_leak",
|
|
18
|
-
"name": "Internal leak - exposes routing info",
|
|
19
|
-
"draft": "No instructor routing configured for this app. You'll want to reach out through another channel.",
|
|
20
|
-
"assertions": {
|
|
21
|
-
"noInternalLeak": true
|
|
22
|
-
},
|
|
23
|
-
"context": {
|
|
24
|
-
"customer": "no-purchase"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"id": "validate_meta_commentary",
|
|
29
|
-
"name": "Meta commentary - agent explains itself",
|
|
30
|
-
"draft": "This is clearly a vendor outreach email, not a support request. I won't draft a response here since it falls outside customer support scope.",
|
|
31
|
-
"assertions": {
|
|
32
|
-
"noMetaCommentary": true
|
|
33
|
-
},
|
|
34
|
-
"context": {
|
|
35
|
-
"customer": "no-purchase"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"id": "validate_banned_phrases",
|
|
40
|
-
"name": "Banned phrases - corporate speak",
|
|
41
|
-
"draft": "Great! I'd recommend starting with the basics. Let me know if you have any other questions! I hope this helps!",
|
|
42
|
-
"assertions": {
|
|
43
|
-
"noBannedPhrases": true
|
|
44
|
-
},
|
|
45
|
-
"context": {
|
|
46
|
-
"customer": "recent-purchase"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"id": "validate_fabrication",
|
|
51
|
-
"name": "Fabrication - made up course content",
|
|
52
|
-
"draft": "Start with the fundamentals section in Module 1. It covers core concepts like typing basics, generics, and utility types.",
|
|
53
|
-
"assertions": {
|
|
54
|
-
"noFabrication": true,
|
|
55
|
-
"mustNotContain": ["fundamentals section", "Module 1"]
|
|
56
|
-
},
|
|
57
|
-
"context": {
|
|
58
|
-
"customer": "no-purchase"
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"id": "validate_em_dash",
|
|
63
|
-
"name": "Em dash - banned character",
|
|
64
|
-
"draft": "TypeScript — like JavaScript — is a powerful language for building web applications.",
|
|
65
|
-
"assertions": {
|
|
66
|
-
"noBannedPhrases": true
|
|
67
|
-
},
|
|
68
|
-
"context": {
|
|
69
|
-
"customer": "recent-purchase"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"id": "validate_multiple_issues",
|
|
74
|
-
"name": "Multiple issues - several patterns detected",
|
|
75
|
-
"draft": "Great! I understand your frustration. The routing failed so I can't process this. Start with the fundamentals section — it covers everything.",
|
|
76
|
-
"assertions": {
|
|
77
|
-
"noFabrication": true,
|
|
78
|
-
"noInternalLeak": true,
|
|
79
|
-
"noBannedPhrases": true
|
|
80
|
-
},
|
|
81
|
-
"context": {
|
|
82
|
-
"customer": "no-purchase"
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"id": "validate_outside_scope",
|
|
87
|
-
"name": "Outside scope leak",
|
|
88
|
-
"draft": "This falls outside my scope as a support agent. You should contact the instructor directly.",
|
|
89
|
-
"assertions": {
|
|
90
|
-
"noInternalLeak": true,
|
|
91
|
-
"mustNotContain": ["outside", "scope"]
|
|
92
|
-
},
|
|
93
|
-
"context": {
|
|
94
|
-
"customer": "no-purchase"
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
]
|