feat(tasks): add skill-templated task graph execution

This commit is contained in:
2026-06-23 10:22:58 +08:00
parent 6843d89b2c
commit 53b13e8eac
53 changed files with 4773 additions and 756 deletions

View File

@ -2,7 +2,14 @@ import { NextRequest, NextResponse } from 'next/server';
import type { TokenResponse } from '@/types/auth';
import { normalizePortalLocale, pickPortalText } from '@/lib/i18n/core';
import { HttpError, callDeployControl, callInstanceApi, normalizeTokenResponse } from '@/lib/runtime-control';
import {
HttpError,
callDeployControl,
callInstanceApi,
normalizeTokenResponse,
targetFrontendBaseUrl,
waitForFrontendReady,
} from '@/lib/runtime-control';
function errorStatus(error: unknown): number {
if (error instanceof HttpError) {
@ -49,7 +56,9 @@ export async function POST(request: NextRequest) {
password,
});
return NextResponse.json(normalizeTokenResponse(response, routing));
const normalized = normalizeTokenResponse(response, routing);
await waitForFrontendReady(targetFrontendBaseUrl(normalized));
return NextResponse.json(normalized);
} catch (error) {
const status = errorStatus(error);
const detail = status === 404 || status === 401

View File

@ -2,7 +2,14 @@ import { NextRequest, NextResponse } from 'next/server';
import type { TokenResponse } from '@/types/auth';
import { normalizePortalLocale, pickPortalText } from '@/lib/i18n/core';
import { HttpError, callDeployControl, callInstanceApi, normalizeTokenResponse } from '@/lib/runtime-control';
import {
HttpError,
callDeployControl,
callInstanceApi,
normalizeTokenResponse,
targetFrontendBaseUrl,
waitForFrontendReady,
} from '@/lib/runtime-control';
const PROVIDER_ONBOARDING_TIMEOUT_MS = 120000;
const KNOWN_PROVIDERS = new Set([
@ -113,7 +120,9 @@ export async function POST(request: NextRequest) {
password,
});
return NextResponse.json(normalizeTokenResponse(response, configuredRouting));
const normalized = normalizeTokenResponse(response, configuredRouting);
await waitForFrontendReady(targetFrontendBaseUrl(normalized));
return NextResponse.json(normalized);
} catch (error) {
return NextResponse.json({ detail: errorDetail(error) }, { status: errorStatus(error) });
}

View File

@ -8,6 +8,8 @@ import {
callAuthzService,
callDeployControl,
normalizeTokenResponse,
targetFrontendBaseUrl,
waitForFrontendReady,
} from '@/lib/runtime-control';
function errorStatus(error: unknown): number {
@ -62,6 +64,7 @@ export async function POST(request: NextRequest) {
}, REGISTER_REQUEST_TIMEOUT_MS);
if (hasTargetFrontendUrl(response)) {
await waitForFrontendReady(targetFrontendBaseUrl(response));
return NextResponse.json(response);
}
@ -72,7 +75,9 @@ export async function POST(request: NextRequest) {
instance?: unknown;
}>('/api/instances/resolve', { username });
return NextResponse.json(normalizeTokenResponse(response, routing));
const normalized = normalizeTokenResponse(response, routing);
await waitForFrontendReady(targetFrontendBaseUrl(normalized));
return NextResponse.json(normalized);
} catch (error) {
return NextResponse.json({ detail: errorDetail(error) }, { status: errorStatus(error) });
}