@deepagents/text2sql 0.20.0 → 0.22.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.
@@ -1 +1 @@
1
- {"version":3,"file":"result-tools.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/result-tools.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,WAAW,EAOjB,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AA+kBD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,uDAAuD;IACvD,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,6BAA6B;IAC7B,UAAU,EAAE,WAAW,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB;;kCA4C/B,MAAM;;;;;;;;;;;;;;;;;;;;;GAoDzC"}
1
+ {"version":3,"file":"result-tools.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/result-tools.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,WAAW,EAOjB,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAikCD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,uDAAuD;IACvD,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,6BAA6B;IAC7B,UAAU,EAAE,WAAW,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB;;kCA4C/B,MAAM;;;;;;;;;;;;;;;;;;;;;GAoDzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sql.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/sql.agent.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAEL,KAAK,eAAe,EAOrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGtD,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,8BAA8B;IAC9B,KAAK,EAAE,UAAU,CAAC;IAClB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA4GD,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAoJvE"}
1
+ {"version":3,"file":"sql.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/sql.agent.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAEL,KAAK,eAAe,EAWrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGtD,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,8BAA8B;IAC9B,KAAK,EAAE,UAAU,CAAC;IAClB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA+ND,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAmJvE"}
@@ -871,13 +871,17 @@ import "@deepagents/agent";
871
871
  import {
872
872
  ContextEngine as ContextEngine5,
873
873
  InMemoryContextStore as InMemoryContextStore5,
874
+ example,
874
875
  fragment as fragment5,
876
+ guardrail as guardrail2,
877
+ hint,
875
878
  persona as persona5,
876
879
  policy,
877
880
  structuredOutput as structuredOutput5,
878
- user as user5
881
+ user as user5,
882
+ workflow
879
883
  } from "@deepagents/context";
880
- var RETRY_TEMPERATURES = [0, 0.2, 0.3];
884
+ var RETRY_TEMPERATURES = [0, 0.4, 0.8];
881
885
  var SQL_AGENT_ROLE = "Expert SQL query generator.";
882
886
  var SQL_AGENT_OBJECTIVE = "Generate precise SQL grounded in provided schema.";
