mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-01 17:39:39 +02:00
feat: add schema foundation for document pipeline, agent, and deployment
Add missing topics (librarian, knowledge, collection-management, flow), pipeline message types (TextDocument, Chunk, Triples, EntityContexts), service message types (Librarian, Knowledge, Collection, Flow CRUD), and update AgentResponse for streaming chunk format. Add RequestResponseSpec enabling flow-scoped request/response calls (needed by knowledge extraction and agent services). Add requestor registry to Flow class with proper lifecycle management. Add end_of_dialog to gateway's isComplete() check for agent streaming. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
28747e1a92
commit
5ed3f0e2d8
6 changed files with 236 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ import type { PubSubBackend } from "../backend/types.js";
|
|||
import type { Spec } from "../spec/types.js";
|
||||
import type { Producer } from "../messaging/producer.js";
|
||||
import type { Consumer } from "../messaging/consumer.js";
|
||||
import type { RequestResponse } from "../messaging/request-response.js";
|
||||
|
||||
export interface FlowDefinition {
|
||||
/** Topic overrides keyed by spec name */
|
||||
|
|
@ -19,6 +20,7 @@ export interface FlowDefinition {
|
|||
export class Flow {
|
||||
private producers = new Map<string, Producer<unknown>>();
|
||||
private consumers = new Map<string, Consumer<unknown>>();
|
||||
private requestors = new Map<string, RequestResponse<unknown, unknown>>();
|
||||
private parameters = new Map<string, unknown>();
|
||||
|
||||
constructor(
|
||||
|
|
@ -49,6 +51,9 @@ export class Flow {
|
|||
for (const producer of this.producers.values()) {
|
||||
await producer.stop();
|
||||
}
|
||||
for (const rr of this.requestors.values()) {
|
||||
await rr.stop();
|
||||
}
|
||||
}
|
||||
|
||||
registerProducer(name: string, producer: Producer<unknown>): void {
|
||||
|
|
@ -59,6 +64,10 @@ export class Flow {
|
|||
this.consumers.set(name, consumer);
|
||||
}
|
||||
|
||||
registerRequestor(name: string, rr: RequestResponse<unknown, unknown>): void {
|
||||
this.requestors.set(name, rr);
|
||||
}
|
||||
|
||||
setParameter(name: string, value: unknown): void {
|
||||
this.parameters.set(name, value);
|
||||
}
|
||||
|
|
@ -75,6 +84,12 @@ export class Flow {
|
|||
return c as Consumer<T>;
|
||||
}
|
||||
|
||||
requestor<TReq, TRes>(name: string): RequestResponse<TReq, TRes> {
|
||||
const rr = this.requestors.get(name);
|
||||
if (!rr) throw new Error(`Requestor "${name}" not found in flow "${this.name}"`);
|
||||
return rr as RequestResponse<TReq, TRes>;
|
||||
}
|
||||
|
||||
parameter<T>(name: string): T {
|
||||
const v = this.parameters.get(name);
|
||||
if (v === undefined) throw new Error(`Parameter "${name}" not found in flow "${this.name}"`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue