mcp-scraper 0.46.0 → 0.47.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/README.md +1 -1
- package/dist/bin/api-server.cjs +450 -181
- package/dist/bin/api-server.cjs.map +1 -1
- package/dist/bin/api-server.js +3 -3
- package/dist/bin/mcp-scraper-cli.cjs +1 -1
- package/dist/bin/mcp-scraper-cli.cjs.map +1 -1
- package/dist/bin/mcp-scraper-cli.js +1 -1
- package/dist/bin/mcp-scraper-install.cjs +1 -1
- package/dist/bin/mcp-scraper-install.cjs.map +1 -1
- package/dist/bin/mcp-scraper-install.js +1 -1
- package/dist/bin/mcp-stdio-server.cjs +149 -33
- package/dist/bin/mcp-stdio-server.cjs.map +1 -1
- package/dist/bin/mcp-stdio-server.js +4 -4
- package/dist/bin/paa-harvest.cjs.map +1 -1
- package/dist/bin/paa-harvest.js +3 -3
- package/dist/{chunk-5X7CJEK3.js → chunk-5S6LYQQO.js} +2 -2
- package/dist/chunk-5S6LYQQO.js.map +1 -0
- package/dist/{chunk-OVD4E4AP.js → chunk-GV5EGE5M.js} +2 -2
- package/dist/chunk-H4NWAF5B.js +7 -0
- package/dist/chunk-H4NWAF5B.js.map +1 -0
- package/dist/{chunk-T5AFM4G5.js → chunk-IWYYZXBR.js} +2 -2
- package/dist/{chunk-RJMOOII7.js → chunk-JH7A4HA7.js} +2 -2
- package/dist/{chunk-JFOT5JEL.js → chunk-MW3ET532.js} +2 -2
- package/dist/{chunk-WT2UHDSE.js → chunk-TV6KPZ6J.js} +2 -2
- package/dist/{chunk-BP2IUIAH.js → chunk-XCGQBGDA.js} +192 -38
- package/dist/chunk-XCGQBGDA.js.map +1 -0
- package/dist/{db-4ABEYNDM.js → db-W3RPRILW.js} +2 -2
- package/dist/{extract-bundle-DYMQRQWG.js → extract-bundle-DXWWQER6.js} +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/{location-data-repository-HDNCU4Z4.js → location-data-repository-2FJVMTZ2.js} +3 -3
- package/dist/{server-SMEHT3OU.js → server-OHMZJRSB.js} +237 -124
- package/dist/server-OHMZJRSB.js.map +1 -0
- package/dist/{site-extract-repository-G723PZIL.js → site-extract-repository-UULQAGO4.js} +3 -3
- package/dist/{worker-4LZGRHDA.js → worker-3QX7LG62.js} +5 -5
- package/package.json +2 -2
- package/dist/chunk-5X7CJEK3.js.map +0 -1
- package/dist/chunk-BP2IUIAH.js.map +0 -1
- package/dist/chunk-TQKQK7OV.js +0 -7
- package/dist/chunk-TQKQK7OV.js.map +0 -1
- package/dist/server-SMEHT3OU.js.map +0 -1
- /package/dist/{chunk-OVD4E4AP.js.map → chunk-GV5EGE5M.js.map} +0 -0
- /package/dist/{chunk-T5AFM4G5.js.map → chunk-IWYYZXBR.js.map} +0 -0
- /package/dist/{chunk-RJMOOII7.js.map → chunk-JH7A4HA7.js.map} +0 -0
- /package/dist/{chunk-JFOT5JEL.js.map → chunk-MW3ET532.js.map} +0 -0
- /package/dist/{chunk-WT2UHDSE.js.map → chunk-TV6KPZ6J.js.map} +0 -0
- /package/dist/{db-4ABEYNDM.js.map → db-W3RPRILW.js.map} +0 -0
- /package/dist/{extract-bundle-DYMQRQWG.js.map → extract-bundle-DXWWQER6.js.map} +0 -0
- /package/dist/{location-data-repository-HDNCU4Z4.js.map → location-data-repository-2FJVMTZ2.js.map} +0 -0
- /package/dist/{site-extract-repository-G723PZIL.js.map → site-extract-repository-UULQAGO4.js.map} +0 -0
- /package/dist/{worker-4LZGRHDA.js.map → worker-3QX7LG62.js.map} +0 -0
package/dist/bin/api-server.cjs
CHANGED
|
@@ -2623,38 +2623,38 @@ function renderCard(card) {
|
|
|
2623
2623
|
</div>
|
|
2624
2624
|
</div>`;
|
|
2625
2625
|
}
|
|
2626
|
-
function renderSection(
|
|
2627
|
-
const calloutHtml =
|
|
2626
|
+
function renderSection(section2, tocTitle) {
|
|
2627
|
+
const calloutHtml = section2.callout ? `
|
|
2628
2628
|
<div class="callout">
|
|
2629
|
-
<p class="callout-eyebrow">${
|
|
2630
|
-
<h3 class="callout-heading">${
|
|
2631
|
-
<p class="callout-body">${
|
|
2629
|
+
<p class="callout-eyebrow">${section2.callout.eyebrow}</p>
|
|
2630
|
+
<h3 class="callout-heading">${section2.callout.heading}</h3>
|
|
2631
|
+
<p class="callout-body">${section2.callout.body}</p>
|
|
2632
2632
|
</div>` : "";
|
|
2633
|
-
const cardsHtml =
|
|
2634
|
-
const interactiveHtml =
|
|
2635
|
-
<div class="section-interactive">${
|
|
2636
|
-
return `<section class="post-section" id="${
|
|
2633
|
+
const cardsHtml = section2.cards.map(renderCard).join("\n ");
|
|
2634
|
+
const interactiveHtml = section2.interactiveHtml ? `
|
|
2635
|
+
<div class="section-interactive">${section2.interactiveHtml}</div>` : "";
|
|
2636
|
+
return `<section class="post-section" id="${section2.id}" aria-label="${tocTitle}">
|
|
2637
2637
|
<div class="section-header">
|
|
2638
|
-
<span class="section-num">${
|
|
2639
|
-
<h2 class="section-title">${
|
|
2640
|
-
<p class="section-deck">${
|
|
2638
|
+
<span class="section-num">${section2.num}</span>
|
|
2639
|
+
<h2 class="section-title">${section2.title}${section2.titleItalic ? ` <em>${section2.titleItalic}</em>` : ""}</h2>
|
|
2640
|
+
<p class="section-deck">${section2.deck}</p>
|
|
2641
2641
|
</div>${calloutHtml}
|
|
2642
2642
|
<div class="card-stack">
|
|
2643
2643
|
${cardsHtml}
|
|
2644
2644
|
</div>${interactiveHtml}
|
|
2645
2645
|
</section>`;
|
|
2646
2646
|
}
|
|
2647
|
-
function tocItem(
|
|
2648
|
-
const label = `${
|
|
2649
|
-
const subItems =
|
|
2647
|
+
function tocItem(section2) {
|
|
2648
|
+
const label = `${section2.title}${section2.titleItalic ? " " + section2.titleItalic : ""}`;
|
|
2649
|
+
const subItems = section2.cards.map((card) => `<li>
|
|
2650
2650
|
<a href="#${card.id}" class="toc-sub-link" data-toc="${card.id}">
|
|
2651
2651
|
<span class="toc-sub-num">${card.num}</span>
|
|
2652
2652
|
<span class="toc-sub-label">${card.question}</span>
|
|
2653
2653
|
</a>
|
|
2654
2654
|
</li>`).join("\n ");
|
|
2655
2655
|
return `<li>
|
|
2656
|
-
<a href="#${
|
|
2657
|
-
<span class="toc-num">${
|
|
2656
|
+
<a href="#${section2.id}" class="toc-link" data-toc="${section2.id}">
|
|
2657
|
+
<span class="toc-num">${section2.num}</span>
|
|
2658
2658
|
<span class="toc-label">${label}</span>
|
|
2659
2659
|
</a>
|
|
2660
2660
|
<ul class="toc-sub-list">
|
|
@@ -4548,7 +4548,7 @@ async function migrate(options = {}) {
|
|
|
4548
4548
|
artifact_id TEXT NOT NULL,
|
|
4549
4549
|
title TEXT NOT NULL,
|
|
4550
4550
|
summary TEXT NOT NULL,
|
|
4551
|
-
renderer_key TEXT NOT NULL CHECK (renderer_key
|
|
4551
|
+
renderer_key TEXT NOT NULL CHECK (renderer_key IN ('editorial_reading_room_v1','personal_authority_v1')),
|
|
4552
4552
|
token_hash TEXT NOT NULL UNIQUE,
|
|
4553
4553
|
expires_at TEXT NOT NULL,
|
|
4554
4554
|
revoked_at TEXT,
|
|
@@ -29055,8 +29055,8 @@ var init_YouTubeExtractor = __esm({
|
|
|
29055
29055
|
const sections = slr?.contents ?? [];
|
|
29056
29056
|
const videos = [];
|
|
29057
29057
|
const channels = [];
|
|
29058
|
-
for (const
|
|
29059
|
-
const contents =
|
|
29058
|
+
for (const section2 of sections) {
|
|
29059
|
+
const contents = section2.itemSectionRenderer?.contents ?? [];
|
|
29060
29060
|
for (const item of contents) {
|
|
29061
29061
|
const rec = item;
|
|
29062
29062
|
if (rec.videoRenderer) {
|
|
@@ -34302,9 +34302,9 @@ var init_PAAExtractor = __esm({
|
|
|
34302
34302
|
async extractWhatPeopleSaying(page) {
|
|
34303
34303
|
const sels = WhatPeopleSayingSelectors;
|
|
34304
34304
|
return page.evaluate((s) => {
|
|
34305
|
-
const
|
|
34306
|
-
if (!
|
|
34307
|
-
return Array.from(
|
|
34305
|
+
const section2 = Array.from(document.querySelectorAll(s.sectionTag)).find((el2) => el2.textContent?.includes(s.sectionHeadingText)) ?? document.querySelector(".yG4QQe.TBC9ub.NbhJ1c");
|
|
34306
|
+
if (!section2) return [];
|
|
34307
|
+
return Array.from(section2.querySelectorAll(s.card)).map((card) => {
|
|
34308
34308
|
const link = card.querySelector(s.cardLink);
|
|
34309
34309
|
const url = link?.href ?? "";
|
|
34310
34310
|
const titleH1 = card.querySelector(s.titleH1)?.textContent?.trim();
|
|
@@ -37938,7 +37938,7 @@ function renderTable(table) {
|
|
|
37938
37938
|
}
|
|
37939
37939
|
function renderWorkflowReport(input) {
|
|
37940
37940
|
const warnings = input.warnings?.length ? `<section class="warnings"><h2>Warnings</h2><ul>${input.warnings.map((w) => `<li>${escapeHtml(w)}</li>`).join("")}</ul></section>` : "";
|
|
37941
|
-
const sections = (input.sections ?? []).map((
|
|
37941
|
+
const sections = (input.sections ?? []).map((section2) => `<section><h2>${escapeHtml(section2.title)}</h2><p>${escapeHtml(section2.body)}</p></section>`).join("\n");
|
|
37942
37942
|
const tables = (input.tables ?? []).map(renderTable).join("\n");
|
|
37943
37943
|
return [
|
|
37944
37944
|
"<!doctype html>",
|
|
@@ -41371,7 +41371,7 @@ var PACKAGE_VERSION;
|
|
|
41371
41371
|
var init_version = __esm({
|
|
41372
41372
|
"src/version.ts"() {
|
|
41373
41373
|
"use strict";
|
|
41374
|
-
PACKAGE_VERSION = "0.
|
|
41374
|
+
PACKAGE_VERSION = "0.47.0";
|
|
41375
41375
|
}
|
|
41376
41376
|
});
|
|
41377
41377
|
|
|
@@ -41937,7 +41937,7 @@ async function buildMetaAdCreativeMediaResult(executor, input) {
|
|
|
41937
41937
|
publicPostCandidateUrl ? `**Public post candidate:** ${publicPostCandidateUrl} (unverified; dark/paused ads may not be public)` : "",
|
|
41938
41938
|
nextActions.length ? `
|
|
41939
41939
|
## Recommended next calls
|
|
41940
|
-
${nextActions.map((
|
|
41940
|
+
${nextActions.map((action2) => `- \`${String(action2["tool"] ?? "")}\`: ${String(action2["reason"] ?? "")}`).join("\n")}` : "",
|
|
41941
41941
|
warnings.length ? `
|
|
41942
41942
|
## Warnings
|
|
41943
41943
|
${warnings.map((warning) => `- ${warning}`).join("\n")}` : "",
|
|
@@ -41984,7 +41984,7 @@ var init_meta_ad_creative_media = __esm({
|
|
|
41984
41984
|
});
|
|
41985
41985
|
|
|
41986
41986
|
// src/scheduled-artifacts/contracts.ts
|
|
41987
|
-
var import_zod41, ScheduledArtifactSelectionSchema, ArtifactTemplateConfigSchema, EditorialReadingRoomV1InputSchema, CreateArtifactTemplateInputSchema, UpdateArtifactTemplateInputSchema, ArtifactTemplateVersionSchema, ArtifactTemplateSchema, ListArtifactTemplatesResponseSchema, ScheduledRunNoteOutputSchema, ScheduledRunArtifactOutputSchema, ScheduledRunResultSchema, ListScheduledRunsQuerySchema, ListScheduledRunsResponseSchema, GetScheduledRunResponseSchema, InternalScheduledArtifactRenderRequestSchema, CreateScheduledRunViewLinkInputSchema, PublicScheduledRunTokenSchema, ApiErrorResponseSchema,
|
|
41987
|
+
var import_zod41, ScheduledArtifactSelectionSchema, EditorialArtifactTemplateConfigSchema, PersonalAuthorityFeatureFlagsSchema, PersonalAuthorityTemplateConfigSchema, ArtifactTemplateConfigSchema, EditorialReadingRoomV1InputSchema, PersonalAuthorityActionSchema, PersonalAuthorityV1InputSchema, TemplateIdentityFields, CreateArtifactTemplateInputSchema, UpdateArtifactTemplateInputSchema, ArtifactTemplateVersionBase, ArtifactTemplateVersionSchema, ArtifactTemplateSchema, ListArtifactTemplatesResponseSchema, ScheduledRunNoteOutputSchema, ScheduledRunArtifactOutputSchema, ScheduledRunResultSchema, ListScheduledRunsQuerySchema, ListScheduledRunsResponseSchema, GetScheduledRunResponseSchema, InternalScheduledArtifactRenderRequestBase, InternalScheduledArtifactRenderRequestSchema, CreateScheduledRunViewLinkInputSchema, PublicScheduledRunTokenSchema, ApiErrorResponseSchema, EDITORIAL_READING_ROOM_TEMPLATE_PRESET, PERSONAL_AUTHORITY_TEMPLATE_PRESET;
|
|
41988
41988
|
var init_contracts = __esm({
|
|
41989
41989
|
"src/scheduled-artifacts/contracts.ts"() {
|
|
41990
41990
|
"use strict";
|
|
@@ -41997,13 +41997,33 @@ var init_contracts = __esm({
|
|
|
41997
41997
|
templateVersionId: import_zod41.z.string().uuid()
|
|
41998
41998
|
}).strict()
|
|
41999
41999
|
]);
|
|
42000
|
-
|
|
42000
|
+
EditorialArtifactTemplateConfigSchema = import_zod41.z.object({
|
|
42001
42001
|
theme: import_zod41.z.enum(["paper", "ink", "warm"]),
|
|
42002
42002
|
density: import_zod41.z.enum(["comfortable", "compact"]),
|
|
42003
42003
|
showSourceRail: import_zod41.z.boolean(),
|
|
42004
42004
|
showGeneratedAt: import_zod41.z.boolean(),
|
|
42005
42005
|
brandName: import_zod41.z.string().trim().min(1).max(80).optional()
|
|
42006
42006
|
}).strict();
|
|
42007
|
+
PersonalAuthorityFeatureFlagsSchema = import_zod41.z.object({
|
|
42008
|
+
navigation: import_zod41.z.boolean(),
|
|
42009
|
+
socialLinks: import_zod41.z.boolean(),
|
|
42010
|
+
authority: import_zod41.z.boolean(),
|
|
42011
|
+
consultation: import_zod41.z.boolean(),
|
|
42012
|
+
learning: import_zod41.z.boolean(),
|
|
42013
|
+
services: import_zod41.z.boolean(),
|
|
42014
|
+
proof: import_zod41.z.boolean(),
|
|
42015
|
+
finalCta: import_zod41.z.boolean()
|
|
42016
|
+
}).strict();
|
|
42017
|
+
PersonalAuthorityTemplateConfigSchema = import_zod41.z.object({
|
|
42018
|
+
theme: import_zod41.z.enum(["blue", "slate", "monochrome"]),
|
|
42019
|
+
showGeneratedAt: import_zod41.z.boolean(),
|
|
42020
|
+
brandName: import_zod41.z.string().trim().min(1).max(80).optional(),
|
|
42021
|
+
featureFlags: PersonalAuthorityFeatureFlagsSchema
|
|
42022
|
+
}).strict();
|
|
42023
|
+
ArtifactTemplateConfigSchema = import_zod41.z.union([
|
|
42024
|
+
EditorialArtifactTemplateConfigSchema,
|
|
42025
|
+
PersonalAuthorityTemplateConfigSchema
|
|
42026
|
+
]);
|
|
42007
42027
|
EditorialReadingRoomV1InputSchema = import_zod41.z.object({
|
|
42008
42028
|
title: import_zod41.z.string().trim().min(1).max(300),
|
|
42009
42029
|
dek: import_zod41.z.string().trim().max(1e3).optional(),
|
|
@@ -42025,7 +42045,7 @@ var init_contracts = __esm({
|
|
|
42025
42045
|
}).strict()).max(1e3).optional()
|
|
42026
42046
|
}).strict().superRefine((input, ctx) => {
|
|
42027
42047
|
const markdownBytes = input.sections.reduce(
|
|
42028
|
-
(total,
|
|
42048
|
+
(total, section2) => total + Buffer.byteLength(section2.markdown),
|
|
42029
42049
|
0
|
|
42030
42050
|
);
|
|
42031
42051
|
if (markdownBytes > 2e6) {
|
|
@@ -42036,25 +42056,104 @@ var init_contracts = __esm({
|
|
|
42036
42056
|
});
|
|
42037
42057
|
}
|
|
42038
42058
|
});
|
|
42039
|
-
|
|
42040
|
-
|
|
42059
|
+
PersonalAuthorityActionSchema = import_zod41.z.object({
|
|
42060
|
+
label: import_zod41.z.string().trim().min(1).max(120),
|
|
42061
|
+
href: import_zod41.z.string().trim().min(1).max(2e3)
|
|
42062
|
+
}).strict();
|
|
42063
|
+
PersonalAuthorityV1InputSchema = import_zod41.z.object({
|
|
42064
|
+
name: import_zod41.z.string().trim().min(1).max(160),
|
|
42065
|
+
professionalTitle: import_zod41.z.string().trim().min(1).max(300),
|
|
42066
|
+
summary: import_zod41.z.string().trim().min(1).max(1500),
|
|
42067
|
+
location: import_zod41.z.string().trim().max(160).optional(),
|
|
42068
|
+
email: import_zod41.z.string().trim().email().max(320).optional(),
|
|
42069
|
+
phone: import_zod41.z.string().trim().max(80).optional(),
|
|
42070
|
+
primaryAction: PersonalAuthorityActionSchema,
|
|
42071
|
+
secondaryAction: PersonalAuthorityActionSchema.optional(),
|
|
42072
|
+
socialLinks: import_zod41.z.array(import_zod41.z.object({
|
|
42073
|
+
label: import_zod41.z.string().trim().min(1).max(60),
|
|
42074
|
+
href: import_zod41.z.string().trim().min(1).max(2e3)
|
|
42075
|
+
}).strict()).max(8).default([]),
|
|
42076
|
+
authority: import_zod41.z.object({
|
|
42077
|
+
heading: import_zod41.z.string().trim().min(1).max(500),
|
|
42078
|
+
paragraphs: import_zod41.z.array(import_zod41.z.string().trim().min(1).max(2e3)).min(1).max(6)
|
|
42079
|
+
}).strict().optional(),
|
|
42080
|
+
consultation: import_zod41.z.object({
|
|
42081
|
+
eyebrow: import_zod41.z.string().trim().max(120).optional(),
|
|
42082
|
+
heading: import_zod41.z.string().trim().min(1).max(400),
|
|
42083
|
+
summary: import_zod41.z.string().trim().min(1).max(1e3),
|
|
42084
|
+
action: PersonalAuthorityActionSchema
|
|
42085
|
+
}).strict().optional(),
|
|
42086
|
+
learning: import_zod41.z.object({
|
|
42087
|
+
heading: import_zod41.z.string().trim().min(1).max(400),
|
|
42088
|
+
summary: import_zod41.z.string().trim().max(1e3).optional(),
|
|
42089
|
+
topics: import_zod41.z.array(import_zod41.z.object({
|
|
42090
|
+
title: import_zod41.z.string().trim().min(1).max(160),
|
|
42091
|
+
headline: import_zod41.z.string().trim().min(1).max(300),
|
|
42092
|
+
summary: import_zod41.z.string().trim().min(1).max(1500),
|
|
42093
|
+
href: import_zod41.z.string().trim().min(1).max(2e3).optional()
|
|
42094
|
+
}).strict()).min(1).max(12)
|
|
42095
|
+
}).strict().optional(),
|
|
42096
|
+
services: import_zod41.z.object({
|
|
42097
|
+
heading: import_zod41.z.string().trim().min(1).max(400),
|
|
42098
|
+
summary: import_zod41.z.string().trim().max(1e3).optional(),
|
|
42099
|
+
offers: import_zod41.z.array(import_zod41.z.object({
|
|
42100
|
+
title: import_zod41.z.string().trim().min(1).max(160),
|
|
42101
|
+
description: import_zod41.z.string().trim().min(1).max(1500),
|
|
42102
|
+
action: PersonalAuthorityActionSchema.optional()
|
|
42103
|
+
}).strict()).min(1).max(6)
|
|
42104
|
+
}).strict().optional(),
|
|
42105
|
+
proof: import_zod41.z.object({
|
|
42106
|
+
heading: import_zod41.z.string().trim().min(1).max(400),
|
|
42107
|
+
summary: import_zod41.z.string().trim().max(1e3).optional(),
|
|
42108
|
+
testimonials: import_zod41.z.array(import_zod41.z.object({
|
|
42109
|
+
quote: import_zod41.z.string().trim().min(1).max(1500),
|
|
42110
|
+
person: import_zod41.z.string().trim().min(1).max(160),
|
|
42111
|
+
role: import_zod41.z.string().trim().max(200).optional()
|
|
42112
|
+
}).strict()).min(1).max(12)
|
|
42113
|
+
}).strict().optional(),
|
|
42114
|
+
finalCta: import_zod41.z.object({
|
|
42115
|
+
eyebrow: import_zod41.z.string().trim().max(120).optional(),
|
|
42116
|
+
heading: import_zod41.z.string().trim().min(1).max(400),
|
|
42117
|
+
summary: import_zod41.z.string().trim().max(1e3).optional(),
|
|
42118
|
+
action: PersonalAuthorityActionSchema
|
|
42119
|
+
}).strict().optional()
|
|
42120
|
+
}).strict();
|
|
42121
|
+
TemplateIdentityFields = {
|
|
42041
42122
|
name: import_zod41.z.string().trim().min(1).max(120),
|
|
42042
42123
|
description: import_zod41.z.string().trim().max(500).default(""),
|
|
42043
|
-
config: ArtifactTemplateConfigSchema,
|
|
42044
42124
|
authoringInstructions: import_zod41.z.string().trim().max(4e3)
|
|
42045
|
-
}
|
|
42046
|
-
|
|
42047
|
-
|
|
42125
|
+
};
|
|
42126
|
+
CreateArtifactTemplateInputSchema = import_zod41.z.discriminatedUnion("presetKey", [
|
|
42127
|
+
import_zod41.z.object({
|
|
42128
|
+
presetKey: import_zod41.z.literal("editorial_reading_room_v1"),
|
|
42129
|
+
...TemplateIdentityFields,
|
|
42130
|
+
config: EditorialArtifactTemplateConfigSchema
|
|
42131
|
+
}).strict(),
|
|
42132
|
+
import_zod41.z.object({
|
|
42133
|
+
presetKey: import_zod41.z.literal("personal_authority_v1"),
|
|
42134
|
+
...TemplateIdentityFields,
|
|
42135
|
+
config: PersonalAuthorityTemplateConfigSchema
|
|
42136
|
+
}).strict()
|
|
42137
|
+
]);
|
|
42138
|
+
UpdateArtifactTemplateInputSchema = import_zod41.z.object({
|
|
42139
|
+
name: TemplateIdentityFields.name.optional(),
|
|
42140
|
+
description: import_zod41.z.string().trim().max(500).optional(),
|
|
42141
|
+
config: ArtifactTemplateConfigSchema.optional(),
|
|
42142
|
+
authoringInstructions: TemplateIdentityFields.authoringInstructions.optional()
|
|
42143
|
+
}).strict().refine((input) => Object.keys(input).length > 0, "At least one field is required");
|
|
42144
|
+
ArtifactTemplateVersionBase = {
|
|
42048
42145
|
templateVersionId: import_zod41.z.string().uuid(),
|
|
42049
42146
|
templateId: import_zod41.z.string().uuid(),
|
|
42050
42147
|
version: import_zod41.z.number().int().positive(),
|
|
42051
|
-
rendererKey: import_zod41.z.literal("editorial_reading_room_v1"),
|
|
42052
42148
|
rendererVersion: import_zod41.z.literal(1),
|
|
42053
42149
|
inputContractVersion: import_zod41.z.literal(1),
|
|
42054
|
-
config: ArtifactTemplateConfigSchema,
|
|
42055
42150
|
authoringInstructions: import_zod41.z.string().max(4e3),
|
|
42056
42151
|
createdAt: import_zod41.z.string().datetime()
|
|
42057
|
-
}
|
|
42152
|
+
};
|
|
42153
|
+
ArtifactTemplateVersionSchema = import_zod41.z.discriminatedUnion("rendererKey", [
|
|
42154
|
+
import_zod41.z.object({ ...ArtifactTemplateVersionBase, rendererKey: import_zod41.z.literal("editorial_reading_room_v1"), config: EditorialArtifactTemplateConfigSchema }).strict(),
|
|
42155
|
+
import_zod41.z.object({ ...ArtifactTemplateVersionBase, rendererKey: import_zod41.z.literal("personal_authority_v1"), config: PersonalAuthorityTemplateConfigSchema }).strict()
|
|
42156
|
+
]);
|
|
42058
42157
|
ArtifactTemplateSchema = import_zod41.z.object({
|
|
42059
42158
|
templateId: import_zod41.z.string().uuid(),
|
|
42060
42159
|
name: import_zod41.z.string().min(1).max(120),
|
|
@@ -42069,9 +42168,15 @@ var init_contracts = __esm({
|
|
|
42069
42168
|
ListArtifactTemplatesResponseSchema = import_zod41.z.object({
|
|
42070
42169
|
ok: import_zod41.z.literal(true),
|
|
42071
42170
|
presets: import_zod41.z.array(import_zod41.z.object({
|
|
42072
|
-
presetKey: import_zod41.z.
|
|
42171
|
+
presetKey: import_zod41.z.enum(["editorial_reading_room_v1", "personal_authority_v1"]),
|
|
42073
42172
|
name: import_zod41.z.string(),
|
|
42074
42173
|
description: import_zod41.z.string(),
|
|
42174
|
+
mark: import_zod41.z.string().min(1).max(4),
|
|
42175
|
+
featureFlags: import_zod41.z.array(import_zod41.z.object({
|
|
42176
|
+
key: import_zod41.z.string().min(1),
|
|
42177
|
+
label: import_zod41.z.string().min(1),
|
|
42178
|
+
description: import_zod41.z.string().min(1)
|
|
42179
|
+
}).strict()),
|
|
42075
42180
|
defaultConfig: ArtifactTemplateConfigSchema
|
|
42076
42181
|
}).strict()),
|
|
42077
42182
|
templates: import_zod41.z.array(ArtifactTemplateSchema)
|
|
@@ -42086,7 +42191,7 @@ var init_contracts = __esm({
|
|
|
42086
42191
|
artifactId: import_zod41.z.string().min(1).max(1e3),
|
|
42087
42192
|
templateId: import_zod41.z.string().uuid(),
|
|
42088
42193
|
templateVersionId: import_zod41.z.string().uuid(),
|
|
42089
|
-
rendererKey: import_zod41.z.
|
|
42194
|
+
rendererKey: import_zod41.z.enum(["editorial_reading_room_v1", "personal_authority_v1"]),
|
|
42090
42195
|
rendererVersion: import_zod41.z.literal(1),
|
|
42091
42196
|
mimeType: import_zod41.z.literal("text/html"),
|
|
42092
42197
|
title: import_zod41.z.string().min(1).max(300),
|
|
@@ -42138,18 +42243,29 @@ var init_contracts = __esm({
|
|
|
42138
42243
|
ok: import_zod41.z.literal(true),
|
|
42139
42244
|
run: ScheduledRunResultSchema
|
|
42140
42245
|
}).strict();
|
|
42141
|
-
|
|
42246
|
+
InternalScheduledArtifactRenderRequestBase = {
|
|
42142
42247
|
identity: import_zod41.z.string().min(1).max(320),
|
|
42143
42248
|
ownerId: import_zod41.z.string().regex(/^[a-f0-9]{24}$/),
|
|
42144
42249
|
runId: import_zod41.z.string().min(1).max(200),
|
|
42145
42250
|
scheduleId: import_zod41.z.string().uuid(),
|
|
42146
42251
|
templateId: import_zod41.z.string().uuid(),
|
|
42147
42252
|
templateVersionId: import_zod41.z.string().uuid(),
|
|
42148
|
-
|
|
42149
|
-
|
|
42150
|
-
|
|
42151
|
-
|
|
42152
|
-
|
|
42253
|
+
rendererVersion: import_zod41.z.literal(1)
|
|
42254
|
+
};
|
|
42255
|
+
InternalScheduledArtifactRenderRequestSchema = import_zod41.z.discriminatedUnion("rendererKey", [
|
|
42256
|
+
import_zod41.z.object({
|
|
42257
|
+
...InternalScheduledArtifactRenderRequestBase,
|
|
42258
|
+
rendererKey: import_zod41.z.literal("editorial_reading_room_v1"),
|
|
42259
|
+
config: EditorialArtifactTemplateConfigSchema,
|
|
42260
|
+
input: EditorialReadingRoomV1InputSchema
|
|
42261
|
+
}).strict(),
|
|
42262
|
+
import_zod41.z.object({
|
|
42263
|
+
...InternalScheduledArtifactRenderRequestBase,
|
|
42264
|
+
rendererKey: import_zod41.z.literal("personal_authority_v1"),
|
|
42265
|
+
config: PersonalAuthorityTemplateConfigSchema,
|
|
42266
|
+
input: PersonalAuthorityV1InputSchema
|
|
42267
|
+
}).strict()
|
|
42268
|
+
]);
|
|
42153
42269
|
CreateScheduledRunViewLinkInputSchema = import_zod41.z.object({
|
|
42154
42270
|
artifactId: import_zod41.z.string().min(1).max(1e3),
|
|
42155
42271
|
expiresInDays: import_zod41.z.number().int().min(1).max(30).default(7)
|
|
@@ -42172,10 +42288,15 @@ var init_contracts = __esm({
|
|
|
42172
42288
|
]),
|
|
42173
42289
|
requestId: import_zod41.z.string().max(200).optional()
|
|
42174
42290
|
}).strict();
|
|
42175
|
-
|
|
42291
|
+
EDITORIAL_READING_ROOM_TEMPLATE_PRESET = {
|
|
42176
42292
|
presetKey: "editorial_reading_room_v1",
|
|
42177
42293
|
name: "Editorial Reading Room",
|
|
42178
42294
|
description: "A self-contained, source-labelled reading experience for scheduled research and reports.",
|
|
42295
|
+
mark: "Aa",
|
|
42296
|
+
featureFlags: [
|
|
42297
|
+
{ key: "showSourceRail", label: "Source rail", description: "Keep source references visible beside the report." },
|
|
42298
|
+
{ key: "showGeneratedAt", label: "Generated time", description: "Show when the report was rendered." }
|
|
42299
|
+
],
|
|
42179
42300
|
defaultConfig: {
|
|
42180
42301
|
theme: "paper",
|
|
42181
42302
|
density: "comfortable",
|
|
@@ -42183,6 +42304,36 @@ var init_contracts = __esm({
|
|
|
42183
42304
|
showGeneratedAt: true
|
|
42184
42305
|
}
|
|
42185
42306
|
};
|
|
42307
|
+
PERSONAL_AUTHORITY_TEMPLATE_PRESET = {
|
|
42308
|
+
presetKey: "personal_authority_v1",
|
|
42309
|
+
name: "Personal Authority",
|
|
42310
|
+
description: "A flexible person-focused website for practitioners, founders, leaders, authors, coaches, and other professionals.",
|
|
42311
|
+
mark: "M",
|
|
42312
|
+
featureFlags: [
|
|
42313
|
+
{ key: "navigation", label: "Navigation", description: "Show the responsive header and section navigation." },
|
|
42314
|
+
{ key: "socialLinks", label: "Social links", description: "Show professional and media profile links." },
|
|
42315
|
+
{ key: "authority", label: "Experience", description: "Show the background and authority section." },
|
|
42316
|
+
{ key: "consultation", label: "Consultation", description: "Show an early invitation to connect." },
|
|
42317
|
+
{ key: "learning", label: "Ideas and resources", description: "Show educational topics and useful resources." },
|
|
42318
|
+
{ key: "services", label: "Ways to work together", description: "Show services, appointments, or offers." },
|
|
42319
|
+
{ key: "proof", label: "Proof", description: "Show testimonials, outcomes, or affiliations." },
|
|
42320
|
+
{ key: "finalCta", label: "Final invitation", description: "Show the closing contact call to action." }
|
|
42321
|
+
],
|
|
42322
|
+
defaultConfig: {
|
|
42323
|
+
theme: "blue",
|
|
42324
|
+
showGeneratedAt: false,
|
|
42325
|
+
featureFlags: {
|
|
42326
|
+
navigation: true,
|
|
42327
|
+
socialLinks: true,
|
|
42328
|
+
authority: true,
|
|
42329
|
+
consultation: true,
|
|
42330
|
+
learning: true,
|
|
42331
|
+
services: true,
|
|
42332
|
+
proof: true,
|
|
42333
|
+
finalCta: true
|
|
42334
|
+
}
|
|
42335
|
+
}
|
|
42336
|
+
};
|
|
42186
42337
|
}
|
|
42187
42338
|
});
|
|
42188
42339
|
|
|
@@ -51508,40 +51659,40 @@ function annotations(title, readOnlyHint, destructiveHint = false, idempotentHin
|
|
|
51508
51659
|
}
|
|
51509
51660
|
function registerScheduledResultsMcpTools(server, executor) {
|
|
51510
51661
|
server.registerTool("list_artifact_templates", {
|
|
51511
|
-
title: "List
|
|
51512
|
-
description: "List
|
|
51662
|
+
title: "List Templates",
|
|
51663
|
+
description: "List registered presentation presets and saved immutable template versions. A preset must be saved before an automation can select it.",
|
|
51513
51664
|
inputSchema: import_zod47.z.object({
|
|
51514
51665
|
status: import_zod47.z.enum(["active", "archived", "all"]).default("active")
|
|
51515
51666
|
}).strict(),
|
|
51516
51667
|
outputSchema: recordOutputSchema("list_artifact_templates", McpListArtifactTemplatesOutputSchema),
|
|
51517
|
-
annotations: annotations("List
|
|
51668
|
+
annotations: annotations("List Templates", true)
|
|
51518
51669
|
}, (input) => executor.call(
|
|
51519
51670
|
`/artifact-templates?status=${encodeURIComponent(input.status)}`,
|
|
51520
51671
|
ListArtifactTemplatesOutputSchema
|
|
51521
51672
|
));
|
|
51522
51673
|
server.registerTool("get_artifact_template", {
|
|
51523
|
-
title: "Get
|
|
51524
|
-
description: "Read one saved
|
|
51674
|
+
title: "Get Template",
|
|
51675
|
+
description: "Read one saved template, its renderer family, configuration, and immutable version history.",
|
|
51525
51676
|
inputSchema: import_zod47.z.object({ templateId: TemplateIdSchema }).strict(),
|
|
51526
51677
|
outputSchema: recordOutputSchema("get_artifact_template", McpArtifactTemplateOutputSchema),
|
|
51527
|
-
annotations: annotations("Get
|
|
51678
|
+
annotations: annotations("Get Template", true)
|
|
51528
51679
|
}, (input) => executor.call(
|
|
51529
51680
|
`/artifact-templates/${encodeURIComponent(input.templateId)}`,
|
|
51530
51681
|
ArtifactTemplateOutputSchema
|
|
51531
51682
|
));
|
|
51532
51683
|
server.registerTool("create_artifact_template", {
|
|
51533
|
-
title: "
|
|
51534
|
-
description: "
|
|
51684
|
+
title: "Create Template",
|
|
51685
|
+
description: "Create a user-owned template from a registered preset. Customize supported flags and presentation guidance; arbitrary executable code is not accepted.",
|
|
51535
51686
|
inputSchema: CreateArtifactTemplateInputSchema,
|
|
51536
51687
|
outputSchema: recordOutputSchema("create_artifact_template", McpArtifactTemplateOutputSchema),
|
|
51537
|
-
annotations: annotations("
|
|
51688
|
+
annotations: annotations("Create Template", false)
|
|
51538
51689
|
}, (input) => executor.call("/artifact-templates", ArtifactTemplateOutputSchema, "POST", input));
|
|
51539
51690
|
server.registerTool("update_artifact_template", {
|
|
51540
|
-
title: "
|
|
51541
|
-
description: "Create the next immutable version of a saved
|
|
51691
|
+
title: "Update Template",
|
|
51692
|
+
description: "Create the next immutable version of a saved template. Existing automations remain pinned to their exact prior version until explicitly changed.",
|
|
51542
51693
|
inputSchema: UpdateArtifactTemplateToolInputSchema,
|
|
51543
51694
|
outputSchema: recordOutputSchema("update_artifact_template", McpArtifactTemplateOutputSchema),
|
|
51544
|
-
annotations: annotations("
|
|
51695
|
+
annotations: annotations("Update Template", false)
|
|
51545
51696
|
}, (input) => {
|
|
51546
51697
|
const { templateId, ...body } = input;
|
|
51547
51698
|
UpdateArtifactTemplateInputSchema.parse(body);
|
|
@@ -51553,14 +51704,14 @@ function registerScheduledResultsMcpTools(server, executor) {
|
|
|
51553
51704
|
);
|
|
51554
51705
|
});
|
|
51555
51706
|
server.registerTool("archive_artifact_template", {
|
|
51556
|
-
title: "Archive
|
|
51707
|
+
title: "Archive Template",
|
|
51557
51708
|
description: "Archive or restore a saved template without deleting its immutable versions. Existing pinned automations continue to work.",
|
|
51558
51709
|
inputSchema: import_zod47.z.object({
|
|
51559
51710
|
templateId: TemplateIdSchema,
|
|
51560
51711
|
archived: import_zod47.z.boolean()
|
|
51561
51712
|
}).strict(),
|
|
51562
51713
|
outputSchema: recordOutputSchema("archive_artifact_template", McpArtifactTemplateOutputSchema),
|
|
51563
|
-
annotations: annotations("Archive
|
|
51714
|
+
annotations: annotations("Archive Template", false, false, true)
|
|
51564
51715
|
}, (input) => executor.call(
|
|
51565
51716
|
`/artifact-templates/${encodeURIComponent(input.templateId)}/${input.archived ? "archive" : "restore"}`,
|
|
51566
51717
|
ArtifactTemplateOutputSchema,
|
|
@@ -54988,10 +55139,10 @@ var init_oauth_routes = __esm({
|
|
|
54988
55139
|
return typeof v === "string" ? v : void 0;
|
|
54989
55140
|
};
|
|
54990
55141
|
const p = parseAuthParams(get);
|
|
54991
|
-
const
|
|
55142
|
+
const action2 = get("action") ?? "";
|
|
54992
55143
|
const valid = await validateAuthRequest(p);
|
|
54993
55144
|
if (!valid.ok) return c.text(valid.message, valid.status);
|
|
54994
|
-
if (
|
|
55145
|
+
if (action2 === "login") {
|
|
54995
55146
|
const email = (get("email") ?? "").trim().toLowerCase();
|
|
54996
55147
|
const password = get("password") ?? "";
|
|
54997
55148
|
const user2 = email ? await withOAuthDatabaseDeadline("login-user", getUserByEmail(email)) : void 0;
|
|
@@ -55005,8 +55156,8 @@ var init_oauth_routes = __esm({
|
|
|
55005
55156
|
}
|
|
55006
55157
|
const user = await sessionUser((0, import_cookie.getCookie)(c, "session"));
|
|
55007
55158
|
if (!user) return c.html(renderLogin(p, "Your session expired. Please sign in again."));
|
|
55008
|
-
if (
|
|
55009
|
-
if (
|
|
55159
|
+
if (action2 === "deny") return redirectWithError(p.redirect_uri, p.state, "access_denied");
|
|
55160
|
+
if (action2 !== "approve") return c.text("unsupported action", 400);
|
|
55010
55161
|
const scope = negotiateScope(p.scope, user, p.resource);
|
|
55011
55162
|
const code = `code_${(0, import_node_crypto30.randomBytes)(32).toString("base64url")}`;
|
|
55012
55163
|
const expiresAt = new Date(Date.now() + CODE_TTL_SECONDS * 1e3).toISOString();
|
|
@@ -56064,12 +56215,12 @@ var init_vault_routes = __esm({
|
|
|
56064
56215
|
const token4 = typeof body.token === "string" ? body.token : void 0;
|
|
56065
56216
|
if (!validToken(token4)) return c.json({ ok: false, error: "missing or malformed Vault App link" }, 401);
|
|
56066
56217
|
const path6 = stringValue(body.path, 320);
|
|
56067
|
-
const
|
|
56218
|
+
const action2 = stringValue(body.action, 24);
|
|
56068
56219
|
const title = typeof body.title === "string" ? stringValue(body.title, 320) : void 0;
|
|
56069
56220
|
const content = typeof body.content === "string" && body.content.length <= 1e5 ? body.content : void 0;
|
|
56070
56221
|
const feedback = typeof body.feedback === "string" ? body.feedback.trim().slice(0, 1e4) : void 0;
|
|
56071
56222
|
const baseRevision = typeof body.baseRevision === "number" && Number.isInteger(body.baseRevision) ? body.baseRevision : void 0;
|
|
56072
|
-
const normalizedAction =
|
|
56223
|
+
const normalizedAction = action2 === "accept" ? "approve" : action2;
|
|
56073
56224
|
if (!path6 || !normalizedAction || !["approve", "deny", "edit"].includes(normalizedAction) || body.title !== void 0 && !title) {
|
|
56074
56225
|
return c.json({ ok: false, error: "valid path, action, and optional draft fields are required" }, 400);
|
|
56075
56226
|
}
|
|
@@ -58233,30 +58384,30 @@ function renderEditorialReadingRoomV1(input, config, now = /* @__PURE__ */ new D
|
|
|
58233
58384
|
startLabel: "Start reading"
|
|
58234
58385
|
},
|
|
58235
58386
|
deck: input.dek ?? `Prepared for ${input.generatedFor}.`,
|
|
58236
|
-
articles: input.sections.map((
|
|
58387
|
+
articles: input.sections.map((section2, index) => {
|
|
58237
58388
|
const provenance = [
|
|
58238
58389
|
"",
|
|
58239
58390
|
"## Sources",
|
|
58240
58391
|
"",
|
|
58241
|
-
...
|
|
58242
|
-
...
|
|
58392
|
+
...section2.sourceLabels.map((label) => `- ${label}`),
|
|
58393
|
+
...section2.sourceRefs.map((ref) => `- ${scheduledSourceRef(ref)}`)
|
|
58243
58394
|
].join("\n");
|
|
58244
|
-
const withFiles = index === input.sections.length - 1 && filesMarkdown ? `${
|
|
58395
|
+
const withFiles = index === input.sections.length - 1 && filesMarkdown ? `${section2.markdown}
|
|
58245
58396
|
|
|
58246
58397
|
${provenance}
|
|
58247
58398
|
|
|
58248
|
-
${filesMarkdown}` : `${
|
|
58399
|
+
${filesMarkdown}` : `${section2.markdown}
|
|
58249
58400
|
|
|
58250
58401
|
${provenance}`;
|
|
58251
58402
|
return {
|
|
58252
|
-
slug:
|
|
58403
|
+
slug: section2.id,
|
|
58253
58404
|
category: "Report",
|
|
58254
|
-
kicker:
|
|
58405
|
+
kicker: section2.summary ?? "Scheduled result",
|
|
58255
58406
|
order: index + 1,
|
|
58256
|
-
title:
|
|
58257
|
-
summary:
|
|
58407
|
+
title: section2.title,
|
|
58408
|
+
summary: section2.summary ?? section2.title,
|
|
58258
58409
|
sourceType: "Scheduled result",
|
|
58259
|
-
sourceLabel:
|
|
58410
|
+
sourceLabel: section2.sourceLabels.join(" \xB7 ").slice(0, 500),
|
|
58260
58411
|
markdown: withFiles
|
|
58261
58412
|
};
|
|
58262
58413
|
}),
|
|
@@ -58715,7 +58866,7 @@ async function prepareCommonsEntity(input, user) {
|
|
|
58715
58866
|
presentHeadings: headings,
|
|
58716
58867
|
recommendedSections: contract.recommendedSections,
|
|
58717
58868
|
optionalSections: contract.optionalSections,
|
|
58718
|
-
missingRecommendedSections: contract.recommendedSections.filter((
|
|
58869
|
+
missingRecommendedSections: contract.recommendedSections.filter((section2) => !presentHeadingLabels.has(section2.toLowerCase())),
|
|
58719
58870
|
rule: "Use the entity profile as a guide, but omit any section or subsection that is not supported by source evidence."
|
|
58720
58871
|
},
|
|
58721
58872
|
instructions: [
|
|
@@ -58788,8 +58939,8 @@ async function validateCommonsEntity(input, user) {
|
|
|
58788
58939
|
headings,
|
|
58789
58940
|
placeholderSections,
|
|
58790
58941
|
requiredOmissionRule: "Omit unsupported profile sections; do not publish sections whose only content is that the source lacks evidence.",
|
|
58791
|
-
supportedRecommendedSections: contract.recommendedSections.filter((
|
|
58792
|
-
unsupportedRecommendedSections: contract.recommendedSections.filter((
|
|
58942
|
+
supportedRecommendedSections: contract.recommendedSections.filter((section2) => headings.some((heading) => heading.text.toLowerCase() === section2.toLowerCase())),
|
|
58943
|
+
unsupportedRecommendedSections: contract.recommendedSections.filter((section2) => !headings.some((heading) => heading.text.toLowerCase() === section2.toLowerCase()))
|
|
58793
58944
|
},
|
|
58794
58945
|
tagResolutions: resolveCommonsTags(
|
|
58795
58946
|
uniqueStrings([...input.tags ?? [], ...input.keywords ?? []]).slice(0, 20),
|
|
@@ -59314,7 +59465,7 @@ function unsupportedPlaceholderSections(markdown) {
|
|
|
59314
59465
|
/insufficient evidence/i,
|
|
59315
59466
|
/source material does not/i
|
|
59316
59467
|
];
|
|
59317
|
-
return sections.filter((
|
|
59468
|
+
return sections.filter((section2) => placeholderPatterns.some((pattern) => pattern.test(section2.body)) && wordCount2(section2.body) <= 160).map((section2) => section2.heading);
|
|
59318
59469
|
}
|
|
59319
59470
|
function markdownSectionBodies(markdown) {
|
|
59320
59471
|
const lines = String(markdown || "").split(/\r?\n/);
|
|
@@ -59798,18 +59949,18 @@ function normalizeBody(bodyMarkdown, contentSections) {
|
|
|
59798
59949
|
const body = String(bodyMarkdown ?? "").trim();
|
|
59799
59950
|
if (body) return body.slice(0, 5e5);
|
|
59800
59951
|
const sections = normalizeContentSections(contentSections);
|
|
59801
|
-
return sections.map((
|
|
59952
|
+
return sections.map((section2) => `## ${section2.heading}
|
|
59802
59953
|
|
|
59803
|
-
${
|
|
59954
|
+
${section2.body}`).join("\n\n").slice(0, 5e5);
|
|
59804
59955
|
}
|
|
59805
59956
|
function normalizeContentSections(sections) {
|
|
59806
59957
|
if (!Array.isArray(sections)) return [];
|
|
59807
|
-
return sections.map((
|
|
59808
|
-
id: normalizeSlug(
|
|
59809
|
-
heading: requiredText(
|
|
59810
|
-
body: requiredText(
|
|
59811
|
-
position: Number.isFinite(
|
|
59812
|
-
citations: normalizeCitations(
|
|
59958
|
+
return sections.map((section2, index) => ({
|
|
59959
|
+
id: normalizeSlug(section2.id || section2.heading),
|
|
59960
|
+
heading: requiredText(section2.heading, "section.heading", 1, 180),
|
|
59961
|
+
body: requiredText(section2.body, "section.body", 1, 1e5),
|
|
59962
|
+
position: Number.isFinite(section2.position) ? Number(section2.position) : index + 1,
|
|
59963
|
+
citations: normalizeCitations(section2.citations)
|
|
59813
59964
|
})).slice(0, 80);
|
|
59814
59965
|
}
|
|
59815
59966
|
function normalizeArticleSections(sections) {
|
|
@@ -61182,13 +61333,36 @@ async function ensureScheduledRunViewLinksSchema() {
|
|
|
61182
61333
|
artifact_id TEXT NOT NULL,
|
|
61183
61334
|
title TEXT NOT NULL,
|
|
61184
61335
|
summary TEXT NOT NULL,
|
|
61185
|
-
renderer_key TEXT NOT NULL CHECK (renderer_key
|
|
61336
|
+
renderer_key TEXT NOT NULL CHECK (renderer_key IN ('editorial_reading_room_v1','personal_authority_v1')),
|
|
61186
61337
|
token_hash TEXT NOT NULL UNIQUE,
|
|
61187
61338
|
expires_at TEXT NOT NULL,
|
|
61188
61339
|
revoked_at TEXT,
|
|
61189
61340
|
created_at TEXT NOT NULL
|
|
61190
61341
|
)
|
|
61191
61342
|
`);
|
|
61343
|
+
const schema = await db.execute({
|
|
61344
|
+
sql: `SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'scheduled_run_view_links' LIMIT 1`,
|
|
61345
|
+
args: []
|
|
61346
|
+
});
|
|
61347
|
+
const createSql = String(schema.rows[0]?.sql ?? "");
|
|
61348
|
+
if (createSql.includes("renderer_key = 'editorial_reading_room_v1'")) {
|
|
61349
|
+
await db.batch([
|
|
61350
|
+
`DROP TABLE IF EXISTS scheduled_run_view_links_v2`,
|
|
61351
|
+
`CREATE TABLE scheduled_run_view_links_v2 (
|
|
61352
|
+
share_id TEXT PRIMARY KEY, owner_id TEXT NOT NULL, run_id TEXT NOT NULL,
|
|
61353
|
+
artifact_id TEXT NOT NULL, title TEXT NOT NULL, summary TEXT NOT NULL,
|
|
61354
|
+
renderer_key TEXT NOT NULL CHECK (renderer_key IN ('editorial_reading_room_v1','personal_authority_v1')),
|
|
61355
|
+
token_hash TEXT NOT NULL UNIQUE, expires_at TEXT NOT NULL, revoked_at TEXT,
|
|
61356
|
+
created_at TEXT NOT NULL
|
|
61357
|
+
)`,
|
|
61358
|
+
`INSERT INTO scheduled_run_view_links_v2
|
|
61359
|
+
SELECT share_id, owner_id, run_id, artifact_id, title, summary, renderer_key,
|
|
61360
|
+
token_hash, expires_at, revoked_at, created_at
|
|
61361
|
+
FROM scheduled_run_view_links`,
|
|
61362
|
+
`DROP TABLE scheduled_run_view_links`,
|
|
61363
|
+
`ALTER TABLE scheduled_run_view_links_v2 RENAME TO scheduled_run_view_links`
|
|
61364
|
+
], "write");
|
|
61365
|
+
}
|
|
61192
61366
|
await db.execute(`
|
|
61193
61367
|
CREATE INDEX IF NOT EXISTS scheduled_run_view_links_owner_run
|
|
61194
61368
|
ON scheduled_run_view_links(owner_id, run_id, created_at DESC)
|
|
@@ -61210,7 +61384,7 @@ function mapRow(row) {
|
|
|
61210
61384
|
artifactId: String(row.artifact_id),
|
|
61211
61385
|
title: String(row.title),
|
|
61212
61386
|
summary: String(row.summary),
|
|
61213
|
-
rendererKey: "editorial_reading_room_v1",
|
|
61387
|
+
rendererKey: row.renderer_key === "personal_authority_v1" ? "personal_authority_v1" : "editorial_reading_room_v1",
|
|
61214
61388
|
tokenHash: String(row.token_hash),
|
|
61215
61389
|
expiresAt: String(row.expires_at),
|
|
61216
61390
|
revokedAt: row.revoked_at == null ? null : String(row.revoked_at),
|
|
@@ -61295,6 +61469,136 @@ var init_scheduled_run_view_links = __esm({
|
|
|
61295
61469
|
}
|
|
61296
61470
|
});
|
|
61297
61471
|
|
|
61472
|
+
// src/personal-authority/render.ts
|
|
61473
|
+
function escapeHtml7(value) {
|
|
61474
|
+
return value.replace(/[&<>"']/g, (character) => ({
|
|
61475
|
+
"&": "&",
|
|
61476
|
+
"<": "<",
|
|
61477
|
+
">": ">",
|
|
61478
|
+
'"': """,
|
|
61479
|
+
"'": "'"
|
|
61480
|
+
})[character] ?? character);
|
|
61481
|
+
}
|
|
61482
|
+
function safeHref(value) {
|
|
61483
|
+
const trimmed = value.trim();
|
|
61484
|
+
return /^(?:https?:|mailto:|tel:|#|\/)/i.test(trimmed) ? escapeHtml7(trimmed) : "#";
|
|
61485
|
+
}
|
|
61486
|
+
function initials(name) {
|
|
61487
|
+
return name.split(/\s+/).filter(Boolean).slice(0, 2).map((part) => part[0]?.toUpperCase()).join("") || "PA";
|
|
61488
|
+
}
|
|
61489
|
+
function action(action2, secondary = false) {
|
|
61490
|
+
return `<a class="button${secondary ? " button--secondary" : ""}" href="${safeHref(action2.href)}">${escapeHtml7(action2.label)} <span aria-hidden="true">\u2197</span></a>`;
|
|
61491
|
+
}
|
|
61492
|
+
function section(enabled, html) {
|
|
61493
|
+
return enabled ? html : "";
|
|
61494
|
+
}
|
|
61495
|
+
function renderPersonalAuthorityV1(input, config, generatedAt) {
|
|
61496
|
+
const flags = config.featureFlags;
|
|
61497
|
+
const brand = config.brandName || input.name;
|
|
61498
|
+
const generatedAtIso = generatedAt.toISOString();
|
|
61499
|
+
const social = flags.socialLinks && input.socialLinks.length > 0 ? `<nav class="social" aria-label="Professional profiles">${input.socialLinks.map((link) => `<a href="${safeHref(link.href)}">${escapeHtml7(link.label)}</a>`).join("")}</nav>` : "";
|
|
61500
|
+
const navigation = flags.navigation ? `<button class="menu" type="button" aria-expanded="false" aria-controls="nav">Menu</button><nav id="nav" class="nav" aria-label="Primary navigation"><a href="#about">About</a><a href="#services">Work</a><a href="#proof">Proof</a><a href="#contact">Contact</a></nav>` : "";
|
|
61501
|
+
const authority = input.authority;
|
|
61502
|
+
const consultation = input.consultation;
|
|
61503
|
+
const learning = input.learning;
|
|
61504
|
+
const services = input.services;
|
|
61505
|
+
const proof = input.proof;
|
|
61506
|
+
const finalCta = input.finalCta;
|
|
61507
|
+
const html = `<!doctype html>
|
|
61508
|
+
<html lang="en" data-theme="${config.theme}">
|
|
61509
|
+
<head>
|
|
61510
|
+
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
61511
|
+
<meta name="description" content="${escapeHtml7(input.summary)}"><title>${escapeHtml7(input.name)} \u2014 ${escapeHtml7(input.professionalTitle)}</title>
|
|
61512
|
+
<style>
|
|
61513
|
+
:root{--blue:#2f66eb;--blue-soft:#dbe6ff;--ink:#050708;--paper:#f7f8fb;--white:#fff;--gray:#9ca5b5;--line:#27303b;--serif:Georgia,'Times New Roman',serif;--sans:Arial,Helvetica,sans-serif}*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--ink);color:var(--white);font-family:var(--sans);line-height:1.55}a{color:inherit}.skip{position:absolute;left:-9999px}.skip:focus{left:16px;top:16px;z-index:9;background:#fff;color:#000;padding:10px}.header{height:88px;display:flex;align-items:center;justify-content:space-between;padding:0 clamp(20px,4vw,72px);border-bottom:1px solid var(--line);position:relative;z-index:3;background:rgba(5,7,8,.96)}.brand{display:flex;align-items:center;gap:12px;text-decoration:none;font-family:var(--serif);font-size:24px}.mark{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:var(--blue);font-family:var(--sans);font-weight:700}.nav{display:flex;align-items:center;gap:28px}.nav a{text-decoration:none;color:#c8ced8;font-size:14px}.nav a:hover{color:#fff}.menu{display:none;background:transparent;color:#fff;border:1px solid #5b6471;padding:10px 14px}.hero{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.25fr);min-height:760px;border-bottom:3px solid var(--blue)}.portrait{display:grid;place-items:end center;background:radial-gradient(circle at 50% 38%,#273243 0,#11161d 38%,#060708 70%);overflow:hidden}.portrait-card{width:min(82%,560px);aspect-ratio:4/5;display:grid;place-items:center;align-self:end;border:1px solid #263142;border-bottom:0;background:linear-gradient(145deg,#252d38,#0b0d10 58%);font-family:var(--serif);font-size:clamp(80px,13vw,180px);color:#d9e4ff;text-shadow:0 0 42px rgba(47,102,235,.5)}.hero-copy{padding:clamp(44px,7vw,110px) clamp(24px,6vw,100px);display:flex;flex-direction:column;justify-content:center;background:linear-gradient(135deg,#080a0d,#101318)}h1,h2,h3,p{margin-top:0}.hero h1{font-family:var(--serif);font-size:clamp(58px,8vw,116px);line-height:.92;font-weight:400;color:var(--blue);margin-bottom:24px}.role{font-family:var(--serif);font-size:clamp(28px,3.8vw,52px);line-height:1.05;border-left:5px solid var(--blue);padding-left:22px;max-width:820px}.summary{color:#c6cbd3;font-size:clamp(17px,1.5vw,22px);max-width:760px}.actions{display:flex;gap:12px;flex-wrap:wrap;margin:24px 0}.button{display:inline-flex;align-items:center;justify-content:space-between;gap:28px;min-height:58px;padding:0 26px;background:var(--blue);border:1px solid var(--blue);text-decoration:none;font-weight:700}.button--secondary{background:transparent;border-color:#5c6572}.social{display:flex;gap:10px;flex-wrap:wrap}.social a{border:1px solid #39414d;border-radius:999px;padding:8px 13px;text-decoration:none;color:#d8dce4;font-size:13px}.light{background:var(--paper);color:#111722;padding:clamp(70px,10vw,150px) clamp(20px,6vw,90px)}.light h2,.section h2{font-family:var(--serif);font-size:clamp(42px,6vw,82px);line-height:1.02;font-weight:400;max-width:1080px}.light p{max-width:920px;color:#4e596a;font-size:18px}.section{padding:clamp(70px,9vw,130px) clamp(20px,6vw,90px);border-bottom:1px solid var(--line)}.section-head{max-width:920px;margin-bottom:46px}.eyebrow{text-transform:uppercase;letter-spacing:.18em;font-size:12px;color:#aab2bf}.consult{display:grid;grid-template-columns:1.3fr .7fr;gap:50px;background:linear-gradient(130deg,#060708,#111721)}.accent-card{min-height:360px;border:1px solid #2a3545;background:linear-gradient(145deg,rgba(47,102,235,.22),transparent 55%);display:grid;place-items:center;font-family:var(--serif);font-size:96px;color:var(--blue)}.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.card{border:1px solid #323a46;padding:26px;min-height:220px;background:#0b0e12}.card h3{font-family:var(--serif);font-size:30px}.card p{color:#b9c0ca}.learning{background:#020303}.topic-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1px;background:#29313c;border:1px solid #29313c}.topic{background:#050708;padding:30px}.topic strong{display:block;color:var(--blue);text-transform:uppercase;font-size:11px;letter-spacing:.15em}.topic h3{font-family:var(--serif);font-size:30px;margin:8px 0}.topic p{color:#aeb6c1}.proof{background:linear-gradient(180deg,#0a0d11,#050607)}.quotes{display:flex;gap:14px;overflow:auto;scroll-snap-type:x mandatory;padding-bottom:12px}.quote{min-width:min(420px,86vw);scroll-snap-align:start;border:1px solid #343d49;padding:30px;background:#0c1015}.quote q{font-family:var(--serif);font-size:30px;line-height:1.25}.quote span{display:block;margin-top:24px;color:#aeb5c0;font-size:12px;text-transform:uppercase;letter-spacing:.12em}.cta{text-align:center;border-top:3px solid var(--blue);background:radial-gradient(circle at 50% 0,rgba(47,102,235,.25),transparent 50%)}.cta h2{margin-left:auto;margin-right:auto}.footer{display:grid;grid-template-columns:1fr auto;gap:40px;padding:46px clamp(20px,6vw,90px);color:#abb3bf}.footer strong{color:#fff;font-family:var(--serif);font-size:26px}.generated{font-size:11px;color:#737d8b;margin-top:10px}html[data-theme='slate']{--blue:#7f95b8;--blue-soft:#dfe6ef}html[data-theme='monochrome']{--blue:#fff;--blue-soft:#e7e7e7}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
|
|
61514
|
+
@media(max-width:760px){.header{height:78px}.menu{display:block}.nav{display:none;position:absolute;left:0;right:0;top:77px;padding:18px 20px;background:#090b0e;border-bottom:1px solid #303844;flex-direction:column;align-items:stretch}.nav.open{display:flex}.hero{grid-template-columns:1fr;min-height:0}.portrait{min-height:390px}.portrait-card{width:72%;max-height:360px}.hero-copy{padding:48px 20px 66px}.hero h1{font-size:64px}.role{font-size:34px}.actions{display:grid}.button{width:100%}.consult{grid-template-columns:1fr}.accent-card{min-height:220px}.grid,.topic-grid{grid-template-columns:1fr}.light,.section{padding:64px 20px}.light h2,.section h2{font-size:46px}.footer{grid-template-columns:1fr}}
|
|
61515
|
+
</style></head>
|
|
61516
|
+
<body><a class="skip" href="#main">Skip to main content</a>
|
|
61517
|
+
<header class="header"><a class="brand" href="#top"><span class="mark">${escapeHtml7(initials(input.name).slice(0, 1))}</span><strong>${escapeHtml7(brand)}</strong></a>${navigation}</header>
|
|
61518
|
+
<main id="main"><section class="hero" id="top"><div class="portrait" aria-label="Portrait placeholder"><div class="portrait-card" aria-hidden="true">${escapeHtml7(initials(input.name))}</div></div><div class="hero-copy"><h1>${escapeHtml7(input.name)}</h1><p class="role">${escapeHtml7(input.professionalTitle)}</p><p class="summary">${escapeHtml7(input.summary)}</p><div class="actions">${action(input.primaryAction)}${input.secondaryAction ? action(input.secondaryAction, true) : ""}</div>${social}</div></section>
|
|
61519
|
+
${section(flags.authority && Boolean(authority), `<section class="light" id="about"><h2>${escapeHtml7(authority?.heading ?? "")}</h2>${authority?.paragraphs.map((paragraph) => `<p>${escapeHtml7(paragraph)}</p>`).join("") ?? ""}</section>`)}
|
|
61520
|
+
${section(flags.consultation && Boolean(consultation), `<section class="section consult"><div><p class="eyebrow">${escapeHtml7(consultation?.eyebrow ?? "Start a conversation")}</p><h2>${escapeHtml7(consultation?.heading ?? "")}</h2><p class="summary">${escapeHtml7(consultation?.summary ?? "")}</p>${consultation ? action(consultation.action) : ""}</div><div class="accent-card" aria-label="Image placeholder">${escapeHtml7(initials(input.name))}</div></section>`)}
|
|
61521
|
+
${section(flags.learning && Boolean(learning), `<section class="section learning"><div class="section-head"><h2>${escapeHtml7(learning?.heading ?? "")}</h2><p class="summary">${escapeHtml7(learning?.summary ?? "")}</p></div><div class="topic-grid">${learning?.topics.map((topic) => `<article class="topic"><strong>${escapeHtml7(topic.title)}</strong><h3>${escapeHtml7(topic.headline)}</h3><p>${escapeHtml7(topic.summary)}</p>${topic.href ? `<a href="${safeHref(topic.href)}">Explore \u2192</a>` : ""}</article>`).join("") ?? ""}</div></section>`)}
|
|
61522
|
+
${section(flags.services && Boolean(services), `<section class="section" id="services"><div class="section-head"><h2>${escapeHtml7(services?.heading ?? "")}</h2><p class="summary">${escapeHtml7(services?.summary ?? "")}</p></div><div class="grid">${services?.offers.map((offer) => `<article class="card"><h3>${escapeHtml7(offer.title)}</h3><p>${escapeHtml7(offer.description)}</p>${offer.action ? action(offer.action, true) : ""}</article>`).join("") ?? ""}</div></section>`)}
|
|
61523
|
+
${section(flags.proof && Boolean(proof), `<section class="section proof" id="proof"><div class="section-head"><h2>${escapeHtml7(proof?.heading ?? "")}</h2><p class="summary">${escapeHtml7(proof?.summary ?? "")}</p></div><div class="quotes">${proof?.testimonials.map((item) => `<article class="quote"><q>${escapeHtml7(item.quote)}</q><span>${escapeHtml7(item.person)}${item.role ? ` / ${escapeHtml7(item.role)}` : ""}</span></article>`).join("") ?? ""}</div></section>`)}
|
|
61524
|
+
${section(flags.finalCta && Boolean(finalCta), `<section class="section cta" id="contact"><p class="eyebrow">${escapeHtml7(finalCta?.eyebrow ?? "Ready when you are")}</p><h2>${escapeHtml7(finalCta?.heading ?? "")}</h2><p class="summary">${escapeHtml7(finalCta?.summary ?? "")}</p>${finalCta ? action(finalCta.action) : ""}</section>`)}
|
|
61525
|
+
</main><footer class="footer"><div><strong>${escapeHtml7(input.name)}</strong><div>${escapeHtml7(input.professionalTitle)}</div>${config.showGeneratedAt ? `<div class="generated">Generated ${escapeHtml7(generatedAtIso)}</div>` : ""}</div><div>${input.location ? `<div>${escapeHtml7(input.location)}</div>` : ""}${input.email ? `<a href="mailto:${escapeHtml7(input.email)}">${escapeHtml7(input.email)}</a>` : ""}${input.phone ? `<div>${escapeHtml7(input.phone)}</div>` : ""}</div></footer>
|
|
61526
|
+
<script>document.querySelector('.menu')?.addEventListener('click',function(){var nav=document.querySelector('.nav');var open=this.getAttribute('aria-expanded')!=='true';this.setAttribute('aria-expanded',String(open));nav?.classList.toggle('open',open)});document.querySelectorAll('.nav a').forEach(function(link){link.addEventListener('click',function(){document.querySelector('.nav')?.classList.remove('open');document.querySelector('.menu')?.setAttribute('aria-expanded','false')})});</script></body></html>`;
|
|
61527
|
+
const bytes = Buffer.byteLength(html, "utf8");
|
|
61528
|
+
return {
|
|
61529
|
+
html,
|
|
61530
|
+
filename: `${input.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "personal-authority"}.html`,
|
|
61531
|
+
bytes,
|
|
61532
|
+
sha256: (0, import_node_crypto38.createHash)("sha256").update(html).digest("hex"),
|
|
61533
|
+
generatedAt: generatedAtIso
|
|
61534
|
+
};
|
|
61535
|
+
}
|
|
61536
|
+
var import_node_crypto38;
|
|
61537
|
+
var init_render2 = __esm({
|
|
61538
|
+
"src/personal-authority/render.ts"() {
|
|
61539
|
+
"use strict";
|
|
61540
|
+
import_node_crypto38 = require("crypto");
|
|
61541
|
+
}
|
|
61542
|
+
});
|
|
61543
|
+
|
|
61544
|
+
// src/scheduled-artifacts/scheduled-artifact-renderer-registry.ts
|
|
61545
|
+
function getScheduledArtifactRenderer(rendererKey, rendererVersion) {
|
|
61546
|
+
return scheduledArtifactRendererRegistry[`${rendererKey}:${rendererVersion}`] ?? null;
|
|
61547
|
+
}
|
|
61548
|
+
var editorialReadingRoomV1, personalAuthorityV1, scheduledArtifactRendererRegistry, scheduledArtifactTemplatePresets;
|
|
61549
|
+
var init_scheduled_artifact_renderer_registry = __esm({
|
|
61550
|
+
"src/scheduled-artifacts/scheduled-artifact-renderer-registry.ts"() {
|
|
61551
|
+
"use strict";
|
|
61552
|
+
init_render();
|
|
61553
|
+
init_render2();
|
|
61554
|
+
init_contracts();
|
|
61555
|
+
editorialReadingRoomV1 = {
|
|
61556
|
+
rendererKey: "editorial_reading_room_v1",
|
|
61557
|
+
rendererVersion: 1,
|
|
61558
|
+
async render(rawInput, rawConfig, generatedAt) {
|
|
61559
|
+
const input = EditorialReadingRoomV1InputSchema.parse(rawInput);
|
|
61560
|
+
const config = EditorialArtifactTemplateConfigSchema.parse(rawConfig);
|
|
61561
|
+
const rendered = renderEditorialReadingRoomV1(input, config, generatedAt);
|
|
61562
|
+
if (rendered.bytes > 2e6) {
|
|
61563
|
+
throw new Error("Scheduled artifact HTML must be 2,000,000 bytes or fewer.");
|
|
61564
|
+
}
|
|
61565
|
+
return {
|
|
61566
|
+
html: rendered.html,
|
|
61567
|
+
filename: rendered.filename,
|
|
61568
|
+
title: input.title,
|
|
61569
|
+
bytes: rendered.bytes,
|
|
61570
|
+
sha256: rendered.sha256,
|
|
61571
|
+
generatedAt: rendered.generatedAt
|
|
61572
|
+
};
|
|
61573
|
+
}
|
|
61574
|
+
};
|
|
61575
|
+
personalAuthorityV1 = {
|
|
61576
|
+
rendererKey: "personal_authority_v1",
|
|
61577
|
+
rendererVersion: 1,
|
|
61578
|
+
async render(rawInput, rawConfig, generatedAt) {
|
|
61579
|
+
const input = PersonalAuthorityV1InputSchema.parse(rawInput);
|
|
61580
|
+
const config = PersonalAuthorityTemplateConfigSchema.parse(rawConfig);
|
|
61581
|
+
const rendered = renderPersonalAuthorityV1(input, config, generatedAt);
|
|
61582
|
+
if (rendered.bytes > 2e6) {
|
|
61583
|
+
throw new Error("Scheduled artifact HTML must be 2,000,000 bytes or fewer.");
|
|
61584
|
+
}
|
|
61585
|
+
return {
|
|
61586
|
+
...rendered,
|
|
61587
|
+
title: input.name
|
|
61588
|
+
};
|
|
61589
|
+
}
|
|
61590
|
+
};
|
|
61591
|
+
scheduledArtifactRendererRegistry = Object.freeze({
|
|
61592
|
+
"editorial_reading_room_v1:1": editorialReadingRoomV1,
|
|
61593
|
+
"personal_authority_v1:1": personalAuthorityV1
|
|
61594
|
+
});
|
|
61595
|
+
scheduledArtifactTemplatePresets = [
|
|
61596
|
+
EDITORIAL_READING_ROOM_TEMPLATE_PRESET,
|
|
61597
|
+
PERSONAL_AUTHORITY_TEMPLATE_PRESET
|
|
61598
|
+
];
|
|
61599
|
+
}
|
|
61600
|
+
});
|
|
61601
|
+
|
|
61298
61602
|
// src/api/scheduled-result-routes.ts
|
|
61299
61603
|
function apiError(error, errorCode = "invalid_request") {
|
|
61300
61604
|
return { ok: false, error, errorCode };
|
|
@@ -61334,6 +61638,7 @@ var init_scheduled_result_routes = __esm({
|
|
|
61334
61638
|
init_scheduled_artifact_owner();
|
|
61335
61639
|
init_scheduled_run_view_links();
|
|
61336
61640
|
init_contracts();
|
|
61641
|
+
init_scheduled_artifact_renderer_registry();
|
|
61337
61642
|
TemplateParamsSchema = import_zod51.z.object({ templateId: import_zod51.z.string().uuid() }).strict();
|
|
61338
61643
|
RunParamsSchema = import_zod51.z.object({ runId: import_zod51.z.string().min(1).max(200) }).strict();
|
|
61339
61644
|
ViewLinkParamsSchema = import_zod51.z.object({
|
|
@@ -61357,7 +61662,7 @@ var init_scheduled_result_routes = __esm({
|
|
|
61357
61662
|
c.header("Cache-Control", "private, no-store");
|
|
61358
61663
|
return c.json({
|
|
61359
61664
|
...result,
|
|
61360
|
-
presets: Array.isArray(result.presets) ? result.presets :
|
|
61665
|
+
presets: Array.isArray(result.presets) ? result.presets : scheduledArtifactTemplatePresets
|
|
61361
61666
|
});
|
|
61362
61667
|
});
|
|
61363
61668
|
scheduledResultApp.post("/artifact-templates", async (c) => {
|
|
@@ -61490,7 +61795,7 @@ function policy4() {
|
|
|
61490
61795
|
};
|
|
61491
61796
|
}
|
|
61492
61797
|
function runStorageSegment(runId) {
|
|
61493
|
-
return /^[a-zA-Z0-9_-]{1,160}$/.test(runId) ? runId : `run-${(0,
|
|
61798
|
+
return /^[a-zA-Z0-9_-]{1,160}$/.test(runId) ? runId : `run-${(0, import_node_crypto39.createHash)("sha256").update(runId).digest("hex").slice(0, 32)}`;
|
|
61494
61799
|
}
|
|
61495
61800
|
async function createScheduledRunArtifact(args) {
|
|
61496
61801
|
if (args.rendered.bytes > SCHEDULED_RUN_ARTIFACT_MAX_BYTES) {
|
|
@@ -61531,12 +61836,12 @@ async function readScheduledRunArtifact(args) {
|
|
|
61531
61836
|
if (!window2 || window2.nextOffset !== null || window2.totalBytes > SCHEDULED_RUN_ARTIFACT_MAX_BYTES) return null;
|
|
61532
61837
|
return window2.text;
|
|
61533
61838
|
}
|
|
61534
|
-
var
|
|
61839
|
+
var import_node_crypto39, SCHEDULED_RUN_ARTIFACT_PREFIX, SCHEDULED_RUN_ARTIFACT_DOWNLOAD_TTL_MS, SCHEDULED_RUN_ARTIFACT_MAX_BYTES;
|
|
61535
61840
|
var init_scheduled_run_artifact_store = __esm({
|
|
61536
61841
|
"src/scheduled-artifacts/scheduled-run-artifact-store.ts"() {
|
|
61537
61842
|
"use strict";
|
|
61538
61843
|
init_private_artifacts();
|
|
61539
|
-
|
|
61844
|
+
import_node_crypto39 = require("crypto");
|
|
61540
61845
|
SCHEDULED_RUN_ARTIFACT_PREFIX = "scheduled-run-artifacts/";
|
|
61541
61846
|
SCHEDULED_RUN_ARTIFACT_DOWNLOAD_TTL_MS = 15 * 60 * 1e3;
|
|
61542
61847
|
SCHEDULED_RUN_ARTIFACT_MAX_BYTES = 2e6;
|
|
@@ -61754,7 +62059,7 @@ async function reconcileDiscoveredNangoConnections(identity, discovered) {
|
|
|
61754
62059
|
updated_at = excluded.updated_at
|
|
61755
62060
|
`,
|
|
61756
62061
|
args: [
|
|
61757
|
-
(0,
|
|
62062
|
+
(0, import_node_crypto40.randomUUID)(),
|
|
61758
62063
|
userId,
|
|
61759
62064
|
connection.providerConfigKey,
|
|
61760
62065
|
connection.provider,
|
|
@@ -61825,7 +62130,7 @@ async function recordServiceConnectionHealth(args) {
|
|
|
61825
62130
|
});
|
|
61826
62131
|
await getDb().execute({
|
|
61827
62132
|
sql: `INSERT INTO service_connection_health_events (id, connection_id, operational_status, failure_code, retryable, evidence_source) VALUES (?, ?, ?, ?, ?, ?)`,
|
|
61828
|
-
args: [(0,
|
|
62133
|
+
args: [(0, import_node_crypto40.randomUUID)(), args.connectionId, args.operationalStatus, args.failureCode ?? null, args.retryable == null ? null : args.retryable ? 1 : 0, args.evidenceSource]
|
|
61829
62134
|
});
|
|
61830
62135
|
}
|
|
61831
62136
|
async function setServiceConnectionActions(identity, connectionId, enabled) {
|
|
@@ -61865,7 +62170,7 @@ async function claimServiceConnectionAction(args) {
|
|
|
61865
62170
|
if (!connection) throw new Error("service_connection_not_found");
|
|
61866
62171
|
const inserted = await getDb().execute({
|
|
61867
62172
|
sql: `INSERT OR IGNORE INTO service_connection_action_audit (id, connection_id, user_id, tool, request_id, status, request_digest) VALUES (?, ?, ?, ?, ?, 'started', ?)`,
|
|
61868
|
-
args: [(0,
|
|
62173
|
+
args: [(0, import_node_crypto40.randomUUID)(), connection.id, connection.userId, args.tool, args.requestId, args.requestDigest]
|
|
61869
62174
|
});
|
|
61870
62175
|
if (Number(inserted.rowsAffected ?? 0) === 1) return { claimed: true };
|
|
61871
62176
|
const existing = await getDb().execute({
|
|
@@ -61890,11 +62195,11 @@ async function claimServiceConnectionAction(args) {
|
|
|
61890
62195
|
...result !== void 0 ? { result } : {}
|
|
61891
62196
|
};
|
|
61892
62197
|
}
|
|
61893
|
-
var
|
|
62198
|
+
var import_node_crypto40, schemaReady4, schemaDb4;
|
|
61894
62199
|
var init_service_connections = __esm({
|
|
61895
62200
|
"src/api/service-connections.ts"() {
|
|
61896
62201
|
"use strict";
|
|
61897
|
-
|
|
62202
|
+
import_node_crypto40 = require("crypto");
|
|
61898
62203
|
init_db();
|
|
61899
62204
|
schemaReady4 = null;
|
|
61900
62205
|
schemaDb4 = null;
|
|
@@ -61908,8 +62213,8 @@ function signingSecret() {
|
|
|
61908
62213
|
return secret2;
|
|
61909
62214
|
}
|
|
61910
62215
|
function schedulerIntegrationSignature(args) {
|
|
61911
|
-
const bodyHash = (0,
|
|
61912
|
-
return (0,
|
|
62216
|
+
const bodyHash = (0, import_node_crypto41.createHash)("sha256").update(args.body).digest("hex");
|
|
62217
|
+
return (0, import_node_crypto41.createHmac)("sha256", args.secret).update(`${args.method.toUpperCase()}
|
|
61913
62218
|
${args.path}
|
|
61914
62219
|
${args.timestamp}
|
|
61915
62220
|
${args.nonce}
|
|
@@ -61956,17 +62261,17 @@ async function verifySchedulerIntegrationRequest(request, rawBody) {
|
|
|
61956
62261
|
});
|
|
61957
62262
|
const suppliedBytes = Buffer.from(signature, "hex");
|
|
61958
62263
|
const expectedBytes = Buffer.from(expected, "hex");
|
|
61959
|
-
if (suppliedBytes.length !== expectedBytes.length || !(0,
|
|
62264
|
+
if (suppliedBytes.length !== expectedBytes.length || !(0, import_node_crypto41.timingSafeEqual)(suppliedBytes, expectedBytes)) {
|
|
61960
62265
|
throw new SchedulerIntegrationAuthError("invalid_signature");
|
|
61961
62266
|
}
|
|
61962
62267
|
await claimNonce(nonce, timestampMs);
|
|
61963
62268
|
return { requestId };
|
|
61964
62269
|
}
|
|
61965
|
-
var
|
|
62270
|
+
var import_node_crypto41, MAX_CLOCK_SKEW_MS, SchedulerIntegrationAuthError;
|
|
61966
62271
|
var init_scheduler_integration_auth = __esm({
|
|
61967
62272
|
"src/api/scheduler-integration-auth.ts"() {
|
|
61968
62273
|
"use strict";
|
|
61969
|
-
|
|
62274
|
+
import_node_crypto41 = require("crypto");
|
|
61970
62275
|
init_db();
|
|
61971
62276
|
init_service_connections();
|
|
61972
62277
|
MAX_CLOCK_SKEW_MS = 5 * 60 * 1e3;
|
|
@@ -61981,42 +62286,6 @@ var init_scheduler_integration_auth = __esm({
|
|
|
61981
62286
|
}
|
|
61982
62287
|
});
|
|
61983
62288
|
|
|
61984
|
-
// src/scheduled-artifacts/scheduled-artifact-renderer-registry.ts
|
|
61985
|
-
function getScheduledArtifactRenderer(rendererKey, rendererVersion) {
|
|
61986
|
-
return scheduledArtifactRendererRegistry[`${rendererKey}:${rendererVersion}`] ?? null;
|
|
61987
|
-
}
|
|
61988
|
-
var editorialReadingRoomV1, scheduledArtifactRendererRegistry;
|
|
61989
|
-
var init_scheduled_artifact_renderer_registry = __esm({
|
|
61990
|
-
"src/scheduled-artifacts/scheduled-artifact-renderer-registry.ts"() {
|
|
61991
|
-
"use strict";
|
|
61992
|
-
init_render();
|
|
61993
|
-
init_contracts();
|
|
61994
|
-
editorialReadingRoomV1 = {
|
|
61995
|
-
rendererKey: "editorial_reading_room_v1",
|
|
61996
|
-
rendererVersion: 1,
|
|
61997
|
-
async render(rawInput, rawConfig, generatedAt) {
|
|
61998
|
-
const input = EditorialReadingRoomV1InputSchema.parse(rawInput);
|
|
61999
|
-
const config = ArtifactTemplateConfigSchema.parse(rawConfig);
|
|
62000
|
-
const rendered = renderEditorialReadingRoomV1(input, config, generatedAt);
|
|
62001
|
-
if (rendered.bytes > 2e6) {
|
|
62002
|
-
throw new Error("Scheduled artifact HTML must be 2,000,000 bytes or fewer.");
|
|
62003
|
-
}
|
|
62004
|
-
return {
|
|
62005
|
-
html: rendered.html,
|
|
62006
|
-
filename: rendered.filename,
|
|
62007
|
-
title: input.title,
|
|
62008
|
-
bytes: rendered.bytes,
|
|
62009
|
-
sha256: rendered.sha256,
|
|
62010
|
-
generatedAt: rendered.generatedAt
|
|
62011
|
-
};
|
|
62012
|
-
}
|
|
62013
|
-
};
|
|
62014
|
-
scheduledArtifactRendererRegistry = Object.freeze({
|
|
62015
|
-
"editorial_reading_room_v1:1": editorialReadingRoomV1
|
|
62016
|
-
});
|
|
62017
|
-
}
|
|
62018
|
-
});
|
|
62019
|
-
|
|
62020
62289
|
// src/api/scheduled-artifact-internal-routes.ts
|
|
62021
62290
|
function errorPayload(errorCode, error, requestId) {
|
|
62022
62291
|
return ApiErrorResponseSchema.parse({
|
|
@@ -62250,7 +62519,7 @@ var init_site_extract_reconciliation = __esm({
|
|
|
62250
62519
|
|
|
62251
62520
|
// src/api/page-diff.ts
|
|
62252
62521
|
function sha256Hex(value) {
|
|
62253
|
-
return (0,
|
|
62522
|
+
return (0, import_node_crypto42.createHash)("sha256").update(value).digest("hex");
|
|
62254
62523
|
}
|
|
62255
62524
|
function truncateForStorage(value, maxChars = MAX_SNAPSHOT_CONTENT_CHARS) {
|
|
62256
62525
|
if (value.length <= maxChars) return { value, truncated: false };
|
|
@@ -62307,11 +62576,11 @@ function diffPageContent(oldContent, newContent) {
|
|
|
62307
62576
|
totalChangedLineCount
|
|
62308
62577
|
};
|
|
62309
62578
|
}
|
|
62310
|
-
var
|
|
62579
|
+
var import_node_crypto42, import_diff, MAX_SNAPSHOT_CONTENT_CHARS, MAX_DIFF_HUNKS, MAX_DIFF_LINES_PER_RESPONSE;
|
|
62311
62580
|
var init_page_diff = __esm({
|
|
62312
62581
|
"src/api/page-diff.ts"() {
|
|
62313
62582
|
"use strict";
|
|
62314
|
-
|
|
62583
|
+
import_node_crypto42 = require("crypto");
|
|
62315
62584
|
import_diff = require("diff");
|
|
62316
62585
|
MAX_SNAPSHOT_CONTENT_CHARS = 25e4;
|
|
62317
62586
|
MAX_DIFF_HUNKS = 200;
|
|
@@ -62385,7 +62654,7 @@ var init_scrape_vault_sink = __esm({
|
|
|
62385
62654
|
|
|
62386
62655
|
// src/api/scrape-image-sink.ts
|
|
62387
62656
|
function idempotencyKey2(userId, vault, input) {
|
|
62388
|
-
return `scrape-image-${(0,
|
|
62657
|
+
return `scrape-image-${(0, import_node_crypto43.createHash)("sha256").update(`${userId}\0${vault}\0${input.sourceKind}\0${input.sourceUrl}\0${input.imageUrl ?? ""}\0${input.imageBase64 ?? ""}`).digest("hex")}`;
|
|
62389
62658
|
}
|
|
62390
62659
|
async function persistScrapeImagesToMemory(user, inputs, vault) {
|
|
62391
62660
|
const selected = inputs.slice(0, MAX_IMAGES_PER_SCRAPE);
|
|
@@ -62427,11 +62696,11 @@ async function persistScrapeImagesToMemory(user, inputs, vault) {
|
|
|
62427
62696
|
assets
|
|
62428
62697
|
};
|
|
62429
62698
|
}
|
|
62430
|
-
var
|
|
62699
|
+
var import_node_crypto43, MAX_IMAGES_PER_SCRAPE;
|
|
62431
62700
|
var init_scrape_image_sink = __esm({
|
|
62432
62701
|
"src/api/scrape-image-sink.ts"() {
|
|
62433
62702
|
"use strict";
|
|
62434
|
-
|
|
62703
|
+
import_node_crypto43 = require("crypto");
|
|
62435
62704
|
init_memory();
|
|
62436
62705
|
MAX_IMAGES_PER_SCRAPE = 25;
|
|
62437
62706
|
}
|
|
@@ -62884,7 +63153,7 @@ function canonicalJson(value) {
|
|
|
62884
63153
|
return JSON.stringify(value);
|
|
62885
63154
|
}
|
|
62886
63155
|
function sha2562(value) {
|
|
62887
|
-
return (0,
|
|
63156
|
+
return (0, import_node_crypto44.createHash)("sha256").update(value).digest("hex");
|
|
62888
63157
|
}
|
|
62889
63158
|
function sensitiveKey(key) {
|
|
62890
63159
|
const normalized = key.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
@@ -63099,11 +63368,11 @@ async function importServiceConnectionToMemory(identity, input, dependencies) {
|
|
|
63099
63368
|
...!searchReady ? { warning: "The snapshot was stored, but no search chunks were indexed yet." } : {}
|
|
63100
63369
|
};
|
|
63101
63370
|
}
|
|
63102
|
-
var
|
|
63371
|
+
var import_node_crypto44, CONNECTION_MEMORY_IMPORT_MAX_ARGS_BYTES, CONNECTION_MEMORY_IMPORT_MAX_RESULT_BYTES, CONNECTION_MEMORY_IMPORT_MAX_STRING_CHARS, CONNECTION_MEMORY_IMPORT_MAX_DEPTH, ConnectionMemoryImportError;
|
|
63103
63372
|
var init_connection_memory_import = __esm({
|
|
63104
63373
|
"src/api/connection-memory-import.ts"() {
|
|
63105
63374
|
"use strict";
|
|
63106
|
-
|
|
63375
|
+
import_node_crypto44 = require("crypto");
|
|
63107
63376
|
init_slugify();
|
|
63108
63377
|
CONNECTION_MEMORY_IMPORT_MAX_ARGS_BYTES = 64 * 1024;
|
|
63109
63378
|
CONNECTION_MEMORY_IMPORT_MAX_RESULT_BYTES = 1e6;
|
|
@@ -63321,7 +63590,7 @@ function finitePositive(value, fallback) {
|
|
|
63321
63590
|
return Number.isFinite(value) && value > 0 ? value : fallback;
|
|
63322
63591
|
}
|
|
63323
63592
|
async function collectConnectedDataExport(args) {
|
|
63324
|
-
const exportId = (0,
|
|
63593
|
+
const exportId = (0, import_node_crypto45.randomUUID)();
|
|
63325
63594
|
const now = args.now ?? Date.now;
|
|
63326
63595
|
const startedAt = now();
|
|
63327
63596
|
const budgetMs = finitePositive(CONNECTED_DATA_EXPORT_BUDGET_MS, 24e4);
|
|
@@ -63435,11 +63704,11 @@ ${lines.length ? `${lines.join("\n")}
|
|
|
63435
63704
|
untrustedContent: true
|
|
63436
63705
|
};
|
|
63437
63706
|
}
|
|
63438
|
-
var
|
|
63707
|
+
var import_node_crypto45, CONNECTED_DATA_INLINE_BUDGET_BYTES, CONNECTED_DATA_MAX_EXPORT_BYTES, CONNECTED_DATA_EXPORT_BUDGET_MS, CONNECTED_DATA_PAGE_START_HEADROOM_MS, CONNECTED_DATA_DATASETS, ConnectedDataExportValidationError;
|
|
63439
63708
|
var init_connected_data_export = __esm({
|
|
63440
63709
|
"src/api/connected-data-export.ts"() {
|
|
63441
63710
|
"use strict";
|
|
63442
|
-
|
|
63711
|
+
import_node_crypto45 = require("crypto");
|
|
63443
63712
|
CONNECTED_DATA_INLINE_BUDGET_BYTES = Number(
|
|
63444
63713
|
process.env.MCP_SCRAPER_CONNECTED_DATA_INLINE_BUDGET_BYTES ?? 5e4
|
|
63445
63714
|
);
|
|
@@ -63553,7 +63822,7 @@ async function exportSearchConsoleTableData(args) {
|
|
|
63553
63822
|
offset += rows.length;
|
|
63554
63823
|
if (stoppedForBytes || rows.length < limit || offset >= matchedRows) break;
|
|
63555
63824
|
}
|
|
63556
|
-
const exportId = (0,
|
|
63825
|
+
const exportId = (0, import_node_crypto46.randomUUID)();
|
|
63557
63826
|
const artifact = await args.writeArtifact({
|
|
63558
63827
|
ownerId: args.ownerId,
|
|
63559
63828
|
exportId,
|
|
@@ -63575,11 +63844,11 @@ async function exportSearchConsoleTableData(args) {
|
|
|
63575
63844
|
warnings
|
|
63576
63845
|
};
|
|
63577
63846
|
}
|
|
63578
|
-
var
|
|
63847
|
+
var import_node_crypto46, SEARCH_CONSOLE_TABLE_EXPORT_MAX_ROWS, SEARCH_CONSOLE_TABLE_EXPORT_PAGE_SIZE, SEARCH_CONSOLE_TABLE_EXPORT_MAX_BYTES, SEARCH_CONSOLE_TABLE_COLUMNS, SearchConsoleTableExportValidationError;
|
|
63579
63848
|
var init_search_console_table_export = __esm({
|
|
63580
63849
|
"src/api/search-console-table-export.ts"() {
|
|
63581
63850
|
"use strict";
|
|
63582
|
-
|
|
63851
|
+
import_node_crypto46 = require("crypto");
|
|
63583
63852
|
SEARCH_CONSOLE_TABLE_EXPORT_MAX_ROWS = 5e4;
|
|
63584
63853
|
SEARCH_CONSOLE_TABLE_EXPORT_PAGE_SIZE = 2e3;
|
|
63585
63854
|
SEARCH_CONSOLE_TABLE_EXPORT_MAX_BYTES = 50 * 1024 * 1024;
|
|
@@ -64758,7 +65027,7 @@ async function listNangoToolsDirect(identity, connectionId) {
|
|
|
64758
65027
|
});
|
|
64759
65028
|
const readTools = [...policies.values()].filter((policy5) => policy5.classification === "read").map((policy5) => policy5.name);
|
|
64760
65029
|
const actionTools = [...policies.values()].filter((policy5) => policy5.classification === "action").map((policy5) => policy5.name);
|
|
64761
|
-
const revision = (0,
|
|
65030
|
+
const revision = (0, import_node_crypto47.createHash)("sha256").update(JSON.stringify(tools.map((tool) => ({ name: tool.name, inputSchema: tool.inputSchema })))).digest("hex");
|
|
64762
65031
|
await updateServiceConnectionTools(connection.id, readTools, actionTools, revision);
|
|
64763
65032
|
const refreshed = await getOwnedServiceConnection(identity, connection.id);
|
|
64764
65033
|
return { connection: refreshed ?? { ...connection, readTools, actionTools, toolRevision: revision }, tools };
|
|
@@ -64785,8 +65054,8 @@ async function callNangoToolDirect(args) {
|
|
|
64785
65054
|
identity: args.identity,
|
|
64786
65055
|
ratePolicyVersion: CONNECTED_USAGE_RATE_POLICY_VERSION
|
|
64787
65056
|
});
|
|
64788
|
-
const requestId = args.requestId?.trim() || (0,
|
|
64789
|
-
const idempotencyKey3 = `main-nango:${(0,
|
|
65057
|
+
const requestId = args.requestId?.trim() || (0, import_node_crypto47.randomUUID)();
|
|
65058
|
+
const idempotencyKey3 = `main-nango:${(0, import_node_crypto47.createHash)("sha256").update(args.identity.toLowerCase()).update("\0").update(connection.id).update("\0").update(args.tool).update("\0").update(requestId).digest("hex")}`;
|
|
64790
65059
|
const startedAt = /* @__PURE__ */ new Date();
|
|
64791
65060
|
const started = performance.now();
|
|
64792
65061
|
let result;
|
|
@@ -64811,7 +65080,7 @@ async function callNangoToolDirect(args) {
|
|
|
64811
65080
|
toolName: args.tool,
|
|
64812
65081
|
operationKind: args.operationKind ?? args.classification,
|
|
64813
65082
|
outcome: providerError ? "error" : "partial",
|
|
64814
|
-
requestId: requestId.length <= 200 ? requestId : (0,
|
|
65083
|
+
requestId: requestId.length <= 200 ? requestId : (0, import_node_crypto47.createHash)("sha256").update(requestId).digest("hex"),
|
|
64815
65084
|
startedAt: startedAt.toISOString(),
|
|
64816
65085
|
completedAt: completedAt.toISOString()
|
|
64817
65086
|
}
|
|
@@ -64853,15 +65122,15 @@ async function describeNangoToolDirect(identity, connectionId, toolName) {
|
|
|
64853
65122
|
providerContractHash: MAIN_INTEGRATION_CONTRACT_HASH,
|
|
64854
65123
|
protocolVersion: null,
|
|
64855
65124
|
schemaSource: "live_tools_list",
|
|
64856
|
-
schemaHash: (0,
|
|
65125
|
+
schemaHash: (0, import_node_crypto47.createHash)("sha256").update(JSON.stringify(projected)).digest("hex"),
|
|
64857
65126
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
64858
65127
|
};
|
|
64859
65128
|
}
|
|
64860
|
-
var
|
|
65129
|
+
var import_node_crypto47, import_client13, DEFAULT_NANGO_MCP_URL, NANGO_TIMEOUT_MS, NANGO_CONNECTION_PAGE_SIZE, NANGO_CONNECTION_MAX_PAGES, MAIN_INTEGRATION_CONTRACT_VERSION, MAIN_INTEGRATION_CONTRACT_HASH, MainNangoTransportError;
|
|
64861
65130
|
var init_main_nango_transport = __esm({
|
|
64862
65131
|
"src/api/main-nango-transport.ts"() {
|
|
64863
65132
|
"use strict";
|
|
64864
|
-
|
|
65133
|
+
import_node_crypto47 = require("crypto");
|
|
64865
65134
|
import_client13 = require("@modelcontextprotocol/client");
|
|
64866
65135
|
init_service_connections();
|
|
64867
65136
|
init_connected_usage_billing();
|
|
@@ -65485,8 +65754,8 @@ async function setScheduleConnectionActionsEnabled(identity, connectionId, enabl
|
|
|
65485
65754
|
return data.connection.actionsEnabled === true;
|
|
65486
65755
|
}
|
|
65487
65756
|
async function callScheduleConnectionAction(identity, connectionId, input, tool, idempotencyKey3) {
|
|
65488
|
-
const requestId = `main-connected-action:${(0,
|
|
65489
|
-
const requestDigest = (0,
|
|
65757
|
+
const requestId = `main-connected-action:${(0, import_node_crypto48.createHash)("sha256").update(identity).update("\0").update(idempotencyKey3?.trim() || (0, import_node_crypto48.randomUUID)()).digest("hex")}`;
|
|
65758
|
+
const requestDigest = (0, import_node_crypto48.createHash)("sha256").update(connectionId).update("\0").update(tool?.trim() ?? "").update("\0").update(canonicalJson2(input)).digest("hex");
|
|
65490
65759
|
if (mainOwnsIntegrations()) {
|
|
65491
65760
|
const selectedTool = tool?.trim();
|
|
65492
65761
|
if (!selectedTool) throw new NangoControlError("An action tool is required.", 400, "invalid_request", false);
|
|
@@ -65637,7 +65906,7 @@ function canonicalJson2(value) {
|
|
|
65637
65906
|
return JSON.stringify(value);
|
|
65638
65907
|
}
|
|
65639
65908
|
function projectedToolSchemaHash(tool) {
|
|
65640
|
-
return (0,
|
|
65909
|
+
return (0, import_node_crypto48.createHash)("sha256").update(canonicalJson2(tool)).digest("hex");
|
|
65641
65910
|
}
|
|
65642
65911
|
async function describeNangoTool(identity, connectionId, tool, fresh) {
|
|
65643
65912
|
if (mainOwnsIntegrations()) {
|
|
@@ -65914,11 +66183,11 @@ async function callMainOwnedExportPage(identity, input) {
|
|
|
65914
66183
|
untrustedContent: true
|
|
65915
66184
|
};
|
|
65916
66185
|
}
|
|
65917
|
-
var
|
|
66186
|
+
var import_node_crypto48, DEFAULT_NANGO_CONTROL_URL, DISABLED_NANGO_TOOLS, CONNECTION_SYNC_REQUIRED_TOOLS, CONNECTION_SYNC_OPTIONAL_TOOLS, NangoControlError, ScheduleConnectionValidationError, SAFE_CONTROL_ERROR_CODES, FIXED_CONTROL_ERROR_MESSAGES, CONTROL_ERROR_CODE_ALIASES;
|
|
65918
66187
|
var init_nango_control = __esm({
|
|
65919
66188
|
"src/api/nango-control.ts"() {
|
|
65920
66189
|
"use strict";
|
|
65921
|
-
|
|
66190
|
+
import_node_crypto48 = require("crypto");
|
|
65922
66191
|
init_connected_data_export();
|
|
65923
66192
|
init_slack_connected_data_export();
|
|
65924
66193
|
init_main_nango_transport();
|
|
@@ -66274,7 +66543,7 @@ async function callResendRead(identity, connectionId, tool, args) {
|
|
|
66274
66543
|
return isRecord5(data) ? data.result ?? data : data;
|
|
66275
66544
|
}
|
|
66276
66545
|
async function callResendAction(identity, connectionId, tool, input, idempotencyKey3) {
|
|
66277
|
-
const requestId = `main-resend-action:${(0,
|
|
66546
|
+
const requestId = `main-resend-action:${(0, import_node_crypto49.createHash)("sha256").update(identity).update("\0").update(idempotencyKey3.trim()).digest("hex")}`;
|
|
66278
66547
|
const body = await controlRequest2("/api/internal/resend/actions/call", {
|
|
66279
66548
|
method: "POST",
|
|
66280
66549
|
headers: { "x-request-id": requestId },
|
|
@@ -66339,12 +66608,12 @@ async function callResendExportPage(identity, input) {
|
|
|
66339
66608
|
untrustedContent: true
|
|
66340
66609
|
};
|
|
66341
66610
|
}
|
|
66342
|
-
var
|
|
66611
|
+
var import_node_crypto49, DEFAULT_CONNECTION_CONTROL_URL, RESEND_PROVIDER_CONFIG_KEY, RESEND_LOGO_URL, RESEND_DOCS_URL, RESEND_ADMIN_BLOCKED_TOOLS, RESEND_CONNECTION_SYNC_REQUIRED_TOOLS, ResendControlError;
|
|
66343
66612
|
var init_resend_control = __esm({
|
|
66344
66613
|
"src/api/resend-control.ts"() {
|
|
66345
66614
|
"use strict";
|
|
66346
66615
|
init_connected_data_export();
|
|
66347
|
-
|
|
66616
|
+
import_node_crypto49 = require("crypto");
|
|
66348
66617
|
DEFAULT_CONNECTION_CONTROL_URL = "https://mcp-scraper-scheduler.vercel.app";
|
|
66349
66618
|
RESEND_PROVIDER_CONFIG_KEY = "resend";
|
|
66350
66619
|
RESEND_LOGO_URL = "https://cdn.resend.com/brand/resend-icon-black.svg";
|
|
@@ -66862,7 +67131,7 @@ async function chargeTierChangeNow(stripeClient, subscriptionId, customerId) {
|
|
|
66862
67131
|
return { ok: false, amountDue: 0, error: err instanceof Error ? err.message : "Unable to charge the plan change immediately." };
|
|
66863
67132
|
}
|
|
66864
67133
|
}
|
|
66865
|
-
var import_resend3,
|
|
67134
|
+
var import_resend3, import_node_crypto50, import_hono35, import_hono36, import_factory7, import_cookie2, import_stripe2, secureCookies2, isProduction2, sessionCookieOptions2, requireAllowedOrigin, auth3, sessionAuth, requireIntegrationsTier, requirePaidSchedulingTier, app, deploymentProfile, STRIPE_API_VERSION, SYNC_HARVEST_TIMEOUT_OVERRIDE_MS;
|
|
66866
67135
|
var init_server = __esm({
|
|
66867
67136
|
"src/api/server.ts"() {
|
|
66868
67137
|
"use strict";
|
|
@@ -66875,7 +67144,7 @@ var init_server = __esm({
|
|
|
66875
67144
|
init_og();
|
|
66876
67145
|
import_resend3 = require("resend");
|
|
66877
67146
|
init_url_utils();
|
|
66878
|
-
|
|
67147
|
+
import_node_crypto50 = require("crypto");
|
|
66879
67148
|
init_kpo_extractor();
|
|
66880
67149
|
init_screenshot();
|
|
66881
67150
|
init_media_extractor();
|
|
@@ -68149,12 +68418,12 @@ var init_server = __esm({
|
|
|
68149
68418
|
const r = await memoryCall("listScheduledActionsTool", {}, key);
|
|
68150
68419
|
if (!r.ok || !Array.isArray(r.actions)) return c.json(r);
|
|
68151
68420
|
try {
|
|
68152
|
-
const actions = await Promise.all(r.actions.map(async (
|
|
68153
|
-
const id = typeof
|
|
68154
|
-
const executionMode =
|
|
68155
|
-
if (!id) return { ...
|
|
68421
|
+
const actions = await Promise.all(r.actions.map(async (action2) => {
|
|
68422
|
+
const id = typeof action2.id === "string" ? action2.id : "";
|
|
68423
|
+
const executionMode = action2.executionMode === "connection_sync" ? "connection_sync" : "agent";
|
|
68424
|
+
if (!id) return { ...action2, executionMode, connections: [] };
|
|
68156
68425
|
const bindings = await getScheduleConnectionBindings(user.email, id);
|
|
68157
|
-
return { ...
|
|
68426
|
+
return { ...action2, executionMode, connections: bindingsForSchedule(bindings, id) };
|
|
68158
68427
|
}));
|
|
68159
68428
|
return c.json({
|
|
68160
68429
|
...r,
|
|
@@ -68164,7 +68433,7 @@ var init_server = __esm({
|
|
|
68164
68433
|
console.warn("[schedule-actions] connection bindings unavailable:", err instanceof Error ? err.message : String(err));
|
|
68165
68434
|
return c.json({
|
|
68166
68435
|
...r,
|
|
68167
|
-
actions: r.actions.map((
|
|
68436
|
+
actions: r.actions.map((action2) => ({ ...action2, executionMode: action2.executionMode === "connection_sync" ? "connection_sync" : "agent", connections: [] })),
|
|
68168
68437
|
connectionBindingsUnavailable: true
|
|
68169
68438
|
});
|
|
68170
68439
|
}
|
|
@@ -68247,7 +68516,7 @@ var init_server = __esm({
|
|
|
68247
68516
|
if (!key) return c.json({ ok: false, error: error ?? "memory unavailable" }, 503);
|
|
68248
68517
|
const schedules = await memoryCall("listScheduledActionsTool", {}, key);
|
|
68249
68518
|
if (!schedules.ok || !Array.isArray(schedules.actions)) return c.json(schedules, 502);
|
|
68250
|
-
const schedule = schedules.actions.find((
|
|
68519
|
+
const schedule = schedules.actions.find((action2) => action2.id === scheduleActionId);
|
|
68251
68520
|
if (!schedule) return c.json({ ok: false, error: "scheduled action not found" }, 404);
|
|
68252
68521
|
if (schedule.executionMode === "connection_sync") {
|
|
68253
68522
|
const policyError = connectionSyncSelectionError(connections);
|
|
@@ -68407,7 +68676,7 @@ var init_server = __esm({
|
|
|
68407
68676
|
if (!harvestOk) return c.json(insufficientBalanceResponse(harvestBal, harvestCost), 402);
|
|
68408
68677
|
jobId2 = await createJob(user.id, options.query, { ...options, billingHoldMc: harvestCost }, body.callback_url);
|
|
68409
68678
|
} else {
|
|
68410
|
-
jobId2 = (0,
|
|
68679
|
+
jobId2 = (0, import_node_crypto50.randomUUID)();
|
|
68411
68680
|
const billingDebitKey = `paa-harvest:${jobId2}:hold`;
|
|
68412
68681
|
const description = `PAA harvest: ${options.query}`.slice(0, 500);
|
|
68413
68682
|
const hold = await debitMcIdempotent(
|