Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/JAVA/Openclaw/src/gateway/   (Openclaw AI Version 22©)  Datei vom 26.3.2026 mit Größe 1 kB image not shown  

Quelle  startup-tasks.ts

  Sprache: JAVA
 

import { formatErrorMessage } from "../infra/errors.js";

export type StartupTaskResult =
  | { status: "skipped"; reason: string }
  | { status: "ran" }
  | { status: "failed"; reason: string };

export type StartupTask = {
  source: string;
  agentId?: string;
  sessionKey?: string;
  workspaceDir?: string;
  run: () => Promise<StartupTaskResult>;
};

export type StartupTaskLogger = {
  debug: (message: string, meta?: Record<string, unknown>) => void;
  warn: (message: string, meta?: Record<string, unknown>) => void;
};

function taskMeta(task: StartupTask, result?: StartupTaskResult): Record<string, unknown> {
  return {
    source: task.source,
    ...(task.agentId ? { agentId: task.agentId } : {}),
    ...(task.sessionKey ? { sessionKey: task.sessionKey } : {}),
    ...(task.workspaceDir ? { workspaceDir: task.workspaceDir } : {}),
    ...(result?.status === "failed" || result?.status === "skipped"
      ? { reason: result.reason }
      : {}),
  };
}

export async function runStartupTasks(params: {
  tasks: StartupTask[];
  log: StartupTaskLogger;
}): Promise<StartupTaskResult[]> {
  const results: StartupTaskResult[] = [];
  for (const task of params.tasks) {
    let result: StartupTaskResult;
    try {
      result = await task.run();
    } catch (err) {
      result = { status: "failed", reason: formatErrorMessage(err) };
    }
    results.push(result);
    if (result.status === "failed") {
      params.log.warn("startup task failed", taskMeta(task, result));
      continue;
    }
    if (result.status === "skipped") {
      params.log.debug("startup task skipped", taskMeta(task, result));
    }
  }
  return results;
}

Messung V0.5 in Prozent
C=100 H=87 G=93

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-06-09) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.