mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-09 10:23:58 +00:00
* refactor: remove unused internal helpers * refactor(ui): remove unused compatibility helpers * refactor(android): remove unused talk cleanup shim * refactor(android): remove orphaned legacy UI * refactor: remove unused private exports * refactor(docs-i18n): remove dead matcher and satisfy lint
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
// Identifies childless native-subagent task rows that are owned by an external
|
|
// harness and therefore cannot be recovered through an OpenClaw child session.
|
|
import type { TaskRecord } from "./task-registry.types.js";
|
|
|
|
export const COPILOT_NATIVE_SUBAGENT_TASK_KIND = "copilot-native";
|
|
export const COPILOT_NATIVE_SUBAGENT_RUN_ID_PREFIX = "copilot-agent:";
|
|
|
|
const CHILDLESS_NATIVE_SUBAGENT_DEFINITIONS = [
|
|
{
|
|
taskKind: "codex-native",
|
|
runIdPrefix: "codex-thread:",
|
|
},
|
|
{
|
|
taskKind: COPILOT_NATIVE_SUBAGENT_TASK_KIND,
|
|
runIdPrefix: COPILOT_NATIVE_SUBAGENT_RUN_ID_PREFIX,
|
|
},
|
|
] as const;
|
|
|
|
export type NativeSubagentTaskDefinition = (typeof CHILDLESS_NATIVE_SUBAGENT_DEFINITIONS)[number];
|
|
|
|
export function resolveChildlessNativeSubagentTaskDefinition(
|
|
task: TaskRecord,
|
|
): NativeSubagentTaskDefinition | undefined {
|
|
if (task.runtime !== "subagent" || task.childSessionKey?.trim()) {
|
|
return undefined;
|
|
}
|
|
return CHILDLESS_NATIVE_SUBAGENT_DEFINITIONS.find(
|
|
(definition) =>
|
|
task.taskKind === definition.taskKind &&
|
|
[task.sourceId, task.runId].some((candidate) =>
|
|
candidate?.trim().startsWith(definition.runIdPrefix),
|
|
),
|
|
);
|
|
}
|
|
|
|
export function isChildlessNativeSubagentTask(task: TaskRecord): boolean {
|
|
return resolveChildlessNativeSubagentTaskDefinition(task) !== undefined;
|
|
}
|