channelstack 0.1.1 → 0.2.0

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.
Files changed (28) hide show
  1. package/README.md +1 -1
  2. package/dist/integrations/checks/index.d.ts +40 -7
  3. package/dist/integrations/checks/index.js +525 -69
  4. package/dist/integrations/matchers-core/index.d.ts +90 -11
  5. package/dist/integrations/matchers-core/index.js +356 -15
  6. package/dist/integrations/matchers-core/matchers.test.js +251 -3
  7. package/dist/integrations/vitest/index.d.ts +4 -2
  8. package/dist/integrations/vitest/setup.js +33 -3
  9. package/dist/sdks/typescript/client.d.ts +5 -4
  10. package/dist/sdks/typescript/client.js +4 -4
  11. package/dist/sdks/typescript/generated/channels.d.ts +17 -9
  12. package/dist/sdks/typescript/generated/channels.js +3 -1
  13. package/dist/sdks/typescript/generated/index.d.ts +1744 -313
  14. package/dist/sdks/typescript/generated/index.js +1991 -422
  15. package/dist/sdks/typescript/generated/normalisation.d.ts +18 -0
  16. package/dist/sdks/typescript/generated/normalisation.js +14 -0
  17. package/dist/sdks/typescript/runtime/client.d.ts +9 -0
  18. package/dist/sdks/typescript/runtime/client.js +5 -0
  19. package/dist/sdks/typescript/runtime/files.d.ts +17 -2
  20. package/dist/sdks/typescript/runtime/files.js +11 -3
  21. package/dist/sdks/typescript/runtime/launcher.d.ts +5 -2
  22. package/dist/sdks/typescript/runtime/launcher.js +6 -3
  23. package/dist/sdks/typescript/runtime/responder.d.ts +26 -0
  24. package/dist/sdks/typescript/runtime/responder.js +42 -0
  25. package/dist/sdks/typescript/runtime/wait.d.ts +14 -0
  26. package/dist/sdks/typescript/runtime/wait.js +23 -0
  27. package/dist/sdks/typescript/types.d.ts +16 -6
  28. package/package.json +9 -7
@@ -1,6 +1,11 @@
1
- import { describe, expect, test } from "vitest";
2
- import { ChannelstackError, QUIET } from "../../sdks/typescript/client.js";
3
- import { matchers } from "./index.js";
1
+ import { createHash } from "node:crypto";
2
+ import { mkdtempSync, writeFileSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { afterEach, describe, expect, test } from "vitest";
6
+ import { ChannelstackError, QUIET, setFilesRoot } from "../../sdks/typescript/client.js";
7
+ import { CONTEXT } from "../../sdks/typescript/runtime/client.js";
8
+ import { matchers, modelNotes } from "./index.js";
4
9
  const state = { isNot: false, timeout: "100ms", quietFor: "10ms" };
5
10
  const negated = { ...state, isNot: true };
6
11
  const quiet = { [QUIET]: async () => ({ busy: false, quietForMs: 60_000, open: [] }) };
@@ -157,3 +162,246 @@ describe("comments", () => {
157
162
  expect((await matchers.toHaveCommentsFrom(state, discussion, agent, { count: 1 })).pass).toBe(true);
158
163
  });
159
164
  });
