mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-31 03:42:33 +00:00
Deliver Codex-native subagent completions through the generic plugin harness task runtime. Proof: - Autoreview clean on final branch. - Testbox changed gate: tbx_01ks80eqs7d2e3jq3p99zbm4wd, pnpm check:changed, exit 0. - Live Codex harness: tbx_01ks80p4ky32sqv2ksan2p0w0q, codex/gpt-5.5 API-key auth, native parent/child bridge tokens observed, exit 0. Co-authored-by: bryanpearson <bryanmpearson@gmail.com>
30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import type { TaskDeliveryState, TaskRecord } from "./task-registry.types.js";
|
|
|
|
export type TaskRegistryProcessState = {
|
|
tasks: Map<string, TaskRecord>;
|
|
taskDeliveryStates: Map<string, TaskDeliveryState>;
|
|
taskIdsByRunId: Map<string, Set<string>>;
|
|
taskIdsByOwnerKey: Map<string, Set<string>>;
|
|
taskIdsByParentFlowId: Map<string, Set<string>>;
|
|
taskIdsByRelatedSessionKey: Map<string, Set<string>>;
|
|
tasksWithPendingDelivery: Set<string>;
|
|
};
|
|
|
|
const TASK_REGISTRY_PROCESS_STATE_KEY = Symbol.for("openclaw.taskRegistry.state");
|
|
|
|
export function getTaskRegistryProcessState(): TaskRegistryProcessState {
|
|
const globalState = globalThis as typeof globalThis & {
|
|
[TASK_REGISTRY_PROCESS_STATE_KEY]?: TaskRegistryProcessState;
|
|
};
|
|
globalState[TASK_REGISTRY_PROCESS_STATE_KEY] ??= {
|
|
tasks: new Map<string, TaskRecord>(),
|
|
taskDeliveryStates: new Map<string, TaskDeliveryState>(),
|
|
taskIdsByRunId: new Map<string, Set<string>>(),
|
|
taskIdsByOwnerKey: new Map<string, Set<string>>(),
|
|
taskIdsByParentFlowId: new Map<string, Set<string>>(),
|
|
taskIdsByRelatedSessionKey: new Map<string, Set<string>>(),
|
|
tasksWithPendingDelivery: new Set<string>(),
|
|
};
|
|
return globalState[TASK_REGISTRY_PROCESS_STATE_KEY];
|
|
}
|