@sf-explorer/agentscript-migration-tool 1.0.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/LICENSE +21 -0
  3. package/README.md +342 -0
  4. package/dist/builders/actionBuilder.d.ts +39 -0
  5. package/dist/builders/actionBuilder.d.ts.map +1 -0
  6. package/dist/builders/actionBuilder.js +120 -0
  7. package/dist/builders/actionBuilder.js.map +1 -0
  8. package/dist/builders/configBuilder.d.ts +14 -0
  9. package/dist/builders/configBuilder.d.ts.map +1 -0
  10. package/dist/builders/configBuilder.js +22 -0
  11. package/dist/builders/configBuilder.js.map +1 -0
  12. package/dist/builders/index.d.ts +12 -0
  13. package/dist/builders/index.d.ts.map +1 -0
  14. package/dist/builders/index.js +12 -0
  15. package/dist/builders/index.js.map +1 -0
  16. package/dist/builders/languageBuilder.d.ts +13 -0
  17. package/dist/builders/languageBuilder.d.ts.map +1 -0
  18. package/dist/builders/languageBuilder.js +18 -0
  19. package/dist/builders/languageBuilder.js.map +1 -0
  20. package/dist/builders/startAgentBuilder.d.ts +14 -0
  21. package/dist/builders/startAgentBuilder.d.ts.map +1 -0
  22. package/dist/builders/startAgentBuilder.js +35 -0
  23. package/dist/builders/startAgentBuilder.js.map +1 -0
  24. package/dist/builders/systemBuilder.d.ts +14 -0
  25. package/dist/builders/systemBuilder.d.ts.map +1 -0
  26. package/dist/builders/systemBuilder.js +22 -0
  27. package/dist/builders/systemBuilder.js.map +1 -0
  28. package/dist/builders/topicBuilder.d.ts +23 -0
  29. package/dist/builders/topicBuilder.d.ts.map +1 -0
  30. package/dist/builders/topicBuilder.js +77 -0
  31. package/dist/builders/topicBuilder.js.map +1 -0
  32. package/dist/builders/variablesBuilder.d.ts +14 -0
  33. package/dist/builders/variablesBuilder.d.ts.map +1 -0
  34. package/dist/builders/variablesBuilder.js +46 -0
  35. package/dist/builders/variablesBuilder.js.map +1 -0
  36. package/dist/formatters/index.d.ts +5 -0
  37. package/dist/formatters/index.d.ts.map +1 -0
  38. package/dist/formatters/index.js +5 -0
  39. package/dist/formatters/index.js.map +1 -0
  40. package/dist/formatters/yamlFormatter.d.ts +17 -0
  41. package/dist/formatters/yamlFormatter.d.ts.map +1 -0
  42. package/dist/formatters/yamlFormatter.js +226 -0
  43. package/dist/formatters/yamlFormatter.js.map +1 -0
  44. package/dist/generator.d.ts +60 -0
  45. package/dist/generator.d.ts.map +1 -0
  46. package/dist/generator.js +109 -0
  47. package/dist/generator.js.map +1 -0
  48. package/dist/index.d.ts +15 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +15 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/types.d.ts +178 -0
  53. package/dist/types.d.ts.map +1 -0
  54. package/dist/types.js +7 -0
  55. package/dist/types.js.map +1 -0
  56. package/dist/utils/index.d.ts +5 -0
  57. package/dist/utils/index.d.ts.map +1 -0
  58. package/dist/utils/index.js +5 -0
  59. package/dist/utils/index.js.map +1 -0
  60. package/dist/utils/nameSanitizer.d.ts +30 -0
  61. package/dist/utils/nameSanitizer.d.ts.map +1 -0
  62. package/dist/utils/nameSanitizer.js +76 -0
  63. package/dist/utils/nameSanitizer.js.map +1 -0
  64. package/dist/validation.d.ts +46 -0
  65. package/dist/validation.d.ts.map +1 -0
  66. package/dist/validation.js +123 -0
  67. package/dist/validation.js.map +1 -0
  68. package/package.json +54 -0
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Language Block Builder
3
+ * Builds the language block for Agent Script
4
+ */
5
+ /**
6
+ * Build language block
7
+ * Defines locale configuration
8
+ *
9
+ * @returns AgentScriptLanguageBlock object
10
+ */
11
+ export function buildLanguage() {
12
+ return {
13
+ default_locale: "en_US",
14
+ additional_locales: "",
15
+ all_additional_locales: false,
16
+ };
17
+ }
18
+ //# sourceMappingURL=languageBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languageBuilder.js","sourceRoot":"","sources":["../../src/builders/languageBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;GAKG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL,cAAc,EAAE,OAAO;QACvB,kBAAkB,EAAE,EAAE;QACtB,sBAAsB,EAAE,KAAK;KAC9B,CAAA;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Start Agent Builder
3
+ * Builds the start_agent topic selector block
4
+ */
5
+ import type { PlannerDefinition, AgentScriptTopicBlock } from "../types";
6
+ /**
7
+ * Build start_agent topic
8
+ * Topic selector that routes to appropriate topics
9
+ *
10
+ * @param planner - The planner definition
11
+ * @returns AgentScriptTopicBlock for start_agent
12
+ */
13
+ export declare function buildStartAgent(planner: PlannerDefinition): AgentScriptTopicBlock;
14
+ //# sourceMappingURL=startAgentBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startAgentBuilder.d.ts","sourceRoot":"","sources":["../../src/builders/startAgentBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,iBAAiB,EAEjB,qBAAqB,EACtB,MAAM,UAAU,CAAA;AAGjB;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,iBAAiB,GACzB,qBAAqB,CA8BvB"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Start Agent Builder
3
+ * Builds the start_agent topic selector block
4
+ */
5
+ import { sanitizeTopicName } from "../utils/nameSanitizer";
6
+ /**
7
+ * Build start_agent topic
8
+ * Topic selector that routes to appropriate topics
9
+ *
10
+ * @param planner - The planner definition
11
+ * @returns AgentScriptTopicBlock for start_agent
12
+ */
13
+ export function buildStartAgent(planner) {
14
+ const reasoningActions = {};
15
+ // Create transition actions for each topic
16
+ const topics = planner.topics || [];
17
+ topics.forEach((topic, index) => {
18
+ const topicName = sanitizeTopicName(topic.DeveloperName || topic.MasterLabel || `Topic_${index}`);
19
+ const description = topic.Description ||
20
+ topic.Metadata?.description ||
21
+ "Handles specific user requests";
22
+ reasoningActions[`go_to_${topicName.toLowerCase()}`] = {
23
+ action: `@utils.transition to @topic.${topicName}`,
24
+ description: description,
25
+ };
26
+ });
27
+ return {
28
+ description: "Welcome the user and determine the appropriate topic based on user input",
29
+ reasoning: {
30
+ instructions: "You are a topic selector assistant. Welcome the guest and analyze their input to determine the most appropriate topic to handle their request. Be helpful and professional.",
31
+ actions: reasoningActions,
32
+ },
33
+ };
34
+ }
35
+ //# sourceMappingURL=startAgentBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startAgentBuilder.js","sourceRoot":"","sources":["../../src/builders/startAgentBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,OAA0B;IAE1B,MAAM,gBAAgB,GACpB,EAAE,CAAA;IAEJ,2CAA2C;IAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAA;IACnC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC9B,MAAM,SAAS,GAAG,iBAAiB,CACjC,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,WAAW,IAAI,SAAS,KAAK,EAAE,CAC7D,CAAA;QACD,MAAM,WAAW,GACf,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,QAAQ,EAAE,WAAW;YAC3B,gCAAgC,CAAA;QAElC,gBAAgB,CAAC,SAAS,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC,GAAG;YACrD,MAAM,EAAE,+BAA+B,SAAS,EAAE;YAClD,WAAW,EAAE,WAAW;SACzB,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,WAAW,EACT,0EAA0E;QAC5E,SAAS,EAAE;YACT,YAAY,EACV,6KAA6K;YAC/K,OAAO,EAAE,gBAAgB;SAC1B;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * System Block Builder
3
+ * Builds the system block for Agent Script
4
+ */
5
+ import type { PlannerDefinition, AgentScriptSystemBlock } from "../types";
6
+ /**
7
+ * Build system block
8
+ * Defines global settings and instructions
9
+ *
10
+ * @param planner - The planner definition
11
+ * @returns AgentScriptSystemBlock object
12
+ */
13
+ export declare function buildSystem(planner: PlannerDefinition): AgentScriptSystemBlock;
14
+ //# sourceMappingURL=systemBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemBuilder.d.ts","sourceRoot":"","sources":["../../src/builders/systemBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEzE;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,sBAAsB,CAW9E"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * System Block Builder
3
+ * Builds the system block for Agent Script
4
+ */
5
+ /**
6
+ * Build system block
7
+ * Defines global settings and instructions
8
+ *
9
+ * @param planner - The planner definition
10
+ * @returns AgentScriptSystemBlock object
11
+ */
12
+ export function buildSystem(planner) {
13
+ return {
14
+ instructions: planner.Metadata?.description ||
15
+ "You are a helpful assistant that helps users with their requests.",
16
+ messages: {
17
+ welcome: `Hi, I'm your ${planner.MasterLabel || planner.DeveloperName} assistant. How can I help you today?`,
18
+ error: "Sorry, something went wrong on my end. Could you please rephrase that?",
19
+ },
20
+ };
21
+ }
22
+ //# sourceMappingURL=systemBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemBuilder.js","sourceRoot":"","sources":["../../src/builders/systemBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAA0B;IACpD,OAAO;QACL,YAAY,EACV,OAAO,CAAC,QAAQ,EAAE,WAAW;YAC7B,mEAAmE;QACrE,QAAQ,EAAE;YACR,OAAO,EAAE,gBAAgB,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,aAAa,uCAAuC;YAC5G,KAAK,EACH,wEAAwE;SAC3E;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Topic Builder
3
+ * Builds topic blocks for Agent Script
4
+ */
5
+ import type { PlannerTopic, AgentScriptTopicBlock } from "../types";
6
+ /**
7
+ * Build topic instructions
8
+ * Generates helpful reasoning instructions for the topic
9
+ * Returns multi-line string that will be formatted as YAML block scalar
10
+ *
11
+ * @param topic - The topic definition
12
+ * @returns Multi-line instruction string
13
+ */
14
+ export declare function buildTopicInstructions(topic: PlannerTopic): string;
15
+ /**
16
+ * Build individual topic
17
+ * Converts PlannerTopic to Agent Script topic
18
+ *
19
+ * @param topic - The topic definition
20
+ * @returns AgentScriptTopicBlock
21
+ */
22
+ export declare function buildTopic(topic: PlannerTopic): AgentScriptTopicBlock;
23
+ //# sourceMappingURL=topicBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topicBuilder.d.ts","sourceRoot":"","sources":["../../src/builders/topicBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,YAAY,EAEZ,qBAAqB,EACtB,MAAM,UAAU,CAAA;AAIjB;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAmClE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,qBAAqB,CAoCrE"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Topic Builder
3
+ * Builds topic blocks for Agent Script
4
+ */
5
+ import { sanitizeActionName } from "../utils/nameSanitizer";
6
+ import { buildAction } from "./actionBuilder";
7
+ /**
8
+ * Build topic instructions
9
+ * Generates helpful reasoning instructions for the topic
10
+ * Returns multi-line string that will be formatted as YAML block scalar
11
+ *
12
+ * @param topic - The topic definition
13
+ * @returns Multi-line instruction string
14
+ */
15
+ export function buildTopicInstructions(topic) {
16
+ const scope = topic.Scope || topic.Metadata?.scope || "";
17
+ const description = topic.Description || topic.Metadata?.description || "";
18
+ // Build instructions as multi-line content
19
+ const instructionLines = [];
20
+ if (description) {
21
+ instructionLines.push(description);
22
+ }
23
+ else {
24
+ instructionLines.push("Handle user requests for this topic.");
25
+ }
26
+ if (scope) {
27
+ instructionLines.push("");
28
+ instructionLines.push(`Scope: ${scope}`);
29
+ }
30
+ const actions = topic.actions || [];
31
+ if (actions.length > 0) {
32
+ instructionLines.push("");
33
+ instructionLines.push("Available actions:");
34
+ actions.forEach((action) => {
35
+ const actionName = sanitizeActionName(action.DeveloperName || action.MasterLabel || "action");
36
+ const actionDesc = action.Description || "";
37
+ instructionLines.push(`- Use @actions.${actionName}${actionDesc ? ` to ${actionDesc}` : ""}`);
38
+ });
39
+ }
40
+ return instructionLines.join("\n");
41
+ }
42
+ /**
43
+ * Build individual topic
44
+ * Converts PlannerTopic to Agent Script topic
45
+ *
46
+ * @param topic - The topic definition
47
+ * @returns AgentScriptTopicBlock
48
+ */
49
+ export function buildTopic(topic) {
50
+ const description = topic.Description ||
51
+ topic.Metadata?.description ||
52
+ "Handles user requests for this topic";
53
+ const topicBlock = {
54
+ description: description,
55
+ reasoning: {
56
+ instructions: buildTopicInstructions(topic),
57
+ actions: {},
58
+ },
59
+ };
60
+ // Add topic actions
61
+ const actions = topic.actions || [];
62
+ if (actions.length > 0) {
63
+ topicBlock.actions = {};
64
+ actions.forEach((action) => {
65
+ const actionName = sanitizeActionName(action.DeveloperName || action.MasterLabel || "action");
66
+ // Define the action
67
+ topicBlock.actions[actionName] = buildAction(action);
68
+ // Add to reasoning actions (make available to LLM)
69
+ topicBlock.reasoning.actions[actionName] = {
70
+ action: `@actions.${actionName}`,
71
+ description: action.Description || "Performs an action",
72
+ };
73
+ });
74
+ }
75
+ return topicBlock;
76
+ }
77
+ //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AC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,UAAU,CAAA;AACnB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Variables Block Builder
3
+ * Builds the variables block for Agent Script
4
+ */
5
+ import type { PlannerDefinition, AgentScriptVariable } from "../types";
6
+ /**
7
+ * Build variables block
8
+ * Converts PlannerVariable records to agent script variables
9
+ *
10
+ * @param planner - The planner definition
11
+ * @returns Record of variable definitions
12
+ */
13
+ export declare function buildVariables(planner: PlannerDefinition): Record<string, AgentScriptVariable>;
14
+ //# sourceMappingURL=variablesBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variablesBuilder.d.ts","sourceRoot":"","sources":["../../src/builders/variablesBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,iBAAiB,EAEjB,mBAAmB,EACpB,MAAM,UAAU,CAAA;AAEjB;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,iBAAiB,GACzB,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAuCrC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Variables Block Builder
3
+ * Builds the variables block for Agent Script
4
+ */
5
+ /**
6
+ * Build variables block
7
+ * Converts PlannerVariable records to agent script variables
8
+ *
9
+ * @param planner - The planner definition
10
+ * @returns Record of variable definitions
11
+ */
12
+ export function buildVariables(planner) {
13
+ const variables = {};
14
+ const vars = planner.variables || [];
15
+ vars.forEach((variable) => {
16
+ const varName = variable.parameterName || variable.DeveloperName;
17
+ if (!varName)
18
+ return;
19
+ // Map MappingType to variable type
20
+ const mappingType = variable.mappingType || "string";
21
+ let varType = "string";
22
+ // Attempt to infer type from mapping type or description
23
+ const lowerMappingType = mappingType.toLowerCase();
24
+ if (lowerMappingType.includes("number") ||
25
+ lowerMappingType.includes("int")) {
26
+ varType = "number";
27
+ }
28
+ else if (lowerMappingType.includes("bool")) {
29
+ varType = "boolean";
30
+ }
31
+ else if (lowerMappingType.includes("object")) {
32
+ varType = "object";
33
+ }
34
+ else if (lowerMappingType.includes("array") ||
35
+ lowerMappingType.includes("list")) {
36
+ varType = "array";
37
+ }
38
+ variables[varName] = {
39
+ type: varType,
40
+ mutable: true, // Default to mutable unless specified otherwise
41
+ description: variable.description || `Variable: ${varName}`,
42
+ };
43
+ });
44
+ return variables;
45
+ }
46
+ //# sourceMappingURL=variablesBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variablesBuilder.js","sourceRoot":"","sources":["../../src/builders/variablesBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA0B;IAE1B,MAAM,SAAS,GAAwC,EAAE,CAAA;IAEzD,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAA;IACpC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACxB,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,IAAI,QAAQ,CAAC,aAAa,CAAA;QAChE,IAAI,CAAC,OAAO;YAAE,OAAM;QAEpB,mCAAmC;QACnC,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAA;QACpD,IAAI,OAAO,GACT,QAAQ,CAAA;QAEV,yDAAyD;QACzD,MAAM,gBAAgB,GAAG,WAAW,CAAC,WAAW,EAAE,CAAA;QAClD,IACE,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACnC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAChC,CAAC;YACD,OAAO,GAAG,QAAQ,CAAA;QACpB,CAAC;aAAM,IAAI,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7C,OAAO,GAAG,SAAS,CAAA;QACrB,CAAC;aAAM,IAAI,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/C,OAAO,GAAG,QAAQ,CAAA;QACpB,CAAC;aAAM,IACL,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC;YAClC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,EACjC,CAAC;YACD,OAAO,GAAG,OAAO,CAAA;QACnB,CAAC;QAED,SAAS,CAAC,OAAO,CAAC,GAAG;YACnB,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,IAAI,EAAE,gDAAgD;YAC/D,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,aAAa,OAAO,EAAE;SAC5D,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;AAClB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Formatters Module Exports
3
+ */
4
+ export * from "./yamlFormatter";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/formatters/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Formatters Module Exports
3
+ */
4
+ export * from "./yamlFormatter";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/formatters/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * YAML Formatter
3
+ * Handles conversion of Agent Script structure to YAML format
4
+ * Following Salesforce Agent Script Recipes specifications
5
+ */
6
+ import type { AgentScriptStructure, AgentScriptGenerationOptions } from "../types";
7
+ /**
8
+ * Convert agent script structure to YAML
9
+ *
10
+ * @param agentScript - The agent script structure
11
+ * @param options - Generation options
12
+ * @param plannerName - Planner name for comments
13
+ * @param plannerDeveloperName - Planner developer name for comments
14
+ * @returns Formatted YAML string
15
+ */
16
+ export declare function convertToYaml(agentScript: AgentScriptStructure, options: Required<AgentScriptGenerationOptions>, plannerName?: string, plannerDeveloperName?: string): string;
17
+ //# sourceMappingURL=yamlFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yamlFormatter.d.ts","sourceRoot":"","sources":["../../src/formatters/yamlFormatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,4BAA4B,EAC7B,MAAM,UAAU,CAAA;AAEjB;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,oBAAoB,EACjC,OAAO,EAAE,QAAQ,CAAC,4BAA4B,CAAC,EAC/C,WAAW,CAAC,EAAE,MAAM,EACpB,oBAAoB,CAAC,EAAE,MAAM,GAC5B,MAAM,CA0CR"}
@@ -0,0 +1,226 @@
1
+ /**
2
+ * YAML Formatter
3
+ * Handles conversion of Agent Script structure to YAML format
4
+ * Following Salesforce Agent Script Recipes specifications
5
+ */
6
+ import yaml from "js-yaml";
7
+ /**
8
+ * Convert agent script structure to YAML
9
+ *
10
+ * @param agentScript - The agent script structure
11
+ * @param options - Generation options
12
+ * @param plannerName - Planner name for comments
13
+ * @param plannerDeveloperName - Planner developer name for comments
14
+ * @returns Formatted YAML string
15
+ */
16
+ export function convertToYaml(agentScript, options, plannerName, plannerDeveloperName) {
17
+ let yamlContent = "";
18
+ // Add header comments
19
+ if (options.includeComments) {
20
+ yamlContent += "# Agent Script\n";
21
+ yamlContent += `# Generated from GenAI Planner: ${plannerName || plannerDeveloperName || "Unknown"}\n`;
22
+ yamlContent += `# Developer Name: ${plannerDeveloperName || "unknown"}\n`;
23
+ yamlContent +=
24
+ "# This agent script follows Salesforce Agent Script Recipes patterns\n";
25
+ yamlContent +=
26
+ "# @see https://developer.salesforce.com/sample-apps/agent-script-recipes/getting-started/overview\n\n";
27
+ }
28
+ // Convert to YAML with literal block scalars for multi-line strings
29
+ yamlContent += yaml.dump(agentScript, {
30
+ indent: options.yamlIndent || 4,
31
+ lineWidth: -1, // Don't wrap lines
32
+ noRefs: true,
33
+ sortKeys: false,
34
+ quotingType: '"',
35
+ forceQuotes: true,
36
+ styles: {
37
+ "!!str": "literal", // Use literal block scalar (|) for multi-line strings
38
+ },
39
+ });
40
+ // Convert JavaScript-style booleans to Python-style (Salesforce Agent Script format)
41
+ // Replace: true -> True, false -> False
42
+ yamlContent = yamlContent
43
+ .replace(/:\s*true\b/g, ": True")
44
+ .replace(/:\s*false\b/g, ": False");
45
+ // Apply all formatting transformations
46
+ yamlContent = convertTransitionActionsToCompactFormat(yamlContent);
47
+ yamlContent = convertReasoningActionsToCompactFormat(yamlContent);
48
+ yamlContent = convertInstructionsToSpecFormat(yamlContent);
49
+ yamlContent = convertVariablesToCompactFormat(yamlContent);
50
+ yamlContent = unquoteActionTypes(yamlContent);
51
+ yamlContent = yamlContent.replace(/available_when:/g, "available when");
52
+ return yamlContent;
53
+ }
54
+ /**
55
+ * Unquote type names in action inputs and outputs
56
+ * From: email: "string"
57
+ * To: email: string
58
+ */
59
+ function unquoteActionTypes(yamlContent) {
60
+ // Common type names that should not be quoted
61
+ const types = [
62
+ "string",
63
+ "number",
64
+ "boolean",
65
+ "object",
66
+ "array",
67
+ "int",
68
+ "float",
69
+ "date",
70
+ "datetime",
71
+ ];
72
+ types.forEach((type) => {
73
+ // Match: field_name: "type"
74
+ const regex = new RegExp(`(\\w+):\\s*"(${type})"`, "g");
75
+ yamlContent = yamlContent.replace(regex, `$1: ${type}`);
76
+ });
77
+ return yamlContent;
78
+ }
79
+ /**
80
+ * Convert multi-line instructions to Salesforce Agent Script spec format
81
+ * From: instructions: "text" or instructions: |
82
+ * Line 1
83
+ * Line 2
84
+ * To: instructions: ->
85
+ * | Line 1
86
+ * Line 2
87
+ */
88
+ function convertInstructionsToSpecFormat(yamlContent) {
89
+ // Pattern 1: Match quoted instructions ONLY in reasoning blocks
90
+ const quotedInstructionsPattern = /^(\s+)(reasoning:\s*\n\s+)instructions:\s*"([^"]+(?:\\n[^"]*)*)"$/gm;
91
+ yamlContent = yamlContent.replace(quotedInstructionsPattern, (match, indent, reasoningLine, content) => {
92
+ // Unescape newlines and split into lines
93
+ const unescaped = content.replace(/\\n/g, "\n");
94
+ const lines = unescaped.split("\n").map((line) => line.trim());
95
+ if (lines.length === 0)
96
+ return match;
97
+ if (lines.length === 1 && lines[0].length < 80) {
98
+ // Keep short single-line instructions as-is
99
+ return match;
100
+ }
101
+ // Build new format: reasoning:\n instructions: ->
102
+ let result = `${indent}${reasoningLine}instructions: ->\n`;
103
+ // First line gets the | prefix (5 spaces for proper alignment)
104
+ result += `${indent} | ${lines[0]}\n`;
105
+ // Subsequent lines continue with same indentation (no | prefix)
106
+ for (let i = 1; i < lines.length; i++) {
107
+ const line = lines[i];
108
+ if (line) {
109
+ result += `${indent} ${line}\n`;
110
+ }
111
+ }
112
+ return result;
113
+ });
114
+ // Pattern 2: Match literal block scalar instructions ONLY in reasoning blocks
115
+ const literalInstructionsPattern = /^(\s+)(reasoning:\s*\n\s+)instructions:\s*\|\s*\n((?:\s+.+\n)+)/gm;
116
+ yamlContent = yamlContent.replace(literalInstructionsPattern, (match, indent, reasoningLine, content) => {
117
+ // Split content into lines
118
+ const lines = content.split("\n").filter((line) => line.trim());
119
+ if (lines.length === 0)
120
+ return match;
121
+ // Build new format: reasoning:\n instructions: ->
122
+ let result = `${indent}${reasoningLine}instructions: ->\n`;
123
+ // First line gets the | prefix (5 spaces for proper alignment)
124
+ const firstLine = lines[0].trim();
125
+ result += `${indent} | ${firstLine}\n`;
126
+ // Subsequent lines continue with same indentation (no | prefix)
127
+ for (let i = 1; i < lines.length; i++) {
128
+ const line = lines[i].trim();
129
+ if (line) {
130
+ result += `${indent} ${line}\n`;
131
+ }
132
+ }
133
+ return result;
134
+ });
135
+ return yamlContent;
136
+ }
137
+ /**
138
+ * Convert variables to compact Salesforce Agent Script spec format
139
+ * From: var_name:
140
+ * type: "string"
141
+ * mutable: True
142
+ * description: "..."
143
+ * To: var_name: mutable string
144
+ * description: "..."
145
+ */
146
+ function convertVariablesToCompactFormat(yamlContent) {
147
+ const variablePattern = /^(\s+)(\w+):\s*\n\1 type:\s*"(\w+)"\s*\n\1 mutable:\s*(True|False)\s*\n((?:\1 \w+:.*\n)*)/gm;
148
+ yamlContent = yamlContent.replace(variablePattern, (match, indent, varName, varType, mutableValue, remainingProps) => {
149
+ // Build compact format
150
+ const mutable = mutableValue === "True" ? "mutable" : "";
151
+ let result = `${indent}${varName}: ${mutable} ${varType}`.trim();
152
+ // Check if there's a default value in remaining props
153
+ let description = "";
154
+ let defaultValue = "";
155
+ if (remainingProps) {
156
+ const defaultMatch = remainingProps.match(/description:\s*"([^"]*)"/);
157
+ if (defaultMatch) {
158
+ description = defaultMatch[1];
159
+ }
160
+ const defaultValMatch = remainingProps.match(/default:\s*"([^"]*)"/);
161
+ if (defaultValMatch) {
162
+ defaultValue = defaultValMatch[1];
163
+ }
164
+ }
165
+ result = `${indent}${varName}: ${mutable} ${varType}`;
166
+ if (defaultValue) {
167
+ result += ` = "${defaultValue}"`;
168
+ }
169
+ result += "\n";
170
+ // Add description on next line if exists
171
+ if (description) {
172
+ result += `${indent} description: "${description}"\n`;
173
+ }
174
+ return result;
175
+ });
176
+ return yamlContent;
177
+ }
178
+ /**
179
+ * Convert transition actions to the compact YAML format used in Salesforce Agent Script spec
180
+ */
181
+ function convertTransitionActionsToCompactFormat(yamlContent) {
182
+ const actionPattern = /^(\s+)(\w+):\s*\n\1 action:\s*"(@utils\.transition[^"]+)"\s*\n((?:\1 \w+:.*\n)*)/gm;
183
+ yamlContent = yamlContent.replace(actionPattern, (match, indent, actionName, transitionValue, remainingProps) => {
184
+ // Start with the compact format: action_name: @utils.transition...
185
+ let result = `${indent}${actionName}: ${transitionValue}\n`;
186
+ // Process remaining properties (description, available_when, etc.)
187
+ if (remainingProps) {
188
+ // Split into individual property lines and adjust indentation
189
+ const propLines = remainingProps.trim().split("\n");
190
+ propLines.forEach((line) => {
191
+ // Remove the extra 4 spaces of indentation from "action:" level
192
+ const trimmedLine = line.replace(/^\s{4}/, "");
193
+ if (trimmedLine) {
194
+ result += `${indent} ${trimmedLine}\n`;
195
+ }
196
+ });
197
+ }
198
+ return result;
199
+ });
200
+ return yamlContent;
201
+ }
202
+ /**
203
+ * Convert reasoning actions (action references) to compact YAML format
204
+ */
205
+ function convertReasoningActionsToCompactFormat(yamlContent) {
206
+ const reasoningActionPattern = /^(\s+)(\w+):\s*\n\1 action:\s*"(@actions\.[^"]+)"\s*\n((?:\1 \w+:.*\n)*)/gm;
207
+ yamlContent = yamlContent.replace(reasoningActionPattern, (match, indent, actionName, actionRef, remainingProps) => {
208
+ // Start with the compact format: action_name: @actions.ActionName
209
+ let result = `${indent}${actionName}: ${actionRef}\n`;
210
+ // Process remaining properties (description, with, set, etc.)
211
+ if (remainingProps) {
212
+ // Split into individual property lines and adjust indentation
213
+ const propLines = remainingProps.trim().split("\n");
214
+ propLines.forEach((line) => {
215
+ // Remove the extra 4 spaces of indentation from "action:" level
216
+ const trimmedLine = line.replace(/^\s{4}/, "");
217
+ if (trimmedLine) {
218
+ result += `${indent} ${trimmedLine}\n`;
219
+ }
220
+ });
221
+ }
222
+ return result;
223
+ });
224
+ return yamlContent;
225
+ }
226
+ //# sourceMappingURL=yamlFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yamlFormatter.js","sourceRoot":"","sources":["../../src/formatters/yamlFormatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAA;AAM1B;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC3B,WAAiC,EACjC,OAA+C,EAC/C,WAAoB,EACpB,oBAA6B;IAE7B,IAAI,WAAW,GAAG,EAAE,CAAA;IAEpB,sBAAsB;IACtB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC5B,WAAW,IAAI,kBAAkB,CAAA;QACjC,WAAW,IAAI,mCAAmC,WAAW,IAAI,oBAAoB,IAAI,SAAS,IAAI,CAAA;QACt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cAAc,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACnD,SAAS,CAAC,OAAO,CAAC,CAAC,IAAY,EAAE,EAAE;gBACjC,gEAAgE;gBAChE,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;gBAC9C,IAAI,WAAW,EAAE,CAAC;oBAChB,MAAM,IAAI,GAAG,MAAM,OAAO,WAAW,IAAI,CAAA;gBAC3C,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CACF,CAAA;IAED,OAAO,WAAW,CAAA;AACpB,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Agent Script Generator
3
+ * Generates Salesforce Agent Script YAML from PlannerDefinition
4
+ * Based on official Salesforce Agent Script Recipes
5
+ * @see https://developer.salesforce.com/sample-apps/agent-script-recipes/getting-started/overview
6
+ */
7
+ import type { PlannerDefinition, AgentScriptGenerationOptions } from "./types";
8
+ /**
9
+ * AgentScriptGenerator
10
+ * Generates complete Agent Script YAML following Salesforce patterns
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const generator = new AgentScriptGenerator(planner, {
15
+ * includeComments: true,
16
+ * yamlIndent: 4
17
+ * })
18
+ * const yaml = generator.generate()
19
+ * ```
20
+ */
21
+ export declare class AgentScriptGenerator {
22
+ private planner;
23
+ private options;
24
+ /**
25
+ * Creates a new AgentScriptGenerator instance
26
+ * @param planner - The planner definition to generate YAML from
27
+ * @param options - Optional generation options
28
+ * @throws {ValidationError} If the planner definition is invalid
29
+ */
30
+ constructor(planner: PlannerDefinition, options?: AgentScriptGenerationOptions);
31
+ /**
32
+ * Generate complete Agent Script YAML
33
+ * @returns Generated YAML string
34
+ * @throws {Error} If generation fails
35
+ */
36
+ generate(): string;
37
+ /**
38
+ * Build the complete agent script structure
39
+ * @returns Complete AgentScriptStructure
40
+ */
41
+ private buildAgentScript;
42
+ }
43
+ /**
44
+ * Convenience function to generate Agent Script YAML
45
+ *
46
+ * @param planner - The planner definition to generate YAML from
47
+ * @param options - Optional generation options
48
+ * @returns Generated YAML string
49
+ * @throws {ValidationError} If the planner definition is invalid
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * const yaml = generateAgentScript(planner, {
54
+ * includeComments: true,
55
+ * includeLanguageConfig: true
56
+ * })
57
+ * ```
58
+ */
59
+ export declare function generateAgentScript(planner: PlannerDefinition, options?: AgentScriptGenerationOptions): string;
60
+ //# sourceMappingURL=generator.d.ts.map