165
+ describe("toHaveSentFile", () => {
166
+ const png = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0, 255]);
167
+ const sha256 = createHash("sha256").update(png).digest("hex");
168
+ const root = mkdtempSync(join(tmpdir(), "cs-sent-file-"));
169
+ writeFileSync(join(root, "chart.png"), png);
170
+ afterEach(() => setFilesRoot(undefined));
171
+ /** The openai fixture: its calls, the newest last, with what they carried. */
172
+ const fixture = (...requests) => ({
173
+ ...quiet,
174
+ calls: async () => requests.map((request) => ({ request: { text: "", tools: [], ...request } })),
175
+ });
176
+ const sent = fixture({
177
+ messages: [
178
+ {
179
+ role: "user",
180
+ text: "what is this?",
181
+ parts: [{ type: "image", from: "url", url: "https://example.com/a.png" }],
182
+ },
183
+ ],
184
+ },
185
+ // A media endpoint's call: its file is its message's first part.
186
+ {
187
+ messages: [
188
+ {
189
+ role: "user",
190
+ text: "",
191
+ parts: [{ type: "audio", from: "data", mediaType: "audio/wav", bytes: 44, sha256: "ab".repeat(32) }],
192
+ },
193
+ ],
194
+ }, {
195
+ messages: [
196
+ { role: "system", text: "be brief" },
197
+ {
198
+ role: "user",
199
+ text: "and this?",
200
+ parts: [{ type: "image", from: "data", mediaType: "image/png", bytes: 6, sha256 }],
201
+ },
202
+ ],
203
+ });
204
+ test("holds for a fixture file's path, from the files root, and for its bytes", async () => {
205
+ setFilesRoot(root);
206
+ expect((await matchers.toHaveSentFile(state, sent, "./chart.png")).pass).toBe(true);
207
+ expect((await matchers.toHaveSentFile(state, sent, png)).pass).toBe(true);
208
+ // One call is a subject too: `refresh()` reads it again.
209
+ const call = {
210
+ request: { text: "", tools: [] },
211
+ refresh: async () => ({
212
+ request: {
213
+ text: "",
214
+ tools: [],
215
+ messages: [{ role: "user", text: "", parts: [{ type: "image", from: "data", sha256 }] }],
216
+ },
217
+ }),
218
+ };
219
+ expect((await matchers.toHaveSentFile(state, call, png)).pass).toBe(true);
220
+ });
221
+ test("fails with what was expected and what was sent, newest first", async () => {
222
+ const result = await matchers.toHaveSentFile(state, sent, new Uint8Array([1, 2, 3]));
223
+ expect(result.pass).toBe(false);
224
+ expect(result.message()).toBe([
225
+ "Expected the agent to send the model these bytes (3 bytes, sha256 039058c6f2c0). What it sent, newest first:",
226
+ ` image, image/png, 6 bytes, sha256 ${sha256.slice(0, 12)}`,
227
+ " audio, audio/wav, 44 bytes, sha256 abababababab",
228
+ " image, https://example.com/a.png",
229
+ ].join("\n"));
230
+ const none = await matchers.toHaveSentFile(state, fixture({ messages: [{ role: "user", text: "hi" }] }), join(root, "chart.png"));
231
+ expect(none.message()).toBe(`Expected the agent to send the model chart.png (6 bytes, sha256 ${sha256.slice(0, 12)}). It sent no image, file or audio.`);
232
+ });
233
+ test("`not.` waits for quiet and fails when the file was sent", async () => {
234
+ const result = await matchers.toHaveSentFile(negated, sent, png);
235
+ expect(result.pass).toBe(true);
236
+ expect(result.message()).toMatch(/^Expected the agent not to send the model these bytes \(6 bytes/);
237
+ expect((await matchers.toHaveSentFile(negated, sent, new Uint8Array([1]))).pass).toBe(false);
238
+ });
239
+ test("a path that isn't there is an error", async () => {
240
+ setFilesRoot(root);
241
+ await expect(async () => matchers.toHaveSentFile(state, sent, "./missing.png")).rejects.toThrow(/ENOENT/);
242
+ });
243
+ });
244
+ describe("the model", () => {
245
+ /** A script whose calls are these: what `toHaveAnswered` counts. */
246
+ const script = (responses, problems = []) => ({
247
+ ...quiet,
248
+ id: "ms_1",
249
+ refresh: async () => ({ used: responses.length, problems }),
250
+ calls: async () => responses.map((response) => ({ response })),
251
+ });
252
+ test("toHaveAnswered counts the turns that reached the agent, not those the fake refused", async () => {
253
+ const refused = script([{ error: "channelstack_no_script" }], ["ms_1 called `search_incidents`, but the request offered no tools"]);
254
+ const result = await matchers.toHaveAnswered(state, refused);
255
+ expect(result.pass).toBe(false);
256
+ expect(result.message()).toBe("Expected script ms_1 to answer a call, it answered 0. Its problems:\n ms_1 called `search_incidents`, but the request offered no tools");
257
+ // A held call (a responder still answering) isn't answered yet; a scripted error is an answer.
258
+ expect((await matchers.toHaveAnswered(state, script([{}]))).pass).toBe(false);
259
+ const answered = script([
260
+ { text: "All good." },
261
+ { error: "rate_limit_exceeded" },
262
+ { error: "channelstack_no_script" },
263
+ ]);
264
+ expect((await matchers.toHaveAnswered(state, answered, { times: 2 })).pass).toBe(true);
265
+ });
266
+ test("toHaveAnswered leaves out a call the agent hung up on before its first token, not a scripted timeout", async () => {
267
+ // The fake had the answer, but the agent was gone before a byte of it was sent.
268
+ const abandoned = script([{ status: 0, text: "Too late.", end: "aborted" }]);
269
+ const result = await matchers.toHaveAnswered(state, abandoned);
270
+ expect(result.pass).toBe(false);
271
+ expect(result.message()).toBe("Expected script ms_1 to answer a call, it answered 0");
272
+ const counted = script([
273
+ { status: 0, text: "Too late.", end: "aborted" },
274
+ { status: 0, error: "timeout", end: "aborted" },
275
+ { status: 200, text: "Half of it", end: "aborted" },
276
+ ]);
277
+ expect((await matchers.toHaveAnswered(state, counted, { times: 2 })).pass).toBe(true);
278
+ });
279
+ test("toHaveSent compares text as attribution does: a Slack link is its URL", async () => {
280
+ const call = {
281
+ ...quiet,
282
+ request: { text: "Ana: Deploy https://example.com/runs/7 NOW", tools: [] },
283
+ };
284
+ const sent = await matchers.toHaveSent(state, call, {
285
+ text: "<@U08B5K2M9QX> deploy <https://example.com/runs/7|the run> now",
286
+ });
287
+ expect(sent.pass).toBe(true);
288
+ });
289
+ /** A handle in session `ses_1` whose server answers these model reads. */
290
+ const inSession = (reads, asked = []) => ({
291
+ ...quiet,
292
+ [CONTEXT]: () => ({
293
+ session: "ses_1",
294
+ transport: {
295
+ request: async (_method, path, options) => {
296
+ asked.push([path, options?.query]);
297
+ return path.endsWith("/unattributed") ? (reads.unattributed ?? []) : (reads.calls ?? []);
298
+ },
299
+ },
300
+ }),
301
+ replies: async () => [],
302
+ });
303
+ test("a failing check names the model calls no session claimed, recent ones only", async () => {
304
+ const asked = [];
305
+ const subject = inSession({
306
+ unattributed: [
307
+ {
308
+ id: "chatcmpl-1",
309
+ lastUserText: "summarise the backlog",
310
+ sinceMs: 2400,
311
+ message: "this call couldn't be attributed to any test: nothing in it matches.",
312
+ },
313
+ ],
314
+ }, asked);
315
+ const result = await matchers.toHaveReplyFrom(state, subject, "my-agent");
316
+ expect(result.pass).toBe(false);
317
+ expect(result.message()).toBe([
318
+ "Expected a reply from my-agent. The thread has:\n (nothing)",
319
+ "1 model call in the last 10s couldn't be attributed to a test:",
320
+ ' chatcmpl-1 ("summarise the backlog", 2s ago): this call couldn\'t be attributed to any test: nothing in it matches.',
321
+ ].join("\n"));
322
+ expect(asked).toContainEqual(["/sessions/ses_1/openai/unattributed", { withinMs: 10_000 }]);
323
+ // A check that passes reads nothing more.
324
+ asked.length = 0;
325
+ expect((await matchers.toHaveReplyFrom(negated, subject, "my-agent")).pass).toBe(false);
326
+ expect(asked).toEqual([]);
327
+ });
328
+ test("a failing check names the sessions a call attributed by order tied with", async () => {
329
+ const byOrder = (id) => ({
330
+ id,
331
+ request: { context: { attributedBy: "order", matched: "@my-agent hello", tiedWith: ["ses_2"] } },
332
+ });
333
+ const subject = inSession({
334
+ calls: [byOrder("chatcmpl-1"), { id: "chatcmpl-2", request: { context: { attributedBy: "text" } } }],
335
+ });
336
+ const result = await matchers.toHaveReplyFrom(state, subject, "my-agent");
337
+ expect(result.message()).toBe([
338
+ "Expected a reply from my-agent. The thread has:\n (nothing)",
339
+ 'Model call chatcmpl-1 was attributed by order, between 2 sessions that all sent "@my-agent hello" (this one and ses_2): each went to the oldest unanswered message. Give each test\'s prompt something of its own, or have the agent send `user`.',
340
+ ].join("\n"));
341
+ const [both, ...more] = modelNotes([], [byOrder("chatcmpl-1"), byOrder("chatcmpl-3")]);
342
+ expect(both).toMatch(/^Model calls chatcmpl-1, chatcmpl-3 were attributed by order, between 2 sessions/);
343
+ expect(more).toEqual([]);
344
+ });
345
+ test("a failing check adds nothing when the server can't say (live)", async () => {
346
+ const subject = {
347
+ ...quiet,
348
+ [CONTEXT]: () => ({
349
+ session: "ses_1",
350
+ transport: {
351
+ request: async () => {
352
+ throw new ChannelstackError("unsupported_in_live", 422, "the fake OpenAI isn't live");
353
+ },
354
+ },
355
+ }),
356
+ replies: async () => [],
357
+ };
358
+ const result = await matchers.toHaveReplyFrom(state, subject, "my-agent");
359
+ expect(result.message()).toBe("Expected a reply from my-agent. The thread has:\n (nothing)");
360
+ });
361
+ });
362
+ describe("toGoQuiet (exit check 12.6)", () => {
363
+ const coder = { id: "A0CODER", name: "coder", kind: "app" };
364
+ const loop = (turns) => [
365
+ entry("1", ana, "fix the login page"),
366
+ ...Array.from({ length: turns }, (_, at) => entry(String(at + 2), at % 2 === 0 ? agent : coder, `turn ${at}`)),
367
+ ];
368
+ test("a conversation that settles within the bound passes", async () => {
369
+ expect((await matchers.toGoQuiet(state, conversation(loop(2)), { maxReplies: 4 })).pass).toBe(true);
370
+ });
371
+ test("apps answering each other fail it, counting what came before the check, and the message names them in turn", async () => {
372
+ const result = await matchers.toGoQuiet(state, conversation(loop(5)), { maxReplies: 4 });
373
+ expect(result.pass).toBe(false);
374
+ expect(result.message()).toBe("Expected the conversation to go quiet within 100ms with at most 4 app messages since a person last wrote. It went quiet with 5 app messages and no person between them: my-agent → coder → my-agent → coder → my-agent");
375
+ });
376
+ test("a person writing starts the count over", async () => {
377
+ const entries = [...loop(4), entry("9", ana, "thanks"), entry("10", agent, "you're welcome")];
378
+ expect((await matchers.toGoQuiet(state, conversation(entries), { maxReplies: 1 })).pass).toBe(true);
379
+ });
380
+ test("a conversation that never goes quiet fails, and says it was busy and what the fake stopped", async () => {
381
+ const busy = {
382
+ ...conversation(loop(1)),
383
+ [QUIET]: async () => ({
384
+ busy: true,
385
+ quietForMs: 0,
386
+ open: ["1 delivery in flight"],
387
+ loops: ["a bot loop in slack C1 (50 app messages with no person between them: my-agent → coder …)"],
388
+ }),
389
+ };
390
+ const result = await matchers.toGoQuiet(state, busy, { within: "50ms", maxReplies: 4 });
391
+ expect(result.pass).toBe(false);
392
+ expect(result.message()).toContain("It was still busy with 1 app message");
393
+ expect(result.message()).toContain("Stopped: a bot loop in slack C1 (50 app messages");
394
+ });
395
+ test("comments count the same way: a GitHub issue, a Linear issue", async () => {
396
+ const issue = {
397
+ ...quiet,
398
+ comments: async () => [
399
+ { author: ana, body: "please triage" },
400
+ { author: agent, body: "on it" },
401
+ { author: coder, body: "done" },
402
+ ],
403
+ };
404
+ expect((await matchers.toGoQuiet(state, issue, { maxReplies: 1 })).pass).toBe(false);
405
+ expect((await matchers.toGoQuiet(state, issue, { maxReplies: 2 })).pass).toBe(true);
406
+ });
407
+ });
@@ -1,4 +1,4 @@
1
- import type { ChannelFixtures, Duration } from "../../sdks/typescript/client.ts";
1
+ import type { ChannelFixtures, Duration, ProviderFixtures } from "../../sdks/typescript/client.ts";
2
2
  import type { MatcherName, matchers } from "../matchers-core/index.ts";
