@okostream/mcp 0.13.2 → 0.14.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/server.js +34 -9
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -116300,7 +116300,7 @@ function sanitizeScopes(scopes) {
|
|
|
116300
116300
|
}
|
|
116301
116301
|
|
|
116302
116302
|
// build/version.js
|
|
116303
|
-
var OKO_MCP_VERSION = "0.
|
|
116303
|
+
var OKO_MCP_VERSION = "0.14.0";
|
|
116304
116304
|
|
|
116305
116305
|
// build/auth.js
|
|
116306
116306
|
var state = null;
|
|
@@ -117610,13 +117610,24 @@ var notificationsMarkOutputSchema = external_exports.object({
|
|
|
117610
117610
|
markedRead: external_exports.number().int().nonnegative(),
|
|
117611
117611
|
notificationIds: external_exports.array(external_exports.string())
|
|
117612
117612
|
}).passthrough();
|
|
117613
|
+
var FORM_FIELD_TYPES = ["text", "tel", "email", "textarea", "select", "checkbox"];
|
|
117613
117614
|
var formFieldSchema = external_exports.object({
|
|
117614
117615
|
id: external_exports.string().min(1).optional(),
|
|
117615
117616
|
label: external_exports.string().max(120),
|
|
117616
|
-
type: external_exports.enum(
|
|
117617
|
+
type: external_exports.enum(FORM_FIELD_TYPES).default("text").describe("text | tel | email | textarea answer with free text; select (one answer) and checkbox (several) answer with one of `options`."),
|
|
117617
117618
|
required: external_exports.boolean().default(false),
|
|
117618
|
-
placeholder: external_exports.string().max(160).nullable().optional()
|
|
117619
|
-
|
|
117619
|
+
placeholder: external_exports.string().max(160).nullable().optional(),
|
|
117620
|
+
options: external_exports.array(external_exports.string().trim().min(1).max(80)).max(20).optional().describe("Choices of a select or checkbox field: 1\u201320 unique option texts. The lead stores the option text itself \u2014 a string for select, an array of strings for checkbox.")
|
|
117621
|
+
}).strict().superRefine((field2, ctx) => {
|
|
117622
|
+
const choice = field2.type === "select" || field2.type === "checkbox";
|
|
117623
|
+
const count = new Set(field2.options ?? []).size;
|
|
117624
|
+
if (choice && count === 0) {
|
|
117625
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["options"], message: `A ${field2.type} field needs at least one option.` });
|
|
117626
|
+
}
|
|
117627
|
+
if (!choice && field2.options !== void 0) {
|
|
117628
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["options"], message: `options belong to select or checkbox fields only; this field is ${field2.type}.` });
|
|
117629
|
+
}
|
|
117630
|
+
});
|
|
117620
117631
|
var formSchema = external_exports.object({
|
|
117621
117632
|
id: external_exports.string().min(1).optional(),
|
|
117622
117633
|
title: external_exports.string().max(160).nullable().optional(),
|
|
@@ -118553,7 +118564,7 @@ function eventRuntimeHint(runtime) {
|
|
|
118553
118564
|
}
|
|
118554
118565
|
|
|
118555
118566
|
// build/tools/setupValidation.js
|
|
118556
|
-
function validateEventSetup(eventId, event) {
|
|
118567
|
+
function validateEventSetup(eventId, event, nowMs = Date.now()) {
|
|
118557
118568
|
const errors = [];
|
|
118558
118569
|
const warnings = [];
|
|
118559
118570
|
const suggestions = [];
|
|
@@ -118574,7 +118585,7 @@ function validateEventSetup(eventId, event) {
|
|
|
118574
118585
|
const eventDateMs = toMillis(meta2.eventDate);
|
|
118575
118586
|
if (eventDateMs == null) {
|
|
118576
118587
|
add(suggestions, "date_missing", "meta.eventDate", "Add the webinar date/time if it is known.");
|
|
118577
|
-
} else if (eventDateMs <
|
|
118588
|
+
} else if (eventDateMs < nowMs - 60 * 60 * 1e3) {
|
|
118578
118589
|
add(warnings, "date_in_past", "meta.eventDate", "Configured webinar date appears to be in the past.");
|
|
118579
118590
|
}
|
|
118580
118591
|
if (scheduleMissesDate(event.analyticsSessionMode, meta2.eventDate)) {
|
|
@@ -118593,6 +118604,16 @@ function validateEventSetup(eventId, event) {
|
|
|
118593
118604
|
const fields = Array.isArray(form.fields) ? form.fields : [];
|
|
118594
118605
|
if (fields.length === 0)
|
|
118595
118606
|
add(warnings, "form_fields_missing", `forms[${index}].fields`, "Lead form has no fields.");
|
|
118607
|
+
fields.forEach((rawField, fieldIndex) => {
|
|
118608
|
+
const field2 = asRecord(rawField);
|
|
118609
|
+
const type = safeString(field2.type);
|
|
118610
|
+
if (type !== "select" && type !== "checkbox")
|
|
118611
|
+
return;
|
|
118612
|
+
const options2 = Array.isArray(field2.options) ? field2.options : [];
|
|
118613
|
+
if (!options2.some((item) => typeof item === "string" && item.trim())) {
|
|
118614
|
+
add(errors, "form_field_options_missing", `forms[${index}].fields[${fieldIndex}].options`, `A ${type} field has no options, so the viewer sees an empty list. Add at least one option or change the field type.`);
|
|
118615
|
+
}
|
|
118616
|
+
});
|
|
118596
118617
|
});
|
|
118597
118618
|
for (const id of duplicateFormIds)
|
|
118598
118619
|
add(errors, "form_id_duplicate", "forms", `Duplicate form id: ${id}.`);
|
|
@@ -118863,7 +118884,7 @@ function registerEventTools(server2) {
|
|
|
118863
118884
|
}, async ({ eventId }) => {
|
|
118864
118885
|
const { uid } = await authed(["events:read"]);
|
|
118865
118886
|
const data = await readEvent(eventId, uid, "read");
|
|
118866
|
-
return textResult(validateEventSetup(eventId, data));
|
|
118887
|
+
return textResult(validateEventSetup(eventId, data, await serverNowMs()));
|
|
118867
118888
|
});
|
|
118868
118889
|
server2.registerTool("oko_create_webinar", {
|
|
118869
118890
|
title: "Create webinar",
|
|
@@ -119093,7 +119114,11 @@ function registerEventTools(server2) {
|
|
|
119093
119114
|
label: field2.label.trim(),
|
|
119094
119115
|
type: field2.type,
|
|
119095
119116
|
required: field2.required === true,
|
|
119096
|
-
placeholder: field2.placeholder?.trim() || null
|
|
119117
|
+
placeholder: field2.placeholder?.trim() || null,
|
|
119118
|
+
// Options are written for choice types only (the schema refuses them
|
|
119119
|
+
// elsewhere); duplicates collapse, order is kept — the viewer sees the
|
|
119120
|
+
// list in this order and a checkbox answer is stored in it.
|
|
119121
|
+
...field2.type === "select" || field2.type === "checkbox" ? { options: [...new Set((field2.options ?? []).map((option) => option.trim()).filter(Boolean))] } : {}
|
|
119097
119122
|
}))
|
|
119098
119123
|
}));
|
|
119099
119124
|
Object.assign(patch, telegramPatch);
|
|
@@ -119664,7 +119689,7 @@ function registerLeadTools(server2) {
|
|
|
119664
119689
|
"limit: max rows, default 50, max 200.",
|
|
119665
119690
|
"cursor: lead document id returned as nextCursor by the previous page."
|
|
119666
119691
|
],
|
|
119667
|
-
returns: "leads or csv plus count, limit, hasMore/has_more, nextCursor/next_cursor. Without formId the rows are newest-first across pages; with formId they are newest-first WITHIN a page only, because paging there follows document ids \u2014 to rank one form's submissions by time, read every page and sort by submittedAt.",
|
|
119692
|
+
returns: "leads or csv plus count, limit, hasMore/has_more, nextCursor/next_cursor. A lead's values are keyed by field id: a checkbox field answers with an array of option texts, every other field with a string (in the CSV both sit inside valuesJson). Without formId the rows are newest-first across pages; with formId they are newest-first WITHIN a page only, because paging there follows document ids \u2014 to rank one form's submissions by time, read every page and sort by submittedAt.",
|
|
119668
119693
|
examples: ["Use formId to export one form; if Firestore requests an index, create it from the error link and rerun."]
|
|
119669
119694
|
}),
|
|
119670
119695
|
inputSchema: {
|