883
887
  var SQL_AGENT_POLICIES = [
@@ -885,94 +889,201 @@ var SQL_AGENT_POLICIES = [
885
889
  "schema_mapping",
886
890
  policy({
887
891
  rule: "Translate natural language into precise SQL grounded in available schema entities."
892
+ }),
893
+ hint("Preserve schema spelling exactly, including typos in column names.")
894
+ ),
895
+ fragment5(
896
+ "projection_minimality",
897
+ policy({
898
+ rule: "Return only columns requested by the question; do not add helper columns unless explicitly requested."
899
+ }),
900
+ policy({
901
+ rule: 'For requests of the form "X sorted/ordered by Y", project X only unless Y is explicitly requested as an output field.'
902
+ }),
903
+ policy({
904
+ rule: "Prefer selecting schema columns directly without derived expressions when direct selection answers the request."
905
+ }),
906
+ hint(
907
+ "Do not include ORDER BY, GROUP BY, or JOIN helper columns in SELECT output unless the question explicitly asks for them."
908
+ ),
909
+ policy({
910
+ rule: "Use DISTINCT only when uniqueness is explicitly requested (for example distinct/unique/different/no duplicates)."
911
+ }),
912
+ hint(
913
+ 'Do not infer DISTINCT from generic wording such as "some", plural nouns, or entity-set phrasing; for transactional/attendance-style tables, default to raw rows unless uniqueness is explicitly requested.'
914
+ )
915
+ ),
916
+ fragment5(
917
+ "date_transform_safety",
918
+ policy({
919
+ rule: "Do not assume VARCHAR/TEXT values are parseable dates. Avoid date extraction functions on text columns by default."
920
+ }),
921
+ policy({
922
+ rule: "Use date-part extraction only when both conditions hold: the question explicitly asks for transformation and schema values require transformation to produce that unit."
923
+ }),
924
+ hint(
925
+ "Do not apply SUBSTR, STRFTIME, DATE_PART, YEAR, or similar extraction functions unless the question explicitly asks for transformation and schema values require it."
926
+ ),
927
+ hint(
928
+ "If a column already represents the requested concept (for example a stored year-like value), use the column as-is."
929
+ )
930
+ ),
931
+ fragment5(
932
+ "sql_minimality",
933
+ guardrail2({
934
+ rule: "Never hallucinate tables or columns.",
935
+ reason: "Schema fidelity is required.",
936
+ action: "Use only available schema entities."
937
+ }),
938
+ guardrail2({
939
+ rule: "Avoid unnecessary transformations and derived projections.",
940
+ reason: "Extra transformations frequently change semantics and reduce correctness.",
941
+ action: "Do not add date parsing, substring extraction, or derived columns unless explicitly required by the question or schema."
942
+ })
943
+ ),
944
+ fragment5(
945
+ "preflight_checklist",
946
+ workflow({
947
+ task: "Final SQL preflight before returning output",
948
+ steps: [
949
+ "Verify selected columns match the question and remove unrequested helper projections.",
950
+ "If aggregate values are used only for ranking/filtering, keep them out of SELECT unless explicitly requested.",
951
+ "Prefer raw schema columns over derived expressions when raw columns already satisfy the request.",
952
+ "If a candidate query uses STRFTIME, SUBSTR, DATE_PART, YEAR, or similar extraction on text-like columns, remove that transformation unless explicitly required by the question.",
953
+ "Return only schema-grounded SQL using existing tables and columns."
954
+ ]
955
+ })
956
+ ),
957
+ fragment5(
958
+ "set_semantics",
959
+ policy({
960
+ rule: "For questions asking where both condition A and condition B hold over an attribute, compute the intersection of qualifying sets for that attribute."
961
+ }),
962
+ policy({
963
+ rule: "Do not force the same entity instance to satisfy both conditions unless the question explicitly requests the same person/row/entity."
964
+ }),
965
+ hint(
966
+ "Prefer INTERSECT (or logically equivalent set-based shape) over requiring the same physical row/entity to satisfy both conditions unless explicitly requested."
967
+ ),
968
+ hint(
969
+ "When two conditions describe different row groups whose shared attribute is requested, build each group separately and intersect the attribute values."
970
+ ),
971
+ hint(
972
+ "Do not collapse cross-group conditions into a single-row AND predicate when the intent is shared values across groups."
973
+ ),
974
+ policy({
975
+ rule: "If two predicates on the same field cannot both be true for one row, do not combine them with AND; use set operations across separate filtered subsets when shared values are requested."
976
+ })
977
+ ),
978
+ fragment5(
979
+ "predicate_column_alignment",
980
+ policy({
981
+ rule: "Match literal values to semantically compatible columns. Do not compare descriptive names to identifier columns."
982
+ }),
983
+ hint(
984
+ "When a filter value is a descriptive label (for example a department name), join through the lookup table and filter on its name/title column, not on *_id columns."
985
+ ),
986
+ hint(
987
+ "When relation roles are explicit in wording (for example host/home/source/destination), prefer foreign keys with matching role qualifiers over generic similarly named columns."
988
+ ),
989
+ policy({
990
+ rule: "When multiple foreign-key candidates exist, select the column whose qualifier best matches the relationship described in the question."
991
+ }),
992
+ policy({
993
+ rule: "For hosting/held semantics, prefer host_* relationship columns when available over generic *_id alternatives."
994
+ }),
995
+ hint(
996
+ 'Interpret wording like "held/hosted a competition or event" as a hosting relationship and map to host_* foreign keys when present.'
997
+ ),
998
+ policy({
999
+ rule: "Do not compare descriptive labels or names to *_id columns; join to the table containing the descriptive field and filter there."
1000
+ }),
1001
+ policy({
1002
+ rule: "Keep numeric identifiers unquoted when used as numeric equality filters unless schema indicates text identifiers."
1003
+ }),
1004
+ policy({
1005
+ rule: "When filtering by a descriptive label value and a related table exposes a corresponding *_name or title column, join to that table and filter on the descriptive column."
1006
+ })
1007
+ ),
1008
+ fragment5(
1009
+ "ordering_semantics",
1010
+ policy({
1011
+ rule: "Respect explicit sort direction terms. If direction is not specified, use ascending order unless a superlative intent (most/least/highest/lowest) implies direction."
1012
+ }),
1013
+ policy({
1014
+ rule: "When ranking categories by frequency, use COUNT for ordering but keep output focused on requested category fields unless counts are explicitly requested."
1015
+ }),
1016
+ policy({
1017
+ rule: "Do not use DESC unless descending direction is explicit or a superlative intent requires descending ranking."
1018
+ }),
1019
+ policy({
1020
+ rule: 'For "most common/frequent <attribute>" requests, return the attribute value(s) only; use counts only for ordering/filtering unless the question explicitly asks to return counts.'
1021
+ }),
1022
+ hint(
1023
+ 'Use DESC with LIMIT 1 for "most/highest/largest"; use ASC with LIMIT 1 for "least/lowest/smallest".'
1024
+ )
1025
+ ),
1026
+ fragment5(
1027
+ "negative_membership_queries",
1028
+ policy({
1029
+ rule: "For requests asking entities that did not participate/host/appear in related records, prefer NOT IN or NOT EXISTS against the related foreign-key set."
1030
+ }),
1031
+ hint(
1032
+ "Map role-bearing relationship columns carefully (for example host_* foreign keys for hosting relationships) instead of generic IDs when role wording is explicit."
1033
+ ),
1034
+ hint(
1035
+ 'For "never had/never exceeded" conditions over history tables, exclude entities via NOT IN/NOT EXISTS against the disqualifying entity-id set (often built with GROUP BY/HAVING MAX(...)).'
1036
+ )
1037
+ ),
1038
+ fragment5(
1039
+ "join_completeness",
1040
+ policy({
1041
+ rule: "Preserve entity-restricting joins implied by the question. Do not widen results by querying only a broader attribute table when a subset entity table is available."
1042
+ }),
1043
+ policy({
1044
+ rule: "If an entity term in the question maps to a table, keep that table in query scope and join to attribute tables rather than dropping the entity table."
1045
+ }),
1046
+ hint(
1047
+ "If the question targets a specific entity group, include that entity table and its join conditions even when selected columns come from a related table."
1048
+ ),
1049
+ hint(
1050
+ "When the question names an entity type and a relation table links to that entity via *_id, include the entity table in scope instead of counting only relation rows."
1051
+ ),
1052
+ hint(
1053
+ "Prefer INNER JOIN by default; use LEFT JOIN only when the question explicitly requests including unmatched rows or zero-related entities."
1054
+ )
1055
+ ),
1056
+ fragment5(
1057
+ "aggregation_exactness",
1058
+ policy({
1059
+ rule: "Preserve requested aggregation semantics exactly: use COUNT(*) by default for total rows, use COUNT(DISTINCT ...) only when uniqueness is explicitly requested, and group by stable entity keys when computing per-entity aggregates."
1060
+ }),
1061
+ policy({
1062
+ rule: "For questions asking which entity has lowest/highest average of a metric, compute AVG(metric) per entity (GROUP BY entity) and rank those aggregates."
1063
+ }),
1064
+ hint(
1065
+ 'For "how many <entities>" questions over relation records, default to COUNT(*) on qualifying rows unless explicit uniqueness language is present.'
1066
+ )
1067
+ ),
1068
+ fragment5(
1069
+ "query_shape_examples",
1070
+ example({
1071
+ question: "List categories ordered by how many records belong to each category.",
1072
+ answer: "SELECT category FROM records GROUP BY category ORDER BY COUNT(*)"
1073
+ }),
1074
+ example({
1075
+ question: "Show labels shared by rows with metric > 100 and rows with metric < 10.",
1076
+ answer: "SELECT label FROM records WHERE metric > 100 INTERSECT SELECT label FROM records WHERE metric < 10"
1077
+ }),
1078
+ example({
1079
+ question: "List locations that have not hosted any event.",
1080
+ answer: "SELECT location_name FROM locations WHERE location_id NOT IN (SELECT host_location_id FROM events)"
1081
+ }),
1082
+ example({
1083
+ question: "List the most common category across records.",
1084
+ answer: "SELECT category FROM records GROUP BY category ORDER BY COUNT(*) DESC LIMIT 1"
888
1085
  })
889
- // policy({
890
- // rule: 'Before returning an error, perform a schema-grounded self-check: identify core intent, draft best-effort SQL, then verify it uses only existing tables/columns.',
891
- // }),
892
- // policy({
893
- // rule: 'Return unanswerable only if that self-check confirms no valid SQL can express the required intent without inventing schema elements.',
894
- // }),
895
- // policy({
896
- // rule: 'Prefer a best-effort valid SQL query when entities can be reasonably inferred from table or column names.',
897
- // }),
898
- // policy({
899
- // rule: 'Use lexical normalization (singular/plural, paraphrases, role synonyms, and minor wording differences) to align question terms with schema names.',
900
- // }),
901
- // policy({
902
- // rule: 'Decompose noun phrases into core entity and qualifiers, and map the core entity first.',
903
- // }),
904
- // policy({
905
- // rule: 'Do not require every descriptive word to map to a separate schema field when the core entity match is unambiguous.',
906
- // }),
907
- // policy({
908
- // rule: 'For phrases like "X of Y", treat Y as contextual (non-blocking) when Y has no mapped schema field and the question does not ask to filter/group/select by Y explicitly.',
909
- // }),
910
- // policy({
911
- // rule: 'Treat unmatched qualifiers as blockers only when they are restrictive constraints (specific values, comparisons, or conditions that change row eligibility).',
912
- // }),
913
- // hint('Preserve schema spelling exactly, including typos in column names.'),
914
1086
  )
915
- // fragment(
916
- // 'unanswerable_gate',
917
- // workflow({
918
- // task: 'Unanswerable decision',
919
- // steps: [
920
- // 'Identify the core intent (metric/projection and required filters).',
921
- // 'Attempt schema-grounded mapping for the core intent before considering error.',
922
- // 'If a valid SELECT can answer the core intent without inventing schema entities, return SQL.',
923
- // 'Return unanswerable only when required information cannot be mapped to any available table or column.',
924
- // ],
925
- // }),
926
- // policy({
927
- // rule: 'Do not reject a question as unanswerable when requested information can be derived by filtering, joining, grouping, counting, set operations, or sorting on available columns.',
928
- // }),
929
- // ),
930
- // fragment(
931
- // 'query_shape_preferences',
932
- // hint(
933
- // 'Prefer explicit INNER JOINs over LEFT JOINs unless the question requires unmatched rows.',
934
- // ),
935
- // hint(
936
- // 'Prefer direct joins over dropping join constraints or using weaker alternatives.',
937
- // ),
938
- // hint('Use DISTINCT only when uniqueness is explicitly requested.'),
939
- // hint(
940
- // 'For superlatives over grouped entities (most/least/highest/lowest by group), prefer GROUP BY with ORDER BY aggregate and LIMIT 1.',
941
- // ),
942
- // hint(
943
- // 'For average/count conditions per entity, prefer GROUP BY with HAVING aggregate predicates over row-level WHERE predicates.',
944
- // ),
945
- // hint(
946
- // 'For "both" conditions across two criteria, prefer INTERSECT when selecting shared values.',
947
- // ),
948
- // hint(
949
- // 'For "A or B" retrieval across criteria, prefer UNION when combining two qualifying sets.',
950
- // ),
951
- // hint(
952
- // 'For "never" constraints against related records, prefer NOT IN or EXCEPT against the disqualifying set.',
953
- // ),
954
- // hint(
955
- // 'Use equality predicates for exact values unless the question asks for pattern matching.',
956
- // ),
957
- // hint(
958
- // 'Keep numeric literals unquoted when they are purely numeric tokens in the question.',
959
- // ),
960
- // ),
961
- // fragment(
962
- // 'sql_minimality',
963
- // guardrail({
964
- // rule: 'Never hallucinate tables or columns.',
965
- // reason: 'Schema fidelity is required.',
966
- // action: 'Use only available schema entities.',
967
- // }),
968
- // guardrail({
969
- // rule: 'Prefer the minimal query over transformed expressions.',
970
- // reason:
971
- // 'Unnecessary transformations reduce correctness and add avoidable complexity.',
972
- // action:
973
- // 'Do not add date parsing, substring extraction, derived projections, or extra selected columns unless explicitly requested or required by schema mismatch.',
974
- // }),
975
- // ),
976
1087
  ];
