agents
Version:
A home for your AI agents
271 lines (269 loc) • 6.94 kB
TypeScript
import {
A as ChannelIngressEventInput,
C as ChannelEventContext,
D as ChannelIngress,
E as ChannelInboundMessageInput,
F as identityKey,
M as matchesPath,
N as ChannelIdentity,
O as ChannelIngressEnvelope,
P as ChannelIdentityInput,
S as ChannelEmailInput,
T as ChannelInboundMessage,
_ as ChannelApprovalResponse,
a as ChannelDeliveryOptions,
b as ChannelEmailIngress,
c as ChannelRoute,
d as ChannelUpgradeMatch,
f as DeliveryFailure,
g as ChannelActorInput,
h as ChannelActor,
i as ChannelDeliveryContext,
j as ChannelIngressResult,
k as ChannelIngressEvent,
l as ChannelStreamOptions,
m as ParticipantResult,
n as Channel,
o as ChannelMessage,
p as DeliveryResult,
r as ChannelChunkSource,
s as ChannelParticipant,
t as Awaitable,
u as ChannelUpgrade,
v as ChannelApprovalResponseInput,
w as ChannelEventContextInput,
x as ChannelEmailIngressResult,
y as ChannelAttachment
} from "../../channel-Bak_6zDP.js";
import {
C as ChannelSurfaceObject,
S as ChannelSurfaceArray,
T as isChannelMessageSurface,
_ as TranscriptMessage,
a as DispatchResult,
b as ChannelMessageSurface,
c as InboundEvent,
d as JsonObject,
f as MessagePart,
g as ToolState,
h as ToolPart,
i as ConversationSnapshot,
l as Json,
m as ResponseChunk,
n as ConversationInfo,
o as EventOrigin,
p as Participant,
r as ConversationOperation,
s as GatewayOrigin,
t as ClientTool,
u as JsonArray,
v as TurnOutcome,
w as ChannelSurfaceValue,
x as ChannelMessageSurfaceInput,
y as TurnStatus
} from "../../protocol-CukuI73M.js";
import {
a as HarnessSessions,
c as OperationStatus,
d as SessionId,
f as SessionInfo,
g as ToolAnswer,
h as SubmitOptions,
i as HarnessSession,
l as Receipt,
m as SessionWatch,
n as HarnessInput,
o as InputPart,
p as SessionState,
r as HarnessInputFrom,
s as OperationResult,
t as AgentHarness,
u as SessionEvent
} from "../../harness-B6B9S3rb.js";
import {
a as ConversationChannel,
c as GatewayEvent,
i as ChannelsOptions,
l as ResponseEnding,
n as Channels,
o as ConversationUpdate,
r as ChannelsHost,
s as ForHarnessOptions,
t as ChannelState,
u as ResponseReadOptions
} from "../../conversations-FjHDRZyD.js";
import {
i as GatewayAgent,
n as ChannelGatewayOptions,
r as ChannelRouteEvent,
t as ChannelGateway
} from "../../gateway-BFO6vRDn.js";
//#region src/experimental/channels/apply-chunks.d.ts
/** Apply a response's chunks to the message it builds or extends. */
declare function applyChunks(
message: TranscriptMessage,
chunks: readonly ResponseChunk[]
): TranscriptMessage;
//#endregion
//#region src/experimental/channels/routes.d.ts
/**
* Common deterministic routing policies for normalized Channel events.
*
* Each one maps an event to a namespaced agent object. That object is the
* authorization boundary: anyone routed to it may use every conversation in
* it. Deciding whether an event is relevant at all is application policy:
* write that in your own `route` function and return `null` to ignore it.
*/
declare const routes: {
/**
* Give each participant an agent object of their own. The default for every
* Channel, so that a group chat never shares an object by accident.
*
* A surface that names no conversation, such as a Slack thread or an
* email, joins the object's default conversation, so a participant keeps
* one history wherever they write from.
*/
perParticipant(
_event: ChannelIngressEvent,
_raw: unknown,
participant: Participant
): string;
/**
* Give every event its own application route. Useful to kick off a
* new conversation for each ingress, and where you don't want subsequent
* messages routed back to that same conversation.
**/
perEvent(event: ChannelIngressEvent): string;
/**
* Send every event in the same thread to the same object, whoever sent
* it. Everyone in the thread can then use that object's conversations.
*/
perThread(event: ChannelIngressEvent): string;
};
//#endregion
//#region src/experimental/channels/stream.d.ts
/** Why a consumption loop stopped reading. */
type StreamOutcome =
| {
interrupted: false;
}
| {
interrupted: true;
error: unknown;
};
type ChunkConsumer<TChunk, TResult> = {
onChunk(
chunk: TChunk
): Awaitable<void> /** Runs exactly once, whether the stream closed or ended abnormally. */;
onFinish(outcome: StreamOutcome): Awaitable<TResult>;
};
/**
* Read a stream to completion, then finalize exactly once.
*
* `onFinish` runs whether the stream closed normally, errored because the
* generation failed, or stopped because `onChunk` threw. A Channel that
* finalizes here cannot lose a terminal provider call to an early ending.
*/
declare function consumeChunks<TChunk, TResult>(
chunks: ReadableStream<TChunk>,
consumer: ChunkConsumer<TChunk, TResult>
): Promise<TResult>;
//#endregion
export {
type AgentHarness,
Awaitable,
Channel,
ChannelActor,
ChannelActorInput,
ChannelApprovalResponse,
ChannelApprovalResponseInput,
ChannelAttachment,
ChannelChunkSource,
ChannelDeliveryContext,
ChannelDeliveryOptions,
ChannelEmailIngress,
ChannelEmailIngressResult,
ChannelEmailInput,
ChannelEventContext,
ChannelEventContextInput,
ChannelGateway,
ChannelGatewayOptions,
ChannelIdentity,
ChannelIdentityInput,
ChannelInboundMessage,
ChannelInboundMessageInput,
ChannelIngress,
ChannelIngressEnvelope,
ChannelIngressEvent,
ChannelIngressEventInput,
ChannelIngressResult,
ChannelMessage,
ChannelMessageSurface,
ChannelMessageSurfaceInput,
ChannelParticipant,
ChannelRoute,
ChannelRouteEvent,
ChannelState,
ChannelStreamOptions,
ChannelSurfaceArray,
ChannelSurfaceObject,
ChannelSurfaceValue,
ChannelUpgrade,
ChannelUpgradeMatch,
Channels,
ChannelsHost,
ChannelsOptions,
type ChunkConsumer,
ClientTool,
ConversationChannel,
ConversationInfo,
ConversationOperation,
ConversationSnapshot,
ConversationUpdate,
DeliveryFailure,
DeliveryResult,
DispatchResult,
EventOrigin,
ForHarnessOptions,
GatewayAgent,
GatewayEvent,
GatewayOrigin,
type HarnessInput,
type HarnessInputFrom,
type HarnessSession,
type HarnessSessions,
InboundEvent,
type InputPart,
Json,
JsonArray,
JsonObject,
MessagePart,
type OperationResult,
type OperationStatus,
Participant,
ParticipantResult,
type Receipt,
ResponseChunk,
ResponseEnding,
ResponseReadOptions,
type SessionEvent,
type SessionId,
type SessionInfo,
type SessionState,
type SessionWatch,
type StreamOutcome,
type SubmitOptions,
type ToolAnswer,
ToolPart,
ToolState,
TranscriptMessage,
TurnOutcome,
TurnStatus,
applyChunks,
consumeChunks,
identityKey,
isChannelMessageSurface,
matchesPath,
routes
};
//# sourceMappingURL=index.d.ts.map