@graphext/cuery 0.6.1 → 0.6.3

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/esm/mod.d.ts CHANGED
@@ -19,6 +19,7 @@ export * from './src/tools/sentiment.js';
19
19
  export * from './src/tools/summarize.js';
20
20
  export * from './src/tools/sources.js';
21
21
  export * from './src/tools/entities.js';
22
+ export * from './src/tools/prompts.js';
22
23
  export * from './src/helpers/seedKeywords.js';
23
24
  export * from './src/tools/generic.js';
24
25
  export * from './src/api.js';
package/esm/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACN,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,SAAS,GACd,MAAM,0BAA0B,CAAC;AAGlC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACN,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,SAAS,GACd,MAAM,0BAA0B,CAAC;AAGlC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wBAAwB,CAAC"}
package/esm/mod.js CHANGED
@@ -21,6 +21,7 @@ export * from './src/tools/sentiment.js';
21
21
  export * from './src/tools/summarize.js';
22
22
  export * from './src/tools/sources.js';
23
23
  export * from './src/tools/entities.js';
24
+ export * from './src/tools/prompts.js';
24
25
  export * from './src/helpers/seedKeywords.js';
25
26
  export * from './src/tools/generic.js';
26
27
  export * from './src/api.js';
@@ -14,9 +14,9 @@ export type * from './persona.schema.js';
14
14
  export type * from './brand.schema.js';
15
15
  export type * from './funnel.schema.js';
16
16
  export type * from './keyword.schema.js';
17
- export type * from './pipeline.schema.js';
18
17
  export type * from './models.schema.js';
19
18
  export type * from './seedKeyword.schema.js';
20
19
  export type * from './topics.schema.js';
21
20
  export type * from './summary.schema.js';
