@ariaflowagents/config 0.5.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ function sanitizeIdentifier(input) {
2
+ const cleaned = input.replace(/[^a-zA-Z0-9_$]/g, '_');
3
+ if (!cleaned)
4
+ return 'generatedFlow';
5
+ if (/^[0-9]/.test(cleaned))
6
+ return `flow_${cleaned}`;
7
+ return cleaned;
8
+ }
9
+ export function emitFlowTypeScriptModule(flow, options = {}) {
10
+ const constName = sanitizeIdentifier(options.constName ?? 'generatedFlow');
11
+ const entry = (flow.initialNode ?? flow.entry ?? flow.nodes[0]?.id ?? 'start').trim();
12
+ const events = Array.from(new Set((flow.transitions ?? []).map(t => t.on).filter((v) => typeof v === 'string' && v.length > 0)));
13
+ const flowLiteral = {
14
+ ...flow,
15
+ initialNode: undefined,
16
+ entry,
17
+ };
18
+ return `import type { FlowConfig } from '@ariaflowagents/core';
19
+
20
+ export const ${constName} = ${JSON.stringify(flowLiteral, null, 2)} satisfies FlowConfig;
21
+
22
+ export const ${constName}InitialNode = ${JSON.stringify(entry)} as const;
23
+
24
+ export const ${constName}TransitionEvents = ${JSON.stringify(events, null, 2)} as const;
25
+
26
+ export type ${constName}TransitionEvent = typeof ${constName}TransitionEvents[number];
27
+
28
+ export default ${constName};
29
+ `;
30
+ }
31
+ //# sourceMappingURL=flow-codegen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-codegen.js","sourceRoot":"","sources":["../src/flow-codegen.ts"],"names":[],"mappings":"AAMA,SAAS,kBAAkB,CAAC,KAAa;IACvC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;IACtD,IAAI,CAAC,OAAO;QAAE,OAAO,eAAe,CAAC;IACrC,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,QAAQ,OAAO,EAAE,CAAC;IACrD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,IAAmB,EACnB,UAAiC,EAAE;IAEnC,MAAM,SAAS,GAAG,kBAAkB,CAAC,OAAO,CAAC,SAAS,IAAI,eAAe,CAAC,CAAC;IAC3E,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IACtF,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CACvB,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CACnH,CAAC;IAEF,MAAM,WAAW,GAAkB;QACjC,GAAG,IAAI;QACP,WAAW,EAAE,SAAS;QACtB,KAAK;KACN,CAAC;IAEF,OAAO;;eAEM,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;;eAEnD,SAAS,iBAAiB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;;eAE/C,SAAS,sBAAsB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;;cAE/D,SAAS,4BAA4B,SAAS;;iBAE3C,SAAS;CACzB,CAAC;AACF,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { FlowFileInput } from './types.js';
2
+ export interface FlowPromptBlocks {
3
+ globalPrompt: string;
4
+ startPrompt: string;
5
+ mainAgendaPrompt: string;
6
+ summaryPrompt: string;
7
+ endPrompt: string;
8
+ }
9
+ export interface FlowGenerationOptions {
10
+ useCase: string;
11
+ flowId?: string;
12
+ direction?: 'inbound' | 'outbound';
13
+ agentName?: string;
14
+ promptBlocks?: Partial<FlowPromptBlocks>;
15
+ }
16
+ export declare function generateFlowTemplate(options: FlowGenerationOptions): FlowFileInput;
17
+ //# sourceMappingURL=flow-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-generator.d.ts","sourceRoot":"","sources":["../src/flow-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC1C;AAsHD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,aAAa,CAiGlF"}
@@ -0,0 +1,202 @@
1
+ function slugify(value) {
2
+ return value
3
+ .toLowerCase()
4
+ .replace(/[^a-z0-9]+/g, '-')
5
+ .replace(/^-+|-+$/g, '')
6
+ .slice(0, 64) || 'generated-flow';
7
+ }
8
+ function buildGlobalPrompt({ useCase, direction, agentName, }) {
9
+ return `# OVERALL GOAL
10
+
11
+ You are ${agentName}. You are handling ${direction} conversations for: ${useCase}.
12
+ Guide the user from greeting to resolution, collect required details, and close the conversation cleanly.
13
+
14
+ ## Response Language
15
+ - Reply in the language of the user's latest message.
16
+ - Use simple, clear words.
17
+ - Keep responses concise and conversational.
18
+
19
+ ## Conversation Style
20
+ - Be polite, direct, and practical.
21
+ - Avoid repeating the same question if already answered.
22
+ - If user asks a side question, answer briefly and return to the active step.
23
+
24
+ ## Tool and Transition Rules
25
+ - Never mix plain text and tool/function transitions in the same output.
26
+ - Trigger transitions only after a user turn.
27
+ - If required data is missing, ask a focused follow-up question instead of transitioning.
28
+
29
+ ## Reliability Rules
30
+ - Do not invent facts. Ask clarifying questions when uncertain.
31
+ - Keep track of previously gathered information and avoid contradictions.
32
+ - Prefer deterministic next actions over vague guidance.`;
33
+ }
34
+ function buildStartPrompt(useCase) {
35
+ return `# MAIN ACTION POINT AT THIS STAGE
36
+
37
+ Greet the user, state that you can help with "${useCase}", and ask one focused opening question.
38
+ Wait for the user response, then transition to Main Agenda.
39
+
40
+ # Success criteria WHEN you can move to next step
41
+ - User has responded to the opening question.
42
+ - You have enough context to begin discovery in Main Agenda.
43
+ - Transition using the designated transition tool/event only.`;
44
+ }
45
+ function buildMainAgendaPrompt(useCase) {
46
+ return `# MAIN ACTION POINT AT THIS STEP
47
+ ## Usable details and Main Agenda
48
+
49
+ ## USABLE DETAILS and GOALS AT THIS STAGE:
50
+ ### Task 1: Discovery and Qualification
51
+ Details and Data:
52
+ - Understand user goal and constraints for "${useCase}".
53
+ - Confirm critical details needed to proceed.
54
+ Relevant Questions:
55
+ - What outcome are you trying to achieve today?
56
+ - What constraints or preferences should I consider?
57
+ Final Step and Related Actions:
58
+ - Summarize captured details and identify missing inputs.
59
+
60
+ ### Task 2: Resolution Path
61
+ Details and Data:
62
+ - Propose the best next action and at least one fallback option when relevant.
63
+ - Use tools when external verification/execution is required.
64
+ Relevant Questions:
65
+ - Should I proceed with option A, or would you prefer option B?
66
+ - Do you want me to execute this step now?
67
+ Final Step and Related Actions:
68
+ - Confirm selected path and execute required tool actions.
69
+
70
+ ### Task 3: Completion Readiness Check
71
+ Details and Data:
72
+ - Verify that user goal is satisfied or explicitly capture pending items.
73
+ Relevant Questions:
74
+ - Did this resolve your request fully?
75
+ - Is there anything important still pending?
76
+ Final Step and Related Actions:
77
+ - If resolved, transition to Summary and Next Steps.
78
+
79
+ ## Flow of call
80
+ - Ask one question at a time.
81
+ - Handle objections briefly, then return to this agenda.
82
+ - Avoid loops and repeated asks.
83
+
84
+ # Success criteria WHEN you can move to next step
85
+ - Required details are captured.
86
+ - A concrete resolution path has been taken or scheduled.
87
+ - Transition to Summary using the designated transition tool/event only.`;
88
+ }
89
+ function buildSummaryPrompt() {
90
+ return `# MAIN ACTION POINT AT THIS STEP
91
+
92
+ Summarize what was done, state the next step clearly, and ask if the user needs anything else.
93
+ If user has another request, transition back to Main Agenda.
94
+ If user is done, transition to End Call.
95
+
96
+ # Success criteria WHEN you can move to next step
97
+ - User confirms no further help is needed.
98
+ - Transition to End Call using the designated transition tool/event only.`;
99
+ }
100
+ function buildEndPrompt() {
101
+ return `# Main Action Point for This Stage
102
+
103
+ Close the conversation politely in one short message.
104
+ Do not open new topics.
105
+ End the flow immediately after the closing message.`;
106
+ }
107
+ export function generateFlowTemplate(options) {
108
+ const useCase = options.useCase.trim();
109
+ const direction = options.direction ?? 'inbound';
110
+ const agentName = options.agentName?.trim() || 'Sam';
111
+ const flowId = options.flowId?.trim() || `${slugify(useCase)}-${direction}-flow`;
112
+ const globalPrompt = options.promptBlocks?.globalPrompt ?? buildGlobalPrompt({ useCase, direction, agentName });
113
+ const startPrompt = options.promptBlocks?.startPrompt ?? buildStartPrompt(useCase);
114
+ const mainAgendaPrompt = options.promptBlocks?.mainAgendaPrompt ?? buildMainAgendaPrompt(useCase);
115
+ const summaryPrompt = options.promptBlocks?.summaryPrompt ?? buildSummaryPrompt();
116
+ const endPrompt = options.promptBlocks?.endPrompt ?? buildEndPrompt();
117
+ return {
118
+ id: flowId,
119
+ entry: 'start',
120
+ defaultRolePrompt: globalPrompt,
121
+ nodes: [
122
+ {
123
+ id: 'start',
124
+ name: 'Start',
125
+ nodeType: 'start',
126
+ addGlobalPrompt: true,
127
+ prompt: startPrompt,
128
+ },
129
+ {
130
+ id: 'main_agenda',
131
+ name: 'Main Agenda and Questions',
132
+ nodeType: 'agent',
133
+ addGlobalPrompt: true,
134
+ prompt: mainAgendaPrompt,
135
+ },
136
+ {
137
+ id: 'summary_next_steps',
138
+ name: 'Summary and Next Steps',
139
+ nodeType: 'agent',
140
+ addGlobalPrompt: true,
141
+ prompt: summaryPrompt,
142
+ },
143
+ {
144
+ id: 'end_call',
145
+ name: 'End Call',
146
+ nodeType: 'end',
147
+ addGlobalPrompt: false,
148
+ prompt: endPrompt,
149
+ postActions: [
150
+ { type: 'end', reason: 'completed' },
151
+ ],
152
+ },
153
+ ],
154
+ transitions: [
155
+ {
156
+ from: 'start',
157
+ to: 'main_agenda',
158
+ on: 'to_main_agenda',
159
+ contract: {
160
+ label: 'Move to Main Agenda',
161
+ conditionText: 'After user responds to the opening question.',
162
+ toolOnly: true,
163
+ requiresUserTurn: true,
164
+ },
165
+ },
166
+ {
167
+ from: 'main_agenda',
168
+ to: 'summary_next_steps',
169
+ on: 'to_summary_next_steps',
170
+ contract: {
171
+ label: 'Move to Summary',
172
+ conditionText: 'After required details are captured and action path is confirmed.',
173
+ toolOnly: true,
174
+ requiresUserTurn: true,
175
+ },
176
+ },
177
+ {
178
+ from: 'summary_next_steps',
179
+ to: 'main_agenda',
180
+ on: 'back_to_main_agenda',
181
+ contract: {
182
+ label: 'Return to Main Agenda',
183
+ conditionText: 'When user asks additional questions or new requests.',
184
+ toolOnly: true,
185
+ requiresUserTurn: true,
186
+ },
187
+ },
188
+ {
189
+ from: 'summary_next_steps',
190
+ to: 'end_call',
191
+ on: 'to_end_call',
192
+ contract: {
193
+ label: 'Move to End Call',
194
+ conditionText: 'When user confirms no additional help is needed.',
195
+ toolOnly: true,
196
+ requiresUserTurn: true,
197
+ },
198
+ },
199
+ ],
200
+ };
201
+ }
202
+ //# sourceMappingURL=flow-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-generator.js","sourceRoot":"","sources":["../src/flow-generator.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,QAAQ,EAAE;oBACR,KAAK,EAAE,qBAAqB;oBAC5B,aAAa,EAAE,8CAA8C;oBAC7D,QAAQ,EAAE,IAAI;oBACd,gBAAgB,EAAE,IAAI;iBACvB;aACF;YACD;gBACE,IAAI,EAAE,aAAa;gBACnB,EAAE,EAAE,oBAAoB;gBACxB,EAAE,EAAE,uBAAuB;gBAC3B,QAAQ,EAAE;oBACR,KAAK,EAAE,iBAAiB;oBACxB,aAAa,EAAE,mEAAmE;oBAClF,QAAQ,EAAE,IAAI;oBACd,gBAAgB,EAAE,IAAI;iBACvB;aACF;YACD;gBACE,IAAI,EAAE,oBAAoB;gBAC1B,EAAE,EAAE,aAAa;gBACjB,EAAE,EAAE,qBAAqB;gBACzB,QAAQ,EAAE;oBACR,KAAK,EAAE,uBAAuB;oBAC9B,aAAa,EAAE,sDAAsD;oBACrE,QAAQ,EAAE,IAAI;oBACd,gBAAgB,EAAE,IAAI;iBACvB;aACF;YACD;gBACE,IAAI,EAAE,oBAAoB;gBAC1B,EAAE,EAAE,UAAU;gBACd,EAAE,EAAE,aAAa;gBACjB,QAAQ,EAAE;oBACR,KAAK,EAAE,kBAAkB;oBACzB,aAAa,EAAE,kDAAkD;oBACjE,QAAQ,EAAE,IAAI;oBACd,gBAAgB,EAAE,IAAI;iBACvB;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,11 @@
1
1
  export { loadAriaflowConfig, loadAriaflowConfigWithResult, createRuntimeFromConfig, printLoadSummary } from './loader.js';
