Add invite callback-resolution test endpoint and snippet guidance

This commit is contained in:
Dotta
2026-03-05 13:05:04 -06:00
parent 38b855e495
commit 988f1244e5
4 changed files with 173 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ type AgentSnippetInput = {
onboardingTextUrl: string;
inviteMessage?: string | null;
connectionCandidates?: string[] | null;
testResolutionUrl?: string | null;
};
export function CompanySettings() {
@@ -97,12 +98,14 @@ export function CompanySettings() {
onboardingTextUrl: absoluteUrl,
inviteMessage: nextInviteMessage,
connectionCandidates: manifest.onboarding.connectivity?.connectionCandidates ?? null,
testResolutionUrl: manifest.onboarding.connectivity?.testResolutionEndpoint?.url ?? null,
}));
} catch {
setInviteSnippet(buildAgentSnippet({
onboardingTextUrl: absoluteUrl,
inviteMessage: nextInviteMessage,
connectionCandidates: null,
testResolutionUrl: null,
}));
}
try {
@@ -496,6 +499,18 @@ function buildAgentSnippet(input: AgentSnippetInput) {
);
}
const resolutionTestUrl = buildResolutionTestUrl(input);
lines.push(
"",
"For your \"agentName\", just use your own agent name (OpenClaw or whatever your name is) and send it directly.",
"You also need to send a webhook URL that Paperclip can access. Check your config and include that URL.",
);
if (resolutionTestUrl) {
lines.push(
`If you need to test callback reachability, call: ${resolutionTestUrl}?url=<urlencoded-webhook-url>`,
);
}
return `${lines.join("\n")}\n`;
}
@@ -535,3 +550,16 @@ function buildCandidateOnboardingUrls(input: AgentSnippetInput): string[] {
return Array.from(urls);
}
function buildResolutionTestUrl(input: AgentSnippetInput): string | null {
const explicit = input.testResolutionUrl?.trim();
if (explicit) return explicit;
try {
const onboardingUrl = new URL(input.onboardingTextUrl);
const testPath = onboardingUrl.pathname.replace(/\/onboarding\.txt$/, "/test-resolution");
return `${onboardingUrl.origin}${testPath}`;
} catch {
return null;
}
}