feat(ql3): add profile-aware run log reads

This commit is contained in:
whyour
2026-08-12 01:43:14 +08:00
parent c699c32461
commit 308aa75d89
33 changed files with 2880 additions and 306 deletions
@@ -455,11 +455,28 @@ export async function bootstrapLocalApplication(
});
if (options.productSurface) {
const [stepRuns, runCancellation, taskStart] = await Promise.all([
const [
stepRuns,
runCancellation,
taskStart,
{ LocalRunAttemptLogRangeReader },
{ RunAttemptLogReadService },
] = await Promise.all([
storage.stepRunReader(),
storage.runCancellationRepository(),
storage.taskStartRepository(),
import('@qinglong/local-execution/artifact-read'),
import('@qinglong/runtime-core/run-attempt-log-read'),
]);
const runAttemptLogRead = new RunAttemptLogReadService(
storage.runs,
new LocalRunAttemptLogRangeReader(options.artifactRoot),
{
executorType: 'local_process',
artifactIdPattern: /^local-[a-f0-9]{30}$/,
maximumReadBytes: 32 * 1024,
},
);
productSurfaceLifecycle = await options.productSurface.start(
Object.freeze({
profile: options.profile,
@@ -467,6 +484,7 @@ export async function bootstrapLocalApplication(
stepRuns,
runCancellation,
taskStart,
runAttemptLogRead,
taskDefinitions: storage.taskDefinitions,
apiCredentials: storage.apiCredentials,
ownerPepper: storage.ownerPepper,
@@ -18,6 +18,10 @@ import type { PluginPackageRecoveryCycleResult } from '@qinglong/runtime-core/pl
import type { PluginPackageAutomationPublicationRecoveryCycleResult } from '@qinglong/runtime-core/plugin-package-automation-publication';
import type { PluginPackageTaskPublicationRecoveryCycleResult } from '@qinglong/runtime-core/plugin-package-task-publication';
import type { ProjectToolDefinitionSnapshotRecoveryCycleResult } from '@qinglong/runtime-core/project-tool-definition-snapshot';
import type {
RunAttemptLogReadRequest,
RunAttemptLogReadResult,
} from '@qinglong/runtime-core/run-attempt-log-read';
export type LocalApplicationProfile = 'edge' | 'standalone';
@@ -59,6 +63,11 @@ export interface LocalApplicationProductSurfaceAuthority {
ReadyFreshStorage['taskDefinitions'],
'findCurrentTaskDefinition' | 'listTaskDefinitions'
>;
readonly runAttemptLogRead: Readonly<{
read(
request: Readonly<RunAttemptLogReadRequest>,
): Promise<RunAttemptLogReadResult>;
}>;
readonly apiCredentials: ReadyFreshStorage['apiCredentials'];
readonly ownerPepper: ReadyFreshStorage['ownerPepper'];
readonly projectPolicy: ReadyFreshStorage['projectPolicy'];