2
- export type { AriaflowConfig, LoadedConfig, LoadResult, LoadOptions, RuntimeConfigInput, PermissionConfig, ToolConfigInput, ConfigWarning, LoadSummary, } from './types.js';
2
+ export { generateFlowTemplate } from './flow-generator.js';
3
+ export type { FlowGenerationOptions } from './flow-generator.js';
4
+ export { generateFlowTemplateWithLLM } from './llm-flow-generator.js';
5
+ export type { LLMFlowGenerationOptions } from './llm-flow-generator.js';
6
+ export { emitFlowTypeScriptModule } from './flow-codegen.js';
7
+ export type { FlowModuleEmitOptions } from './flow-codegen.js';
8
+ export { lintPrompts } from './prompt-lint.js';
9
+ export type { PromptLintOptions, PromptLintResult, PromptLintIssue, PromptLintSeverity } from './prompt-lint.js';
10
+ export type { AriaflowConfig, FlowFileInput, LoadedConfig, LoadResult, LoadOptions, RuntimeConfigInput, PermissionConfig, ToolConfigInput, ConfigWarning, LoadSummary, } from './types.js';
3
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,YAAY,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACjH,YAAY,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,6 @@
1
1
  export { loadAriaflowConfig, loadAriaflowConfigWithResult, createRuntimeFromConfig, printLoadSummary } from './loader.js';
