UNPKG

@artinet/sdk

Version:

A TypeScript SDK for building collaborative AI agents.

24 lines (23 loc) 741 B
/** * Copyright 2025 The Artinet Project * SPDX-License-Identifier: Apache-2.0 */ import { INTERNAL_ERROR } from "../../../utils/index.js"; export const sendMessageStream = async function* (_, context) { if (!context) { throw INTERNAL_ERROR({ error: { message: "Context is required" } }); } const service = context.service; if (await service.streams.has(context.contextId)) { throw INTERNAL_ERROR({ error: { message: "Stream already exists" } }); } const stream = await service.streams.create({ contextId: context.contextId, context, }); yield* stream.run({ service }); }; /** * @deprecated Use sendMessageStream instead */ export const streamMessage = sendMessageStream;