@wingmanpm/cli 0.2.1 → 0.3.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.
@@ -0,0 +1,166 @@
1
+ // Mirrored in the standalone CLI package; contract tests keep both in sync.
2
+ import { createHash, randomUUID } from "node:crypto";
3
+ import { z } from "zod";
4
+ // Survey tools send whole REST bodies, so the tool layer fills what the
5
+ // gateway needs but an agent should not invent: a globally unique slug,
6
+ // question ids and their order. With an idempotency key the generated values
7
+ // derive from the key, so a retry sends the same body and is replayed instead
8
+ // of refused as a different request.
9
+ export const SURVEY_FIELD_TYPES = ["text", "textarea", "rating", "scale", "multiple_choice", "dropdown", "email", "date", "file"];
10
+ export const SURVEY_METRICS = ["nps", "csat", "ces"];
11
+ const SLUG_PREFIX_LENGTH = 40;
12
+ const SLUG_SUFFIX_LENGTH = 6;
13
+ const GENERATED_ID_LENGTH = 8;
14
+ // The question shapes accept exactly what the gateway's SurveyField and
15
+ // SurveyFieldOption accept (and so what wingman_get_survey returns and the
16
+ // builder stores): no length or range limits the gateway does not apply, and
17
+ // unknown keys are dropped, as the gateway drops them. The gateway checks the
18
+ // metric scales. Only id, option value and order are optional here, because
19
+ // the tool layer fills them.
20
+ export const SurveyOptionInputSchema = z.object({
21
+ id: z.string().optional().describe("Option id. Generated when omitted."),
22
+ label: z.string(),
23
+ value: z.string().optional().describe("Stored answer value. Defaults to the label."),
24
+ tone: z.string().nullable().optional().describe("Option colour, such as neutral, info, success, warning or destructive. Send back the value wingman_get_survey returns."),
25
+ });
26
+ export const SurveyFieldInputSchema = z.object({
27
+ id: z.string().optional().describe("Question id. Generated as q_<8 characters> when omitted; send existing ids when you edit questions."),
28
+ type: z.enum(SURVEY_FIELD_TYPES),
29
+ label: z.string(),
30
+ placeholder: z.string().nullable().optional(),
31
+ required: z.boolean().optional(),
32
+ options: z.array(SurveyOptionInputSchema).nullable().optional().describe("Choices for multiple_choice and dropdown questions."),
33
+ scale_min: z.number().int().nullable().optional(),
34
+ scale_max: z.number().int().nullable().optional(),
35
+ scale_labels: z.record(z.string(), z.string()).nullable().optional().describe("End texts of a rating or scale question: min for the lowest point, max for the highest point, for example {\"min\": \"Not likely\", \"max\": \"Very likely\"}. The survey page and the builder show only min and max; other keys are stored and returned but not shown."),
36
+ metric: z.enum(SURVEY_METRICS).nullable().optional().describe("What a rating or scale question measures: nps needs scale 0 to 10; csat and ces need scale_max 5 or 7."),
37
+ order: z.number().optional().describe("Ignored: questions are saved in the order of this array. wingman_get_survey returns them in that order."),
38
+ });
39
+ // A value each invitation carries (the support ticket it is about). {key} in
40
+ // the survey copy and the invitation email is replaced with the invitation's
41
+ // value, else the fallback.
42
+ export const SurveyVariableSchema = z.object({
43
+ key: z.string().regex(/^[a-z][a-z0-9_]{0,39}$/).describe("Lower-case letters, digits and underscores, for example ticket_id. Not name, survey_link, link, company or email."),
44
+ label: z.string().min(1).max(80).describe("What people see in the Wingman app, for example Ticket."),
45
+ fallback: z.string().max(200).optional().describe("Shown when an invitation has no value, and on the plain public link, for example your request."),
46
+ required: z.boolean().optional().describe("Every invitation must give a value (422 SURVEY_CONTEXT_REQUIRED otherwise)."),
47
+ });
48
+ // Variable values of one invitation: {"ticket_id": "4821"}. Numbers and
49
+ // booleans become text.
50
+ export const SurveyContextSchema = z.record(z.string().regex(/^[a-z][a-z0-9_]{0,39}$/), z.union([z.string().max(500), z.number(), z.boolean(), z.null()]))
51
+ .describe("Values for the survey's variables, for example {\"ticket_id\": \"4821\", \"agent_name\": \"Kim\"}. Keys must be declared in the survey's variables.");
52
+ export const SurveyFeedbackMappingSchema = z.object({
53
+ text_field_id: z.string().min(1).max(100),
54
+ sentiment_field_id: z.string().min(1).max(100).nullable().optional(),
55
+ product_area_field_id: z.string().min(1).max(100).nullable().optional(),
56
+ });
57
+ export const CreateSurveyStatusSchema = z.enum(["paused", "active"]).optional().describe("paused (default) keeps the survey a draft; active publishes it at its public link.");
58
+ export const UpdateSurveyStatusSchema = z.enum(["paused", "active", "closed"]).optional().describe("active publishes the survey; paused takes it off its public link; closed ends it.");
59
+ // Settings shared by create and update; each is optional and sent only when given.
60
+ export const SurveySettingsShape = {
61
+ description: z.string().max(5_000).nullable().optional(),
62
+ display_mode: z.enum(["one_question_at_a_time", "all_at_once"]).optional(),
63
+ feedback_mapping: SurveyFeedbackMappingSchema.nullable().optional().describe("Which question ids feed Wingman feedback. Optional."),
64
+ auto_convert_to_feedback: z.boolean().optional(),
65
+ require_identification: z.boolean().optional(),
66
+ identification_fields: z.array(z.enum(["name", "email", "organization"])).max(3).nullable().optional(),
67
+ thank_you_title: z.string().max(255).nullable().optional(),
68
+ thank_you_message: z.string().max(5_000).nullable().optional(),
69
+ allow_multiple_responses: z.boolean().optional(),
70
+ expires_at: z.string().datetime({ offset: true }).nullable().optional(),
71
+ response_limit: z.number().int().min(1).nullable().optional(),
72
+ language_code: z.string().min(2).max(10).nullable().optional().describe("ISO 639-1 language of the respondent page and invitation emails. Stored when the survey is created; if omitted, the product's language, else the workspace default. On update, null stores that default again. An older survey with no stored language (null) stays English."),
73
+ access_mode: z.enum(["public", "invite_only"]).optional().describe("invite_only accepts answers only through personal recipient links."),
74
+ privacy_notice_url: z.string().url().max(2_048).nullable().optional().describe("https link shown on the respondent page."),
75
+ ui_strings: z.record(z.string(), z.string().min(1).max(500)).nullable().optional().describe("Overrides of respondent page texts by string key."),
76
+ invitation_mode: z.enum(["person", "event"]).optional().describe("person (default): one invitation per email. event: one invitation per event, such as each resolved support ticket; the same email can get many, each answered once. An event survey with invitations cannot switch back to person."),
77
+ variables: z.array(SurveyVariableSchema).max(20).nullable().optional().describe("Values each invitation can carry. Use {key} in the title, description, question labels, thank-you text and invitation email. On update this replaces every variable; [] removes them."),
78
+ };
79
+ export const SURVEY_SLUG_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
80
+ export function slugifyTitle(title) {
81
+ const ascii = title.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase();
82
+ const slug = ascii.replace(/[^a-z0-9]+/g, "-").replace(/^-+/, "").slice(0, SLUG_PREFIX_LENGTH).replace(/-+$/, "");
83
+ return slug || "survey";
84
+ }
85
+ // Lower-case base36 characters derived from a seed (deterministic) or random.
86
+ export function base36Id(seed, length) {
87
+ const digest = createHash("sha256").update(seed ?? randomUUID()).digest();
88
+ let value = 0n;
89
+ for (const byte of digest.subarray(0, 8))
90
+ value = (value << 8n) | BigInt(byte);
91
+ return (value % 36n ** BigInt(length)).toString(36).padStart(length, "0");
92
+ }
93
+ export function generatedSurveySlug(title, seed) {
94
+ return `${slugifyTitle(title)}-${base36Id(seed === null ? null : `slug:${seed}`, SLUG_SUFFIX_LENGTH)}`;
95
+ }
96
+ function generatedId(prefix, seed, parts, taken) {
97
+ for (let attempt = 0;; attempt += 1) {
98
+ const id = `${prefix}_${base36Id(seed === null ? null : [seed, ...parts, attempt].join(":"), GENERATED_ID_LENGTH)}`;
99
+ if (!taken.has(id)) {
100
+ taken.add(id);
101
+ return id;
102
+ }
103
+ }
104
+ }
105
+ // Question payloads in the given order, with ids and option values filled in.
106
+ export function surveyFieldsPayload(fields, seed) {
107
+ const taken = new Set(fields.map(field => field.id).filter((id) => typeof id === "string"));
108
+ return fields.map((field, index) => {
109
+ const payload = {
110
+ id: field.id ?? generatedId("q", seed, ["field", index], taken),
111
+ type: field.type,
112
+ label: field.label,
113
+ required: field.required ?? false,
114
+ order: index,
115
+ };
116
+ if (field.placeholder !== undefined)
117
+ payload.placeholder = field.placeholder;
118
+ if (field.scale_min !== undefined)
119
+ payload.scale_min = field.scale_min;
120
+ if (field.scale_max !== undefined)
121
+ payload.scale_max = field.scale_max;
122
+ if (field.scale_labels !== undefined)
123
+ payload.scale_labels = field.scale_labels;
124
+ // Sent only when given: a question saved without the key keeps the
125
+ // legacy NPS detection.
126
+ if (field.metric !== undefined)
127
+ payload.metric = field.metric;
128
+ if (field.options !== undefined) {
129
+ const optionIds = new Set((field.options ?? []).map(option => option.id).filter((id) => typeof id === "string"));
130
+ payload.options = field.options === null ? null : field.options.map((option, optionIndex) => ({
131
+ id: option.id ?? generatedId("o", seed, ["field", index, "option", optionIndex], optionIds),
132
+ label: option.label,
133
+ value: option.value ?? option.label,
134
+ // Sent only when given, so an option saved without a colour keeps none.
135
+ ...(option.tone !== undefined ? { tone: option.tone } : {}),
136
+ }));
137
+ }
138
+ return payload;
139
+ });
140
+ }
141
+ function definedEntries(values) {
142
+ const out = {};
143
+ for (const [key, value] of Object.entries(values))
144
+ if (value !== undefined)
145
+ out[key] = value;
146
+ return out;
147
+ }
148
+ // POST /surveys body: the given settings plus a slug and question ids derived
149
+ // from the idempotency key.
150
+ export function createSurveyBody(input, idempotencyKey) {
151
+ const { fields, slug, ...settings } = input;
152
+ return {
153
+ ...definedEntries(settings),
154
+ slug: slug ?? generatedSurveySlug(input.title, idempotencyKey),
155
+ fields: surveyFieldsPayload(fields, idempotencyKey),
156
+ };
157
+ }
158
+ // PATCH body: only the keys the agent gave. New questions get random ids.
159
+ export function updateSurveyBody(changes) {
160
+ const { fields, ...rest } = changes;
161
+ const body = definedEntries(rest);
162
+ if (fields !== undefined)
163
+ body.fields = surveyFieldsPayload(fields, null);
164
+ return body;
165
+ }
166
+ //# sourceMappingURL=survey-schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"survey-schemas.js","sourceRoot":"","sources":["../src/survey-schemas.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wEAAwE;AACxE,wEAAwE;AACxE,6EAA6E;AAC7E,8EAA8E;AAC9E,qCAAqC;AAErC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AA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AC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,MAAyC;IAC/D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC7F,OAAO,GAAG,CAAC;AACb,CAAC;AAQD,8EAA8E;AAC9E,4BAA4B;AAC5B,MAAM,UAAU,gBAAgB,CAAC,KAAwB,EAAE,cAAsB;IAC/E,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC5C,OAAO;QACL,GAAG,cAAc,CAAC,QAAQ,CAAC;QAC3B,IAAI,EAAE,IAAI,IAAI,mBAAmB,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC;QAC9D,MAAM,EAAE,mBAAmB,CAAC,MAAM,EAAE,cAAc,CAAC;KACpD,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,gBAAgB,CAAC,OAAwF;IACvH,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACpC,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,MAAM,KAAK,SAAS;QAAE,IAAI,CAAC,MAAM,GAAG,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1E,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Command } from "commander";
2
+ import { type ApiClient } from "./api.js";
3
+ import { type OutputContext } from "./output.js";
4
+ interface SurveyContextDeps {
5
+ api: ApiClient;
6
+ output: OutputContext;
7
+ globalIdempotencyKey: string | undefined;
8
+ }
9
+ export declare function registerSurveys<T extends SurveyContextDeps>(program: Command, context: () => Promise<T>, productId: (ctx: T) => Promise<string>): void;
10
+ export declare function parseContext(values: readonly string[] | undefined): Record<string, string> | undefined;
11
+ export {};