@indexnetwork/protocol 21.0.0-rc.489.1 → 21.0.0-rc.490.1
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.d.ts +1 -0
- package/dist/negotiations/negotiation.agent.d.ts +13 -0
- package/dist/negotiations/negotiation.agent.js +53 -3
- package/dist/negotiations/negotiation.client-dm.d.ts +50 -0
- package/dist/negotiations/negotiation.client-dm.js +66 -0
- package/dist/negotiations/negotiation.graph.d.ts +110 -1
- package/dist/negotiations/negotiation.graph.js +2 -1
- package/dist/negotiations/negotiation.graph.shared.d.ts +17 -0
- package/dist/negotiations/negotiation.graph.shared.js +23 -0
- package/dist/negotiations/negotiation.graph.turn.d.ts +27 -0
- package/dist/negotiations/negotiation.graph.turn.js +64 -2
- package/dist/negotiations/negotiation.module.d.ts +2 -1
- package/dist/negotiations/negotiation.module.js +1 -1
- package/dist/negotiations/negotiation.protocol.d.ts +498 -0
- package/dist/negotiations/negotiation.question-safety.d.ts +28 -0
- package/dist/negotiations/negotiation.question-safety.js +65 -0
- package/dist/negotiations/negotiation.state.d.ts +110 -0
- package/dist/questions/question.schema.d.ts +13 -31
- package/dist/questions/question.schema.js +9 -15
- package/dist/shared/schemas/negotiation-state.schema.d.ts +182 -3
- package/dist/shared/schemas/negotiation-state.schema.js +23 -3
- package/dist/shared/schemas/structured-question.schema.d.ts +66 -0
- package/dist/shared/schemas/structured-question.schema.js +31 -0
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical structured question shape: the title/prompt/options/multiSelect
|
|
4
|
+
* quartet every question renderer (frontend cards, MCP elicitation) consumes.
|
|
5
|
+
*
|
|
6
|
+
* It lives in `shared/` rather than inside `questions/` for the same reason as
|
|
7
|
+
* `underspecification.schema.ts`: more than one capability needs the shape.
|
|
8
|
+
* The questions capability owns question *generation* and extends this with its
|
|
9
|
+
* own provenance field; the negotiator only needs to hand over a question it
|
|
10
|
+
* authored (`AskUserPayloadSchema` in `negotiation-state.schema.ts`), and
|
|
11
|
+
* `shared/schemas` must not value-import a capability module to reach a shape.
|
|
12
|
+
*
|
|
13
|
+
* Field constraints are tuned for the renderer and are the single source of
|
|
14
|
+
* truth — `questions/question.schema.ts` re-exports rather than redeclares.
|
|
15
|
+
*/
|
|
16
|
+
export declare const QuestionOptionSchema: z.ZodObject<{
|
|
17
|
+
/** Display text. Suffix " (Recommended)" on the safest path; list it first. */
|
|
18
|
+
label: z.ZodString;
|
|
19
|
+
/** Explains the consequence of choosing this option, not just its definition. */
|
|
20
|
+
description: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
label: string;
|
|
23
|
+
description: string;
|
|
24
|
+
}, {
|
|
25
|
+
label: string;
|
|
26
|
+
description: string;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const StructuredQuestionSchema: z.ZodObject<{
|
|
29
|
+
/** ≤12 chars. Noun of the decision domain — e.g. "Stage", "Timing", "Role". */
|
|
30
|
+
title: z.ZodString;
|
|
31
|
+
/** ≤2 sentences, ≤400 chars. Ends in a question mark. */
|
|
32
|
+
prompt: z.ZodString;
|
|
33
|
+
/** 2–4 options. No explicit "Other" — clients provide that automatically. */
|
|
34
|
+
options: z.ZodArray<z.ZodObject<{
|
|
35
|
+
/** Display text. Suffix " (Recommended)" on the safest path; list it first. */
|
|
36
|
+
label: z.ZodString;
|
|
37
|
+
/** Explains the consequence of choosing this option, not just its definition. */
|
|
38
|
+
description: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
label: string;
|
|
41
|
+
description: string;
|
|
42
|
+
}, {
|
|
43
|
+
label: string;
|
|
44
|
+
description: string;
|
|
45
|
+
}>, "many">;
|
|
46
|
+
/** True when options are not mutually exclusive (priorities, bundles). */
|
|
47
|
+
multiSelect: z.ZodBoolean;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
prompt: string;
|
|
50
|
+
options: {
|
|
51
|
+
label: string;
|
|
52
|
+
description: string;
|
|
53
|
+
}[];
|
|
54
|
+
title: string;
|
|
55
|
+
multiSelect: boolean;
|
|
56
|
+
}, {
|
|
57
|
+
prompt: string;
|
|
58
|
+
options: {
|
|
59
|
+
label: string;
|
|
60
|
+
description: string;
|
|
61
|
+
}[];
|
|
62
|
+
title: string;
|
|
63
|
+
multiSelect: boolean;
|
|
64
|
+
}>;
|
|
65
|
+
export type QuestionOption = z.infer<typeof QuestionOptionSchema>;
|
|
66
|
+
export type StructuredQuestion = z.infer<typeof StructuredQuestionSchema>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical structured question shape: the title/prompt/options/multiSelect
|
|
4
|
+
* quartet every question renderer (frontend cards, MCP elicitation) consumes.
|
|
5
|
+
*
|
|
6
|
+
* It lives in `shared/` rather than inside `questions/` for the same reason as
|
|
7
|
+
* `underspecification.schema.ts`: more than one capability needs the shape.
|
|
8
|
+
* The questions capability owns question *generation* and extends this with its
|
|
9
|
+
* own provenance field; the negotiator only needs to hand over a question it
|
|
10
|
+
* authored (`AskUserPayloadSchema` in `negotiation-state.schema.ts`), and
|
|
11
|
+
* `shared/schemas` must not value-import a capability module to reach a shape.
|
|
12
|
+
*
|
|
13
|
+
* Field constraints are tuned for the renderer and are the single source of
|
|
14
|
+
* truth — `questions/question.schema.ts` re-exports rather than redeclares.
|
|
15
|
+
*/
|
|
16
|
+
export const QuestionOptionSchema = z.object({
|
|
17
|
+
/** Display text. Suffix " (Recommended)" on the safest path; list it first. */
|
|
18
|
+
label: z.string().min(1).max(120),
|
|
19
|
+
/** Explains the consequence of choosing this option, not just its definition. */
|
|
20
|
+
description: z.string().min(1).max(280),
|
|
21
|
+
});
|
|
22
|
+
export const StructuredQuestionSchema = z.object({
|
|
23
|
+
/** ≤12 chars. Noun of the decision domain — e.g. "Stage", "Timing", "Role". */
|
|
24
|
+
title: z.string().min(1).max(12),
|
|
25
|
+
/** ≤2 sentences, ≤400 chars. Ends in a question mark. */
|
|
26
|
+
prompt: z.string().min(1).max(400),
|
|
27
|
+
/** 2–4 options. No explicit "Other" — clients provide that automatically. */
|
|
28
|
+
options: z.array(QuestionOptionSchema).min(2).max(4),
|
|
29
|
+
/** True when options are not mutually exclusive (priorities, bundles). */
|
|
30
|
+
multiSelect: z.boolean(),
|
|
31
|
+
});
|