MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / runSmoke

Function runSmoke

scripts/agent-config-smoke.ts:177–320  ·  view source on GitHub ↗
(oauth: OAuthTestServerShape, graph: GraphqlTestServerShape)

Source from the content-addressed store, hash-verified

175};
176
177const runSmoke = async (oauth: OAuthTestServerShape, graph: GraphqlTestServerShape) => {
178 const root = await mkdtemp(join(tmpdir(), "executor-agent-config-smoke-"));
179 const ctx: CliContext = {
180 dataDir: join(root, "data"),
181 scopeDir: join(root, "scope"),
182 baseUrl: `http://127.0.0.1:${64180 + Math.floor(Math.random() * 1000)}`,
183 };
184 await mkdir(ctx.dataDir, { recursive: true });
185 await mkdir(ctx.scopeDir, { recursive: true });
186
187 try {
188 console.log("[agent-config-smoke] start dev CLI daemon");
189 const port = new URL(ctx.baseUrl).port;
190 await runCli(ctx, ["daemon", "run", "--port", port, "--scope", ctx.scopeDir]);
191
192 console.log("[agent-config-smoke] discover scope");
193 const scope = firstScope(
194 parseJsonOutput(await callTool(ctx, ["executor", "coreTools", "scopes", "list"])),
195 );
196
197 console.log("[agent-config-smoke] create browser secret handoffs");
198 const clientId = await createSecretPlaceholder(ctx, ctx.scopeDir, scope.id, "OAuth client id");
199 const clientSecret = await createSecretPlaceholder(
200 ctx,
201 ctx.scopeDir,
202 scope.id,
203 "OAuth client secret",
204 );
205 const browserBaseUrl = new URL(clientId.url).origin;
206 await setSecretViaBrowserBoundary(ctx, browserBaseUrl, scope.id, {
207 id: clientId.id,
208 name: "OAuth client id",
209 value: "test-client",
210 });
211 await setSecretViaBrowserBoundary(ctx, browserBaseUrl, scope.id, {
212 id: clientSecret.id,
213 name: "OAuth client secret",
214 value: "test-secret",
215 });
216
217 console.log("[agent-config-smoke] start OAuth handoff through core tool");
218 const oauthStart = toolData<{
219 readonly sessionId: string;
220 readonly authorizationUrl: string | null;
221 }>(
222 parseJsonOutput(
223 await callTool(ctx, ["executor", "coreTools", "oauth", "start"], {
224 scope: ctx.scopeDir,
225 endpoint: oauth.resourceUrl,
226 connectionId: "agent-smoke-oauth",
227 pluginId: "graphql",
228 identityLabel: "Agent Smoke OAuth",
229 strategy: {
230 kind: "authorization-code",
231 authorizationEndpoint: oauth.authorizationEndpoint,
232 tokenEndpoint: oauth.tokenEndpoint,
233 clientIdSecretId: clientId.id,
234 clientSecretSecretId: clientSecret.id,

Callers 1

mainFunction · 0.85

Calls 14

mkdtempFunction · 0.85
runCliFunction · 0.85
firstScopeFunction · 0.85
parseJsonOutputFunction · 0.85
callToolFunction · 0.85
createSecretPlaceholderFunction · 0.85
toolDataFunction · 0.85
assertFunction · 0.85
approvePausedCallFunction · 0.85
logMethod · 0.80
textMethod · 0.65

Tested by

no test coverage detected