977
1088
  function extractSql(output) {
978
1089
  const match = output.match(/```sql\n?([\s\S]*?)```/);
@@ -1257,7 +1368,7 @@ import {
1257
1368
  ContextEngine as ContextEngine6,
1258
1369
  InMemoryContextStore as InMemoryContextStore6,
1259
1370
  fragment as fragment6,
1260
- guardrail as guardrail2,
1371
+ guardrail as guardrail3,
1261
1372
  persona as personaFragment,
1262
1373
  structuredOutput as structuredOutput6,
1263
1374
  user as user6
@@ -1354,14 +1465,14 @@ async function paraphraseQuestion(params) {
1354
1465
  ${params.persona?.styles?.length ? "6. Apply the specified communication styles to create diverse phrasings" : ""}
1355
1466
  `
1356
1467
  ),
1357
- guardrail2({ rule: "NEVER change what data is being requested" }),
1358
- guardrail2({
1468
+ guardrail3({ rule: "NEVER change what data is being requested" }),
1469
+ guardrail3({
1359
1470
  rule: "NEVER add filters, aggregations, or conditions not in the original"
1360
1471
  }),
1361
- guardrail2({
1472
+ guardrail3({
1362
1473
  rule: "NEVER remove any specificity from the original question"
1363
1474
  }),
1364
- guardrail2({
1475
+ guardrail3({
1365
1476
  rule: "All paraphrases must be answerable by the exact same SQL query"
1366
1477
  }),
1367
1478
  user6(
@@ -1428,7 +1539,7 @@ import {
1428
1539
  ContextEngine as ContextEngine7,
1429
1540
  InMemoryContextStore as InMemoryContextStore7,
1430
1541
  fragment as fragment7,
1431
- guardrail as guardrail3,
1542
+ guardrail as guardrail4,
1432
1543
  persona as persona6,
1433
1544
  structuredOutput as structuredOutput7,
1434
1545
  user as user7
@@ -1516,16 +1627,16 @@ async function evolveQuestion(params) {
1516
1627
  6. The evolved question should build upon the original topic/domain
1517
1628
  `
1518
1629
  ),
1519
- guardrail3({
1630
+ guardrail4({
1520
1631
  rule: "The evolved question MUST require more complex SQL than the original"
1521
1632
  }),
1522
- guardrail3({
1633
+ guardrail4({
1523
1634
  rule: "Do not ask for data that does not exist in the schema"
1524
1635
  }),
1525
- guardrail3({
1636
+ guardrail4({
1526
1637
  rule: "Keep the question grounded in the same domain as the original"
1527
1638
  }),
1528
- guardrail3({ rule: "Make sure the question is clear and unambiguous" }),
1639
+ guardrail4({ rule: "Make sure the question is clear and unambiguous" }),
1529
1640
  user7(
1530
1641
  `Evolve this question using "${params.technique}": "${params.question}"`
1531
1642
  )
@@ -1655,7 +1766,7 @@ import {
1655
1766
  InMemoryContextStore as InMemoryContextStore8,
1656
1767
  XmlRenderer,
1657
1768
  fragment as fragment8,
1658
- guardrail as guardrail4,
1769
+ guardrail as guardrail5,
1659
1770
  persona as personaFragment2,
1660
1771
  structuredOutput as structuredOutput8,
1661
1772
  user as user8
@@ -1739,13 +1850,13 @@ async function generatePersonas(schemaFragments, options) {
1739
1850
  }
1740
1851
  `
1741
1852
  ),
1742
- guardrail4({
1853
+ guardrail5({
1743
1854
  rule: "Only generate personas relevant to the actual schema provided"
1744
1855
  }),
1745
- guardrail4({
1856
+ guardrail5({
1746
1857
  rule: "Do not invent tables or data that do not exist in the schema"
1747
1858
  }),
1748
- guardrail4({
1859
+ guardrail5({
1749
1860
  rule: "Ensure perspectives are specific to the domain, not generic"
1750
1861
  }),
1751
1862
  user8(
@@ -1774,18 +1885,18 @@ import {
1774
1885
  InMemoryContextStore as InMemoryContextStore9,
1775
1886
  analogy,
1776
1887
  clarification,
1777
- example,
1888
+ example as example2,
1778
1889
  explain,
1779
1890
  fragment as fragment9,
1780
- guardrail as guardrail5,
1781
- hint,
1891
+ guardrail as guardrail6,
1892
+ hint as hint2,
1782
1893
  persona as persona7,
1783
1894
  quirk,
1784
1895
  structuredOutput as structuredOutput9,
1785
1896
  styleGuide,
1786
1897
  term,
1787
1898
  user as user9,
1788
- workflow
1899
+ workflow as workflow2
1789
1900
  } from "@deepagents/context";
1790
1901
  var outputSchema4 = z9.object({
1791
1902
  terms: z9.array(z9.object({ name: z9.string(), definition: z9.string() })).optional().describe("Domain terminology definitions"),
@@ -1892,10 +2003,10 @@ async function toTeachings(input, options) {
1892
2003
  const result = await teachablesOutput.generate();
1893
2004
  const fragments = [];
1894
2005
  result.terms?.forEach((t) => fragments.push(term(t.name, t.definition)));
1895
- result.hints?.forEach((h) => fragments.push(hint(h.text)));
2006
+ result.hints?.forEach((h) => fragments.push(hint2(h.text)));
1896
2007
  result.guardrails?.forEach(
1897
2008
  (g) => fragments.push(
1898
- guardrail5({ rule: g.rule, reason: g.reason, action: g.action })
2009
+ guardrail6({ rule: g.rule, reason: g.reason, action: g.action })
1899
2010
  )
1900
2011
  );
1901
2012
  result.explains?.forEach(
@@ -1909,7 +2020,7 @@ async function toTeachings(input, options) {
1909
2020
  );
1910
2021
  result.examples?.forEach(
1911
2022
  (e) => fragments.push(
1912
- example({ question: e.question, answer: e.answer, note: e.note })
2023
+ example2({ question: e.question, answer: e.answer, note: e.note })
1913
2024
  )
1914
2025
  );
1915
2026
  result.clarifications?.forEach(
@@ -1919,7 +2030,7 @@ async function toTeachings(input, options) {
1919
2030
  );
1920
2031
  result.workflows?.forEach(
1921
2032
  (w) => fragments.push(
1922
- workflow({
2033
+ workflow2({
1923
2034
  task: w.task,
1924
2035
  steps: w.steps,
1925
2036
  triggers: w.triggers,