(oauth: OAuthTestServerShape, graph: GraphqlTestServerShape)
| 175 | }; |
| 176 | |
| 177 | const 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, |
no test coverage detected