Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a delegated task's question now wakes its parent agent #19521

Mergedflamboh(GitHub profile, opens in a new tab)merged 14 commits intomain fromrefs/pull/19521/headmerged by maria-rcks View on GitHub

Showing 5 changed files with 185 additions and 0 deletions (loading 4).

x
0 of 5 viewed, 5 left
185 additions and 0 deletionsapps/server/src/orchestration-v2/DelegatedTaskQuestionReactor.tsAdded
View file
@@ -0,0 +1,185 @@
+import {
+ CommandId,
+ MessageId,
+ type OrchestrationV2DomainEvent,
+ type OrchestrationV2RuntimeRequest,
+ type OrchestrationV2Subagent,
+} from "@t3tools/contracts";
+import * as Context from "effect/Context";
+import * as Effect from "effect/Effect";
+import * as Layer from "effect/Layer";
+import type * as Scope from "effect/Scope";
+import * as Stream from "effect/Stream";
+​
+import { reportLabel } from "@t3tools/provider-core/server/notification";
+​
+import { forkParked } from "../serverActivation.ts";
+import * as Orchestrator from "./Orchestrator.ts";
+import * as ProjectionStore from "./ProjectionStore.ts";
+​
+/**
+ * Wakes the parent of an app-owned delegated task when the task asks a question. The question
+ * blocks the task until someone answers it, and the user rarely watches child threads, so the
+ * parent agent is told to answer it or to ask the user. Only questions are routed: approvals
+ * cannot be answered through the pending request tools.
+ */
+export class DelegatedTaskQuestionReactor extends Context.Service<
+ DelegatedTaskQuestionReactor,
+ {
+ readonly start: () => Effect.Effect<void, never, Scope.Scope>;
+ readonly handle: (event: OrchestrationV2DomainEvent) => Effect.Effect<void>;