2
+ export { generateFlowTemplate } from './flow-generator.js';
3
+ export { generateFlowTemplateWithLLM } from './llm-flow-generator.js';
4
+ export { emitFlowTypeScriptModule } from './flow-codegen.js';
5
+ export { lintPrompts } from './prompt-lint.js';
2
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type FlowGenerationOptions } from './flow-generator.js';
2
+ import type { FlowFileInput } from './types.js';
3
+ export interface LLMFlowGenerationOptions extends FlowGenerationOptions {
4
+ model?: string;
5
+ contextText?: string;
6
+ timeoutMs?: number;
7
+ llmMode?: 'hybrid' | 'full';
8
+ }
9
+ export declare function generateFlowTemplateWithLLM(options: LLMFlowGenerationOptions): Promise<FlowFileInput>;
10
+ //# sourceMappingURL=llm-flow-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-flow-generator.d.ts","sourceRoot":"","sources":["../src/llm-flow-generator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,wBAAyB,SAAQ,qBAAqB;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC7B;AAgQD,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,aAAa,CAAC,CA8FxB"}
@@ -0,0 +1,286 @@
1
+ import { generateObject, generateText } from 'ai';
2
+ import { openai } from '@ai-sdk/openai';
3
+ import { z } from 'zod';
4
+ import { generateFlowTemplate } from './flow-generator.js';
5
+ const fullPromptBlocksSchema = z.object({
6
+ globalPrompt: z
7
+ .string()
8
+ .min(1)
9
+ .describe('Global role prompt with sections for overall goal, language/style rules, tool+transition rules, and reliability rules.'),
10
+ mainAgendaPrompt: z
11
+ .string()
12
+ .min(1)
13
+ .describe('Main agenda prompt with concrete stage tasks, required data, relevant questions, and strict transition success criteria.'),
14
+ });
15
+ const taskBlockSchema = z.object({
16
+ title: z.string().min(1).max(120),
17
+ details: z.array(z.string().min(1).max(280)).min(1).max(6),
18
+ questions: z.array(z.string().min(1).max(280)).min(1).max(6),
19
+ finalActions: z.array(z.string().min(1).max(280)).min(1).max(6),
20
+ });
21
+ const hybridDraftSchema = z.object({
22
+ goalDescription: z.string().min(1).max(420),
23
+ useCases: z.array(z.string().min(1).max(280)).min(1).max(8),
24
+ fallbackOptions: z.array(z.string().min(1).max(280)).min(1).max(6),
25
+ taskBlocks: z.array(taskBlockSchema).min(1).max(6),
26
+ summaryMoveCriteria: z.array(z.string().min(1).max(280)).min(1).max(8),
27
+ });
28
+ function buildFullLlmPrompt(options) {
29
+ const contextSection = options.contextText && options.contextText.trim().length > 0
30
+ ? `\n## Additional Context\n${options.contextText.trim()}\n`
31
+ : '';
32
+ return `Generate production-grade flow prompts for a voice-first guided agent.
33
+
34
+ ## Use Case
35
+ - agent name: ${options.agentName}
36
+ - direction: ${options.direction}
37
+ - use case: ${options.useCase}
38
+ ${contextSection}
39
+ ## Output Requirements
40
+ - Return ONLY structured fields via the schema.
41
+ - globalPrompt must include:
42
+ - OVERALL GOAL section
43
+ - response language/style rules
44
+ - tool/function transition discipline
45
+ - reliability / non-hallucination rules
46
+ - mainAgendaPrompt must include:
47
+ - "MAIN ACTION POINT AT THIS STEP"
48
+ - 3-5 task blocks
49
+ - each task block has details/data + relevant questions + final actions
50
+ - explicit success criteria for moving to summary stage
51
+ - Make questions concrete and domain-specific, not generic filler.
52
+ - Enforce deterministic behavior: one question at a time, no mixing text+tool transition output.
53
+ - Keep wording clear for spoken conversations.
54
+ - Do not include markdown code fences.`;
55
+ }
56
+ function buildHybridLlmPrompt(options) {
57
+ const contextSection = options.contextText && options.contextText.trim().length > 0
58
+ ? `\n## Additional Context\n${options.contextText.trim()}\n`
59
+ : '';
60
+ return `Create domain-specific variable blocks for a voice flow.
61
+ Do NOT output full prompts. Return only fields in schema.
62
+
63
+ ## Use Case
64
+ - agent name: ${options.agentName}
65
+ - direction: ${options.direction}
66
+ - use case: ${options.useCase}
67
+ ${contextSection}
68
+ ## Constraints
69
+ - Keep content specific and realistic for the use case.
70
+ - Avoid generic filler.
71
+ - Questions should be voice-friendly and one-at-a-time.
72
+ - Include only facts/steps that can be asked or verified in conversation.
73
+ - No markdown code fences.`;
74
+ }
75
+ function composeHybridGlobalPrompt(options, draft) {
76
+ const useCases = draft.useCases.map(item => item.trim()).filter(Boolean);
77
+ const fallbacks = draft.fallbackOptions.map(item => item.trim()).filter(Boolean);
78
+ const effectiveUseCases = useCases.length > 0 ? useCases : ['addressing user requests and collecting required details'];
79
+ const effectiveFallbacks = fallbacks.length > 0 ? fallbacks : ['providing a concise summary and a follow-up option'];
80
+ const goal = draft.goalDescription.trim().length > 0
81
+ ? draft.goalDescription.trim()
82
+ : 'handling user requests accurately and moving toward clear resolution';
83
+ return `# OVERALL GOAL
84
+
85
+ You are ${options.agentName}. We are getting ${options.direction} calls for ${goal}. Your goal is to address user requests within these use cases: ${effectiveUseCases.join(', ')}. If the caller is hesitant, confused, or does not wish to continue, offer alternatives such as ${effectiveFallbacks.join(', ')}.
86
+
87
+ ## Response Language
88
+ YOU MUST only REPLY IN the language of the latest user input. Use simple words, keep tone informal but professional, and keep answers concise for voice.
89
+
90
+ ## Critical Rules
91
+ - If the last message is not a user message, do not make a function/tool call.
92
+ - Never mix text and tool calls in the same output.
93
+ - Ask one focused question at a time and wait for the user response.
94
+ - If a transition is required, end the turn with the correct tool call or a question, never both.
95
+
96
+ ## Reliability Rules
97
+ - Do not invent facts. If uncertain, ask a clarifying question or use a verification tool.
98
+ - Keep collected details consistent across turns and avoid contradictions.
99
+ - Prefer deterministic next actions over vague responses.`;
100
+ }
101
+ function composeHybridMainAgendaPrompt(draft) {
102
+ const blocks = draft.taskBlocks
103
+ .map((block, index) => {
104
+ const detailsList = block.details.map(item => item.trim()).filter(Boolean);
105
+ const questionList = block.questions.map(item => item.trim()).filter(Boolean);
106
+ const actionList = block.finalActions.map(item => item.trim()).filter(Boolean);
107
+ const details = (detailsList.length > 0 ? detailsList : ['Collect the required data for this step.'])
108
+ .map(item => ` - ${item}`).join('\n');
109
+ const questions = (questionList.length > 0 ? questionList : ['What is the key detail needed to proceed?'])
110
+ .map(item => ` - ${item}`).join('\n');
111
+ const actions = (actionList.length > 0 ? actionList : ['Summarize captured inputs and proceed deterministically.'])
112
+ .map(item => ` - ${item}`).join('\n');
113
+ const title = block.title.trim().length > 0 ? block.title.trim() : `Step ${index + 1}`;
114
+ return `### Task ${index + 1}: ${title}
115
+ Details and Data:
116
+ ${details}
117
+ Relevant Questions:
118
+ ${questions}
119
+ Final Step and Related Actions:
120
+ ${actions}`;
121
+ })
122
+ .join('\n\n');
123
+ const successCriteriaList = draft.summaryMoveCriteria
124
+ .map(item => item.trim())
125
+ .filter(Boolean);
126
+ const successCriteria = (successCriteriaList.length > 0
127
+ ? successCriteriaList
128
+ : ['Required details are collected and validated', 'A clear next action is identified'])
129
+ .map(item => `- ${item}`)
130
+ .join('\n');
131
+ return `# MAIN ACTION POINT AT THIS STEP
132
+ ## Usable details and Main Agenda
133
+
134
+ ## USABLE DETAILS and GOALS AT THIS STAGE:
135
+ ${blocks}
136
+
137
+ ## Flow of call
138
+ Here’s how the flow should work:
139
+ - Ask one question at a time.
140
+ - Handle objections briefly, then continue the agenda.
141
+ - Do not loop or repeat already-confirmed questions.
142
+ - Use transition tools/events to move stages.
143
+
144
+ # Success criteria WHEN you can move to next step
145
+ ${successCriteria}
146
+ - Transition to Summary using the designated transition tool/event only.`;
147
+ }
148
+ function runWithTimeout(promise, timeoutMs, timeoutMessage) {
149
+ let timeoutHandle;
150
+ const timeout = new Promise((_, reject) => {
151
+ timeoutHandle = setTimeout(() => reject(new Error(timeoutMessage)), timeoutMs);
152
+ });
153
+ return Promise.race([promise, timeout]).finally(() => {
154
+ if (timeoutHandle) {
155
+ clearTimeout(timeoutHandle);
156
+ }
157
+ });
158
+ }
159
+ function extractJsonObjectFromText(text) {
160
+ const trimmed = text.trim();
161
+ try {
162
+ return JSON.parse(trimmed);
163
+ }
164
+ catch {
165
+ // continue
166
+ }
167
+ const first = trimmed.indexOf('{');
168
+ const last = trimmed.lastIndexOf('}');
169
+ if (first >= 0 && last > first) {
170
+ const candidate = trimmed.slice(first, last + 1);
171
+ return JSON.parse(candidate);
172
+ }
173
+ throw new Error('Could not parse JSON object from model response');
174
+ }
175
+ async function generateObjectWithFallback({ model, schema, system, prompt, }) {
176
+ try {
177
+ const result = await generateObject({
178
+ model,
179
+ schema,
180
+ system,
181
+ prompt,
182
+ });
183
+ return result.object;
184
+ }
185
+ catch {
186
+ const fallback = await generateText({
187
+ model,
188
+ system: `${system}\nReturn ONLY JSON object, no markdown, no prose.`,
189
+ prompt: `${prompt}\n\nReturn JSON object only.`,
190
+ });
191
+ const parsed = extractJsonObjectFromText(fallback.text);
192
+ const validated = schema.parse(parsed);
193
+ return validated;
194
+ }
195
+ }
196
+ function resolveModelSpec(modelInput) {
197
+ const requested = modelInput?.trim() || 'gpt-5-mini';
198
+ const modelId = requested.startsWith('openai:') ? requested.slice('openai:'.length).trim() : requested;
199
+ if (!modelId) {
200
+ throw new Error('Model id cannot be empty');
201
+ }
202
+ if (!process.env.OPENAI_API_KEY || process.env.OPENAI_API_KEY.trim().length === 0) {
203
+ throw new Error('OPENAI_API_KEY is required for LLM flow generation');
204
+ }
205
+ return {
206
+ modelId,
207
+ label: `openai:${modelId}`,
208
+ model: openai(modelId),
209
+ };
210
+ }
211
+ export async function generateFlowTemplateWithLLM(options) {
212
+ const useCase = options.useCase.trim();
213
+ const direction = options.direction ?? 'inbound';
214
+ const agentName = options.agentName?.trim() || 'Sam';
215
+ const modelSpec = resolveModelSpec(options.model);
216
+ const timeoutMs = options.timeoutMs ?? 45000;
217
+ const llmMode = options.llmMode ?? 'hybrid';
218
+ if (llmMode === 'full') {
219
+ const generate = generateObjectWithFallback({
220
+ model: modelSpec.model,
221
+ schema: fullPromptBlocksSchema,
222
+ system: 'You are an expert prompt engineer for deterministic conversational flow agents. Produce concise, robust prompts only.',
223
+ prompt: buildFullLlmPrompt({
224
+ useCase,
225
+ direction,
226
+ agentName,
227
+ contextText: options.contextText,
228
+ }),
229
+ });
230
+ const object = await runWithTimeout(generate, timeoutMs, `LLM flow generation timed out after ${timeoutMs}ms (${modelSpec.label})`);
231
+ return generateFlowTemplate({
232
+ ...options,
233
+ promptBlocks: {
234
+ ...options.promptBlocks,
235
+ globalPrompt: object.globalPrompt.trim(),
236
+ mainAgendaPrompt: object.mainAgendaPrompt.trim(),
237
+ },
238
+ });
239
+ }
240
+ let draft;
241
+ try {
242
+ draft = await runWithTimeout(generateObjectWithFallback({
243
+ model: modelSpec.model,
244
+ schema: hybridDraftSchema,
245
+ system: 'You generate domain-specific variable blocks for conversational flow prompts. Keep content concrete and deterministic.',
246
+ prompt: buildHybridLlmPrompt({
247
+ useCase,
248
+ direction,
249
+ agentName,
250
+ contextText: options.contextText,
251
+ }),
252
+ }), timeoutMs, `LLM flow generation timed out after ${timeoutMs}ms (${modelSpec.label})`);
253
+ }
254
+ catch {
255
+ const fullFallback = await runWithTimeout(generateObjectWithFallback({
256
+ model: modelSpec.model,
257
+ schema: fullPromptBlocksSchema,
258
+ system: 'You are an expert prompt engineer for deterministic conversational flow agents. Produce concise, robust prompts only.',
259
+ prompt: buildFullLlmPrompt({
260
+ useCase,
261
+ direction,
262
+ agentName,
263
+ contextText: options.contextText,
264
+ }),
265
+ }), timeoutMs, `LLM flow generation timed out after ${timeoutMs}ms (${modelSpec.label})`);
266
+ return generateFlowTemplate({
267
+ ...options,
268
+ promptBlocks: {
269
+ ...options.promptBlocks,
270
+ globalPrompt: fullFallback.globalPrompt.trim(),
271
+ mainAgendaPrompt: fullFallback.mainAgendaPrompt.trim(),
272
+ },
273
+ });
274
+ }
275
+ const globalPrompt = composeHybridGlobalPrompt({ direction, agentName }, draft);
276
+ const mainAgendaPrompt = composeHybridMainAgendaPrompt(draft);
277
+ return generateFlowTemplate({
278
+ ...options,
279
+ promptBlocks: {
280
+ ...options.promptBlocks,
281
+ globalPrompt,
282
+ mainAgendaPrompt,
283
+ },
284
+ });
285
+ }
286
+ //# sourceMappingURL=llm-flow-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-flow-generator.js","sourceRoot":"","sources":["../src/llm-flow-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,IAAI,CAA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CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,YAAY,GAAG,MAAM,cAAc,CACvC,0BAA0B,CAAC;YACzB,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,MAAM,EAAE,sBAAsB;YAC9B,MAAM,EACJ,uHAAuH;YACzH,MAAM,EAAE,kBAAkB,CAAC;gBACzB,OAAO;gBACP,SAAS;gBACT,SAAS;gBACT,WAAW,EAAE,OAAO,CAAC,WAAW;aACjC,CAAC;SACH,CAAC,EACF,SAAS,EACT,uCAAuC,SAAS,OAAO,SAAS,CAAC,KAAK,GAAG,CAC1E,CAAC;QAEF,OAAO,oBAAoB,CAAC;YAC1B,GAAG,OAAO;YACV,YAAY,EAAE;gBACZ,GAAG,OAAO,CAAC,YAAY;gBACvB,YAAY,EAAE,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE;gBAC9C,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,CAAC,IAAI,EAAE;aACvD;SACF,CAAC,CAAC;IACL,CAAC;IACD,MAAM,YAAY,GAAG,yBAAyB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;IAChF,MAAM,gBAAgB,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;IAE9D,OAAO,oBAAoB,CAAC;QAC1B,GAAG,OAAO;QACV,YAAY,EAAE;YACZ,GAAG,OAAO,CAAC,YAAY;YACvB,YAAY;YACZ,gBAAgB;SACjB;KACF,CAAC,CAAC;AACL,CAAC"}
package/dist/loader.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type HarnessConfig, type Runtime } from '@ariaflowagents/core';
2
2
  import type { LoadedConfig, LoadOptions } from './types.js';
