experimental-ash 0.2.0-alpha.16 → 0.2.0-alpha.18
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/dist/src/channel/http-channel.d.ts +12 -5
- package/dist/src/channel/http-channel.d.ts.map +1 -1
- package/dist/src/channel/http-channel.js +5 -7
- package/dist/src/channel/http-channel.js.map +1 -1
- package/dist/src/channel/schedule-channel.d.ts +2 -4
- package/dist/src/channel/schedule-channel.d.ts.map +1 -1
- package/dist/src/channel/schedule-channel.js +2 -7
- package/dist/src/channel/schedule-channel.js.map +1 -1
- package/dist/src/channel/slack-channel.d.ts +35 -11
- package/dist/src/channel/slack-channel.d.ts.map +1 -1
- package/dist/src/channel/slack-channel.js +40 -15
- package/dist/src/channel/slack-channel.js.map +1 -1
- package/dist/src/channel/subagent-channel.d.ts +2 -4
- package/dist/src/channel/subagent-channel.d.ts.map +1 -1
- package/dist/src/channel/subagent-channel.js +3 -10
- package/dist/src/channel/subagent-channel.js.map +1 -1
- package/dist/src/channel/types.d.ts +55 -25
- package/dist/src/channel/types.d.ts.map +1 -1
- package/dist/src/channel/types.js +64 -1
- package/dist/src/channel/types.js.map +1 -1
- package/dist/src/cli/dev/input-requests.js +1 -1
- package/dist/src/cli/dev/input-requests.js.map +1 -1
- package/dist/src/context/key.d.ts +16 -8
- package/dist/src/context/key.d.ts.map +1 -1
- package/dist/src/context/key.js.map +1 -1
- package/dist/src/context/keys.d.ts +2 -12
- package/dist/src/context/keys.d.ts.map +1 -1
- package/dist/src/context/keys.js +10 -25
- package/dist/src/context/keys.js.map +1 -1
- package/dist/src/context/providers/skill.d.ts.map +1 -1
- package/dist/src/context/providers/skill.js +2 -15
- package/dist/src/context/providers/skill.js.map +1 -1
- package/dist/src/context/seed-keys.d.ts +21 -0
- package/dist/src/context/seed-keys.d.ts.map +1 -0
- package/dist/src/context/seed-keys.js +19 -0
- package/dist/src/context/seed-keys.js.map +1 -0
- package/dist/src/context/serialize.d.ts.map +1 -1
- package/dist/src/context/serialize.js +12 -1
- package/dist/src/context/serialize.js.map +1 -1
- package/dist/src/context/state.js +1 -1
- package/dist/src/context/state.js.map +1 -1
- package/dist/src/execution/skills/instructions.d.ts +5 -5
- package/dist/src/execution/skills/instructions.d.ts.map +1 -1
- package/dist/src/execution/skills/instructions.js +5 -12
- package/dist/src/execution/skills/instructions.js.map +1 -1
- package/dist/src/internal/application/compiled-artifacts.d.ts +5 -3
- package/dist/src/internal/application/compiled-artifacts.d.ts.map +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +19 -40
- package/dist/src/internal/application/compiled-artifacts.js.map +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/channel.d.ts.map +1 -1
- package/dist/src/internal/authored-definition/channel.js +27 -3
- package/dist/src/internal/authored-definition/channel.js.map +1 -1
- package/dist/src/internal/message/builder.d.ts +1 -2
- package/dist/src/internal/message/builder.d.ts.map +1 -1
- package/dist/src/internal/message/builder.js +4 -12
- package/dist/src/internal/message/builder.js.map +1 -1
- package/dist/src/internal/nitro/host/configure-message-routes.d.ts +3 -1
- package/dist/src/internal/nitro/host/configure-message-routes.d.ts.map +1 -1
- package/dist/src/internal/nitro/host/configure-message-routes.js +93 -21
- package/dist/src/internal/nitro/host/configure-message-routes.js.map +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts.map +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +50 -19
- package/dist/src/internal/nitro/host/create-application-nitro.js.map +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.d.ts +8 -18
- package/dist/src/internal/nitro/routes/channel-dispatch.d.ts.map +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +11 -44
- package/dist/src/internal/nitro/routes/channel-dispatch.js.map +1 -1
- package/dist/src/internal/nitro/routes/home.d.ts +0 -5
- package/dist/src/internal/nitro/routes/home.d.ts.map +1 -1
- package/dist/src/internal/nitro/routes/home.js +2 -18
- package/dist/src/internal/nitro/routes/home.js.map +1 -1
- package/dist/src/internal/nitro/routes/index.d.ts +2 -7
- package/dist/src/internal/nitro/routes/index.d.ts.map +1 -1
- package/dist/src/internal/nitro/routes/index.js +2 -19
- package/dist/src/internal/nitro/routes/index.js.map +1 -1
- package/dist/src/internal/nitro/routes/runtime-artifacts.d.ts +10 -3
- package/dist/src/internal/nitro/routes/runtime-artifacts.d.ts.map +1 -1
- package/dist/src/internal/nitro/routes/runtime-artifacts.js +2 -9
- package/dist/src/internal/nitro/routes/runtime-artifacts.js.map +1 -1
- package/dist/src/internal/nitro/routes/runtime-stack.d.ts +3 -2
- package/dist/src/internal/nitro/routes/runtime-stack.d.ts.map +1 -1
- package/dist/src/internal/nitro/routes/runtime-stack.js +5 -5
- package/dist/src/internal/nitro/routes/runtime-stack.js.map +1 -1
- package/dist/src/internal/nitro/routes/schedule-task.d.ts +7 -7
- package/dist/src/internal/nitro/routes/schedule-task.d.ts.map +1 -1
- package/dist/src/internal/nitro/routes/schedule-task.js +21 -29
- package/dist/src/internal/nitro/routes/schedule-task.js.map +1 -1
- package/dist/src/public/channels/http.d.ts +43 -3
- package/dist/src/public/channels/http.d.ts.map +1 -1
- package/dist/src/public/channels/http.js +14 -2
- package/dist/src/public/channels/http.js.map +1 -1
- package/dist/src/public/channels/index.d.ts +1 -2
- package/dist/src/public/channels/index.d.ts.map +1 -1
- package/dist/src/public/channels/index.js +1 -1
- package/dist/src/public/channels/index.js.map +1 -1
- package/dist/src/public/channels/slack/index.d.ts +24 -12
- package/dist/src/public/channels/slack/index.d.ts.map +1 -1
- package/dist/src/public/channels/slack/index.js +33 -9
- package/dist/src/public/channels/slack/index.js.map +1 -1
- package/dist/src/public/definitions/channel.d.ts +30 -2
- package/dist/src/public/definitions/channel.d.ts.map +1 -1
- package/dist/src/public/definitions/channel.js +18 -0
- package/dist/src/public/definitions/channel.js.map +1 -1
- package/dist/src/public/index.d.ts +1 -2
- package/dist/src/public/index.d.ts.map +1 -1
- package/dist/src/public/index.js +1 -1
- package/dist/src/public/index.js.map +1 -1
- package/dist/src/runtime/agent/bootstrap.d.ts.map +1 -1
- package/dist/src/runtime/agent/bootstrap.js +3 -1
- package/dist/src/runtime/agent/bootstrap.js.map +1 -1
- package/dist/src/runtime/channels/registry.d.ts +21 -0
- package/dist/src/runtime/channels/registry.d.ts.map +1 -0
- package/dist/src/runtime/channels/registry.js +65 -0
- package/dist/src/runtime/channels/registry.js.map +1 -0
- package/dist/src/runtime/framework-channels/index.d.ts.map +1 -1
- package/dist/src/runtime/framework-channels/index.js +2 -0
- package/dist/src/runtime/framework-channels/index.js.map +1 -1
- package/dist/src/runtime/prompt/compose.d.ts +2 -0
- package/dist/src/runtime/prompt/compose.d.ts.map +1 -1
- package/dist/src/runtime/prompt/compose.js +10 -0
- package/dist/src/runtime/prompt/compose.js.map +1 -1
- package/dist/src/runtime/resolve-channel.d.ts.map +1 -1
- package/dist/src/runtime/resolve-channel.js +1 -0
- package/dist/src/runtime/resolve-channel.js.map +1 -1
- package/dist/src/runtime/sessions/compiled-agent-cache.d.ts +2 -0
- package/dist/src/runtime/sessions/compiled-agent-cache.d.ts.map +1 -1
- package/dist/src/runtime/sessions/compiled-agent-cache.js +14 -0
- package/dist/src/runtime/sessions/compiled-agent-cache.js.map +1 -1
- package/dist/src/runtime/types.d.ts +2 -0
- package/dist/src/runtime/types.d.ts.map +1 -1
- package/docs/internals/context.md +27 -11
- package/docs/public/session-context.md +24 -13
- package/package.json +1 -1
- package/dist/src/channel/channel-registry.d.ts +0 -34
- package/dist/src/channel/channel-registry.d.ts.map +0 -1
- package/dist/src/channel/channel-registry.js +0 -63
- package/dist/src/channel/channel-registry.js.map +0 -1
- package/dist/src/internal/message/nitro-route-shims.d.ts +0 -6
- package/dist/src/internal/message/nitro-route-shims.d.ts.map +0 -1
- package/dist/src/internal/message/nitro-route-shims.js +0 -38
- package/dist/src/internal/message/nitro-route-shims.js.map +0 -1
- package/dist/src/internal/message/rewrite-generated-imports.d.ts +0 -15
- package/dist/src/internal/message/rewrite-generated-imports.d.ts.map +0 -1
- package/dist/src/internal/message/rewrite-generated-imports.js +0 -59
- package/dist/src/internal/message/rewrite-generated-imports.js.map +0 -1
- package/dist/src/internal/nitro/host/channel-url-matcher.d.ts +0 -35
- package/dist/src/internal/nitro/host/channel-url-matcher.d.ts.map +0 -1
- package/dist/src/internal/nitro/host/channel-url-matcher.js +0 -57
- package/dist/src/internal/nitro/host/channel-url-matcher.js.map +0 -1
- package/dist/src/internal/nitro/routes/workflow-flow.d.ts +0 -8
- package/dist/src/internal/nitro/routes/workflow-flow.d.ts.map +0 -1
- package/dist/src/internal/nitro/routes/workflow-flow.js +0 -9
- package/dist/src/internal/nitro/routes/workflow-flow.js.map +0 -1
- package/dist/src/internal/nitro/routes/workflow-generated-handler.d.ts +0 -10
- package/dist/src/internal/nitro/routes/workflow-generated-handler.d.ts.map +0 -1
- package/dist/src/internal/nitro/routes/workflow-generated-handler.js +0 -30
- package/dist/src/internal/nitro/routes/workflow-generated-handler.js.map +0 -1
- package/dist/src/internal/nitro/routes/workflow-step.d.ts +0 -8
- package/dist/src/internal/nitro/routes/workflow-step.d.ts.map +0 -1
- package/dist/src/internal/nitro/routes/workflow-step.js +0 -9
- package/dist/src/internal/nitro/routes/workflow-step.js.map +0 -1
- package/dist/src/internal/nitro/routes/workflow-webhook.d.ts +0 -8
- package/dist/src/internal/nitro/routes/workflow-webhook.d.ts.map +0 -1
- package/dist/src/internal/nitro/routes/workflow-webhook.js +0 -9
- package/dist/src/internal/nitro/routes/workflow-webhook.js.map +0 -1
- package/dist/src/internal/nitro/runtime-configuration.d.ts +0 -16
- package/dist/src/internal/nitro/runtime-configuration.d.ts.map +0 -1
- package/dist/src/internal/nitro/runtime-configuration.js +0 -23
- package/dist/src/internal/nitro/runtime-configuration.js.map +0 -1
- package/dist/src/internal/nitro/shims/runtime-configuration-plugin.d.ts +0 -10
- package/dist/src/internal/nitro/shims/runtime-configuration-plugin.d.ts.map +0 -1
- package/dist/src/internal/nitro/shims/runtime-configuration-plugin.js +0 -17
- package/dist/src/internal/nitro/shims/runtime-configuration-plugin.js.map +0 -1
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { StepInput } from "../harness/types.js";
|
|
2
2
|
import type { HandleMessageStreamEvent } from "../protocol/message.js";
|
|
3
|
-
import
|
|
3
|
+
import { Channel, type ContextAccessor, type DeliverPayload } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Serializable state for {@link HttpChannel}.
|
|
6
|
+
*
|
|
7
|
+
* The framework's built-in HTTP channel is stateless, so the default shape is
|
|
8
|
+
* an empty object. Custom HTTP channel subclasses may extend this with their
|
|
9
|
+
* own durable fields.
|
|
10
|
+
*/
|
|
11
|
+
export type HttpChannelState = Record<string, unknown>;
|
|
4
12
|
/**
|
|
5
13
|
* Stateless channel for HTTP routes.
|
|
6
14
|
*
|
|
@@ -8,12 +16,11 @@ import type { Channel, ContextAccessor, DeliverPayload } from "./types.js";
|
|
|
8
16
|
* payloads pass through untransformed — HTTP clients send structured
|
|
9
17
|
* {@link InputResponse} objects directly.
|
|
10
18
|
*/
|
|
11
|
-
export declare class HttpChannel
|
|
12
|
-
static readonly kind
|
|
13
|
-
|
|
19
|
+
export declare class HttpChannel extends Channel {
|
|
20
|
+
static readonly kind: string;
|
|
21
|
+
constructor(_state?: HttpChannelState);
|
|
14
22
|
onEvent(event: HandleMessageStreamEvent): Promise<HandleMessageStreamEvent>;
|
|
15
23
|
onDeliver(_ctx: ContextAccessor, payload: DeliverPayload): Promise<StepInput>;
|
|
16
24
|
serialize(): Record<string, unknown>;
|
|
17
|
-
static deserialize(_state: Record<string, unknown>): HttpChannel;
|
|
18
25
|
}
|
|
19
26
|
//# sourceMappingURL=http-channel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/http-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"http-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/http-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhF;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEvD;;;;;;GAMG;AACH,qBAAa,WAAY,SAAQ,OAAO;IACtC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAU;gBAE1B,MAAM,GAAE,gBAAqB;IAInC,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAI3E,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAInF,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAGrC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Channel } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Stateless channel for HTTP routes.
|
|
4
4
|
*
|
|
@@ -6,9 +6,11 @@ import { registerChannel } from "./channel-registry.js";
|
|
|
6
6
|
* payloads pass through untransformed — HTTP clients send structured
|
|
7
7
|
* {@link InputResponse} objects directly.
|
|
8
8
|
*/
|
|
9
|
-
export class HttpChannel {
|
|
9
|
+
export class HttpChannel extends Channel {
|
|
10
10
|
static kind = "http";
|
|
11
|
-
|
|
11
|
+
constructor(_state = {}) {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
12
14
|
async onEvent(event) {
|
|
13
15
|
return event;
|
|
14
16
|
}
|
|
@@ -18,9 +20,5 @@ export class HttpChannel {
|
|
|
18
20
|
serialize() {
|
|
19
21
|
return {};
|
|
20
22
|
}
|
|
21
|
-
static deserialize(_state) {
|
|
22
|
-
return new HttpChannel();
|
|
23
|
-
}
|
|
24
23
|
}
|
|
25
|
-
registerChannel(HttpChannel);
|
|
26
24
|
//# sourceMappingURL=http-channel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-channel.js","sourceRoot":"","sources":["../../../src/channel/http-channel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"http-channel.js","sourceRoot":"","sources":["../../../src/channel/http-channel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAA6C,MAAM,YAAY,CAAC;AAWhF;;;;;;GAMG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAO;IACtC,MAAM,CAAU,IAAI,GAAW,MAAM,CAAC;IAEtC,YAAY,SAA2B,EAAE;QACvC,KAAK,EAAE,CAAC;IACV,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,KAA+B;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAqB,EAAE,OAAuB;QAC5D,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS;QACP,OAAO,EAAE,CAAC;IACZ,CAAC"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import type { StepInput } from "../harness/types.js";
|
|
2
2
|
import type { HandleMessageStreamEvent } from "../protocol/message.js";
|
|
3
|
-
import
|
|
3
|
+
import { Channel, type ContextAccessor, type DeliverPayload } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Stateless channel for scheduled runs.
|
|
6
6
|
*
|
|
7
7
|
* Events pass straight through to the stream (no side effects). Deliver
|
|
8
8
|
* payloads pass through untransformed.
|
|
9
9
|
*/
|
|
10
|
-
export declare class ScheduleChannel
|
|
10
|
+
export declare class ScheduleChannel extends Channel {
|
|
11
11
|
static readonly kind = "schedule";
|
|
12
|
-
readonly kind = "schedule";
|
|
13
12
|
onEvent(event: HandleMessageStreamEvent): Promise<HandleMessageStreamEvent>;
|
|
14
13
|
onDeliver(_ctx: ContextAccessor, payload: DeliverPayload): Promise<StepInput>;
|
|
15
14
|
serialize(): Record<string, unknown>;
|
|
16
|
-
static deserialize(_state: Record<string, unknown>): ScheduleChannel;
|
|
17
15
|
}
|
|
18
16
|
//# sourceMappingURL=schedule-channel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/schedule-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"schedule-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/schedule-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhF;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,OAAO;IAC1C,MAAM,CAAC,QAAQ,CAAC,IAAI,cAAc;IAE5B,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAI3E,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAInF,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAGrC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Channel } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Stateless channel for scheduled runs.
|
|
4
4
|
*
|
|
5
5
|
* Events pass straight through to the stream (no side effects). Deliver
|
|
6
6
|
* payloads pass through untransformed.
|
|
7
7
|
*/
|
|
8
|
-
export class ScheduleChannel {
|
|
8
|
+
export class ScheduleChannel extends Channel {
|
|
9
9
|
static kind = "schedule";
|
|
10
|
-
kind = "schedule";
|
|
11
10
|
async onEvent(event) {
|
|
12
11
|
return event;
|
|
13
12
|
}
|
|
@@ -17,9 +16,5 @@ export class ScheduleChannel {
|
|
|
17
16
|
serialize() {
|
|
18
17
|
return {};
|
|
19
18
|
}
|
|
20
|
-
static deserialize(_state) {
|
|
21
|
-
return new ScheduleChannel();
|
|
22
|
-
}
|
|
23
19
|
}
|
|
24
|
-
registerChannel(ScheduleChannel);
|
|
25
20
|
//# sourceMappingURL=schedule-channel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-channel.js","sourceRoot":"","sources":["../../../src/channel/schedule-channel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"schedule-channel.js","sourceRoot":"","sources":["../../../src/channel/schedule-channel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAA6C,MAAM,YAAY,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,OAAO;IAC1C,MAAM,CAAU,IAAI,GAAG,UAAU,CAAC;IAElC,KAAK,CAAC,OAAO,CAAC,KAA+B;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAqB,EAAE,OAAuB;QAC5D,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS;QACP,OAAO,EAAE,CAAC;IACZ,CAAC"}
|
|
@@ -2,7 +2,25 @@ import type { Actions, Button, Card, CardText, Select, SelectOption, SerializedT
|
|
|
2
2
|
import type { StepInput } from "../harness/types.js";
|
|
3
3
|
import type { HandleMessageStreamEvent } from "../protocol/message.js";
|
|
4
4
|
import type { InputRequest } from "../runtime/input/types.js";
|
|
5
|
-
import
|
|
5
|
+
import { Channel, type ContextAccessor, type DeliverPayload } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* User context for the Slack message sender, stored in channel state so
|
|
8
|
+
* agents can understand who they are interacting with.
|
|
9
|
+
*/
|
|
10
|
+
export interface SlackUserContext {
|
|
11
|
+
/** Slack user id, e.g. `U0123ABC`. */
|
|
12
|
+
readonly userId: string;
|
|
13
|
+
/** Slack handle, e.g. `jane.smith`. */
|
|
14
|
+
readonly userName: string;
|
|
15
|
+
/** Display name, e.g. `Jane Smith`. */
|
|
16
|
+
readonly fullName: string;
|
|
17
|
+
/** Slack workspace (team) id, e.g. `T0123ABC`. */
|
|
18
|
+
readonly teamId?: string;
|
|
19
|
+
/** Slack channel id where the conversation is happening, e.g. `C0123ABC`. */
|
|
20
|
+
readonly channelId: string;
|
|
21
|
+
/** Thread root timestamp identifying the conversation. */
|
|
22
|
+
readonly threadTs: string;
|
|
23
|
+
}
|
|
6
24
|
/**
|
|
7
25
|
* Minimal serializable state for the Slack channel.
|
|
8
26
|
*/
|
|
@@ -15,6 +33,12 @@ export interface SlackChannelState {
|
|
|
15
33
|
* request options.
|
|
16
34
|
*/
|
|
17
35
|
readonly pendingRequests?: readonly InputRequest[];
|
|
36
|
+
/**
|
|
37
|
+
* Context about the current Slack user and thread. Included in every
|
|
38
|
+
* message so the agent knows who it is interacting with and can use
|
|
39
|
+
* the thread id for tool calls.
|
|
40
|
+
*/
|
|
41
|
+
readonly userContext?: SlackUserContext;
|
|
18
42
|
}
|
|
19
43
|
interface RehydratedThread {
|
|
20
44
|
post(message: string | {
|
|
@@ -35,10 +59,6 @@ interface CardKit {
|
|
|
35
59
|
Select: typeof Select;
|
|
36
60
|
SelectOption: typeof SelectOption;
|
|
37
61
|
}
|
|
38
|
-
interface SlackChannelClass<TState extends SlackChannelState = SlackChannelState, T extends SlackChannel<TState> = SlackChannel<TState>> {
|
|
39
|
-
readonly kind: string;
|
|
40
|
-
new (state: TState): T;
|
|
41
|
-
}
|
|
42
62
|
/**
|
|
43
63
|
* Channel that rehydrates a Chat SDK `Thread` from serialized state and
|
|
44
64
|
* uses `thread.startTyping()` to show typing status with tool names while
|
|
@@ -51,11 +71,11 @@ interface SlackChannelClass<TState extends SlackChannelState = SlackChannelState
|
|
|
51
71
|
* Subclasses may override the static {@link kind} field and extend the
|
|
52
72
|
* channel state shape by parameterizing {@link SlackChannel} with their own
|
|
53
73
|
* `TState extends SlackChannelState`. The inherited instance {@link kind}
|
|
54
|
-
* getter
|
|
55
|
-
*
|
|
56
|
-
*
|
|
74
|
+
* getter and {@link serialize} behavior follow the subclass automatically,
|
|
75
|
+
* so stateful subclasses do not need extra boilerplate just to preserve
|
|
76
|
+
* their durable identity and JSON-serializable state.
|
|
57
77
|
*/
|
|
58
|
-
export declare class SlackChannel<TState extends SlackChannelState = SlackChannelState>
|
|
78
|
+
export declare class SlackChannel<TState extends SlackChannelState = SlackChannelState> extends Channel {
|
|
59
79
|
static readonly kind: string;
|
|
60
80
|
private _state;
|
|
61
81
|
private _cardKit;
|
|
@@ -73,10 +93,14 @@ export declare class SlackChannel<TState extends SlackChannelState = SlackChanne
|
|
|
73
93
|
protected set state(value: TState);
|
|
74
94
|
get botToken(): string | undefined;
|
|
75
95
|
get serializedThread(): SerializedThread;
|
|
76
|
-
get kind(): string;
|
|
77
96
|
serialize(): Record<string, unknown>;
|
|
78
|
-
static deserialize<TState extends SlackChannelState, T extends SlackChannel<TState>>(this: SlackChannelClass<TState, T>, state: Record<string, unknown>): T;
|
|
79
97
|
onDeliver(_ctx: ContextAccessor, payload: DeliverPayload): Promise<StepInput>;
|
|
98
|
+
/**
|
|
99
|
+
* Prepends the Slack user context XML block to a message if user context
|
|
100
|
+
* is available. This provides the agent with information about who sent
|
|
101
|
+
* the message and the thread context for potential use in tool calls.
|
|
102
|
+
*/
|
|
103
|
+
private prependUserContext;
|
|
80
104
|
onEvent(event: HandleMessageStreamEvent): Promise<HandleMessageStreamEvent>;
|
|
81
105
|
private consumePendingToolCallMessage;
|
|
82
106
|
private consumePendingToolCallStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/slack-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"slack-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/slack-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhF;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,uCAAuC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O,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,uBAAuB,CAAuB;IACtD,OAAO,CAAC,OAAO,CAAiC;gBAEpC,KAAK,EAAE,MAAM;IAKzB;;;;;;OAMG;IACH,SAAS,KAAK,KAAK,IAAI,MAAM,CAE5B;IAED,SAAS,KAAK,KAAK,CAAC,KAAK,EAAE,MAAM,EAEhC;IAED,IAAI,QAAQ,IAAI,MAAM,GAAG,SAAS,CAEjC;IAED,IAAI,gBAAgB,IAAI,gBAAgB,CAEvC;IAED,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAW9B,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAuBnF;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAYpB,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IA8CjF,OAAO,CAAC,6BAA6B;IAMrC,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,2BAA2B;IAInC,OAAO,CAAC,yBAAyB;cAKjB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;cAWjC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1D;;;OAGG;YACW,mBAAmB;IAcjC;;OAEG;cACa,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAiB9C;;;;;;;;OAQG;cACa,SAAS,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAevD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { registerChannel } from "./channel-registry.js";
|
|
2
1
|
import { resolveTextToResponses } from "./resolve-text.js";
|
|
2
|
+
import { Channel } from "./types.js";
|
|
3
3
|
const SLACK_MAX_TYPING_STATUS_LENGTH = 50;
|
|
4
4
|
function labelForAction(action) {
|
|
5
5
|
switch (action.kind) {
|
|
@@ -28,6 +28,24 @@ function truncateTypingStatus(status) {
|
|
|
28
28
|
}
|
|
29
29
|
return `${normalized.slice(0, SLACK_MAX_TYPING_STATUS_LENGTH - 3).trimEnd()}...`;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Formats user context as an XML block to prepend to messages.
|
|
33
|
+
*/
|
|
34
|
+
function formatUserContextBlock(ctx) {
|
|
35
|
+
const lines = [
|
|
36
|
+
"<slack_context>",
|
|
37
|
+
`user_id: ${ctx.userId}`,
|
|
38
|
+
`user_name: ${ctx.userName}`,
|
|
39
|
+
`full_name: ${ctx.fullName}`,
|
|
40
|
+
`channel_id: ${ctx.channelId}`,
|
|
41
|
+
`thread_ts: ${ctx.threadTs}`,
|
|
42
|
+
];
|
|
43
|
+
if (ctx.teamId !== undefined) {
|
|
44
|
+
lines.push(`team_id: ${ctx.teamId}`);
|
|
45
|
+
}
|
|
46
|
+
lines.push("</slack_context>");
|
|
47
|
+
return lines.join("\n");
|
|
48
|
+
}
|
|
31
49
|
// ---------------------------------------------------------------------------
|
|
32
50
|
// Channel
|
|
33
51
|
// ---------------------------------------------------------------------------
|
|
@@ -43,17 +61,18 @@ function truncateTypingStatus(status) {
|
|
|
43
61
|
* Subclasses may override the static {@link kind} field and extend the
|
|
44
62
|
* channel state shape by parameterizing {@link SlackChannel} with their own
|
|
45
63
|
* `TState extends SlackChannelState`. The inherited instance {@link kind}
|
|
46
|
-
* getter
|
|
47
|
-
*
|
|
48
|
-
*
|
|
64
|
+
* getter and {@link serialize} behavior follow the subclass automatically,
|
|
65
|
+
* so stateful subclasses do not need extra boilerplate just to preserve
|
|
66
|
+
* their durable identity and JSON-serializable state.
|
|
49
67
|
*/
|
|
50
|
-
export class SlackChannel {
|
|
68
|
+
export class SlackChannel extends Channel {
|
|
51
69
|
static kind = "slack";
|
|
52
70
|
_state;
|
|
53
71
|
_cardKit = null;
|
|
54
72
|
_pendingToolCallMessage = null;
|
|
55
73
|
_thread = null;
|
|
56
74
|
constructor(state) {
|
|
75
|
+
super();
|
|
57
76
|
this._state = state;
|
|
58
77
|
}
|
|
59
78
|
/**
|
|
@@ -75,9 +94,6 @@ export class SlackChannel {
|
|
|
75
94
|
get serializedThread() {
|
|
76
95
|
return this._state.serializedThread;
|
|
77
96
|
}
|
|
78
|
-
get kind() {
|
|
79
|
-
return this.constructor.kind;
|
|
80
|
-
}
|
|
81
97
|
serialize() {
|
|
82
98
|
return {
|
|
83
99
|
...this._state,
|
|
@@ -86,10 +102,6 @@ export class SlackChannel {
|
|
|
86
102
|
serializedThread: this._state.serializedThread,
|
|
87
103
|
};
|
|
88
104
|
}
|
|
89
|
-
static deserialize(state) {
|
|
90
|
-
// biome-ignore lint/complexity/noThisInStatic: deserialization must rehydrate the subclass constructor.
|
|
91
|
-
return new this(state);
|
|
92
|
-
}
|
|
93
105
|
// ── Inbound: transform delivered input ─────────────────
|
|
94
106
|
async onDeliver(_ctx, payload) {
|
|
95
107
|
// Structured responses (Slack button callback, HTTP client) —
|
|
@@ -99,7 +111,7 @@ export class SlackChannel {
|
|
|
99
111
|
}
|
|
100
112
|
// No pending requests — this is a normal conversation message.
|
|
101
113
|
if (this._state.pendingRequests === undefined || this._state.pendingRequests.length === 0) {
|
|
102
|
-
return { message: payload.message };
|
|
114
|
+
return { message: this.prependUserContext(payload.message) };
|
|
103
115
|
}
|
|
104
116
|
// Text with pending requests — resolve against stored options.
|
|
105
117
|
if (payload.message !== undefined) {
|
|
@@ -108,7 +120,21 @@ export class SlackChannel {
|
|
|
108
120
|
return { inputResponses: responses };
|
|
109
121
|
}
|
|
110
122
|
}
|
|
111
|
-
return { message: payload.message };
|
|
123
|
+
return { message: this.prependUserContext(payload.message) };
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Prepends the Slack user context XML block to a message if user context
|
|
127
|
+
* is available. This provides the agent with information about who sent
|
|
128
|
+
* the message and the thread context for potential use in tool calls.
|
|
129
|
+
*/
|
|
130
|
+
prependUserContext(message) {
|
|
131
|
+
if (message === undefined) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
if (this._state.userContext === undefined) {
|
|
135
|
+
return message;
|
|
136
|
+
}
|
|
137
|
+
return `${formatUserContextBlock(this._state.userContext)}\n\n${message}`;
|
|
112
138
|
}
|
|
113
139
|
// ── Outbound: render events to Slack ───────────────────
|
|
114
140
|
async onEvent(event) {
|
|
@@ -252,7 +278,6 @@ export class SlackChannel {
|
|
|
252
278
|
return thread;
|
|
253
279
|
}
|
|
254
280
|
}
|
|
255
|
-
registerChannel(SlackChannel);
|
|
256
281
|
const INPUT_OPTION_STYLE_TO_BUTTON_STYLE = {
|
|
257
282
|
danger: "danger",
|
|
258
283
|
default: undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-channel.js","sourceRoot":"","sources":["../../../src/channel/slack-channel.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"slack-channel.js","sourceRoot":"","sources":["../../../src/channel/slack-channel.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAA6C,MAAM,YAAY,CAAC;AA4DhF,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAE1C,SAAS,cAAc,CAAC,MAA4B;IAClD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB,KAAK,eAAe;YAClB,OAAO,MAAM,CAAC,YAAY,CAAC;QAC7B,KAAK,WAAW;YACd,OAAO,MAAM,CAAC,QAAQ,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,SAAS,2BAA2B,CAAC,IAAY;IAC/C,MAAM,SAAS,GAAG,IAAI;SACnB,KAAK,CAAC,QAAQ,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,IAAI,CAAC,CA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CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChG,OAAO,GAAG,CAAC,IAAI,CAAC;YACd,QAAQ,EAAE;gBACR,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;gBAC5B,GAAG,CAAC,OAAO,CAAC;oBACV,GAAG,CAAC,MAAM,CAAC;wBACT,EAAE,EAAE,UAAU,OAAO,CAAC,SAAS,EAAE;wBACjC,KAAK,EAAE,kBAAkB;wBACzB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACnC,GAAG,CAAC,YAAY,CAAC;4BACf,WAAW,EAAE,GAAG,CAAC,WAAW;4BAC5B,KAAK,EAAE,GAAG,CAAC,KAAK;4BAChB,KAAK,EAAE,GAAG,CAAC,EAAE;yBACd,CAAC,CACH;qBACF,CAAC;iBACH,CAAC;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAED,gEAAgE;IAChE,OAAO,GAAG,CAAC,IAAI,CAAC;QACd,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KACzC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StepInput } from "../harness/types.js";
|
|
2
2
|
import { type HandleMessageStreamEvent } from "../protocol/message.js";
|
|
3
|
-
import
|
|
3
|
+
import { Channel, type ContextAccessor, type DeliverPayload } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Serializable state for the subagent channel.
|
|
6
6
|
*
|
|
@@ -28,9 +28,8 @@ export interface SubagentChannelState {
|
|
|
28
28
|
* like {@link SlackChannel} that hold serializable state and
|
|
29
29
|
* do real work in `onEvent`.
|
|
30
30
|
*/
|
|
31
|
-
export declare class SubagentChannel
|
|
31
|
+
export declare class SubagentChannel extends Channel {
|
|
32
32
|
static readonly kind = "subagent";
|
|
33
|
-
readonly kind = "subagent";
|
|
34
33
|
private readonly _state;
|
|
35
34
|
constructor(state: SubagentChannelState);
|
|
36
35
|
get callId(): string;
|
|
@@ -38,6 +37,5 @@ export declare class SubagentChannel implements Channel {
|
|
|
38
37
|
onEvent(event: HandleMessageStreamEvent): Promise<HandleMessageStreamEvent>;
|
|
39
38
|
onDeliver(_ctx: ContextAccessor, payload: DeliverPayload): Promise<StepInput>;
|
|
40
39
|
serialize(): Record<string, unknown>;
|
|
41
|
-
static deserialize(state: Record<string, unknown>): SubagentChannel;
|
|
42
40
|
}
|
|
43
41
|
//# sourceMappingURL=subagent-channel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/subagent-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"subagent-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/subagent-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhF;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,eAAgB,SAAQ,OAAO;IAC1C,MAAM,CAAC,QAAQ,CAAC,IAAI,cAAc;IAElC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;gBAElC,KAAK,EAAE,oBAAoB;IAKvC,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,YAAY,IAAI,MAAM,CAEzB;IAEK,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAQ3E,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAInF,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMrC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSubagentChildEventEvent, } from "../protocol/message.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Channel } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Channel attached to a delegated subagent child run.
|
|
5
5
|
*
|
|
@@ -16,11 +16,11 @@ import { registerChannel } from "./channel-registry.js";
|
|
|
16
16
|
* like {@link SlackChannel} that hold serializable state and
|
|
17
17
|
* do real work in `onEvent`.
|
|
18
18
|
*/
|
|
19
|
-
export class SubagentChannel {
|
|
19
|
+
export class SubagentChannel extends Channel {
|
|
20
20
|
static kind = "subagent";
|
|
21
|
-
kind = "subagent";
|
|
22
21
|
_state;
|
|
23
22
|
constructor(state) {
|
|
23
|
+
super();
|
|
24
24
|
this._state = state;
|
|
25
25
|
}
|
|
26
26
|
get callId() {
|
|
@@ -45,12 +45,5 @@ export class SubagentChannel {
|
|
|
45
45
|
subagentName: this._state.subagentName,
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
static deserialize(state) {
|
|
49
|
-
return new SubagentChannel({
|
|
50
|
-
callId: state.callId,
|
|
51
|
-
subagentName: state.subagentName,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
48
|
}
|
|
55
|
-
registerChannel(SubagentChannel);
|
|
56
49
|
//# sourceMappingURL=subagent-channel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-channel.js","sourceRoot":"","sources":["../../../src/channel/subagent-channel.ts"],"names":[],"mappings":"AACA,OAAO,EACL,6BAA6B,GAE9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"subagent-channel.js","sourceRoot":"","sources":["../../../src/channel/subagent-channel.ts"],"names":[],"mappings":"AACA,OAAO,EACL,6BAA6B,GAE9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAA6C,MAAM,YAAY,CAAC;AAchF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,eAAgB,SAAQ,OAAO;IAC1C,MAAM,CAAU,IAAI,GAAG,UAAU,CAAC;IAEjB,MAAM,CAAuB;IAE9C,YAAY,KAA2B;QACrC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,KAA+B;QAC3C,OAAO,6BAA6B,CAAC;YACnC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC1B,KAAK;YACL,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;SACvC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAqB,EAAE,OAAuB;QAC5D,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS;QACP,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC1B,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;SACvC,CAAC;IACJ,CAAC"}
|
|
@@ -3,6 +3,12 @@ import type { StepInput } from "../harness/types.js";
|
|
|
3
3
|
import type { HandleMessageStreamEvent } from "../protocol/message.js";
|
|
4
4
|
import type { RunMode } from "../run-mode.js";
|
|
5
5
|
import type { InputResponse } from "../runtime/input/types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Global symbol brand used to recognize Ash channel classes across
|
|
8
|
+
* independently-loaded copies of the package during compile/runtime tests.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CHANNEL_CLASS_BRAND: unique symbol;
|
|
11
|
+
export declare const CHANNEL_PROTOTYPE_BRAND: unique symbol;
|
|
6
12
|
/**
|
|
7
13
|
* Identifies one turn within a session.
|
|
8
14
|
*/
|
|
@@ -22,8 +28,8 @@ export interface SessionParent {
|
|
|
22
28
|
* Authenticated caller principal attached to a request.
|
|
23
29
|
*
|
|
24
30
|
* Produced by route-level auth strategies (JWT, OIDC, HTTP Basic, etc.)
|
|
25
|
-
* and
|
|
26
|
-
* {@link
|
|
31
|
+
* and passed to the runtime on {@link RunInput.auth} and
|
|
32
|
+
* {@link DeliverInput.auth}.
|
|
27
33
|
*/
|
|
28
34
|
export interface SessionAuthContext {
|
|
29
35
|
readonly attributes: Readonly<Record<string, string | readonly string[]>>;
|
|
@@ -34,7 +40,7 @@ export interface SessionAuthContext {
|
|
|
34
40
|
readonly subject?: string;
|
|
35
41
|
}
|
|
36
42
|
/**
|
|
37
|
-
* Narrow accessor passed to {@link Channel.
|
|
43
|
+
* Narrow accessor passed to {@link Channel.onDeliver} callbacks. Exposes only
|
|
38
44
|
* typed get/set with {@link ContextKey} — keeps channel code
|
|
39
45
|
* workflow-agnostic and prevents channels from depending on
|
|
40
46
|
* {@link AshContext} internals such as `entries()` or `has()`.
|
|
@@ -81,25 +87,40 @@ export interface HookPayload {
|
|
|
81
87
|
* A channel carries auth, renders outbound events to the platform,
|
|
82
88
|
* transforms inbound deliver payloads, and optionally sets custom
|
|
83
89
|
* context keys. It is serialized across workflow step boundaries via
|
|
84
|
-
* {@link serialize}
|
|
85
|
-
*
|
|
86
|
-
* The framework's `ChannelKey` codec calls these methods through a
|
|
87
|
-
* process-global registry keyed by {@link kind} — the registry is
|
|
88
|
-
* populated when a channel module is imported and calls
|
|
89
|
-
* `registerChannel`.
|
|
90
|
+
* {@link serialize} plus constructor-based rehydration performed by the
|
|
91
|
+
* runtime-owned channel registry.
|
|
90
92
|
*
|
|
91
|
-
* Channels are
|
|
92
|
-
*
|
|
93
|
-
* {@link
|
|
94
|
-
*
|
|
93
|
+
* Channels are class-based durable values. Authors define a concrete
|
|
94
|
+
* subclass, declare a unique static `kind`, and pass an instance on
|
|
95
|
+
* {@link RunInput.channel}. The runtime invokes {@link onEvent} /
|
|
96
|
+
* {@link onDeliver} during the step loop. Auth is separate from the
|
|
97
|
+
* channel — it lives on {@link RunInput.auth} and
|
|
95
98
|
* {@link DeliverInput.auth}.
|
|
96
99
|
*/
|
|
97
|
-
export
|
|
100
|
+
export declare abstract class Channel {
|
|
98
101
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
102
|
+
* Runtime marker inherited by every channel subclass constructor.
|
|
103
|
+
* Used by route-definition validation without relying on `instanceof`
|
|
104
|
+
* across multiple loaded copies of the package.
|
|
101
105
|
*/
|
|
102
|
-
readonly
|
|
106
|
+
static readonly [CHANNEL_CLASS_BRAND] = true;
|
|
107
|
+
/**
|
|
108
|
+
* Runtime marker inherited by every channel subclass prototype.
|
|
109
|
+
* Route-definition validation reads this through the subclass prototype
|
|
110
|
+
* chain so authored channels from another loaded package copy still
|
|
111
|
+
* register correctly.
|
|
112
|
+
*/
|
|
113
|
+
protected get [CHANNEL_PROTOTYPE_BRAND](): true;
|
|
114
|
+
/**
|
|
115
|
+
* Nominal marker that prevents plain object literals from satisfying
|
|
116
|
+
* the channel contract. Durable channels must be real class instances.
|
|
117
|
+
*/
|
|
118
|
+
protected readonly __channelBrand: undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Stable identifier for this channel instance, derived from the
|
|
121
|
+
* subclass's static {@link ChannelClass.kind} field.
|
|
122
|
+
*/
|
|
123
|
+
get kind(): string;
|
|
103
124
|
/**
|
|
104
125
|
* Outbound: called by the runtime for every lifecycle event. Returns
|
|
105
126
|
* the event to write to the stream — usually the same event passed
|
|
@@ -109,7 +130,7 @@ export interface Channel {
|
|
|
109
130
|
* Platform-specific side effects (Slack typing indicators, message
|
|
110
131
|
* posting, etc.) happen inside this method before returning.
|
|
111
132
|
*/
|
|
112
|
-
onEvent(event: HandleMessageStreamEvent): Promise<HandleMessageStreamEvent>;
|
|
133
|
+
abstract onEvent(event: HandleMessageStreamEvent): Promise<HandleMessageStreamEvent>;
|
|
113
134
|
/**
|
|
114
135
|
* Called once per turn — both the initial `run()` and each
|
|
115
136
|
* `deliver()` — after auth keys have been seeded on the context.
|
|
@@ -123,28 +144,37 @@ export interface Channel {
|
|
|
123
144
|
* Async so channels can fetch platform data (thread history, user
|
|
124
145
|
* profiles, etc.) before the step runs.
|
|
125
146
|
*/
|
|
126
|
-
onDeliver(ctx: ContextAccessor, payload: DeliverPayload): Promise<StepInput>;
|
|
147
|
+
abstract onDeliver(ctx: ContextAccessor, payload: DeliverPayload): Promise<StepInput>;
|
|
127
148
|
/**
|
|
128
149
|
* Returns the JSON-serializable state needed to reconstruct this
|
|
129
150
|
* channel after a workflow step boundary. The framework wraps the
|
|
130
151
|
* result in `{ kind, state }` and stores it on the durable workflow
|
|
131
152
|
* context.
|
|
132
153
|
*/
|
|
133
|
-
serialize(): Record<string, unknown>;
|
|
154
|
+
abstract serialize(): Record<string, unknown>;
|
|
134
155
|
}
|
|
135
156
|
/**
|
|
136
157
|
* Static interface implemented by every {@link Channel} class. Used by
|
|
137
|
-
* the channel registry to look up a class by `kind` and
|
|
138
|
-
* instance from previously-serialized state.
|
|
158
|
+
* the runtime-owned channel registry to look up a class by `kind` and
|
|
159
|
+
* rebuild an instance from previously-serialized state.
|
|
139
160
|
*/
|
|
140
161
|
export interface ChannelClass<C extends Channel = Channel> {
|
|
162
|
+
/**
|
|
163
|
+
* Stable durable identifier for the channel subclass. Must be unique
|
|
164
|
+
* across all serializable channel classes visible to one runtime bundle.
|
|
165
|
+
*/
|
|
141
166
|
readonly kind: string;
|
|
142
167
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
168
|
+
* Constructs a channel instance. Specific route helpers may constrain the
|
|
169
|
+
* constructor input shape further (for example Slack channel classes accept
|
|
170
|
+
* {@link import("./slack-channel.js").SlackChannelState}).
|
|
145
171
|
*/
|
|
146
|
-
|
|
172
|
+
new (...args: never[]): C;
|
|
147
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Returns the static durable kind for a channel class.
|
|
176
|
+
*/
|
|
177
|
+
export declare function getChannelClassKind(channelClass: ChannelClass): string;
|
|
148
178
|
/**
|
|
149
179
|
* Single input shape consumed by {@link Runtime.run} for both root runs
|
|
150
180
|
* (started by routes) and delegated child runs (started by the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/channel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/channel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,mBAAmB,eAAkC,CAAC;AACnE,eAAO,MAAM,uBAAuB,eAAsC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