3
3
  export interface ChannelstackIntegrationOptions {
4
4
  /** Attach to this server instead of the one in `server.json`. Also `CHANNELSTACK_URL`. */
@@ -20,6 +20,8 @@ export interface ChannelstackIntegrationOptions {
20
20
  export interface ChannelstackFixture {
21
21
  /** Control API and UI base, e.g. `https://channelstack.localhost`. */
22
22
  readonly url: string;
23
+ /** This test's session: what a model call can carry (`user`, or the `x-channelstack-session` header) to be the test's for sure. */
24
+ readonly sessionId: string;
23
25
  /** Env vars for the agent: tokens, secrets and API URLs (what `channelstack env` prints). */
24
26
  env(): Promise<Record<string, string>>;
25
27
  /** Resolve when the agent is quiet in this test's session. */
@@ -36,7 +38,7 @@ type ChannelstackMatchers = {
36
38
  [Name in MatcherName]: (...args: MatcherArguments<Name>) => Promise<void>;
37
39
  };
38
40
  declare module "vitest" {
39
- interface TestContext extends ChannelFixtures {
41
+ interface TestContext extends ChannelFixtures, ProviderFixtures {
40
42
  channelstack: ChannelstackFixture;
41
43
  }
42
44
  interface Matchers<R extends void | Promise<void> = void | Promise<void>, T = unknown> extends ChannelstackMatchers {
@@ -1,6 +1,6 @@
1
1
  import { dirname } from "node:path";
2
2
  import { expect, inject, test } from "vitest";
3
- import { CHANNEL_NAMES, ChannelstackError, connect, onRefusal, setFilesRoot, setWaitDefaults, untilQuiet, } from "../../sdks/typescript/client.js";
3
+ import { CHANNEL_NAMES, ChannelstackError, connect, onRefusal, PROVIDER_NAMES, setFilesRoot, setWaitDefaults, unreportedRefusals, untilQuiet, } from "../../sdks/typescript/client.js";
4
4
  import { matchers } from "../matchers-core/index.js";
5
5
  import { refusedFixture, SKIPS_LIVE, unskipped } from "./refused.js";
6
6
  /** Runs in every test worker: one client per worker, one session per test, and the matchers. */
@@ -60,6 +60,25 @@ function channelFixture(open) {
60
60
  };
61
61
  }
62
62
  const auto = { auto: true };
63
+ /**
64
+ * A test fails when the fake had to stop a bot loop in its session (decision 0027): apps that
65
+ * answer each other without end are a bug, whether or not the test asserted anything. Where the
66
+ * server can't tell (live, without proxy mode), there is nothing to report.
67
+ */
68
+ async function failOnLoops(session) {
69
+ let loops;
70
+ try {
71
+ // Unreported: a refusal here must not turn the test into a skip with the wrong reason.
72
+ loops = (await unreportedRefusals(() => session.quiet())).loops;
73
+ }
74
+ catch (error) {
75
+ if (error instanceof ChannelstackError)
76
+ return;
77
+ throw error;
78
+ }
79
+ if (loops !== undefined && loops.length > 0)
80
+ throw new Error(`The fake stopped ${loops.join("; ")}`);
81
+ }
63
82
  test.override({
64
83
  channelstackSession: [
65
84
  async ({ task, skip }, use) => {
@@ -67,14 +86,24 @@ test.override({
67
86
  // A fixture path in a test (`files: "./fixtures/web"`) starts from the test file, like an import.
68
87
  setFilesRoot(dirname(task.file.filepath));
69
88
  skips.set(session.sessionId, skip);
89
+ let problems = [];
70
90
  try {
71
91
  await use(session);
92
+ await failOnLoops(session);
72
93
  }
73
94
  finally {
74
95
  skips.delete(session.sessionId);
96
+ // What went wrong with the model fails the test even if it asserted nothing about it
97
+ // (decision 0029): read before the session, and its record, are gone.
98
+ problems = await session
99
+ .quiet()
100
+ .then((state) => state.problems)
101
+ .catch(() => []);
75
102
  // Closing the session removes everything the test created. Disposing never fails a test.
76
103
  await session[Symbol.asyncDispose]();
77
104
  }
105
+ if (problems.length > 0)
106
+ throw new Error(`The model calls of this test went wrong:\n${problems.map((problem) => ` ${problem}`).join("\n")}`);
78
107
  },
79
108
  auto,
80
109
  ],
@@ -83,6 +112,7 @@ test.override({
83
112
  const channelstack = await connected();
84
113
  await use({
85
114
  url: server.url,
115
+ sessionId: session.sessionId,
86
116
  env: () => channelstack.env(),
87
117
  quiet: (options = {}) => untilQuiet(() => session.quiet(), options),
88
118
  reset: () => channelstack.reset(),
@@ -90,8 +120,8 @@ test.override({
90
120
  },
91
121
  auto,
92
122
  ],
93
- // One fixture per channel, by its name: `slack` opens `session.slack()`.
94
- ...Object.fromEntries(CHANNEL_NAMES.map((name) => [name, [channelFixture((session) => session[name]()), auto]])),
123
+ // One fixture per channel, by its name: `slack` opens `session.slack()`; and one per provider (`openai`).
124
+ ...Object.fromEntries([...CHANNEL_NAMES, ...PROVIDER_NAMES].map((name) => [name, [channelFixture((session) => session[name]()), auto]])),
95
125
  });
96
126
  expect.extend(
97
127
  // Vitest types a matcher's `this` as its own state; the adapter only needs `isNot` from it.
@@ -1,13 +1,14 @@
1
1
  /**
2
2
  * `channelstack` and `channelstack/client`: the generated client the test integrations are built
3
- * on, and its types (`import type { SlackUser } from "channelstack"`). The public contract is `api/*.d.ts`.
3
+ * on, and its types (`import type { SlackUser } from "channelstack"`).
4
4
  */
5
- export { CHANNEL_NAMES, type ChannelFixtures } from "./generated/channels.ts";
5
+ export { CHANNEL_NAMES, type ChannelFixtures, PROVIDER_NAMES, type ProviderFixtures } from "./generated/channels.ts";
6
6
  export * from "./generated/index.ts";
7
7
  export { type Duration, parseDuration } from "./runtime/duration.ts";
8
- export { type FileInput, setFilesRoot } from "./runtime/files.ts";
8
+ export { type FileInput, type MediaSource, readMedia, setFilesRoot } from "./runtime/files.ts";
9
9
  export { type InSession, QUIET } from "./runtime/client.ts";
10
+ export type { Responder } from "./runtime/responder.ts";
10
11
  export type { LaunchOptions } from "./runtime/launcher.ts";
11
12
  export { ChannelstackError, onRefusal, unreportedRefusals } from "./runtime/transport.ts";
12
13
  export type * from "./types.ts";
13
- export { fromMatches, type QuietOptions, type QuietState, setWaitDefaults, textMatches, untilQuiet, type WaitDefaults, type WaitOptions, WaitTimeoutError, waitDefaults, waitFor, } from "./runtime/wait.ts";
14
+ export { fromMatches, ModelProblemError, type QuietOptions, type QuietState, setWaitDefaults, textMatches, untilQuiet, type WaitDefaults, type WaitOptions, WaitTimeoutError, waitDefaults, waitFor, } from "./runtime/wait.ts";
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * `channelstack` and `channelstack/client`: the generated client the test integrations are built
3
- * on, and its types (`import type { SlackUser } from "channelstack"`). The public contract is `api/*.d.ts`.
3
+ * on, and its types (`import type { SlackUser } from "channelstack"`).
4
4
  */
5
- export { CHANNEL_NAMES } from "./generated/channels.js";
5
+ export { CHANNEL_NAMES, PROVIDER_NAMES } from "./generated/channels.js";
6
6
  export * from "./generated/index.js";
7
7
  export { parseDuration } from "./runtime/duration.js";
8
- export { setFilesRoot } from "./runtime/files.js";
8
+ export { readMedia, setFilesRoot } from "./runtime/files.js";
9
9
  export { QUIET } from "./runtime/client.js";
10
10
  export { ChannelstackError, onRefusal, unreportedRefusals } from "./runtime/transport.js";
11
- export { fromMatches, setWaitDefaults, textMatches, untilQuiet, WaitTimeoutError, waitDefaults, waitFor, } from "./runtime/wait.js";
11
+ export { fromMatches, ModelProblemError, setWaitDefaults, textMatches, untilQuiet, WaitTimeoutError, waitDefaults, waitFor, } from "./runtime/wait.js";
@@ -1,7 +1,7 @@
1
1
  import type * as G from "./index.ts";
2
2
  type Option<Method extends (...args: never[]) => unknown> = NonNullable<Parameters<Method>[0]>;
3
3
  /** Every channel, by name, in the server's order. */
4
- export declare const CHANNEL_NAMES: readonly ["slack", "github", "linear", "notion", "resend", "google"];
4
+ export declare const CHANNEL_NAMES: readonly ["slack", "github", "linear", "notion", "resend", "google", "discord"];
5
5
  export type ChannelKind = (typeof CHANNEL_NAMES)[number];
6
6
  /** Each channel's fixture, by its name: what a test framework hands a test. */
7
7
  export interface ChannelFixtures {
@@ -11,14 +11,22 @@ export interface ChannelFixtures {
11
11
  notion: G.NotionFixture;
12
12
  resend: G.ResendFixture;
13
13
  google: G.GoogleFixture;
14
+ discord: G.DiscordFixture;
14
15
  }
15
- export type User = G.SlackUser | G.GitHubUser | G.LinearUser | G.NotionUser | G.ResendUser | G.GoogleUser;
16
- export type App = G.SlackApp | G.GitHubApp | G.LinearApp | G.NotionIntegration | G.ResendApp | G.GoogleApp;
17
- export type Resource = G.SlackConversation | G.GitHubRepo | G.LinearTeam | G.NotionPage | G.NotionDatabase | G.ResendThread | G.GoogleThread;
18
- export type AnyDelivery = G.SlackDelivery | G.GitHubDelivery | G.LinearDelivery | G.NotionDelivery | G.ResendDelivery | G.GoogleDelivery;
19
- export type DeliveryFilter = Option<G.GitHubFixture["deliveries"]> | Option<G.LinearFixture["deliveries"]> | Option<G.NotionFixture["deliveries"]> | Option<G.ResendFixture["deliveries"]> | Option<G.GoogleFixture["deliveries"]>;
20
- export type ApiCall = G.SlackApiCall | G.GitHubApiCall | G.LinearApiCall | G.NotionApiCall | G.ResendApiCall | G.GoogleApiCall;
21
- export type Transcript = G.SlackTranscript | G.GitHubTranscript | G.LinearTranscript | G.NotionTranscript | G.ResendTranscript | G.GoogleTranscript;
16
+ /** The fakes the agent calls that aren't channels (the fake OpenAI), by name. */
17
+ export declare const PROVIDER_NAMES: readonly ["openai"];
18
+ export type ProviderKind = (typeof PROVIDER_NAMES)[number];
19
+ /** Each provider's fixture, by its name: what a test framework hands a test besides the channels. */
20
+ export interface ProviderFixtures {
21
+ openai: G.OpenAIFixture;
22
+ }
23
+ export type User = G.SlackUser | G.GitHubUser | G.LinearUser | G.NotionUser | G.ResendUser | G.GoogleUser | G.DiscordUser;
24
+ export type App = G.SlackApp | G.GitHubApp | G.LinearApp | G.NotionIntegration | G.ResendApp | G.GoogleApp | G.DiscordApp;
25
+ export type Resource = G.SlackConversation | G.GitHubRepo | G.LinearTeam | G.NotionPage | G.NotionDatabase | G.ResendThread | G.GoogleThread | G.DiscordChannel;
26
+ export type AnyDelivery = G.SlackDelivery | G.GitHubDelivery | G.LinearDelivery | G.NotionDelivery | G.ResendDelivery | G.GoogleDelivery | G.DiscordDelivery;
27
+ export type DeliveryFilter = Option<G.SlackFixture["deliveries"]> | Option<G.GitHubFixture["deliveries"]> | Option<G.LinearFixture["deliveries"]> | Option<G.NotionFixture["deliveries"]> | Option<G.ResendFixture["deliveries"]> | Option<G.GoogleFixture["deliveries"]> | Option<G.DiscordFixture["deliveries"]>;
28
+ export type ApiCall = G.SlackApiCall | G.GitHubApiCall | G.LinearApiCall | G.NotionApiCall | G.ResendApiCall | G.GoogleApiCall | G.DiscordApiCall;
29
+ export type Transcript = G.SlackTranscript | G.GitHubTranscript | G.LinearTranscript | G.NotionTranscript | G.ResendTranscript | G.GoogleTranscript | G.DiscordTranscript;
22
30
  /** What every channel fixture has to inspect what the agent did: the fixture whose deliveries are `TDelivery`. */
23
- export type Inspectable<TDelivery extends AnyDelivery = AnyDelivery> = TDelivery extends G.SlackDelivery ? G.SlackFixture : TDelivery extends G.GitHubDelivery ? G.GitHubFixture : TDelivery extends G.LinearDelivery ? G.LinearFixture : TDelivery extends G.NotionDelivery ? G.NotionFixture : TDelivery extends G.ResendDelivery ? G.ResendFixture : TDelivery extends G.GoogleDelivery ? G.GoogleFixture : never;
31
+ export type Inspectable<TDelivery extends AnyDelivery = AnyDelivery> = TDelivery extends G.SlackDelivery ? G.SlackFixture : TDelivery extends G.GitHubDelivery ? G.GitHubFixture : TDelivery extends G.LinearDelivery ? G.LinearFixture : TDelivery extends G.NotionDelivery ? G.NotionFixture : TDelivery extends G.ResendDelivery ? G.ResendFixture : TDelivery extends G.GoogleDelivery ? G.GoogleFixture : TDelivery extends G.DiscordDelivery ? G.DiscordFixture : never;
24
32
  export {};
@@ -1,2 +1,4 @@
1
1
  /** Every channel, by name, in the server's order. */
2
- export const CHANNEL_NAMES = ["slack", "github", "linear", "notion", "resend", "google"];
2
+ export const CHANNEL_NAMES = ["slack", "github", "linear", "notion", "resend", "google", "discord"];
3
+ /** The fakes the agent calls that aren't channels (the fake OpenAI), by name. */
4
+ export const PROVIDER_NAMES = ["openai"];