@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.
- package/CHANGELOG.md +30 -0
- package/agent/index.ts +2 -8
- package/dist/agent/index.d.ts +128 -48
- package/dist/agent/index.js +586 -512
- package/dist/agent/index.js.map +1 -1
- package/dist/bridge/index.d.ts +11 -1
- package/dist/bridge/index.js +37 -7
- package/dist/bridge/index.js.map +1 -1
- package/dist/index.d.ts +84 -2
- package/dist/index.js +286 -229
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +17 -3
- package/dist/utils/index.js +323 -19
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -3
- package/src/agent/harness-agent-session.ts +9 -8
- package/src/agent/harness-agent-settings.ts +82 -3
- package/src/agent/harness-agent-tool-approval-continuation.ts +6 -32
- package/src/agent/harness-agent-tool-result-continuation.ts +4 -53
- package/src/agent/harness-agent.ts +107 -18
- package/src/agent/internal/harness-stream-text-result.ts +33 -13
- package/src/agent/internal/run-prompt.ts +309 -122
- package/src/agent/internal/turn-telemetry.ts +293 -444
- package/src/bridge/index.ts +82 -11
- package/src/utils/index.ts +5 -0
- package/src/utils/write-instructions.ts +373 -0
- package/src/utils/write-skills.ts +59 -2
- package/src/v1/harness-v1-bridge-protocol.ts +1 -0
- package/src/v1/harness-v1-builtin-tool.ts +2 -0
- package/src/v1/harness-v1-lifecycle-state.ts +2 -0
- package/src/v1/harness-v1-prompt-control.ts +3 -0
- package/src/v1/harness-v1-questions-tool.ts +72 -0
- package/src/v1/harness-v1-session.ts +5 -0
- package/src/v1/index.ts +9 -0
|
@@ -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 {
|