3
- type WarningType = 'invalid_frontmatter' | 'missing_prompt' | 'missing_template' | 'name_mismatch' | 'missing_ref' | 'invalid_tool_entry' | 'duplicate_agent' | 'duplicate_flow' | 'unresolved_flow_ref' | 'tool_not_found';
3
+ type WarningType = 'invalid_frontmatter' | 'invalid_flow' | 'missing_prompt' | 'missing_template' | 'name_mismatch' | 'missing_ref' | 'invalid_tool_entry' | 'duplicate_agent' | 'duplicate_flow' | 'unresolved_flow_ref' | 'tool_not_found';
4
4
  interface ConfigWarning {
5
5
  type: WarningType;
6
6
  file: string;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAWA,OAAO,EAUL,KAAK,aAAa,EAElB,KAAK,OAAO,EAGb,MAAM,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAKV,YAAY,EACZ,WAAW,EAMZ,MAAM,YAAY,CAAC;AAqDpB,KAAK,WAAW,GACZ,qBAAqB,GACrB,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,aAAa,GACb,oBAAoB,GACpB,iBAAiB,GACjB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,CAAC;AAErB,UAAU,aAAa;IACrB,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAmgCD,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CA+QzF;AAED,wBAAsB,4BAA4B,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC;IACrF,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B,CAAC,CAoSD;AAED,wBA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