@ai-sdk/harness 1.0.100 → 1.0.102

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.
@@ -0,0 +1,72 @@
1
+ import type { FunctionTool } from '@ai-sdk/provider-utils';
2
+ import { z } from 'zod/v4';
3
+
4
+ const harnessV1QuestionSchema = z.object({
5
+ id: z.string().min(1),
6
+ question: z.string().min(1),
7
+ header: z.string().optional(),
8
+ options: z
9
+ .array(
10
+ z.object({
11
+ id: z.string().min(1),
12
+ label: z.string().min(1),
13
+ description: z.string().optional(),
14
+ preview: z.string().optional(),
15
+ }),
16
+ )
17
+ .optional(),
18
+ allowMultiple: z.boolean().optional(),
19
+ allowFreeForm: z
20
+ .union([
21
+ z.boolean(),
22
+ z.object({
23
+ secret: z.boolean(),
24
+ }),
25
+ ])
26
+ .optional(),
27
+ });
28
+
29
+ export const harnessV1QuestionsToolInputSchema = z.object({
30
+ allowPartialAnswers: z.boolean(),
31
+ questions: z.array(harnessV1QuestionSchema).min(1),
32
+ });
33
+
34
+ const harnessV1QuestionAnswerSchema = z.object({
35
+ optionIds: z.array(z.string()),
36
+ freeform: z.string().optional(),
37
+ });
38
+
39
+ export const harnessV1QuestionsToolOutputSchema = z.discriminatedUnion(
40
+ 'action',
41
+ [
42
+ z.object({
43
+ action: z.literal('answered'),
44
+ answers: z.record(z.string(), harnessV1QuestionAnswerSchema),
45
+ }),
46
+ z.object({
47
+ action: z.literal('partially-answered'),
48
+ answers: z.record(z.string(), harnessV1QuestionAnswerSchema),
49
+ }),
50
+ z.object({ action: z.literal('declined') }),
51
+ z.object({ action: z.literal('cancelled') }),
52
+ ],
53
+ );
54
+
55
+ export type HarnessV1QuestionsToolInput = z.infer<
56
+ typeof harnessV1QuestionsToolInputSchema
57
+ >;
58
+
59
+ export type HarnessV1QuestionsToolOutput = z.infer<
60
+ typeof harnessV1QuestionsToolOutputSchema
61
+ >;
62
+
63
+ export const harnessV1QuestionsTool: FunctionTool<
64
+ HarnessV1QuestionsToolInput,
65
+ HarnessV1QuestionsToolOutput
66
+ > = {
67
+ description: 'Ask the user one or more questions',
68
+ inputSchema: harnessV1QuestionsToolInputSchema,
69
+ outputSchema: harnessV1QuestionsToolOutputSchema,
70
+ };
71
+
72
+ export type HarnessV1QuestionsTool = typeof harnessV1QuestionsTool;
@@ -21,6 +21,11 @@ import type { HarnessV1BuiltinToolFiltering } from './harness-v1-tool-filtering'
21
21
  * calling the adapter, so adapters never need to derive provider-specific paths.
22
22
  */
23
23
  export type HarnessV1StartOptions = {
24
+ /**
25
+ * Additional normalized HTTP headers to send with model requests.
26
+ */
27
+ readonly headers?: Readonly<Record<string, string>>;
28
+
24
29
  /**
25
30
  * Stable identifier for this harness session. Used as the underlying
26
31
  * resource name where the adapter has a notion of a named session
package/src/v1/index.ts CHANGED
@@ -28,6 +28,15 @@ export {
28
28
  HARNESS_V1_BUILTIN_TOOLS,
29
29
  commonTool,
30
30
  } from './harness-v1-builtin-tool';
31
+ export type {
32
+ HarnessV1QuestionsTool,
33
+ HarnessV1QuestionsToolInput,
34
+ HarnessV1QuestionsToolOutput,
35
+ } from './harness-v1-questions-tool';
36
+ export {
37
+ harnessV1QuestionsToolInputSchema,
38
+ harnessV1QuestionsToolOutputSchema,
39
+ } from './harness-v1-questions-tool';
31
40
  export type { HarnessV1Metadata } from './harness-v1-metadata';
32
41
  export type { HarnessV1Prompt } from './harness-v1-prompt';
33
42
  export type {