managed-deepagents 0.10.7 → 0.10.8-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +449 -89
- package/dist/agent-auth.d.ts +4 -2
- package/dist/agent-auth.d.ts.map +1 -1
- package/dist/agent-auth.js +3 -1
- package/dist/agent-auth.js.map +1 -1
- package/dist/channels/address.d.ts +13 -0
- package/dist/channels/address.d.ts.map +1 -0
- package/dist/channels/address.js +67 -0
- package/dist/channels/address.js.map +1 -0
- package/dist/channels/binding.d.ts +7 -0
- package/dist/channels/binding.d.ts.map +1 -1
- package/dist/channels/binding.js +28 -4
- package/dist/channels/binding.js.map +1 -1
- package/dist/channels/delivery.d.ts.map +1 -1
- package/dist/channels/delivery.js +13 -16
- package/dist/channels/delivery.js.map +1 -1
- package/dist/channels/github/app-setup.d.ts.map +1 -1
- package/dist/channels/github/app-setup.js +86 -3
- package/dist/channels/github/app-setup.js.map +1 -1
- package/dist/channels/github/index.d.ts +1 -6
- package/dist/channels/github/index.d.ts.map +1 -1
- package/dist/channels/github/index.js +191 -38
- package/dist/channels/github/index.js.map +1 -1
- package/dist/channels/github/schema.d.ts +9280 -1622
- package/dist/channels/github/schema.d.ts.map +1 -1
- package/dist/channels/github/schema.js +164 -0
- package/dist/channels/github/schema.js.map +1 -1
- package/dist/channels/github/types.d.ts +98 -36
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/http/endpoint.d.ts +33 -9
- package/dist/channels/http/endpoint.d.ts.map +1 -1
- package/dist/channels/http/endpoint.js +72 -18
- package/dist/channels/http/endpoint.js.map +1 -1
- package/dist/channels/http/http.d.ts +7 -0
- package/dist/channels/http/http.d.ts.map +1 -1
- package/dist/channels/http/http.js +273 -27
- package/dist/channels/http/http.js.map +1 -1
- package/dist/channels/http/index.d.ts.map +1 -1
- package/dist/channels/http/index.js +4 -5
- package/dist/channels/http/index.js.map +1 -1
- package/dist/channels/http/ingress.d.ts +44 -1
- package/dist/channels/http/ingress.d.ts.map +1 -1
- package/dist/channels/http/ingress.js +63 -0
- package/dist/channels/http/ingress.js.map +1 -1
- package/dist/channels/http/input-state.d.ts +7 -0
- package/dist/channels/http/input-state.d.ts.map +1 -0
- package/dist/channels/http/input-state.js +16 -0
- package/dist/channels/http/input-state.js.map +1 -0
- package/dist/channels/http/provider.d.ts +36 -7
- package/dist/channels/http/provider.d.ts.map +1 -1
- package/dist/channels/http/provider.js +46 -7
- package/dist/channels/http/provider.js.map +1 -1
- package/dist/channels/http/types.d.ts +13 -5
- package/dist/channels/http/types.d.ts.map +1 -1
- package/dist/channels/linear/index.d.ts +0 -5
- package/dist/channels/linear/index.d.ts.map +1 -1
- package/dist/channels/linear/index.js +94 -21
- package/dist/channels/linear/index.js.map +1 -1
- package/dist/channels/linear/schema.d.ts +20 -20
- package/dist/channels/linear/schema.d.ts.map +1 -1
- package/dist/channels/linear/schema.js +20 -1
- package/dist/channels/linear/schema.js.map +1 -1
- package/dist/channels/linear/types.d.ts +58 -49
- package/dist/channels/linear/types.d.ts.map +1 -1
- package/dist/channels/reply.d.ts +28 -0
- package/dist/channels/reply.d.ts.map +1 -0
- package/dist/channels/reply.js +37 -0
- package/dist/channels/reply.js.map +1 -0
- package/dist/channels/resolve-user.d.ts +3 -2
- package/dist/channels/resolve-user.d.ts.map +1 -1
- package/dist/channels/resolve-user.js +5 -4
- package/dist/channels/resolve-user.js.map +1 -1
- package/dist/channels/run-input.d.ts +120 -10
- package/dist/channels/run-input.d.ts.map +1 -1
- package/dist/channels/run-input.js +233 -16
- package/dist/channels/run-input.js.map +1 -1
- package/dist/channels/runtime.d.ts +10 -3
- package/dist/channels/runtime.d.ts.map +1 -1
- package/dist/channels/runtime.js +15 -1
- package/dist/channels/runtime.js.map +1 -1
- package/dist/channels/schedule-delivery.d.ts +2 -2
- package/dist/channels/schedule-delivery.d.ts.map +1 -1
- package/dist/channels/slack/events.d.ts +176 -63
- package/dist/channels/slack/events.d.ts.map +1 -1
- package/dist/channels/slack/events.js +153 -4
- package/dist/channels/slack/events.js.map +1 -1
- package/dist/channels/slack/files.d.ts +6 -3
- package/dist/channels/slack/files.d.ts.map +1 -1
- package/dist/channels/slack/files.js +4 -1
- package/dist/channels/slack/files.js.map +1 -1
- package/dist/channels/slack/index.d.ts +60 -29
- package/dist/channels/slack/index.d.ts.map +1 -1
- package/dist/channels/slack/index.js +134 -56
- package/dist/channels/slack/index.js.map +1 -1
- package/dist/channels/trigger/conversation.d.ts +8 -3
- package/dist/channels/trigger/conversation.d.ts.map +1 -1
- package/dist/channels/trigger/conversation.js +101 -12
- package/dist/channels/trigger/conversation.js.map +1 -1
- package/dist/channels/trigger/http.d.ts +48 -8
- package/dist/channels/trigger/http.d.ts.map +1 -1
- package/dist/channels/trigger/http.js +324 -47
- package/dist/channels/trigger/http.js.map +1 -1
- package/dist/channels/trigger/ingress.d.ts +68 -2
- package/dist/channels/trigger/ingress.d.ts.map +1 -1
- package/dist/channels/trigger/ingress.js +124 -1
- package/dist/channels/trigger/ingress.js.map +1 -1
- package/dist/channels/trigger/transport.d.ts +2 -0
- package/dist/channels/trigger/transport.d.ts.map +1 -1
- package/dist/channels/trigger/transport.js +5 -1
- package/dist/channels/trigger/transport.js.map +1 -1
- package/dist/channels/trigger/types.d.ts +49 -0
- package/dist/channels/trigger/types.d.ts.map +1 -1
- package/dist/channels/trigger/types.js +21 -0
- package/dist/channels/trigger/types.js.map +1 -1
- package/dist/channels/types.d.ts +205 -1
- package/dist/channels/types.d.ts.map +1 -1
- package/dist/channels/types.js +27 -0
- package/dist/channels/types.js.map +1 -1
- package/dist/channels/warnings.d.ts +8 -0
- package/dist/channels/warnings.d.ts.map +1 -0
- package/dist/channels/warnings.js +17 -0
- package/dist/channels/warnings.js.map +1 -0
- package/dist/connectors/mcp/index.d.ts.map +1 -1
- package/dist/connectors/mcp/index.js +12 -4
- package/dist/connectors/mcp/index.js.map +1 -1
- package/dist/connectors/mcp/instructions.d.ts +30 -0
- package/dist/connectors/mcp/instructions.d.ts.map +1 -0
- package/dist/connectors/mcp/instructions.js +150 -0
- package/dist/connectors/mcp/instructions.js.map +1 -0
- package/dist/connectors/mcp/schema.d.ts.map +1 -1
- package/dist/connectors/mcp/schema.js +2 -1
- package/dist/connectors/mcp/schema.js.map +1 -1
- package/dist/connectors/mcp/types.d.ts +10 -0
- package/dist/connectors/mcp/types.d.ts.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/ingress/runs.d.ts +3 -0
- package/dist/ingress/runs.d.ts.map +1 -1
- package/dist/ingress/runs.js +34 -16
- package/dist/ingress/runs.js.map +1 -1
- package/dist/memory/define-memory.d.ts +4 -2
- package/dist/memory/define-memory.d.ts.map +1 -1
- package/dist/memory/define-memory.js +4 -2
- package/dist/memory/define-memory.js.map +1 -1
- package/dist/namespaces.d.ts +2 -3
- package/dist/namespaces.d.ts.map +1 -1
- package/dist/namespaces.js +1 -1
- package/dist/namespaces.js.map +1 -1
- package/dist/run-context.d.ts +8 -0
- package/dist/run-context.d.ts.map +1 -1
- package/dist/run-context.js +5 -0
- package/dist/run-context.js.map +1 -1
- package/dist/run-ending-error.d.ts +16 -0
- package/dist/run-ending-error.d.ts.map +1 -0
- package/dist/run-ending-error.js +16 -0
- package/dist/run-ending-error.js.map +1 -0
- package/dist/runtime/auth.d.ts +1 -0
- package/dist/runtime/auth.d.ts.map +1 -1
- package/dist/runtime/auth.js +1 -1
- package/dist/runtime/auth.js.map +1 -1
- package/dist/runtime/backend.d.ts.map +1 -1
- package/dist/runtime/backend.js +7 -1
- package/dist/runtime/backend.js.map +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +4 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/managed-thread.d.ts +6 -0
- package/dist/runtime/managed-thread.d.ts.map +1 -1
- package/dist/runtime/managed-thread.js +38 -2
- package/dist/runtime/managed-thread.js.map +1 -1
- package/dist/runtime/memory/policy.d.ts.map +1 -1
- package/dist/runtime/memory/policy.js +24 -5
- package/dist/runtime/memory/policy.js.map +1 -1
- package/dist/runtime/run-input.d.ts +1 -0
- package/dist/runtime/run-input.d.ts.map +1 -1
- package/dist/runtime/sandbox-manager.d.ts +27 -3
- package/dist/runtime/sandbox-manager.d.ts.map +1 -1
- package/dist/runtime/sandbox-manager.js +188 -22
- package/dist/runtime/sandbox-manager.js.map +1 -1
- package/dist/runtime/schedule-auth.d.ts +11 -5
- package/dist/runtime/schedule-auth.d.ts.map +1 -1
- package/dist/runtime/schedule-auth.js +37 -12
- package/dist/runtime/schedule-auth.js.map +1 -1
- package/dist/runtime/thread-handoff.d.ts +16 -0
- package/dist/runtime/thread-handoff.d.ts.map +1 -0
- package/dist/runtime/thread-handoff.js +24 -0
- package/dist/runtime/thread-handoff.js.map +1 -0
- package/dist/runtime/thread-record.d.ts +4 -0
- package/dist/runtime/thread-record.d.ts.map +1 -1
- package/dist/runtime/thread-record.js +4 -0
- package/dist/runtime/thread-record.js.map +1 -1
- package/dist/runtime-schedules.d.ts +2 -2
- package/dist/runtime-schedules.d.ts.map +1 -1
- package/dist/runtime-schedules.js +3 -1
- package/dist/runtime-schedules.js.map +1 -1
- package/dist/sandbox.d.ts +12 -0
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sandbox.js +5 -0
- package/dist/sandbox.js.map +1 -1
- package/dist/schedules.d.ts +33 -14
- package/dist/schedules.d.ts.map +1 -1
- package/dist/schedules.js +32 -1
- package/dist/schedules.js.map +1 -1
- package/dist/telemetry/run.d.ts +2 -1
- package/dist/telemetry/run.d.ts.map +1 -1
- package/dist/telemetry/run.js.map +1 -1
- package/dist/tool-errors.d.ts.map +1 -1
- package/dist/tool-errors.js +10 -5
- package/dist/tool-errors.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
|
-
import type { MultitaskStrategy } from "../../ingress/runs.js";
|
|
3
2
|
import type { LINEAR_ENDPOINT_EVENT_FIELDS, linearEventSchema } from "./schema.js";
|
|
4
|
-
import type { ChannelRunResult } from "../run-input.js";
|
|
5
|
-
import type { EventFinished } from "../http/provider.js";
|
|
6
3
|
import type { EndpointRequest, EventEndpoint } from "../http/endpoint.js";
|
|
7
|
-
import type { ChannelReply } from "../types.js";
|
|
8
4
|
import type { LinearActor } from "../actor.js";
|
|
5
|
+
import type { ChannelAutoPostOptions, ChannelEventCallback, ChannelEventResult, ChannelHandlers, ChannelHookThread, ChannelOptions, ChannelReceivedOptions, ChannelReply, ChannelThread } from "../types.js";
|
|
6
|
+
import type { MultitaskStrategy } from "../../ingress/runs.js";
|
|
7
|
+
import type { EventFinished, EventReceived } from "../http/provider.js";
|
|
9
8
|
import type { ResolveUser } from "../resolve-user.js";
|
|
10
9
|
/** Handwritten schema subsets; unmodeled provider fields remain unknown. */
|
|
11
10
|
type EventUnion = z.output<typeof linearEventSchema>;
|
|
@@ -14,29 +13,21 @@ export type LinearEvent<K extends LinearEventKey = LinearEventKey> = Extract<Eve
|
|
|
14
13
|
key: K;
|
|
15
14
|
}>;
|
|
16
15
|
export type LinearPayloadFor<K extends LinearEventKey> = LinearEvent<K>["payload"];
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
* run exists, so this is not a run's runtime.
|
|
20
|
-
*/
|
|
21
|
-
export interface LinearChannelThread {
|
|
16
|
+
/** A Linear handler's thread, the issue's or an agent session's; see {@link ChannelThread}. */
|
|
17
|
+
export interface LinearChannelThread extends ChannelThread {
|
|
22
18
|
/**
|
|
23
19
|
* The conversation's thread, the issue's or an agent session's, which the
|
|
24
20
|
* run the handler starts runs on. Useful for run context that names the
|
|
25
21
|
* thread, such as a token a backend signs for it.
|
|
26
22
|
*/
|
|
27
23
|
id: string;
|
|
28
|
-
channel: {
|
|
29
|
-
name: string;
|
|
30
|
-
};
|
|
31
24
|
}
|
|
32
25
|
/**
|
|
33
|
-
* What
|
|
34
|
-
*
|
|
35
|
-
* `{ messages: [...] }`, or `[input, { context, metadata }]`. `null` or `undefined`
|
|
36
|
-
* starts nothing.
|
|
26
|
+
* What a Linear handler returns; see {@link ChannelEventResult}. A
|
|
27
|
+
* `reply(message)` answers in the agent session, or as a comment on the issue.
|
|
37
28
|
*/
|
|
38
|
-
export type LinearEventResult =
|
|
39
|
-
export type LinearEventCallback<K extends LinearEventKey> =
|
|
29
|
+
export type LinearEventResult = ChannelEventResult;
|
|
30
|
+
export type LinearEventCallback<K extends LinearEventKey> = ChannelEventCallback<LinearEvent<K>, LinearChannelThread>;
|
|
40
31
|
/** The Linear app `mda deploy` sets up: how it looks, and what it may do. */
|
|
41
32
|
export interface LinearAppOptions {
|
|
42
33
|
/**
|
|
@@ -71,11 +62,11 @@ export interface LinearAppOptions {
|
|
|
71
62
|
teams?: string[];
|
|
72
63
|
}
|
|
73
64
|
/**
|
|
74
|
-
* Options for `channels.linear(...)`: the
|
|
75
|
-
*
|
|
76
|
-
* another.
|
|
65
|
+
* Options for `channels.linear(...)`: the shared {@link ChannelOptions}, with
|
|
66
|
+
* the teams in `app`, `autoPost`, `onReceived` and agent `sessions`. Each
|
|
67
|
+
* issue is one conversation, and each agent session on it another.
|
|
77
68
|
*/
|
|
78
|
-
export interface LinearChannelOptions {
|
|
69
|
+
export interface LinearChannelOptions extends ChannelOptions<LinearEvent, LinearChannelThread, LinearActor, LinearAppOptions>, ChannelReceivedOptions<LinearEvent, LinearChannelThread>, ChannelAutoPostOptions {
|
|
79
70
|
/** The Linear app `mda deploy` sets up: its name, description, icon and teams. */
|
|
80
71
|
app?: LinearAppOptions;
|
|
81
72
|
/**
|
|
@@ -99,13 +90,24 @@ export interface LinearChannelOptions {
|
|
|
99
90
|
multitaskStrategy?: MultitaskStrategy;
|
|
100
91
|
/**
|
|
101
92
|
* Whether the channel posts the run's final answer, as a comment or the
|
|
102
|
-
* session's response: `
|
|
103
|
-
* the agent. Session acknowledgements, Stop and error notices still
|
|
93
|
+
* session's response: `true` (the default) or `false`, to leave replying
|
|
94
|
+
* to the agent. Session acknowledgements, Stop and error notices still
|
|
95
|
+
* post.
|
|
96
|
+
*/
|
|
97
|
+
autoPost?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* `"auto"` or `"none"`, as `autoPost` `true` or `false`.
|
|
100
|
+
*
|
|
101
|
+
* @deprecated Use `autoPost`.
|
|
104
102
|
*/
|
|
105
103
|
reply?: ChannelReply;
|
|
106
104
|
/**
|
|
107
105
|
* Event handlers that start runs. Return a prompt (string, message, or
|
|
108
|
-
* state), or nothing to skip.
|
|
106
|
+
* state), or nothing to skip. MDA answers Linear before it asks the handler,
|
|
107
|
+
* so a handler may take longer than Linear waits; one that throws starts
|
|
108
|
+
* nothing, and its error is logged, and an agent session hears that
|
|
109
|
+
* something went wrong. The
|
|
110
|
+
* run's final reply is posted as a comment
|
|
109
111
|
* on the issue, under the comment that started it.
|
|
110
112
|
*
|
|
111
113
|
* @example
|
|
@@ -120,9 +122,35 @@ export interface LinearChannelOptions {
|
|
|
120
122
|
* and starts the run it answers with. See the README's "Asking your service
|
|
121
123
|
* what to start".
|
|
122
124
|
*/
|
|
123
|
-
onEvent?:
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
onEvent?: ChannelHandlers<LinearEvent, LinearChannelThread>;
|
|
126
|
+
/**
|
|
127
|
+
* A delivery of a handled event is done, once, with how, to switch on by
|
|
128
|
+
* `type`: the run it started and how that run ended, as LangGraph names it
|
|
129
|
+
* (`run`), why it started none (`skipped`, such as a Stop or a handler
|
|
130
|
+
* that returned nothing), or that MDA lost it (`failed`); and the
|
|
131
|
+
* decisions the thread waits on. Called after the channel's own
|
|
132
|
+
* activities, such as the session's elicitation or "Stopped.", in the
|
|
133
|
+
* background; failures are logged. See `channels.http`'s `onFinish` for
|
|
134
|
+
* its limits.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* onFinish: async (event, thread, finished) => {
|
|
139
|
+
* if (finished.type === "run" && finished.run.status === "success")
|
|
140
|
+
* await reportRun(thread.id, finished.run.id);
|
|
141
|
+
* }
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
onFinish?: EventFinished<LinearEvent, ChannelHookThread<LinearChannelThread>>;
|
|
145
|
+
/**
|
|
146
|
+
* A delivery of a handled event reached its thread, once, with the event
|
|
147
|
+
* and its thread, before MDA reads the thread or asks the handler, as
|
|
148
|
+
* `channels.github`'s `onReceived` is: the moment to acknowledge it. It
|
|
149
|
+
* runs after the channel acknowledges an agent session, fires even when the
|
|
150
|
+
* thread then waits on a decision or the handler declines, and runs in the
|
|
151
|
+
* background, before `onFinish`; failures are logged and don't stop the run.
|
|
152
|
+
*/
|
|
153
|
+
onReceived?: EventReceived<LinearEvent, ChannelHookThread<LinearChannelThread>>;
|
|
126
154
|
/**
|
|
127
155
|
* Answer Linear agent sessions, which open when someone mentions the app or
|
|
128
156
|
* delegates an issue to it. Defaults to `true`. Without a handler, a new
|
|
@@ -140,30 +168,11 @@ export interface LinearChannelOptions {
|
|
|
140
168
|
sessions?: boolean;
|
|
141
169
|
/**
|
|
142
170
|
* Ignore changes made by other apps and integrations (a delivery whose
|
|
143
|
-
* actor isn't a person, or the creation of an issue
|
|
144
|
-
* `botActor`), so automations don't trigger each other. Defaults to `true`.
|
|
171
|
+
* actor isn't a person or is no longer known, or the creation of an issue
|
|
172
|
+
* or comment with a `botActor`), so automations don't trigger each other. Defaults to `true`.
|
|
145
173
|
* The app's own changes are always ignored.
|
|
146
174
|
*/
|
|
147
175
|
ignoreBots?: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* A delivery of a handled event is done, once, with how, to switch on by
|
|
150
|
-
* `type`: the run it started and how that run ended, as LangGraph names it
|
|
151
|
-
* (`run`), why it started none (`skipped`, such as a Stop or a handler
|
|
152
|
-
* that returned nothing), or that MDA lost it (`failed`); and the
|
|
153
|
-
* decisions the thread waits on. Called after the channel's own
|
|
154
|
-
* activities, such as the session's elicitation or "Stopped.", in the
|
|
155
|
-
* background; failures are logged. See `channels.http`'s `onFinish` for
|
|
156
|
-
* its limits.
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* ```ts
|
|
160
|
-
* onFinish: async (event, thread, finished) => {
|
|
161
|
-
* if (finished.type === "run" && finished.run.status === "success")
|
|
162
|
-
* await reportRun(thread.id, finished.run.id);
|
|
163
|
-
* }
|
|
164
|
-
* ```
|
|
165
|
-
*/
|
|
166
|
-
onFinish?: EventFinished<LinearEvent, LinearChannelThread>;
|
|
167
176
|
}
|
|
168
177
|
/** What a Linear channel POSTs an endpoint, for one event key or any. */
|
|
169
178
|
export type LinearEndpointRequest<K extends LinearEventKey = LinearEventKey> = EndpointRequest<LinearEvent<K>, (typeof LINEAR_ENDPOINT_EVENT_FIELDS)[number]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/channels/linear/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/channels/linear/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACV,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAA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,CAAC,EACxD,sBAAsB;IACxB,kFAAkF;IAClF,GAAG,CAAC,EAAE,gBAAgB,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC;IACvD;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IAC5D;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC,WAAW,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC9E;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,aAAa,CACxB,WAAW,EACX,iBAAiB,CAAC,mBAAmB,CAAC,CACvC,CAAC;IACF;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,yEAAyE;AACzE,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,IACzE,eAAe,CACb,WAAW,CAAC,CAAC,CAAC,EACd,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAC9C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ChannelMessage } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Start nothing, and post `message` where the event came from, as
|
|
4
|
+
* `runtime.channel.post` would. An event handler or `resolveUser` returns it
|
|
5
|
+
* with {@link reply}; an endpoint answers `{ type: "reply", message }`.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This may change in a minor release.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ChannelReplyResult {
|
|
10
|
+
readonly type = "reply";
|
|
11
|
+
readonly message: ChannelMessage;
|
|
12
|
+
constructor(message: ChannelMessage);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Start nothing, and post `message` where the event came from: text, or a
|
|
16
|
+
* `ChannelMessage`. A Linear agent session takes text only.
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* onEvent: {
|
|
20
|
+
* "AgentSessionEvent.created": (event) =>
|
|
21
|
+
* repositoryOf(event) ? event.payload.promptContext : reply("Which repository should I work in?"),
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @experimental This may change in a minor release.
|
|
26
|
+
*/
|
|
27
|
+
export declare function reply(message: ChannelMessage | string): ChannelReplyResult;
|
|
28
|
+
//# sourceMappingURL=reply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../src/channels/reply.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;GAMG;AACH,qBAAa,kBAAkB;IAC7B,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IAEjC,YAAY,OAAO,EAAE,cAAc,EAElC;CACF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,kBAAkB,CAS1E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { channelMessageSchema } from "./message-schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Start nothing, and post `message` where the event came from, as
|
|
4
|
+
* `runtime.channel.post` would. An event handler or `resolveUser` returns it
|
|
5
|
+
* with {@link reply}; an endpoint answers `{ type: "reply", message }`.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This may change in a minor release.
|
|
8
|
+
*/
|
|
9
|
+
export class ChannelReplyResult {
|
|
10
|
+
type = "reply";
|
|
11
|
+
message;
|
|
12
|
+
constructor(message) {
|
|
13
|
+
this.message = message;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Start nothing, and post `message` where the event came from: text, or a
|
|
18
|
+
* `ChannelMessage`. A Linear agent session takes text only.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* onEvent: {
|
|
22
|
+
* "AgentSessionEvent.created": (event) =>
|
|
23
|
+
* repositoryOf(event) ? event.payload.promptContext : reply("Which repository should I work in?"),
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @experimental This may change in a minor release.
|
|
28
|
+
*/
|
|
29
|
+
export function reply(message) {
|
|
30
|
+
const parsed = channelMessageSchema.safeParse(typeof message === "string"
|
|
31
|
+
? { type: "content", content: message }
|
|
32
|
+
: message);
|
|
33
|
+
if (!parsed.success)
|
|
34
|
+
throw new TypeError("reply takes text or a ChannelMessage");
|
|
35
|
+
return new ChannelReplyResult(parsed.data);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=reply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply.js","sourceRoot":"","sources":["../../src/channels/reply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D;;;;;;GAMG;AACH,MAAM,OAAO,kBAAkB;IACpB,IAAI,GAAG,OAAO,CAAC;IACf,OAAO,CAAiB;IAEjC,YAAY,OAAuB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,KAAK,CAAC,OAAgC;IACpD,MAAM,MAAM,GAAG,oBAAoB,CAAC,SAAS,CAC3C,OAAO,OAAO,KAAK,QAAQ;QACzB,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE;QACvC,CAAC,CAAC,OAAO,CACZ,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,OAAO;QACjB,MAAM,IAAI,SAAS,CAAC,sCAAsC,CAAC,CAAC;IAC9D,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -89,8 +89,9 @@ export declare function senderPrincipalId(actor: ChannelActor | undefined, resol
|
|
|
89
89
|
/** Set a channel's own `resolveUser`, which overrides the identity's. */
|
|
90
90
|
export declare function withResolveUser<C extends object>(channel: C, resolveUser: unknown, owner: string): C;
|
|
91
91
|
/**
|
|
92
|
-
* Post `resolveUser`'s
|
|
93
|
-
* once per `deliveryKey`.
|
|
92
|
+
* Post a reply, `resolveUser`'s or a handler's, through the path
|
|
93
|
+
* `runtime.channel.post` takes, once per `deliveryKey`. A channel without
|
|
94
|
+
* `post`, such as GitHub, only logs it.
|
|
94
95
|
*/
|
|
95
96
|
export declare function postReply(message: ChannelMessage, channel: {
|
|
96
97
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-user.d.ts","sourceRoot":"","sources":["../../src/channels/resolve-user.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAK9D,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IACvE,sEAAsE;IACtE,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,OAAO,EAAE;QAA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,QAAQ,EAAE,wBAAwB,KAC/B,OAAO,CAAC,MAAM,CAA8B,GAChD,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe7B;AAED,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAC9C,OAAO,EAAE,CAAC,EACV,WAAW,EAAE,OAAO,EACpB,KAAK,EAAE,MAAM,GACZ,CAAC,CAQH;AAMD;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE;IACP,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACA,OAAO,CAAC,IAAI,CAAC,CAkBf"}
|
|
@@ -113,8 +113,9 @@ export function withResolveUser(channel, resolveUser, owner) {
|
|
|
113
113
|
const repliedDeliveries = new Set();
|
|
114
114
|
const REPLIED_DELIVERIES_KEPT = 1000;
|
|
115
115
|
/**
|
|
116
|
-
* Post `resolveUser`'s
|
|
117
|
-
* once per `deliveryKey`.
|
|
116
|
+
* Post a reply, `resolveUser`'s or a handler's, through the path
|
|
117
|
+
* `runtime.channel.post` takes, once per `deliveryKey`. A channel without
|
|
118
|
+
* `post`, such as GitHub, only logs it.
|
|
118
119
|
*/
|
|
119
120
|
export async function postReply(message, channel) {
|
|
120
121
|
const { deliveryKey, ...route } = channel;
|
|
@@ -127,14 +128,14 @@ export async function postReply(message, channel) {
|
|
|
127
128
|
}
|
|
128
129
|
const { post } = createRuntimeChannel({ ...route, event: null });
|
|
129
130
|
if (!post) {
|
|
130
|
-
logger.warn("channel cannot post
|
|
131
|
+
logger.warn("channel cannot post a reply");
|
|
131
132
|
return;
|
|
132
133
|
}
|
|
133
134
|
try {
|
|
134
135
|
await post(message);
|
|
135
136
|
}
|
|
136
137
|
catch (error) {
|
|
137
|
-
logger.error(`channel
|
|
138
|
+
logger.error(`channel reply failed (${logger.safeErrorLabel(error)})`);
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
function appUserIdentity(id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-user.js","sourceRoot":"","sources":["../../src/channels/resolve-user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,6BAA6B,EAC7B,iBAAiB,GAElB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAqB,MAAM,YAAY,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,oBAAoB,GAErB,MAAM,cAAc,CAAC;AA+CtB,iFAAiF;AACjF,MAAM,YAAY,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAChD,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,oBAAoB,EAAE,CAAC;IACrE,CAAC,CAAC,YAAY,CAAC;QACb,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;QAC3B,QAAQ,EAAE,oBAAoB;QAC9B,MAAM,EAAE,oBAAoB;QAC5B,OAAO,EAAE,oBAAoB;KAC9B,CAAC;IACF,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,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AC,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAM,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,EAAE,IAAI,EAAE,GAAG,oBAAoB,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC3C,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,yBAAyB,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzE,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,EAAU;IACjC,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAC;IACzC,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,6BAA6B,CAAC,iBAAiB,CAAC,CAAC;IAC7E,OAAO;QACL,QAAQ,EAAE,wBAAwB;QAClC,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,EAAE;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
import { type BaseMessage, type BaseMessageLike } from "@langchain/core/messages";
|
|
6
6
|
import type { LangGraphRunnableConfig } from "@langchain/langgraph";
|
|
7
7
|
import type { JsonObject } from "./manifest.js";
|
|
8
|
-
import type { JsonValue } from "./types.js";
|
|
8
|
+
import type { ChannelAddress, ChannelReply, JsonValue } from "./types.js";
|
|
9
|
+
import type { MultitaskStrategy } from "../ingress/runs.js";
|
|
10
|
+
import type { ThreadConfig } from "../schedules.js";
|
|
9
11
|
/**
|
|
10
12
|
* State to start a run with, as `agent.invoke` takes it: `messages` plus any
|
|
11
13
|
* other keys of the agent's state.
|
|
@@ -17,11 +19,56 @@ export interface ChannelStateInput {
|
|
|
17
19
|
/** A user message's text, a message, or state to start a run with. */
|
|
18
20
|
export type ChannelRunInput = string | BaseMessage | ChannelStateInput;
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* A run a handler starts, in a list: its input, with the run options
|
|
23
|
+
* `agent.invoke` takes. GitHub, Linear, HTTP and Slack channels may also
|
|
24
|
+
* choose the run's thread and where it posts its final answer.
|
|
21
25
|
*
|
|
22
26
|
* @experimental This may change in a minor release.
|
|
23
27
|
*/
|
|
24
|
-
export
|
|
28
|
+
export interface ChannelRun extends Pick<LangGraphRunnableConfig<Record<string, unknown>>, "context"> {
|
|
29
|
+
/** The user message's text, a message, or state such as `{ messages }`. */
|
|
30
|
+
input: ChannelRunInput;
|
|
31
|
+
/**
|
|
32
|
+
* The thread the run starts on. Omitted, the thread the handler was given,
|
|
33
|
+
* `{ mode: "persistent", id: thread.id }`: the event's conversation.
|
|
34
|
+
* Otherwise `{ mode: "ephemeral" }` for a fresh thread, deleted once the
|
|
35
|
+
* run ends, or `{ mode: "persistent", id: "<uuid>" }` for the thread with
|
|
36
|
+
* that id, kept across events. GitHub, Linear, HTTP and Slack channels
|
|
37
|
+
* only.
|
|
38
|
+
*/
|
|
39
|
+
thread?: Exclude<ThreadConfig, {
|
|
40
|
+
mode: "persistent";
|
|
41
|
+
}> | {
|
|
42
|
+
mode: "persistent";
|
|
43
|
+
/**
|
|
44
|
+
* The thread's id, a UUID. Unlike a schedule's, a handler's run gets
|
|
45
|
+
* no derived id, so a persistent thread always names one.
|
|
46
|
+
*/
|
|
47
|
+
id: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Where the run posts its final answer: `true` where the event came from,
|
|
51
|
+
* `false` nowhere, or an address, such as the event's own
|
|
52
|
+
* `runtime.thread.origin.channel.address`. For now an address must be where
|
|
53
|
+
* the event came from. Omitted, the channel's `autoPost` decides for a run
|
|
54
|
+
* on the event's conversation, and a run on another thread posts nothing.
|
|
55
|
+
* Linear, HTTP and Slack channels only: GitHub posts no run's answer.
|
|
56
|
+
*/
|
|
57
|
+
autoPost?: boolean | ChannelAddress;
|
|
58
|
+
/**
|
|
59
|
+
* The Slack thread the run belongs to when it isn't the event's, such as a
|
|
60
|
+
* thread the handler just opened in the same Slack app and workspace. Its
|
|
61
|
+
* status, Stop button and decisions show there, Stop there stops it, and
|
|
62
|
+
* `autoPost: true` answers there. Only with `thread`, a thread the handler
|
|
63
|
+
* chose. Slack channels only.
|
|
64
|
+
*/
|
|
65
|
+
conversation?: ChannelAddress;
|
|
66
|
+
/**
|
|
67
|
+
* What the run does while its thread already runs, over the channel's
|
|
68
|
+
* `multitaskStrategy` for this run. GitHub, Linear, HTTP and Slack
|
|
69
|
+
* channels only.
|
|
70
|
+
*/
|
|
71
|
+
multitaskStrategy?: MultitaskStrategy;
|
|
25
72
|
/**
|
|
26
73
|
* Metadata for the run, such as where it came from, to find it by in
|
|
27
74
|
* LangSmith. Keys are letters, digits, `_`, `.` or `-` and start with a
|
|
@@ -39,14 +86,32 @@ export type ChannelRunOptions = Pick<LangGraphRunnableConfig<Record<string, unkn
|
|
|
39
86
|
* http(s), without credentials in it.
|
|
40
87
|
*/
|
|
41
88
|
webhook?: string;
|
|
42
|
-
}
|
|
89
|
+
}
|
|
43
90
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
91
|
+
* Run options a handler set with its input, as `[input, options]`.
|
|
92
|
+
*
|
|
93
|
+
* @deprecated Return a run object, `[{ input, ...options }]`. Removed in 0.12.
|
|
94
|
+
*/
|
|
95
|
+
export type ChannelRunOptions = Pick<ChannelRun, "context" | "metadata" | "webhook">;
|
|
96
|
+
/**
|
|
97
|
+
* What a channel handler may return to start a run: its input, for one run
|
|
98
|
+
* on the event's conversation, or a list of runs with their options. On
|
|
99
|
+
* GitHub, Linear, HTTP and Slack channels a list may start several runs, at
|
|
100
|
+
* most one of them on the event's conversation; elsewhere it holds one run.
|
|
101
|
+
* The `[input, options]` form is deprecated, and removed in 0.12: return
|
|
102
|
+
* `[{ input, ...options }]`.
|
|
46
103
|
*
|
|
47
104
|
* @experimental This may change in a minor release.
|
|
48
105
|
*/
|
|
49
|
-
export type ChannelRunResult = ChannelRunInput | readonly [ChannelRunInput, ChannelRunOptions];
|
|
106
|
+
export type ChannelRunResult = ChannelRunInput | readonly ChannelRun[] | readonly [ChannelRunInput, ChannelRunOptions];
|
|
107
|
+
/** A run's thread as {@link normalizeRunInputs} checked it. */
|
|
108
|
+
export type RunThread = {
|
|
109
|
+
mode: "ephemeral";
|
|
110
|
+
} | {
|
|
111
|
+
mode: "persistent";
|
|
112
|
+
/** A lowercase UUID. */
|
|
113
|
+
id: string;
|
|
114
|
+
};
|
|
50
115
|
/** A handler's result as the Agent Server takes it. */
|
|
51
116
|
export interface NormalizedRunInput {
|
|
52
117
|
/** Messages as JSON, each with a `role`. */
|
|
@@ -56,6 +121,33 @@ export interface NormalizedRunInput {
|
|
|
56
121
|
context?: JsonObject;
|
|
57
122
|
metadata?: JsonObject;
|
|
58
123
|
webhook?: string;
|
|
124
|
+
thread?: RunThread;
|
|
125
|
+
reply?: ChannelReply;
|
|
126
|
+
multitaskStrategy?: MultitaskStrategy;
|
|
127
|
+
/** The run posts its final answer on the event's conversation. */
|
|
128
|
+
deliverToConversation?: true;
|
|
129
|
+
/** The Slack thread the run belongs to, when it isn't the event's. */
|
|
130
|
+
conversation?: RunConversation;
|
|
131
|
+
}
|
|
132
|
+
/** A run's Slack thread, as a Trigger address names it. */
|
|
133
|
+
export interface RunConversation {
|
|
134
|
+
conversation_id: string;
|
|
135
|
+
thread_id: string;
|
|
136
|
+
}
|
|
137
|
+
/** The channel a handler's runs start from. */
|
|
138
|
+
export interface RunChannel {
|
|
139
|
+
name: string;
|
|
140
|
+
provider: string;
|
|
141
|
+
/**
|
|
142
|
+
* The event's conversation's thread. A run on a persistent thread with this
|
|
143
|
+
* id is the conversation's run. Without it, only a run without `thread` is.
|
|
144
|
+
*/
|
|
145
|
+
conversationThreadId?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Where the event came from, for a provider with a typed address. A run's
|
|
148
|
+
* `autoPost` target may name it.
|
|
149
|
+
*/
|
|
150
|
+
origin?: ChannelAddress;
|
|
59
151
|
}
|
|
60
152
|
/**
|
|
61
153
|
* A handler's run input as `startIngressRun` takes it, with MDA's own
|
|
@@ -80,9 +172,27 @@ export declare class InvalidRunInput extends TypeError {
|
|
|
80
172
|
constructor(reason: string);
|
|
81
173
|
}
|
|
82
174
|
/**
|
|
83
|
-
* Normalize what a handler
|
|
84
|
-
*
|
|
85
|
-
* `
|
|
175
|
+
* Normalize what a handler of a channel that starts one run returned: its
|
|
176
|
+
* input, or a list of one run `{ input }` with only `context`, `metadata` or
|
|
177
|
+
* `webhook`. `null`, `undefined` and an empty list start nothing; anything
|
|
178
|
+
* else that is not valid throws an {@link InvalidRunInput}, a `TypeError`. A
|
|
179
|
+
* run option that is `null` or `undefined` is not set.
|
|
86
180
|
*/
|
|
87
181
|
export declare function normalizeRunInput(value: unknown): NormalizedRunInput | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* Normalize what a handler of a GitHub, Linear, HTTP or Slack channel returned.
|
|
184
|
+
* `null`, `undefined` or an empty list start nothing. Input alone starts a
|
|
185
|
+
* run on the event's conversation. A list starts a run per item; each run
|
|
186
|
+
* may choose its thread, `autoPost` and `multitaskStrategy`. At most one run
|
|
187
|
+
* may start on the event's conversation: one without `thread`, or on a
|
|
188
|
+
* persistent thread with the conversation's id. Anything else throws an
|
|
189
|
+
* {@link InvalidRunInput}.
|
|
190
|
+
*/
|
|
191
|
+
export declare function normalizeRunInputs(value: unknown, channel: RunChannel): NormalizedRunInput[];
|
|
192
|
+
/**
|
|
193
|
+
* Whether a handler's result starts a run on the event's conversation: its
|
|
194
|
+
* input alone, or a list with a run without `thread` or on a persistent
|
|
195
|
+
* thread with the conversation's id.
|
|
196
|
+
*/
|
|
197
|
+
export declare function startsOnConversation(result: unknown, conversationThreadId?: string): boolean;
|
|
88
198
|
//# sourceMappingURL=run-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-input.d.ts","sourceRoot":"","sources":["../../src/channels/run-input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,eAAe,EAErB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"run-input.d.ts","sourceRoot":"","sources":["../../src/channels/run-input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,eAAe,EAErB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,WAAW,UAAW,SAAQ,IAAI,CACtC,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAChD,SAA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