21
+ export type * from './prompt.schema.js';
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,oBAAoB,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { z } from '../../deps/jsr.io/@zod/zod/4.3.6/src/index.js';
2
+ /**
3
+ * Zod schemas for AI visibility prompt generation.
4
+ *
5
+ * ⚠️ This file should contain ONLY schema definitions.
6
+ * No business logic, prompts, or function implementations.
7
+ */
8
+ export declare const PromptIntentSchema: z.ZodEnum<{
9
+ local: "local";
10
+ comparison: "comparison";
11
+ informational: "informational";
12
+ navigational: "navigational";
13
+ transactional: "transactional";
14
+ commercial: "commercial";
15
+ troubleshooting: "troubleshooting";
16
+ }>;
17
+ export type PromptIntent = z.infer<typeof PromptIntentSchema>;
18
+ export declare const PromptIdeaSchema: z.ZodObject<{
19
+ prompt: z.ZodString;
20
+ intent: z.ZodEnum<{
21
+ local: "local";
22
+ comparison: "comparison";
23
+ informational: "informational";
24
+ navigational: "navigational";
25
+ transactional: "transactional";
26
+ commercial: "commercial";
27
+ troubleshooting: "troubleshooting";
28
+ }>;
29
+ }, z.core.$strip>;
30
+ export type PromptIdea = z.infer<typeof PromptIdeaSchema>;
31
+ export declare const PromptListSchema: z.ZodArray<z.ZodObject<{
32
+ prompt: z.ZodString;
33
+ intent: z.ZodEnum<{
34
+ local: "local";
35
+ comparison: "comparison";
36
+ informational: "informational";
37
+ navigational: "navigational";
38
+ transactional: "transactional";
39
+ commercial: "commercial";
40
+ troubleshooting: "troubleshooting";
41
+ }>;
42
+ }, z.core.$strip>>;
43
+ export type PromptList = z.infer<typeof PromptListSchema>;
44
+ export declare const PromptListResponseSchema: z.ZodObject<{
45
+ prompts: z.ZodArray<z.ZodObject<{
46
+ prompt: z.ZodString;
47
+ intent: z.ZodEnum<{
48
+ local: "local";
49
+ comparison: "comparison";
50
+ informational: "informational";
51
+ navigational: "navigational";
52
+ transactional: "transactional";
53
+ commercial: "commercial";
54
+ troubleshooting: "troubleshooting";
55
+ }>;
56
+ }, z.core.$strip>>;
57
+ }, z.core.$strip>;
58
+ export type PromptListResponse = z.infer<typeof PromptListResponseSchema>;
59
+ //# sourceMappingURL=prompt.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.schema.d.ts","sourceRoot":"","sources":["../../../src/src/schemas/prompt.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,+CAA+C,CAAC;AAElE;;;;;GAKG;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;EAQ7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,gBAAgB;;;;;;;;;;;iBAG3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,gBAAgB;;;;;;;;;;;kBAC2B,CAAC;AAEzD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;iBAEnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { z } from '../../deps/jsr.io/@zod/zod/4.3.6/src/index.js';
2
+ /**
3
+ * Zod schemas for AI visibility prompt generation.
4
+ *
5
+ * ⚠️ This file should contain ONLY schema definitions.
6
+ * No business logic, prompts, or function implementations.
7
+ */
8
+ export const PromptIntentSchema = z.enum([
9
+ 'informational',
10
+ 'navigational',
11
+ 'transactional',
12
+ 'commercial',
13
+ 'comparison',
14
+ 'troubleshooting',
15
+ 'local'
16
+ ]);
17
+ export const PromptIdeaSchema = z.object({
18
+ prompt: z.string().min(3).describe('A realistic natural-language prompt a user would type into an LLM search engine.'),
19
+ intent: PromptIntentSchema.describe('Primary intent of the prompt.')
20
+ });
21
+ export const PromptListSchema = z.array(PromptIdeaSchema)
22
+ .describe('Generated prompt ideas with intent labels.');
23
+ export const PromptListResponseSchema = z.object({
24
+ prompts: PromptListSchema
25
+ });
@@ -0,0 +1,53 @@
1
+ import type { z } from '../../deps/jsr.io/@zod/zod/4.3.6/src/index.js';
2
+ import { Tool, type ModelConfig } from '../tool.js';
3
+ import type { Message } from '../llm.js';
4
+ import { type PromptList, type PromptListResponse, type PromptIntent } from '../schemas/prompt.schema.js';
5
+ export interface PromptGeneratorConfig {
6
+ /** Minimum number of prompts to generate (default: 5) */
7
+ minPrompts?: number;
8
+ /** Maximum number of prompts to generate (default: 100) */
9
+ maxPrompts?: number;
10
+ /** Language for prompts (default: inferred from instructions) */
11
+ language?: string;
12
+ /** Optional topic context to guide prompt generation */
13
+ topics?: Array<string | {
14
+ topic: string;
15
+ subtopics?: Array<string>;
16
+ }>;
17
+ /** Optional persona context to guide prompt generation */
18
+ personas?: Array<string | {
19
+ name: string;
20
+ description?: string;
21
+ }>;
22
+ /** Optional intent whitelist to focus generation */
23
+ intents?: Array<PromptIntent>;
24
+ /** Optional extra instructions to always apply */
25
+ instructions?: string;
26
+ }
27
+ /**
28
+ * A tool that generates realistic LLM prompts for AI visibility analysis.
29
+ * Input is a single "instructions" string describing the topic and constraints.
30
+ */
31
+ export declare class PromptGenerator extends Tool<string | null, PromptListResponse, PromptList> {
32
+ private readonly systemPrompt;
33
+ private readonly contextBlocks;
34
+ private readonly responseSchema;
35
+ constructor(config: PromptGeneratorConfig | undefined, modelConfig: ModelConfig);
36
+ protected schema(): z.ZodType<{
37
+ prompts: {
38
+ prompt: string;
39
+ intent: "local" | "comparison" | "informational" | "navigational" | "transactional" | "commercial" | "troubleshooting";
40
+ }[];
41
+ }, unknown, z.core.$ZodTypeInternals<{
42
+ prompts: {
43
+ prompt: string;
44
+ intent: "local" | "comparison" | "informational" | "navigational" | "transactional" | "commercial" | "troubleshooting";
45
+ }[];
46
+ }, unknown>>;
47
+ protected prompt(instructions: string | null): Message[];
48
+ protected isEmpty(instructions: string | null): boolean;
49
+ protected extractResult(parsed: PromptListResponse): PromptList;
50
+ }
51
+ export type { PromptList, PromptListResponse, PromptIdea, PromptIntent } from '../schemas/prompt.schema.js';
52
+ export { PromptListSchema, PromptListResponseSchema, PromptIdeaSchema, PromptIntentSchema } from '../schemas/prompt.schema.js';
53
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/src/tools/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,+CAA+C,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,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BAAkB,GAAG,UAAU;CAGxE;AAED,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC5G,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { Tool } from '../tool.js';
2
+ import { PromptListSchema, PromptListResponseSchema } from '../schemas/prompt.schema.js';
3
+ import { dedent } from '../helpers/utils.js';
4
+ const PROMPT_SYSTEM = dedent(`
5
+ You generate realistic natural-language prompts for AI visibility testing with LLM search engines.
6
+
7
+ Follow the user's instructions exactly and only use the context they provide.
8
+
9
+ Output requirements:
10
+ - Return a JSON object with a "prompts" array.
11
+ - Each object must include: prompt, intent.
12
+ - The "intent" must be one of: informational, navigational, transactional, commercial, comparison, troubleshooting, local.
13
+ - Generate between {min} and {max} prompts unless the instructions request a number within that range.
14
+ - If the instructions specify how many prompts to generate, follow that.
15
+
16
+ Quality rules:
17
+ - Prompts should read like real user questions or requests for an AI assistant, not keyword fragments.
18
+ - Cover a mix of intents and realistic personas; avoid repeating the same intent across many prompts.
19
+ - If topics or personas are provided, use them as context to shape prompts (but do not output them).
20
+ - Avoid brand names unless the instructions explicitly include them.
21
+ - Keep prompts focused on the topic and avoid hallucinated claims.
22
+ `);
23
+ const PROMPT_USER = dedent(`
24
+ # Instructions
25
+
26
+ {instructions}
27
+ `);
28
+ /**
29
+ * A tool that generates realistic LLM prompts for AI visibility analysis.
30
+ * Input is a single "instructions" string describing the topic and constraints.
31
+ */
32
+ export class PromptGenerator extends Tool {
33
+ systemPrompt;
34
+ contextBlocks;
35
+ responseSchema;
36
+ constructor(config = {}, modelConfig) {
37
+ super(modelConfig);
38
+ const { minPrompts = 5, maxPrompts = 100, language, topics, personas, intents, instructions } = config;
39
+ if (minPrompts < 0) {
40
+ throw new Error('minPrompts must be >= 0');
41
+ }
42
+ if (maxPrompts < minPrompts) {
43
+ throw new Error('maxPrompts must be >= minPrompts');
44
+ }
45
+ const contextParts = [];
46
+ if (instructions && instructions.trim() !== '') {
47
+ contextParts.push(dedent(`
48
+ # Additional Instructions
49
+
50
+ ${instructions}
51
+ `));
52
+ }
53
+ if (language) {
54
+ contextParts.push(dedent(`
55
+ # Language
56
+
57
+ Generate prompts in: ${language}
58
+ `));
59
+ }
60
+ if (topics && topics.length > 0) {
61
+ contextParts.push(dedent(`
62
+ # Topics (Optional Context)
63
+
64
+ ${JSON.stringify(topics, null, 2)}
65
+ `));
66
+ }
67
+ if (personas && personas.length > 0) {
68
+ contextParts.push(dedent(`
69
+ # Personas (Optional Context)
70
+
71
+ ${JSON.stringify(personas, null, 2)}
72
+ `));
73
+ }
74
+ if (intents && intents.length > 0) {
75
+ contextParts.push(dedent(`
76
+ # Intent Focus (Optional)
77
+
78
+ ${JSON.stringify(intents, null, 2)}
79
+ `));
80
+ }
81
+ this.contextBlocks = contextParts.join('\n\n');
82
+ this.systemPrompt = PROMPT_SYSTEM
83
+ .replace('{min}', String(minPrompts))
84
+ .replace('{max}', String(maxPrompts));
85
+ this.responseSchema = PromptListResponseSchema.extend({
86
+ prompts: PromptListSchema.min(minPrompts).max(maxPrompts)
87
+ });
88
+ }
89
+ schema() {
90
+ return this.responseSchema;
91
+ }
92
+ prompt(instructions) {
93
+ const userPrompt = PROMPT_USER.replace('{instructions}', instructions ?? '');
94
+ return [
95
+ { role: 'system', content: this.systemPrompt },
96
+ { role: 'user', content: this.contextBlocks ? `${userPrompt}\n\n${this.contextBlocks}` : userPrompt }
97
+ ];
98
+ }
99
+ isEmpty(instructions) {
100
+ return instructions == null || instructions.trim() === '';
101
+ }
102
+ extractResult(parsed) {
103
+ return parsed.prompts;
104
+ }
105
+ }
106
+ export { PromptListSchema, PromptListResponseSchema, PromptIdeaSchema, PromptIntentSchema } from '../schemas/prompt.schema.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphext/cuery",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Cuery tools for AI-powered keyword research and brand analysis",
5
5
  "repository": {
6
6
  "type": "git",
package/script/mod.d.ts CHANGED
@@ -19,6 +19,7 @@ export * from './src/tools/sentiment.js';
19
19
  export * from './src/tools/summarize.js';
20
20
  export * from './src/tools/sources.js';
21
21
  export * from './src/tools/entities.js';
22
+ export * from './src/tools/prompts.js';
22
23
  export * from './src/helpers/seedKeywords.js';
23
24
  export * from './src/tools/generic.js';
24
25
  export * from './src/api.js';
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACN,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,SAAS,GACd,MAAM,0BAA0B,CAAC;AAGlC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACN,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,SAAS,GACd,MAAM,0BAA0B,CAAC;AAGlC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wBAAwB,CAAC"}
package/script/mod.js CHANGED
@@ -44,6 +44,7 @@ __exportStar(require("./src/tools/sentiment.js"), exports);
44
44
  __exportStar(require("./src/tools/summarize.js"), exports);
45
45
  __exportStar(require("./src/tools/sources.js"), exports);
46
46
  __exportStar(require("./src/tools/entities.js"), exports);
47
+ __exportStar(require("./src/tools/prompts.js"), exports);
47
48
  __exportStar(require("./src/helpers/seedKeywords.js"), exports);
48
49
  __exportStar(require("./src/tools/generic.js"), exports);
49
50
  __exportStar(require("./src/api.js"), exports);
@@ -14,9 +14,9 @@ export type * from './persona.schema.js';
14
14
  export type * from './brand.schema.js';
15
15
  export type * from './funnel.schema.js';
16
16
  export type * from './keyword.schema.js';
17
- export type * from './pipeline.schema.js';
18
17
  export type * from './models.schema.js';
19
18
  export type * from './seedKeyword.schema.js';
20
19
  export type * from './topics.schema.js';
21
20
  export type * from './summary.schema.js';
21
+ export type * from './prompt.schema.js';
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,oBAAoB,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { z } from '../../deps/jsr.io/@zod/zod/4.3.6/src/index.js';
2
+ /**
3
+ * Zod schemas for AI visibility prompt generation.
4
+ *
5
+ * ⚠️ This file should contain ONLY schema definitions.
6
+ * No business logic, prompts, or function implementations.
7
+ */
8
+ export declare const PromptIntentSchema: z.ZodEnum<{
9
+ local: "local";
10
+ comparison: "comparison";
11
+ informational: "informational";
12
+ navigational: "navigational";
13
+ transactional: "transactional";
14
+ commercial: "commercial";
15
+ troubleshooting: "troubleshooting";
16
+ }>;
17
+ export type PromptIntent = z.infer<typeof PromptIntentSchema>;
18
+ export declare const PromptIdeaSchema: z.ZodObject<{
19
+ prompt: z.ZodString;
20
+ intent: z.ZodEnum<{
21
+ local: "local";
22
+ comparison: "comparison";
23
+ informational: "informational";
24
+ navigational: "navigational";
25
+ transactional: "transactional";
26
+ commercial: "commercial";
27
+ troubleshooting: "troubleshooting";
28
+ }>;
29
+ }, z.core.$strip>;
30
+ export type PromptIdea = z.infer<typeof PromptIdeaSchema>;
31
+ export declare const PromptListSchema: z.ZodArray<z.ZodObject<{
32
+ prompt: z.ZodString;
33
+ intent: z.ZodEnum<{
34
+ local: "local";
35
+ comparison: "comparison";
36
+ informational: "informational";
37
+ navigational: "navigational";
38
+ transactional: "transactional";
39
+ commercial: "commercial";
40
+ troubleshooting: "troubleshooting";
41
+ }>;
42
+ }, z.core.$strip>>;
43
+ export type PromptList = z.infer<typeof PromptListSchema>;
44
+ export declare const PromptListResponseSchema: z.ZodObject<{
45
+ prompts: z.ZodArray<z.ZodObject<{
46
+ prompt: z.ZodString;
47
+ intent: z.ZodEnum<{
48
+ local: "local";
49
+ comparison: "comparison";
50
+ informational: "informational";
51
+ navigational: "navigational";
52
+ transactional: "transactional";
53
+ commercial: "commercial";
54
+ troubleshooting: "troubleshooting";
55
+ }>;
56
+ }, z.core.$strip>>;
57
+ }, z.core.$strip>;
58
+ export type PromptListResponse = z.infer<typeof PromptListResponseSchema>;
59
+ //# sourceMappingURL=prompt.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.schema.d.ts","sourceRoot":"","sources":["../../../src/src/schemas/prompt.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,+CAA+C,CAAC;AAElE;;;;;GAKG;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;EAQ7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,gBAAgB;;;;;;;;;;;iBAG3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,gBAAgB;;;;;;;;;;;kBAC2B,CAAC;AAEzD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;iBAEnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PromptListResponseSchema = exports.PromptListSchema = exports.PromptIdeaSchema = exports.PromptIntentSchema = void 0;
4
+ const index_js_1 = require("../../deps/jsr.io/@zod/zod/4.3.6/src/index.js");
5
+ /**
6
+ * Zod schemas for AI visibility prompt generation.
7
+ *
8
+ * ⚠️ This file should contain ONLY schema definitions.
9
+ * No business logic, prompts, or function implementations.
10
+ */
11
+ exports.PromptIntentSchema = index_js_1.z.enum([
12
+ 'informational',
13
+ 'navigational',
14
+ 'transactional',
15
+ 'commercial',
16
+ 'comparison',
17
+ 'troubleshooting',
18
+ 'local'
19
+ ]);
20
+ exports.PromptIdeaSchema = index_js_1.z.object({
21
+ prompt: index_js_1.z.string().min(3).describe('A realistic natural-language prompt a user would type into an LLM search engine.'),
22
+ intent: exports.PromptIntentSchema.describe('Primary intent of the prompt.')
23
+ });
24
+ exports.PromptListSchema = index_js_1.z.array(exports.PromptIdeaSchema)
25
+ .describe('Generated prompt ideas with intent labels.');
26
+ exports.PromptListResponseSchema = index_js_1.z.object({
27
+ prompts: exports.PromptListSchema
28
+ });
@@ -0,0 +1,53 @@
1
+ import type { z } from '../../deps/jsr.io/@zod/zod/4.3.6/src/index.js';
2
+ import { Tool, type ModelConfig } from '../tool.js';
3
+ import type { Message } from '../llm.js';
4
+ import { type PromptList, type PromptListResponse, type PromptIntent } from '../schemas/prompt.schema.js';
5
+ export interface PromptGeneratorConfig {
6
+ /** Minimum number of prompts to generate (default: 5) */
7
+ minPrompts?: number;
8
+ /** Maximum number of prompts to generate (default: 100) */
9
+ maxPrompts?: number;
10
+ /** Language for prompts (default: inferred from instructions) */
11
+ language?: string;
12
+ /** Optional topic context to guide prompt generation */
13
+ topics?: Array<string | {
14
+ topic: string;
15
+ subtopics?: Array<string>;
16
+ }>;
17
+ /** Optional persona context to guide prompt generation */
18
+ personas?: Array<string | {
19
+ name: string;
20
+ description?: string;
21
+ }>;
22
+ /** Optional intent whitelist to focus generation */
23
+ intents?: Array<PromptIntent>;
24
+ /** Optional extra instructions to always apply */
25
+ instructions?: string;
26
+ }
27
+ /**
28
+ * A tool that generates realistic LLM prompts for AI visibility analysis.
29
+ * Input is a single "instructions" string describing the topic and constraints.
30
+ */
31
+ export declare class PromptGenerator extends Tool<string | null, PromptListResponse, PromptList> {
32
+ private readonly systemPrompt;
33
+ private readonly contextBlocks;
34
+ private readonly responseSchema;
35
+ constructor(config: PromptGeneratorConfig | undefined, modelConfig: ModelConfig);
36
+ protected schema(): z.ZodType<{
37
+ prompts: {
38
+ prompt: string;
39
+ intent: "local" | "comparison" | "informational" | "navigational" | "transactional" | "commercial" | "troubleshooting";
40
+ }[];
41
+ }, unknown, z.core.$ZodTypeInternals<{
42
+ prompts: {
43
+ prompt: string;
44
+ intent: "local" | "comparison" | "informational" | "navigational" | "transactional" | "commercial" | "troubleshooting";
45
+ }[];
46
+ }, unknown>>;
47
+ protected prompt(instructions: string | null): Message[];
48
+ protected isEmpty(instructions: string | null): boolean;
49
+ protected extractResult(parsed: PromptListResponse): PromptList;
50
+ }
51
+ export type { PromptList, PromptListResponse, PromptIdea, PromptIntent } from '../schemas/prompt.schema.js';
52
+ export { PromptListSchema, PromptListResponseSchema, PromptIdeaSchema, PromptIntentSchema } from '../schemas/prompt.schema.js';
53
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 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AAqB,YAAK,EAAE,WAAW,EAAE,WAAW;cAiErD,MAAM;;;;;;;;;;;IAIzB,SAAS,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,EAAE;cAQrC,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;cAI7C,aAAa,CAAC,MAAM,EAAE,kBAAkB,GAAG,UAAU;CAGxE;AAED,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC5G,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PromptIntentSchema = exports.PromptIdeaSchema = exports.PromptListResponseSchema = exports.PromptListSchema = exports.PromptGenerator = void 0;
4
+ const tool_js_1 = require("../tool.js");
5
+ const prompt_schema_js_1 = require("../schemas/prompt.schema.js");
6
+ const utils_js_1 = require("../helpers/utils.js");
7
+ const PROMPT_SYSTEM = (0, utils_js_1.dedent)(`
8
+ You generate realistic natural-language prompts for AI visibility testing with LLM search engines.
9
+
10
+ Follow the user's instructions exactly and only use the context they provide.
11
+
12
+ Output requirements:
13
+ - Return a JSON object with a "prompts" array.
14
+ - Each object must include: prompt, intent.
15
+ - The "intent" must be one of: informational, navigational, transactional, commercial, comparison, troubleshooting, local.
16
+ - Generate between {min} and {max} prompts unless the instructions request a number within that range.
17
+ - If the instructions specify how many prompts to generate, follow that.
18
+
19
+ Quality rules:
20
+ - Prompts should read like real user questions or requests for an AI assistant, not keyword fragments.
21
+ - Cover a mix of intents and realistic personas; avoid repeating the same intent across many prompts.
22
+ - If topics or personas are provided, use them as context to shape prompts (but do not output them).
23
+ - Avoid brand names unless the instructions explicitly include them.
24
+ - Keep prompts focused on the topic and avoid hallucinated claims.
25
+ `);
26
+ const PROMPT_USER = (0, utils_js_1.dedent)(`
27
+ # Instructions
28
+
29
+ {instructions}
30
+ `);
31
+ /**
32
+ * A tool that generates realistic LLM prompts for AI visibility analysis.
33
+ * Input is a single "instructions" string describing the topic and constraints.
34
+ */
35
+ class PromptGenerator extends tool_js_1.Tool {
36
+ systemPrompt;
37
+ contextBlocks;
38
+ responseSchema;
39
+ constructor(config = {}, modelConfig) {
40
+ super(modelConfig);
41
+ const { minPrompts = 5, maxPrompts = 100, language, topics, personas, intents, instructions } = config;
42
+ if (minPrompts < 0) {
43
+ throw new Error('minPrompts must be >= 0');
44
+ }
45
+ if (maxPrompts < minPrompts) {
46
+ throw new Error('maxPrompts must be >= minPrompts');
47
+ }
48
+ const contextParts = [];
49
+ if (instructions && instructions.trim() !== '') {
50
+ contextParts.push((0, utils_js_1.dedent)(`
51
+ # Additional Instructions
52
+
53
+ ${instructions}
54
+ `));
55
+ }
56
+ if (language) {
57
+ contextParts.push((0, utils_js_1.dedent)(`
58
+ # Language
59
+
60
+ Generate prompts in: ${language}
61
+ `));
62
+ }
63
+ if (topics && topics.length > 0) {
64
+ contextParts.push((0, utils_js_1.dedent)(`
65
+ # Topics (Optional Context)
66
+
67
+ ${JSON.stringify(topics, null, 2)}
68
+ `));
69
+ }
70
+ if (personas && personas.length > 0) {
71
+ contextParts.push((0, utils_js_1.dedent)(`
72
+ # Personas (Optional Context)
73
+
74
+ ${JSON.stringify(personas, null, 2)}
75
+ `));
76
+ }
77
+ if (intents && intents.length > 0) {
78
+ contextParts.push((0, utils_js_1.dedent)(`
79
+ # Intent Focus (Optional)
80
+
81
+ ${JSON.stringify(intents, null, 2)}
82
+ `));
83
+ }
84
+ this.contextBlocks = contextParts.join('\n\n');
85
+ this.systemPrompt = PROMPT_SYSTEM
86
+ .replace('{min}', String(minPrompts))
87
+ .replace('{max}', String(maxPrompts));
88
+ this.responseSchema = prompt_schema_js_1.PromptListResponseSchema.extend({
89
+ prompts: prompt_schema_js_1.PromptListSchema.min(minPrompts).max(maxPrompts)
90
+ });
91
+ }
92
+ schema() {
93
+ return this.responseSchema;
94
+ }
95
+ prompt(instructions) {
96
+ const userPrompt = PROMPT_USER.replace('{instructions}', instructions ?? '');
97
+ return [
98
+ { role: 'system', content: this.systemPrompt },
99
+ { role: 'user', content: this.contextBlocks ? `${userPrompt}\n\n${this.contextBlocks}` : userPrompt }
100
+ ];
101
+ }
102
+ isEmpty(instructions) {
103
+ return instructions == null || instructions.trim() === '';
104
+ }
105
+ extractResult(parsed) {
106
+ return parsed.prompts;
107
+ }
108
+ }
109
+ exports.PromptGenerator = PromptGenerator;
110
+ var prompt_schema_js_2 = require("../schemas/prompt.schema.js");
111
+ Object.defineProperty(exports, "PromptListSchema", { enumerable: true, get: function () { return prompt_schema_js_2.PromptListSchema; } });
112
+ Object.defineProperty(exports, "PromptListResponseSchema", { enumerable: true, get: function () { return prompt_schema_js_2.PromptListResponseSchema; } });
113
+ Object.defineProperty(exports, "PromptIdeaSchema", { enumerable: true, get: function () { return prompt_schema_js_2.PromptIdeaSchema; } });
114
+ Object.defineProperty(exports, "PromptIntentSchema", { enumerable: true, get: function () { return prompt_schema_js_2.PromptIntentSchema; } });
@@ -1,146 +0,0 @@
1
- /**
2
- * Pipeline Context Type Definitions
3
- *
4
- * These types define the structure for pipeline execution contexts.
5
- * They are shared between client and server code.
6
- *
7
- * IMPORTANT: This type must be kept in sync with the dynamically generated
8
- * type from: supabase/functions/pipelines/workflows/audit.ts
9
- *
10
- * The actual pipeline generates:
11
- * export type AiAuditPromptsPipelineContext = OrchestratorRunContext<typeof promptsPipeline>;
12
- *
13
- * This static definition serves as a contract for client-side usage.
14
- * It represents the union of all context types required by the pipeline nodes.
15
- */
16
- import type { Brand, BrandContext, FlaggedBrand } from './brand.schema.js';
17
- import type { Funnel } from './funnel.schema.js';
18
- import type { ModelIdentifier } from './models.schema.js';
19
- import type { Persona } from './persona.schema.js';
20
- import type { TopicType } from './topics.schema.js';
21
- export interface KeywordPlannerOptions {
22
- url?: string;
23
- urlAsExpandRelevanceContext?: string;
24
- generateIdeasFromSeeds?: boolean;
25
- }
26
- export interface AiAuditPromptsPipelineOptions {
27
- filterLowRelevanceKeywords?: boolean;
28
- /** When true, adds deduplicatedKeywords column with all keywords sharing the same metrics */
29
- includeDeduplicatedKeywords?: boolean;
30
- /** When true, includes seedKeywords column in output records. Defaults to false. */
31
- includeSeedKeywords?: boolean;
32
- /** When true, generates a separate dataset with all keywords (dedup by keyword only). Defaults to false. */
33
- includeAllKeywordsDataset?: boolean;
34
- }
35
- /**
36
- * AI Audit Pipeline Request Structure
37
- *
38
- * This represents the structure of the request sent to the /pipelines/run endpoint.
39
- * The `context` field should match the AiAuditPromptsPipelineContext from the orchestrator.
40
- */
41
- export interface AiAuditPromptsPipelineRequest {
42
- pipelineName: 'promptsPipeline';
43
- context: AiAuditPromptsPipelineContext;
44
- }
45
- /**
46
- * AI Audit Answers Pipeline Request Structure
47
- *
48
- * This represents the structure of the request sent to the /pipelines/run endpoint.
49
- * The `context` field should match the AiAuditAnswersPipelineContext from the orchestrator.
50
- */
51
- export interface AiAuditAnswersPipelineRequest {
52
- pipelineName: 'answersPipeline';
53
- context: AiAuditAnswersPipelineContext;
54
- }
55
- /**
56
- * AI Audit Prompts Pipeline Context Data - Static Definition
57
- *
58
- * This represents the union of all context parameters required by the
59
- * various nodes in the AI audit prompts pipeline:
60
- *
61
- * - { keywordPlanner }: Keyword Planner parameters & seed sources
62
- * - { options }: Pipeline-level flags
63
- * - { workspaceId, projectName }: Project creation parameters
64
- * - { funnel }: Funnel assignment parameters
65
- * - { brand }: Brand-specific processing parameters
66
- * - { brands }: Brand collection parameters
67
- */
68
- export interface AiAuditPromptsPipelineContext {
69
- clientUserEmail: string;
70
- workspaceId: number;
71
- projectName?: string;
72
- /** Optional existing project to append prompts into. */
73
- projectId?: number;
74
- keywordPlanner: KeywordPlannerOptions;
75
- /** ISO 639-1 language code for prompts/keywords (e.g., "en"). */
76
- languageCode?: string;
77
- /** ISO 3166-1 alpha-2 country code to localize sources (e.g., "US"). */
78
- countryISOCode?: string;
79
- /**
80
- * Custom prompts provided by the user.
81
- * These go directly to the prompt dataset without keyword expansion.
82
- */
83
- directPrompts?: Array<string>;
84
- /**
85
- * Custom seed keywords provided by the user.
86
- * These are processed through keyword expansion like other seed keywords.
87
- */
88
- customSeedKeywords?: Array<string>;
89
- funnel?: Funnel;
90
- brand: BrandContext;
91
- competitors: Array<FlaggedBrand | Brand>;
92
- personas: Array<Persona>;
93
- options?: AiAuditPromptsPipelineOptions;
94
- topics?: Array<TopicType>;
95
- }
96
- /**
97
- * AI Audit Answers Pipeline Context Data
98
- *
99
- * Context parameters required by the answers pipeline.
100
- */
101
- export interface AiAuditAnswersPipelineContext {
102
- clientUserEmail: string;
103
- projectId: number;
104
- promptIds: Array<number>;
105
- models: Array<ModelIdentifier>;
106
- countryISOCode?: string;
107
- brand: BrandContext;
108
- competitors?: Array<FlaggedBrand | Brand>;
109
- /**
110
- * Panel ID for grouping answers by execution source.
111
- * When present (scheduled cron execution), answers are grouped by panelId.
112
- */
113
- panelId?: number;
114
- }
115
- /**
116
- * Persisted project configuration (pipeline context without user metadata).
117
- */
118
- export type AiAuditProjectConfig = Omit<AiAuditPromptsPipelineContext, 'clientUserEmail' | 'projectId'>;
119
- /**
120
- * Topic Update Pipeline Request Structure
121
- *
122
- * This represents the structure of the request sent to the /pipelines/run endpoint
123
- * for updating topic hierarchy in existing prompts.
124
- */
125
- export interface TopicUpdatePipelineRequest {
126
- pipelineName: 'topicUpdatePipeline';
127
- context: TopicUpdatePipelineContext;
128
- }
129
- /**
130
- * Topic Update Pipeline Context Data
131
- *
132
- * Context parameters required by the topic update pipeline.
133
- * This pipeline downloads the prompts dataset, re-assigns topics using AI
134
- * based on the provided taxonomy, and uploads the updated dataset back to the project.
135
- */
136
- export interface TopicUpdatePipelineContext {
137
- clientUserEmail: string;
138
- projectId: number;
139
- /**
140
- * The topics taxonomy to use for assigning topics.
141
- * Each topic contains a name and a list of subtopics.
142
- * The AI will classify each prompt into the appropriate topic/subtopic.
143
- */
144
- topics: Array<TopicType>;
145
- }
146
- //# sourceMappingURL=pipeline.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline.schema.d.ts","sourceRoot":"","sources":["../../../src/src/schemas/pipeline.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,WAAW,qBAAqB;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,6BAA6B;IAC7C,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,6FAA6F;IAC7F,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,oFAAoF;IACpF,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,4GAA4G;IAC5G,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED;;;;;GAKG;AACH,MAAM,WAAW,6BAA6B;IAC7C,YAAY,EAAE,iBAAiB,CAAC;IAChC,OAAO,EAAE,6BAA6B,CAAC;CACvC;AAED;;;;;GAKG;AACH,MAAM,WAAW,6BAA6B;IAC7C,YAAY,EAAE,iBAAiB,CAAC;IAChC,OAAO,EAAE,6BAA6B,CAAC;CACvC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,6BAA6B;IAE7C,eAAe,EAAE,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EAAE,qBAAqB,CAAC;IACpC,OAAO,EAAE,0BAA0B,CAAC;CACpC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IAE1C,eAAe,EAAE,MAAM,CAAC;IAGxB,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CACzB"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Pipeline Context Type Definitions
3
- *
4
- * These types define the structure for pipeline execution contexts.
5
- * They are shared between client and server code.
6
- *
7
- * IMPORTANT: This type must be kept in sync with the dynamically generated
8
- * type from: supabase/functions/pipelines/workflows/audit.ts
9
- *
10
- * The actual pipeline generates:
11
- * export type AiAuditPromptsPipelineContext = OrchestratorRunContext<typeof promptsPipeline>;
12
- *
13
- * This static definition serves as a contract for client-side usage.
14
- * It represents the union of all context types required by the pipeline nodes.
15
- */
16
- export {};
@@ -1,146 +0,0 @@
1
- /**
2
- * Pipeline Context Type Definitions
3
- *
4
- * These types define the structure for pipeline execution contexts.
5
- * They are shared between client and server code.
6
- *
7
- * IMPORTANT: This type must be kept in sync with the dynamically generated
8
- * type from: supabase/functions/pipelines/workflows/audit.ts
9
- *
10
- * The actual pipeline generates:
11
- * export type AiAuditPromptsPipelineContext = OrchestratorRunContext<typeof promptsPipeline>;
12
- *
13
- * This static definition serves as a contract for client-side usage.
14
- * It represents the union of all context types required by the pipeline nodes.
15
- */
16
- import type { Brand, BrandContext, FlaggedBrand } from './brand.schema.js';
17
- import type { Funnel } from './funnel.schema.js';
18
- import type { ModelIdentifier } from './models.schema.js';
19
- import type { Persona } from './persona.schema.js';
20
- import type { TopicType } from './topics.schema.js';
21
- export interface KeywordPlannerOptions {
22
- url?: string;
23
- urlAsExpandRelevanceContext?: string;
24
- generateIdeasFromSeeds?: boolean;
25
- }
26
- export interface AiAuditPromptsPipelineOptions {
27
- filterLowRelevanceKeywords?: boolean;
28
- /** When true, adds deduplicatedKeywords column with all keywords sharing the same metrics */
29
- includeDeduplicatedKeywords?: boolean;
30
- /** When true, includes seedKeywords column in output records. Defaults to false. */
31
- includeSeedKeywords?: boolean;
32
- /** When true, generates a separate dataset with all keywords (dedup by keyword only). Defaults to false. */
33
- includeAllKeywordsDataset?: boolean;
34
- }
35
- /**
36
- * AI Audit Pipeline Request Structure
37
- *
38
- * This represents the structure of the request sent to the /pipelines/run endpoint.
39
- * The `context` field should match the AiAuditPromptsPipelineContext from the orchestrator.
40
- */
41
- export interface AiAuditPromptsPipelineRequest {
42
- pipelineName: 'promptsPipeline';
43
- context: AiAuditPromptsPipelineContext;
44
- }
45
- /**
46
- * AI Audit Answers Pipeline Request Structure
47
- *
48
- * This represents the structure of the request sent to the /pipelines/run endpoint.
49
- * The `context` field should match the AiAuditAnswersPipelineContext from the orchestrator.
50
- */
51
- export interface AiAuditAnswersPipelineRequest {
52
- pipelineName: 'answersPipeline';
53
- context: AiAuditAnswersPipelineContext;
54
- }
55
- /**
56
- * AI Audit Prompts Pipeline Context Data - Static Definition
57
- *
58
- * This represents the union of all context parameters required by the
59
- * various nodes in the AI audit prompts pipeline:
60
- *
61
- * - { keywordPlanner }: Keyword Planner parameters & seed sources
62
- * - { options }: Pipeline-level flags
63
- * - { workspaceId, projectName }: Project creation parameters
64
- * - { funnel }: Funnel assignment parameters
65
- * - { brand }: Brand-specific processing parameters
66
- * - { brands }: Brand collection parameters
67
- */
68
- export interface AiAuditPromptsPipelineContext {
69
- clientUserEmail: string;
70
- workspaceId: number;
71
- projectName?: string;
72
- /** Optional existing project to append prompts into. */
73
- projectId?: number;
74
- keywordPlanner: KeywordPlannerOptions;
75
- /** ISO 639-1 language code for prompts/keywords (e.g., "en"). */
76
- languageCode?: string;
77
- /** ISO 3166-1 alpha-2 country code to localize sources (e.g., "US"). */
78
- countryISOCode?: string;
79
- /**
80
- * Custom prompts provided by the user.
81
- * These go directly to the prompt dataset without keyword expansion.
82
- */
83
- directPrompts?: Array<string>;
84
- /**
85
- * Custom seed keywords provided by the user.
86
- * These are processed through keyword expansion like other seed keywords.
87
- */
88
- customSeedKeywords?: Array<string>;
89
- funnel?: Funnel;
90
- brand: BrandContext;
91
- competitors: Array<FlaggedBrand | Brand>;
92
- personas: Array<Persona>;
93
- options?: AiAuditPromptsPipelineOptions;
94
- topics?: Array<TopicType>;
95
- }
96
- /**
97
- * AI Audit Answers Pipeline Context Data
98
- *
99
- * Context parameters required by the answers pipeline.
100
- */
101
- export interface AiAuditAnswersPipelineContext {
102
- clientUserEmail: string;
103
- projectId: number;
104
- promptIds: Array<number>;
105
- models: Array<ModelIdentifier>;
106
- countryISOCode?: string;
107
- brand: BrandContext;
108
- competitors?: Array<FlaggedBrand | Brand>;
109
- /**
110
- * Panel ID for grouping answers by execution source.
111
- * When present (scheduled cron execution), answers are grouped by panelId.
112
- */
113
- panelId?: number;
114
- }
115
- /**
116
- * Persisted project configuration (pipeline context without user metadata).
117
- */
118
- export type AiAuditProjectConfig = Omit<AiAuditPromptsPipelineContext, 'clientUserEmail' | 'projectId'>;
119
- /**
120
- * Topic Update Pipeline Request Structure
121
- *
122
- * This represents the structure of the request sent to the /pipelines/run endpoint
123
- * for updating topic hierarchy in existing prompts.
124
- */
125
- export interface TopicUpdatePipelineRequest {
126
- pipelineName: 'topicUpdatePipeline';
127
- context: TopicUpdatePipelineContext;
128
- }
129
- /**
130
- * Topic Update Pipeline Context Data
131
- *
132
- * Context parameters required by the topic update pipeline.
133
- * This pipeline downloads the prompts dataset, re-assigns topics using AI
134
- * based on the provided taxonomy, and uploads the updated dataset back to the project.
135
- */
136
- export interface TopicUpdatePipelineContext {
137
- clientUserEmail: string;
138
- projectId: number;
139
- /**
140
- * The topics taxonomy to use for assigning topics.
141
- * Each topic contains a name and a list of subtopics.
142
- * The AI will classify each prompt into the appropriate topic/subtopic.
143
- */
144
- topics: Array<TopicType>;
145
- }
146
- //# sourceMappingURL=pipeline.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline.schema.d.ts","source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;;;;OAIG;IACH,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CACzB"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- /**
3
- * Pipeline Context Type Definitions
4
- *
5
- * These types define the structure for pipeline execution contexts.
6
- * They are shared between client and server code.
7
- *
8
- * IMPORTANT: This type must be kept in sync with the dynamically generated
9
- * type from: supabase/functions/pipelines/workflows/audit.ts
10
- *
11
- * The actual pipeline generates:
12
- * export type AiAuditPromptsPipelineContext = OrchestratorRunContext<typeof promptsPipeline>;
13
- *
14
- * This static definition serves as a contract for client-side usage.
15
- * It represents the union of all context types required by the pipeline nodes.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });