tru-mcp 0.14.17 → 0.15.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/dist/server.js +7 -1
- package/dist/server.js.map +1 -1
- package/dist/tools/add_agent_signup.js +2 -1
- package/dist/tools/add_agent_signup.js.map +1 -1
- package/dist/tools/ask_developer.d.ts +26 -0
- package/dist/tools/ask_developer.js +47 -0
- package/dist/tools/ask_developer.js.map +1 -0
- package/dist/tools/authenticate.d.ts +1 -1
- package/dist/tools/authenticate.js +8 -1
- package/dist/tools/authenticate.js.map +1 -1
- package/dist/tools/configure_products.js +3 -1
- package/dist/tools/configure_products.js.map +1 -1
- package/dist/tools/configure_webhook.d.ts +40 -2
- package/dist/tools/configure_webhook.js +117 -74
- package/dist/tools/configure_webhook.js.map +1 -1
- package/dist/tools/connect_stripe.d.ts +5 -0
- package/dist/tools/connect_stripe.js +53 -22
- package/dist/tools/connect_stripe.js.map +1 -1
- package/dist/tools/discover_api.js +17 -11
- package/dist/tools/discover_api.js.map +1 -1
- package/dist/tools/get_started.d.ts +1 -0
- package/dist/tools/get_started.js +59 -592
- package/dist/tools/get_started.js.map +1 -1
- package/dist/tools/register_app.d.ts +3 -3
- package/dist/tools/register_app.js +19 -75
- package/dist/tools/register_app.js.map +1 -1
- package/dist/tools/setup_content.d.ts +21 -0
- package/dist/tools/setup_content.js +234 -0
- package/dist/tools/setup_content.js.map +1 -0
- package/dist/tools/setup_guide.d.ts +16 -0
- package/dist/tools/setup_guide.js +537 -0
- package/dist/tools/setup_guide.js.map +1 -0
- package/dist/tools/submit_friction_log.d.ts +31 -0
- package/dist/tools/submit_friction_log.js +85 -0
- package/dist/tools/submit_friction_log.js.map +1 -0
- package/dist/tools/validate_integration.d.ts +5 -0
- package/dist/tools/validate_integration.js +152 -31
- package/dist/tools/validate_integration.js.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -9,13 +9,14 @@ import { registerAppTool } from "./tools/register_app.js";
|
|
|
9
9
|
import { initiateOAuthTool } from "./tools/initiate_oauth.js";
|
|
10
10
|
import { connectStripeTool } from "./tools/connect_stripe.js";
|
|
11
11
|
import { getStartedTool } from "./tools/get_started.js";
|
|
12
|
+
import { setupGuideTool } from "./tools/setup_guide.js";
|
|
12
13
|
import { discoverApiTool } from "./tools/discover_api.js";
|
|
13
14
|
import { provisionUserTool } from "./tools/provision_user.js";
|
|
14
15
|
import { authenticateTool, logoutTool } from "./tools/authenticate.js";
|
|
15
16
|
import { discoverProductsTool } from "./tools/discover_products.js";
|
|
16
17
|
import { configureProductsTool } from "./tools/configure_products.js";
|
|
17
18
|
import { addAgentSignupTool } from "./tools/add_agent_signup.js";
|
|
18
|
-
import { configureWebhookTool } from "./tools/configure_webhook.js";
|
|
19
|
+
import { rotateSecretTool, setProvisionUrlTool, configureWebhookTool } from "./tools/configure_webhook.js";
|
|
19
20
|
import { validateIntegrationTool } from "./tools/validate_integration.js";
|
|
20
21
|
import { requestSPTTool } from "./tools/request_spt.js";
|
|
21
22
|
import { enableACPTool } from "./tools/enable_acp.js";
|
|
@@ -29,6 +30,7 @@ import { refundChargeTool } from "./tools/refund_charge.js";
|
|
|
29
30
|
import { reportSpamTool } from "./tools/report_spam.js";
|
|
30
31
|
import { blockSenderTool, unblockSenderTool } from "./tools/block_sender.js";
|
|
31
32
|
import { cancelSubscriptionTool } from "./tools/cancel_subscription.js";
|
|
33
|
+
import { submitFrictionLogTool } from "./tools/submit_friction_log.js";
|
|
32
34
|
import { setClientName, getSourceLabel, saveSourceLabel, getSuggestedLabel, } from "tru-cli/config";
|
|
33
35
|
// Re-export source label functions so existing tool imports work
|
|
34
36
|
export { getSourceLabel, saveSourceLabel, getSuggestedLabel };
|
|
@@ -48,11 +50,14 @@ server.tool(registerAppTool.name, registerAppTool.description, registerAppTool.i
|
|
|
48
50
|
server.tool(initiateOAuthTool.name, initiateOAuthTool.description, initiateOAuthTool.inputSchema, initiateOAuthTool.handler);
|
|
49
51
|
server.tool(connectStripeTool.name, connectStripeTool.description, connectStripeTool.inputSchema, connectStripeTool.handler);
|
|
50
52
|
server.tool(getStartedTool.name, getStartedTool.description, getStartedTool.inputSchema, getStartedTool.handler);
|
|
53
|
+
server.tool(setupGuideTool.name, setupGuideTool.description, setupGuideTool.inputSchema, setupGuideTool.handler);
|
|
51
54
|
server.tool(discoverApiTool.name, discoverApiTool.description, discoverApiTool.inputSchema, discoverApiTool.handler);
|
|
52
55
|
server.tool(provisionUserTool.name, provisionUserTool.description, provisionUserTool.inputSchema, provisionUserTool.handler);
|
|
53
56
|
server.tool(discoverProductsTool.name, discoverProductsTool.description, discoverProductsTool.inputSchema, discoverProductsTool.handler);
|
|
54
57
|
server.tool(configureProductsTool.name, configureProductsTool.description, configureProductsTool.inputSchema, configureProductsTool.handler);
|
|
55
58
|
server.tool(addAgentSignupTool.name, addAgentSignupTool.description, addAgentSignupTool.inputSchema, addAgentSignupTool.handler);
|
|
59
|
+
server.tool(setProvisionUrlTool.name, setProvisionUrlTool.description, setProvisionUrlTool.inputSchema, setProvisionUrlTool.handler);
|
|
60
|
+
server.tool(rotateSecretTool.name, rotateSecretTool.description, rotateSecretTool.inputSchema, rotateSecretTool.handler);
|
|
56
61
|
server.tool(configureWebhookTool.name, configureWebhookTool.description, configureWebhookTool.inputSchema, configureWebhookTool.handler);
|
|
57
62
|
server.tool(validateIntegrationTool.name, validateIntegrationTool.description, validateIntegrationTool.inputSchema, validateIntegrationTool.handler);
|
|
58
63
|
server.tool(requestSPTTool.name, requestSPTTool.description, requestSPTTool.inputSchema, requestSPTTool.handler);
|
|
@@ -68,6 +73,7 @@ server.tool(reportSpamTool.name, reportSpamTool.description, reportSpamTool.inpu
|
|
|
68
73
|
server.tool(blockSenderTool.name, blockSenderTool.description, blockSenderTool.inputSchema, blockSenderTool.handler);
|
|
69
74
|
server.tool(unblockSenderTool.name, unblockSenderTool.description, unblockSenderTool.inputSchema, unblockSenderTool.handler);
|
|
70
75
|
server.tool(cancelSubscriptionTool.name, cancelSubscriptionTool.description, cancelSubscriptionTool.inputSchema, cancelSubscriptionTool.handler);
|
|
76
|
+
server.tool(submitFrictionLogTool.name, submitFrictionLogTool.description, submitFrictionLogTool.inputSchema, submitFrictionLogTool.handler);
|
|
71
77
|
// ─── Prompts (show up as /tru:prompt-name in Claude Code) ──────
|
|
72
78
|
const BASE_URL = process.env.TRU_API_URL || "https://tru.so";
|
|
73
79
|
server.prompt("dev-setup", "Full walkthrough for integrating tru into your app — auth, billing, identity verification, and agent discoverability", async () => {
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,+DAA+D;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBA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AC3C,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IAEV,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { lookupAppByServiceName, reportSetupProgress } from "tru-cli/api-client";
|
|
2
|
+
import { lookupAppByServiceName, reportSetupProgress, reportSetupActivity } from "tru-cli/api-client";
|
|
3
3
|
import { getStoredApp } from "tru-cli/config";
|
|
4
4
|
const BASE_URL = process.env.TRU_API_URL || "https://tru.so";
|
|
5
5
|
export const addAgentSignupTool = {
|
|
@@ -47,6 +47,7 @@ export const addAgentSignupTool = {
|
|
|
47
47
|
].join("\n");
|
|
48
48
|
// Report progress
|
|
49
49
|
if (lookup.app?.id) {
|
|
50
|
+
reportSetupActivity(lookup.app.id, "Generating agent signup snippet...", "add_agent_signup");
|
|
50
51
|
await reportSetupProgress(lookup.app.id, "add_agent_signup");
|
|
51
52
|
}
|
|
52
53
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add_agent_signup.js","sourceRoot":"","sources":["../../src/tools/add_agent_signup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"add_agent_signup.js","sourceRoot":"","sources":["../../src/tools/add_agent_signup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,gBAAgB,CAAC;AAE7D,MAAM,CAAC,MAA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AAC;gBACnB,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,oCAAoC,EAAE,kBAAkB,CAAC,CAAC;gBAC7F,MAAM,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,kBAAkB,CAAC,CAAC;YAC/D,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;aAClD,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE,EAAE,CAAC;gBAC/D,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const askDeveloperTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
app_id: z.ZodString;
|
|
7
|
+
question: z.ZodString;
|
|
8
|
+
options: z.ZodArray<z.ZodObject<{
|
|
9
|
+
label: z.ZodString;
|
|
10
|
+
description: z.ZodString;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
};
|
|
13
|
+
handler: (args: {
|
|
14
|
+
app_id: string;
|
|
15
|
+
question: string;
|
|
16
|
+
options: Array<{
|
|
17
|
+
label: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}>;
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
content: {
|
|
22
|
+
type: "text";
|
|
23
|
+
text: string;
|
|
24
|
+
}[];
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createQuestion, pollQuestionAnswer } from "tru-cli/api-client";
|
|
3
|
+
function sleep(ms) {
|
|
4
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5
|
+
}
|
|
6
|
+
export const askDeveloperTool = {
|
|
7
|
+
name: "ask_developer",
|
|
8
|
+
description: "Ask the developer a question in their browser setup page. " +
|
|
9
|
+
"The developer sees clickable option buttons and can also type a custom answer. " +
|
|
10
|
+
"Use this instead of AskUserQuestion during app setup (after registration, when you have an app_id).",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
app_id: z.string().describe("The app ID"),
|
|
13
|
+
question: z.string().describe("The question to ask"),
|
|
14
|
+
options: z
|
|
15
|
+
.array(z.object({
|
|
16
|
+
label: z.string(),
|
|
17
|
+
description: z.string(),
|
|
18
|
+
}))
|
|
19
|
+
.describe("Clickable options for the developer"),
|
|
20
|
+
},
|
|
21
|
+
handler: async (args) => {
|
|
22
|
+
const { id } = await createQuestion(args.app_id, args.question, args.options);
|
|
23
|
+
const POLL_INTERVAL = 2000;
|
|
24
|
+
const TIMEOUT = 5 * 60 * 1000;
|
|
25
|
+
const start = Date.now();
|
|
26
|
+
while (Date.now() - start < TIMEOUT) {
|
|
27
|
+
await sleep(POLL_INTERVAL);
|
|
28
|
+
const answer = await pollQuestionAnswer(args.app_id, id);
|
|
29
|
+
if (answer !== null) {
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{ type: "text", text: `Developer answered: ${answer}` },
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
content: [
|
|
39
|
+
{
|
|
40
|
+
type: "text",
|
|
41
|
+
text: "Question timed out — developer didn't respond in 5 minutes. Use AskUserQuestion to ask in the terminal instead.",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=ask_developer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask_developer.js","sourceRoot":"","sources":["../../src/tools/ask_developer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExE,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,4DAA4D;QAC5D,iFAAiF;QACjF,qGAAqG;IACvG,WAAW,EAAE;QACX,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC;QACzC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QACpD,OAAO,EAAE,CAAC;aACP,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;YACP,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;YACjB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;SACxB,CAAC,CACH;aACA,QAAQ,CAAC,qCAAqC,CAAC;KACnD;IACD,OAAO,EAAE,KAAK,EAAE,IAIf,EAAE,EAAE;QACH,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE9E,MAAM,aAAa,GAAG,IAAI,CAAC;QAC3B,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEzB,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,OAAO,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC,aAAa,CAAC,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACzD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;gBACpB,OAAO;oBACL,OAAO,EAAE;wBACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,uBAAuB,MAAM,EAAE,EAAE;qBACjE;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,iHAAiH;iBACxH;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -11,7 +11,7 @@ export const authenticateTool = {
|
|
|
11
11
|
inputSchema: {
|
|
12
12
|
switch_account: z.boolean().optional().describe("Log out first and authenticate as a different user"),
|
|
13
13
|
},
|
|
14
|
-
handler: async (args) => {
|
|
14
|
+
handler: async (args, extra) => {
|
|
15
15
|
try {
|
|
16
16
|
// Check if already authenticated (unless switching accounts)
|
|
17
17
|
if (!args.switch_account) {
|
|
@@ -27,8 +27,15 @@ export const authenticateTool = {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
const progressToken = extra?._meta?.progressToken;
|
|
30
31
|
const result = await loginViaBrowser({
|
|
31
32
|
switchAccount: args.switch_account,
|
|
33
|
+
onProgress: progressToken ? async (attempt, maxAttempts) => {
|
|
34
|
+
await extra.sendNotification({
|
|
35
|
+
method: "notifications/progress",
|
|
36
|
+
params: { progressToken, progress: attempt, total: maxAttempts },
|
|
37
|
+
});
|
|
38
|
+
} : undefined,
|
|
32
39
|
});
|
|
33
40
|
return {
|
|
34
41
|
content: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/tools/authenticate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAElE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,OAAO;IACb,WAAW,EACT,yCAAyC;QACzC,wIAAwI;QACxI,sDAAsD;QACtD,iFAAiF;QACjF,gKAAgK;IAClK,WAAW,EAAE;QACX,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;KACtG;IACD,OAAO,EAAE,KAAK,EAAE,IAAkC,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/tools/authenticate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAElE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,OAAO;IACb,WAAW,EACT,yCAAyC;QACzC,wIAAwI;QACxI,sDAAsD;QACtD,iFAAiF;QACjF,gKAAgK;IAClK,WAAW,EAAE;QACX,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;KACtG;IACD,OAAO,EAAE,KAAK,EAAE,IAAkC,EAAE,KAAU,EAAE,EAAE;QAChE,IAAI,CAAC;YACH,6DAA6D;YAC7D,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;gBACzB,MAAM,QAAQ,GAAG,MAAM,iBAAiB,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AkF;IAC/F,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,KAAK,EAAE,KAA4B,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC;aACvE,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,SAAS,EAAE,CAAC;QACZ,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,cAAc,KAAK,sDAAsD,EAAE,CAAC;SACtH,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { syncAppProducts, setProductVisibility, reportSetupProgress } from "tru-cli/api-client";
|
|
2
|
+
import { syncAppProducts, setProductVisibility, reportSetupProgress, reportSetupActivity } from "tru-cli/api-client";
|
|
3
3
|
import { getStoredApp } from "tru-cli/config";
|
|
4
4
|
function formatPrice(amountCents, currency) {
|
|
5
5
|
if (amountCents === null)
|
|
@@ -38,6 +38,8 @@ export const configureProductsTool = {
|
|
|
38
38
|
isError: true,
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
+
// Signal starting
|
|
42
|
+
reportSetupActivity(appId, "Syncing products from Stripe...", "products_synced");
|
|
41
43
|
// Sync products from Stripe
|
|
42
44
|
const products = await syncAppProducts(appId);
|
|
43
45
|
if (products.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure_products.js","sourceRoot":"","sources":["../../src/tools/configure_products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,mBAAmB,EAAmB,MAAM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C,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC,CAAC,CAAC;gBAClG,EAAE;gBACF,KAAK,OAAO,CAAC,MAAM,kCAAkC;gBACrD,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAa,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,MAAM,WAAW,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;gBACjI,EAAE;gBACF,8HAA8H;aAC/H,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;aAC7D,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,+BAA+B,OAAO,EAAE,EAAE,CAAC;gBACpF,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1,15 +1,53 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const rotateSecretTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {};
|
|
6
|
+
handler: () => Promise<{
|
|
7
|
+
content: {
|
|
8
|
+
type: "text";
|
|
9
|
+
text: string;
|
|
10
|
+
}[];
|
|
11
|
+
isError: boolean;
|
|
12
|
+
} | {
|
|
13
|
+
content: {
|
|
14
|
+
type: "text";
|
|
15
|
+
text: string;
|
|
16
|
+
}[];
|
|
17
|
+
isError?: undefined;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
export declare const setProvisionUrlTool: {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
inputSchema: {
|
|
24
|
+
provision_url: z.ZodString;
|
|
25
|
+
};
|
|
26
|
+
handler: (args: {
|
|
27
|
+
provision_url: string;
|
|
28
|
+
}) => Promise<{
|
|
29
|
+
content: {
|
|
30
|
+
type: "text";
|
|
31
|
+
text: string;
|
|
32
|
+
}[];
|
|
33
|
+
isError: boolean;
|
|
34
|
+
} | {
|
|
35
|
+
content: {
|
|
36
|
+
type: "text";
|
|
37
|
+
text: string;
|
|
38
|
+
}[];
|
|
39
|
+
isError?: undefined;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
2
42
|
export declare const configureWebhookTool: {
|
|
3
43
|
name: string;
|
|
4
44
|
description: string;
|
|
5
45
|
inputSchema: {
|
|
6
46
|
webhook_url: z.ZodOptional<z.ZodString>;
|
|
7
|
-
provision_url: z.ZodOptional<z.ZodString>;
|
|
8
47
|
skip: z.ZodOptional<z.ZodBoolean>;
|
|
9
48
|
};
|
|
10
49
|
handler: (args: {
|
|
11
50
|
webhook_url?: string;
|
|
12
|
-
provision_url?: string;
|
|
13
51
|
skip?: boolean;
|
|
14
52
|
}) => Promise<{
|
|
15
53
|
content: {
|
|
@@ -1,23 +1,122 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { lookupAppByServiceName, updateAppSettings, testAppWebhook, reportSetupProgress } from "tru-cli/api-client";
|
|
2
|
+
import { lookupAppByServiceName, updateAppSettings, testAppWebhook, rotateAppSecret, reportSetupProgress, reportSetupActivity } from "tru-cli/api-client";
|
|
3
3
|
import { getStoredApp } from "tru-cli/config";
|
|
4
|
+
export const rotateSecretTool = {
|
|
5
|
+
name: "dev_rotate_secret",
|
|
6
|
+
description: "Rotate the app secret for your tru app. " +
|
|
7
|
+
"Use this if your secret has been leaked or you need a fresh one. " +
|
|
8
|
+
"The old secret is immediately invalidated — update TRU_APP_SECRET in your .env right away.",
|
|
9
|
+
inputSchema: {},
|
|
10
|
+
handler: async () => {
|
|
11
|
+
try {
|
|
12
|
+
const stored = getStoredApp();
|
|
13
|
+
if (!stored?.id) {
|
|
14
|
+
return {
|
|
15
|
+
content: [{ type: "text", text: "No app found in config. Run `dev_register_app` first." }],
|
|
16
|
+
isError: true,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const result = await rotateAppSecret(stored.id);
|
|
20
|
+
return {
|
|
21
|
+
content: [{
|
|
22
|
+
type: "text",
|
|
23
|
+
text: [
|
|
24
|
+
"## App secret rotated",
|
|
25
|
+
"",
|
|
26
|
+
`**New secret:** \`${result.app_secret}\``,
|
|
27
|
+
"",
|
|
28
|
+
"Update `TRU_APP_SECRET` in your `.env` file immediately — the old secret is now invalid.",
|
|
29
|
+
"Restart your server to pick up the new secret.",
|
|
30
|
+
].join("\n"),
|
|
31
|
+
}],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
36
|
+
return {
|
|
37
|
+
content: [{ type: "text", text: `Error rotating secret: ${message}` }],
|
|
38
|
+
isError: true,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export const setProvisionUrlTool = {
|
|
44
|
+
name: "dev_set_provision_url",
|
|
45
|
+
description: "Register the app's provision endpoint URL with tru. " +
|
|
46
|
+
"tru POSTs { email, name, tru_user_id, purchases } to this URL to auto-create accounts for verified users. " +
|
|
47
|
+
"This is how tru connects user identity and payments to your app's account system. " +
|
|
48
|
+
"Required for the provisioning phase of setup.",
|
|
49
|
+
inputSchema: {
|
|
50
|
+
provision_url: z
|
|
51
|
+
.string()
|
|
52
|
+
.describe("The URL of the app's provision endpoint (e.g. https://myapp.com/api/tru/provision or http://localhost:4000/api/tru/provision for local dev)."),
|
|
53
|
+
},
|
|
54
|
+
handler: async (args) => {
|
|
55
|
+
try {
|
|
56
|
+
const stored = getStoredApp();
|
|
57
|
+
const serviceName = stored?.service_name;
|
|
58
|
+
const appId = stored?.id;
|
|
59
|
+
if (!serviceName || !appId) {
|
|
60
|
+
return {
|
|
61
|
+
content: [{ type: "text", text: "No app found in config. Run `dev_register_app` first." }],
|
|
62
|
+
isError: true,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const lookup = await lookupAppByServiceName(serviceName);
|
|
66
|
+
if (lookup.status !== "registered" || !lookup.app) {
|
|
67
|
+
return {
|
|
68
|
+
content: [{ type: "text", text: `App "${serviceName}" not found on tru. Run dev_register_app first.` }],
|
|
69
|
+
isError: true,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// Validate URL format
|
|
73
|
+
try {
|
|
74
|
+
new URL(args.provision_url);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return {
|
|
78
|
+
content: [{ type: "text", text: `Invalid provision URL: "${args.provision_url}". Provide a full URL like https://myapp.com/api/tru/provision.` }],
|
|
79
|
+
isError: true,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
reportSetupActivity(appId, "Registering provision URL...", "register_provision_url");
|
|
83
|
+
await updateAppSettings(appId, { provision_url: args.provision_url });
|
|
84
|
+
await reportSetupProgress(appId, "register_provision_url");
|
|
85
|
+
return {
|
|
86
|
+
content: [{
|
|
87
|
+
type: "text",
|
|
88
|
+
text: [
|
|
89
|
+
`## Provision URL registered`,
|
|
90
|
+
"",
|
|
91
|
+
`**URL:** ${args.provision_url}`,
|
|
92
|
+
"",
|
|
93
|
+
`tru will POST user data to this endpoint when provisioning new accounts. The payload includes \`email\`, \`name\`, \`tru_user_id\`, and any \`purchases\` the user has made.`,
|
|
94
|
+
].join("\n"),
|
|
95
|
+
}],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
100
|
+
return {
|
|
101
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
102
|
+
isError: true,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
// Keep webhook configuration available for future use, but not part of v1 setup flow
|
|
4
108
|
export const configureWebhookTool = {
|
|
5
109
|
name: "dev_configure_webhook",
|
|
6
|
-
description: "Configure webhook delivery
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"Call with
|
|
10
|
-
"Call with skip=true to mark webhooks as
|
|
11
|
-
"You can set both webhook_url and provision_url in a single call.",
|
|
110
|
+
description: "Configure webhook delivery for the developer's app. " +
|
|
111
|
+
"Webhooks notify your app about subscription lifecycle events (renewals, failures, cancellations). " +
|
|
112
|
+
"Not required for initial setup — only needed if your app has recurring charges and needs real-time event notifications. " +
|
|
113
|
+
"Call with webhook_url to set the URL and send a test event. " +
|
|
114
|
+
"Call with skip=true to mark webhooks as not needed.",
|
|
12
115
|
inputSchema: {
|
|
13
116
|
webhook_url: z
|
|
14
117
|
.string()
|
|
15
118
|
.optional()
|
|
16
119
|
.describe("The URL where tru should send webhook events (e.g. https://myapp.com/api/tru/webhook)."),
|
|
17
|
-
provision_url: z
|
|
18
|
-
.string()
|
|
19
|
-
.optional()
|
|
20
|
-
.describe("The URL of the app's provision endpoint (e.g. https://myapp.com/api/tru/provision). tru POSTs user data here to auto-create accounts."),
|
|
21
120
|
skip: z
|
|
22
121
|
.boolean()
|
|
23
122
|
.optional()
|
|
@@ -34,7 +133,6 @@ export const configureWebhookTool = {
|
|
|
34
133
|
isError: true,
|
|
35
134
|
};
|
|
36
135
|
}
|
|
37
|
-
// Verify the app exists
|
|
38
136
|
const lookup = await lookupAppByServiceName(serviceName);
|
|
39
137
|
if (lookup.status !== "registered" || !lookup.app) {
|
|
40
138
|
return {
|
|
@@ -42,7 +140,6 @@ export const configureWebhookTool = {
|
|
|
42
140
|
isError: true,
|
|
43
141
|
};
|
|
44
142
|
}
|
|
45
|
-
// Mode 1: Skip webhooks
|
|
46
143
|
if (args.skip) {
|
|
47
144
|
await reportSetupProgress(appId, "webhooks_skipped");
|
|
48
145
|
return {
|
|
@@ -51,43 +148,12 @@ export const configureWebhookTool = {
|
|
|
51
148
|
text: [
|
|
52
149
|
"## Webhooks skipped",
|
|
53
150
|
"",
|
|
54
|
-
"Webhook setup marked as skipped. You can
|
|
151
|
+
"Webhook setup marked as skipped. You can configure webhooks later from the tru dashboard or by running `dev_configure_webhook(webhook_url: \"...\")` again.",
|
|
55
152
|
].join("\n"),
|
|
56
153
|
}],
|
|
57
154
|
};
|
|
58
155
|
}
|
|
59
|
-
// Register provision URL if provided (can be combined with webhook_url or standalone)
|
|
60
|
-
if (args.provision_url) {
|
|
61
|
-
try {
|
|
62
|
-
new URL(args.provision_url);
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
return {
|
|
66
|
-
content: [{ type: "text", text: `Invalid provision URL: "${args.provision_url}". Provide a full URL like https://myapp.com/api/tru/provision.` }],
|
|
67
|
-
isError: true,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
await updateAppSettings(appId, { provision_url: args.provision_url });
|
|
71
|
-
await reportSetupProgress(appId, "register_provision_url");
|
|
72
|
-
// If only provision_url was provided (no webhook_url, no skip), return now
|
|
73
|
-
if (!args.webhook_url && !args.skip) {
|
|
74
|
-
return {
|
|
75
|
-
content: [{
|
|
76
|
-
type: "text",
|
|
77
|
-
text: [
|
|
78
|
-
`## Provision URL registered`,
|
|
79
|
-
"",
|
|
80
|
-
`**URL:** ${args.provision_url}`,
|
|
81
|
-
"",
|
|
82
|
-
`tru will POST user data to this endpoint when provisioning new accounts. The payload includes \`email\`, \`name\`, \`tru_user_id\`, and any \`purchases\` the user has made.`,
|
|
83
|
-
].join("\n"),
|
|
84
|
-
}],
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
// Mode 2: Set webhook URL, test delivery
|
|
89
156
|
if (args.webhook_url) {
|
|
90
|
-
// Validate URL format
|
|
91
157
|
try {
|
|
92
158
|
new URL(args.webhook_url);
|
|
93
159
|
}
|
|
@@ -97,14 +163,10 @@ export const configureWebhookTool = {
|
|
|
97
163
|
isError: true,
|
|
98
164
|
};
|
|
99
165
|
}
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
if (args.provision_url)
|
|
103
|
-
updates.provision_url = args.provision_url; // already validated above
|
|
104
|
-
const updated = await updateAppSettings(appId, updates);
|
|
166
|
+
reportSetupActivity(appId, "Configuring webhooks...", "configure_webhook_url");
|
|
167
|
+
const updated = await updateAppSettings(appId, { webhook_url: args.webhook_url });
|
|
105
168
|
await reportSetupProgress(appId, "configure_webhook_url");
|
|
106
169
|
const secret = updated?.webhook_secret;
|
|
107
|
-
// Send test webhook
|
|
108
170
|
let testResult;
|
|
109
171
|
let testPassed = false;
|
|
110
172
|
try {
|
|
@@ -125,7 +187,7 @@ export const configureWebhookTool = {
|
|
|
125
187
|
if (secret) {
|
|
126
188
|
lines.push(`**Signing secret:** \`${secret}\``);
|
|
127
189
|
lines.push("");
|
|
128
|
-
lines.push("Save this secret in your app's environment variables (e.g. `
|
|
190
|
+
lines.push("Save this secret in your app's environment variables (e.g. `TRU_APP_SECRET`). Use it to verify the `x-tru-signature` header on incoming webhooks.");
|
|
129
191
|
}
|
|
130
192
|
lines.push("");
|
|
131
193
|
if (testPassed) {
|
|
@@ -133,8 +195,6 @@ export const configureWebhookTool = {
|
|
|
133
195
|
}
|
|
134
196
|
else {
|
|
135
197
|
lines.push(`**Test delivery:** Failed — ${testResult?.error || "endpoint did not respond with 2xx"}. Make sure your webhook endpoint is running and accessible.`);
|
|
136
|
-
lines.push("");
|
|
137
|
-
lines.push("You can retry the test later from the tru dashboard or by running this tool again.");
|
|
138
198
|
}
|
|
139
199
|
lines.push("");
|
|
140
200
|
lines.push("### Events your webhook will receive");
|
|
@@ -149,20 +209,11 @@ export const configureWebhookTool = {
|
|
|
149
209
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
150
210
|
};
|
|
151
211
|
}
|
|
152
|
-
//
|
|
212
|
+
// No args — return guidance
|
|
153
213
|
const guide = [
|
|
154
214
|
`## Configure Webhooks for ${lookup.app.display_name}`,
|
|
155
215
|
"",
|
|
156
|
-
"Webhooks notify your app about subscription lifecycle events
|
|
157
|
-
"",
|
|
158
|
-
"### Events tru sends",
|
|
159
|
-
"",
|
|
160
|
-
"| Event | When | Typical action |",
|
|
161
|
-
"|-------|------|----------------|",
|
|
162
|
-
"| `invoice.payment_succeeded` | Subscription renewed | Extend access |",
|
|
163
|
-
"| `invoice.payment_failed` | Renewal payment failed | Notify user, grace period |",
|
|
164
|
-
"| `customer.subscription.deleted` | Subscription cancelled | Revoke access |",
|
|
165
|
-
"| `customer.subscription.updated` | Plan changed | Update user's plan |",
|
|
216
|
+
"Webhooks notify your app about subscription lifecycle events — renewals, failures, cancellations, and plan changes.",
|
|
166
217
|
"",
|
|
167
218
|
"### Do you need webhooks?",
|
|
168
219
|
"",
|
|
@@ -171,19 +222,11 @@ export const configureWebhookTool = {
|
|
|
171
222
|
"",
|
|
172
223
|
"### Next steps",
|
|
173
224
|
"",
|
|
174
|
-
"Build a webhook endpoint in your app
|
|
225
|
+
"Build a webhook endpoint in your app, then run:",
|
|
175
226
|
"",
|
|
176
227
|
"```",
|
|
177
228
|
`dev_configure_webhook(webhook_url: "https://yourapp.com/api/tru/webhook")`,
|
|
178
229
|
"```",
|
|
179
|
-
"",
|
|
180
|
-
"This sets the URL, generates a signing secret, and sends a test event.",
|
|
181
|
-
"",
|
|
182
|
-
"If you don't need webhooks, run:",
|
|
183
|
-
"",
|
|
184
|
-
"```",
|
|
185
|
-
"dev_configure_webhook(skip: true)",
|
|
186
|
-
"```",
|
|
187
230
|
];
|
|
188
231
|
return {
|
|
189
232
|
content: [{ type: "text", text: guide.join("\n") }],
|