@eum-agent/human-interaction 1.0.1 → 1.1.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.
- package/dist/index.js +6 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -54,20 +54,22 @@ const Option = z.object({
|
|
|
54
54
|
const Question = z.object({
|
|
55
55
|
id: z.string().min(1).max(128).describe("Stable id, echoed in the answer."),
|
|
56
56
|
question: z.string().min(1).max(8e3).describe("The complete question, with any context needed to answer it."),
|
|
57
|
-
header: z.string().max(128).optional().describe("A short
|
|
57
|
+
header: z.string().max(128).optional().describe("A short label for question navigation."),
|
|
58
58
|
options: z.array(Option).min(1).max(8).optional().describe("Suggested answers, in display order; put the recommended one first. Omit for a free-text question."),
|
|
59
59
|
allow_free_text: z.boolean().optional().describe("Whether the person may type an answer instead of picking an option. Default true."),
|
|
60
60
|
allow_multiple: z.boolean().optional().describe("Whether the person may pick several options. Default false.")
|
|
61
61
|
});
|
|
62
|
-
const AskInput = z.object({ questions: z.array(Question).min(1).max(8).describe("One to eight questions
|
|
63
|
-
/**
|
|
62
|
+
const AskInput = z.object({ questions: z.array(Question).min(1).max(8).describe("One to eight questions in a single request.") }).refine((value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 8388608, "Question input exceeds 8 MiB");
|
|
63
|
+
/** Converts model questions to human requests, preserving short headers separately from text.
|
|
64
|
+
* Option ids are the labels: a person picks by label, and the model reads
|
|
64
65
|
* the label back — no second vocabulary to keep in step. */
|
|
65
66
|
function toAsk(input) {
|
|
66
67
|
return {
|
|
67
68
|
kind: "question",
|
|
68
69
|
questions: input.questions.map((q) => ({
|
|
69
70
|
id: q.id,
|
|
70
|
-
|
|
71
|
+
...q.header === void 0 ? {} : { header: q.header },
|
|
72
|
+
text: q.question,
|
|
71
73
|
options: (q.options ?? []).map((o) => ({
|
|
72
74
|
id: o.label,
|
|
73
75
|
label: o.label,
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"en-US": "Human Interaction",
|
|
5
5
|
"zh-CN": "人工交互"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.0
|
|
7
|
+
"version": "1.1.0",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"description": "Requests for human input and human participation in agent sessions",
|
|
10
10
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@eum-agent/container": "1.0.0",
|
|
25
25
|
"@eum-agent/kernel": "1.0.0",
|
|
26
|
-
"@eum-agent/plugin": "1.0
|
|
26
|
+
"@eum-agent/plugin": "1.1.0",
|
|
27
27
|
"vite": "^8.2.2"
|
|
28
28
|
},
|
|
29
29
|
"yaoguang": {
|