@takeshape/schema 11.80.0 → 11.82.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,3 +1,4 @@
1
+ import { embeddingSearchArgsSchema } from "./resolvers/ai/embedding-search.js";
1
2
  export function isAsset(content) {
2
3
  return content._contentTypeId === 'ASSET' || content._shapeId === 'ASSET';
3
4
  }
@@ -423,6 +424,12 @@ export const builtInShapes = {
423
424
  currentValue: { type: 'object' }
424
425
  }
425
426
  }
427
+ },
428
+ TSEmbeddingSearchArgs: {
429
+ id: 'TSEmbeddingSearchArgs',
430
+ name: 'TSEmbeddingSearchArgs',
431
+ title: 'Embedding Search Args',
432
+ schema: embeddingSearchArgsSchema
426
433
  }
427
434
  };
428
435
  export const builtInForms = {
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export * from './service-dependencies.ts';
26
26
  export * from './services/services.ts';
27
27
  export * from './services/types.ts';
28
28
  export * from './services/util.ts';
29
+ export * from './shape-paths.ts';
29
30
  export * from './taxonomies.ts';
30
31
  export * from './template-shapes/index.ts';
31
32
  export * from './types/transforms.ts';
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ export * from "./service-dependencies.js";
24
24
  export * from "./services/services.js";
25
25
  export * from "./services/types.js";
26
26
  export * from "./services/util.js";
27
+ export * from "./shape-paths.js";
27
28
  export * from "./taxonomies.js";
28
29
  export * from "./template-shapes/index.js";
29
30
  export * from "./types/transforms.js";
@@ -77,7 +77,7 @@ export declare function refItemToShape(shapes: ShapeMapV4_0_0, refItem: RefItem)
77
77
  /**
78
78
  * Helper fn to omit `ref` props from the target schema, and then extend it with the source schema.
79
79
  */
80
- export declare const omitRefAndExtend: (targetSchema: PropertySchemaV4_0_0, sourceSchema: PropertySchemaV4_0_0) => import("lodash").Omit<PropertySchemaV4_0_0, "@ref" | "$ref"> & PropertySchemaV4_0_0;
80
+ export declare const omitRefAndExtend: (targetSchema: PropertySchemaV4_0_0, sourceSchema: PropertySchemaV4_0_0) => import("lodash").Omit<PropertySchemaV4_0_0, "$ref" | "@ref"> & PropertySchemaV4_0_0;
81
81
  /**
82
82
  * If there is a $ref, this will insert a content schema from the top level
83
83
  * in place of the reference.
@@ -290,7 +290,6 @@ export type ShapeSchema = ShapeSchemaAllOf | ShapeSchemaExtends | ShapeSchemaOne
290
290
  export type AgentAPI = AgentAPIChat | AgentAPIGenerate;
291
291
  export type InteractionTimeoutMilliseconds = number;
292
292
  export type InteractionTimeoutMilliseconds1 = number;
293
- export type MemoryLocations = AgentSessionMemoryLocation[];
294
293
  export type Variables = AgentVariable[];
295
294
  export type AgentExecution = AgentExecutionGraphQL | AgentExecutionGenerate | AgentExecutionChat;
296
295
  export type AgentAIStateInput = AgentAIStateInputArgument | AgentAIStateInputTemplate;
@@ -1732,6 +1731,7 @@ export interface ShapeSchemaAny {
1732
1731
  export interface AIExperimental {
1733
1732
  agents?: AgentMap;
1734
1733
  guards?: GuardMap;
1734
+ tools?: ToolMap;
1735
1735
  }
1736
1736
  export interface AgentMap {
1737
1737
  [k: string]: AgentJSON;
@@ -1771,11 +1771,7 @@ export interface AgentMemory {
1771
1771
  sessionMemory: AgentSessionMemory;
1772
1772
  }
1773
1773
  export interface AgentSessionMemory {
1774
- memoryLocations: MemoryLocations;
1775
- }
1776
- export interface AgentSessionMemoryLocation {
1777
- key: string;
1778
- shape: string;
1774
+ shape?: string;
1779
1775
  }
1780
1776
  /**
1781
1777
  * Configuration for the start of an agent's execution
@@ -1844,6 +1840,10 @@ export interface AgentAIStateInputTemplate {
1844
1840
  type: 'template';
1845
1841
  inputTemplate: string;
1846
1842
  }
1843
+ /**
1844
+ * This interface was referenced by `ToolMap`'s JSON-Schema definition
1845
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1846
+ */
1847
1847
  export interface AgentToolConfig {
1848
1848
  ref: string;
1849
1849
  description?: string;
@@ -1915,17 +1915,17 @@ export interface AgentChatHistoryClear {
1915
1915
  }
1916
1916
  export interface AgentStateSessionMemoryLocationContent {
1917
1917
  type: 'content';
1918
- memoryKey: string;
1918
+ memoryPath?: string;
1919
1919
  path?: string;
1920
1920
  }
1921
1921
  export interface AgentStateSessionMemoryLocationArtifact {
1922
1922
  type: 'artifactValue';
1923
- memoryKey: string;
1923
+ memoryPath?: string;
1924
1924
  artifactPath?: string;
1925
1925
  }
1926
1926
  export interface AgentStateSessionMemoryLocationStaticValue {
1927
1927
  type: 'staticValue';
1928
- memoryKey: string;
1928
+ memoryPath?: string;
1929
1929
  value?: string;
1930
1930
  }
1931
1931
  export interface AgentGuard {
@@ -1985,6 +1985,9 @@ export interface SensitiveInformationPolicy {
1985
1985
  export interface ContextualGroundingPolicy {
1986
1986
  filtersConfig: Filter1;
1987
1987
  }
1988
+ export interface ToolMap {
1989
+ [k: string]: AgentToolConfig;
1990
+ }
1988
1991
  /**
1989
1992
  * This interface was referenced by `ProjectSchemaJSON`'s JSON-Schema
1990
1993
  * via the `definition` "formMap".
@@ -265,7 +265,6 @@ export type ShapeSchemaV3_48_0 = ShapeSchemaAllOfV3_48_0 | ShapeSchemaExtendsV3_
265
265
  export type AgentAPIV3_48_0 = AgentAPIChatV3_48_0 | AgentAPIGenerateV3_48_0;
266
266
  export type InteractionTimeoutMillisecondsV3_48_0 = number;
267
267
  export type InteractionTimeoutMillisecondsV3_48_01 = number;
268
- export type MemoryLocationsV3_48_0 = AgentSessionMemoryLocationV3_48_0[];
269
268
  export type VariablesV3_48_0 = AgentVariableV3_48_0[];
270
269
  export type AgentExecutionV3_48_0 = AgentExecutionGraphQLV3_48_0 | AgentExecutionGenerateV3_48_0 | AgentExecutionChatV3_48_0;
271
270
  export type AgentAIStateInputV3_48_0 = AgentAIStateInputArgumentV3_48_0 | AgentAIStateInputTemplateV3_48_0;
@@ -1580,6 +1579,7 @@ export interface ShapeSchemaAnyV3_48_0 {
1580
1579
  export interface AIExperimentalV3_48_0 {
1581
1580
  agents?: AgentMapV3_48_0;
1582
1581
  guards?: GuardMapV3_48_0;
1582
+ tools?: ToolMapV3_48_0;
1583
1583
  }
1584
1584
  export interface AgentMapV3_48_0 {
1585
1585
  [k: string]: AgentJSONV3_48_0;
@@ -1619,11 +1619,7 @@ export interface AgentMemoryV3_48_0 {
1619
1619
  sessionMemory: AgentSessionMemoryV3_48_0;
1620
1620
  }
1621
1621
  export interface AgentSessionMemoryV3_48_0 {
1622
- memoryLocations: MemoryLocationsV3_48_0;
1623
- }
1624
- export interface AgentSessionMemoryLocationV3_48_0 {
1625
- key: string;
1626
- shape: string;
1622
+ shape?: string;
1627
1623
  }
1628
1624
  /**
1629
1625
  * Configuration for the start of an agent's execution
@@ -1692,6 +1688,10 @@ export interface AgentAIStateInputTemplateV3_48_0 {
1692
1688
  type: 'template';
1693
1689
  inputTemplate: string;
1694
1690
  }
1691
+ /**
1692
+ * This interface was referenced by `ToolMapV3_48_0`'s JSON-Schema definition
1693
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1694
+ */
1695
1695
  export interface AgentToolConfigV3_48_0 {
1696
1696
  ref: string;
1697
1697
  description?: string;
@@ -1763,17 +1763,17 @@ export interface AgentChatHistoryClearV3_48_0 {
1763
1763
  }
1764
1764
  export interface AgentStateSessionMemoryLocationContentV3_48_0 {
1765
1765
  type: 'content';
1766
- memoryKey: string;
1766
+ memoryPath?: string;
1767
1767
  path?: string;
1768
1768
  }
1769
1769
  export interface AgentStateSessionMemoryLocationArtifactV3_48_0 {
1770
1770
  type: 'artifactValue';
1771
- memoryKey: string;
1771
+ memoryPath?: string;
1772
1772
  artifactPath?: string;
1773
1773
  }
1774
1774
  export interface AgentStateSessionMemoryLocationStaticValueV3_48_0 {
1775
1775
  type: 'staticValue';
1776
- memoryKey: string;
1776
+ memoryPath?: string;
1777
1777
  value?: string;
1778
1778
  }
1779
1779
  export interface AgentGuardV3_48_0 {
@@ -1833,6 +1833,9 @@ export interface SensitiveInformationPolicyV3_48_0 {
1833
1833
  export interface ContextualGroundingPolicyV3_48_0 {
1834
1834
  filtersConfig: FilterV3_48_01;
1835
1835
  }
1836
+ export interface ToolMapV3_48_0 {
1837
+ [k: string]: AgentToolConfigV3_48_0;
1838
+ }
1836
1839
  /**
1837
1840
  * This interface was referenced by `ProjectSchemaJSONV3_48_0`'s JSON-Schema
1838
1841
  * via the `definition` "formMap".
@@ -265,7 +265,6 @@ export type ShapeSchemaV3_49_0 = ShapeSchemaAllOfV3_49_0 | ShapeSchemaExtendsV3_
265
265
  export type AgentAPIV3_49_0 = AgentAPIChatV3_49_0 | AgentAPIGenerateV3_49_0;
266
266
  export type InteractionTimeoutMillisecondsV3_49_0 = number;
267
267
  export type InteractionTimeoutMillisecondsV3_49_01 = number;
268
- export type MemoryLocationsV3_49_0 = AgentSessionMemoryLocationV3_49_0[];
269
268
  export type VariablesV3_49_0 = AgentVariableV3_49_0[];
270
269
  export type AgentExecutionV3_49_0 = AgentExecutionGraphQLV3_49_0 | AgentExecutionGenerateV3_49_0 | AgentExecutionChatV3_49_0;
271
270
  export type AgentAIStateInputV3_49_0 = AgentAIStateInputArgumentV3_49_0 | AgentAIStateInputTemplateV3_49_0;
@@ -1580,6 +1579,7 @@ export interface ShapeSchemaAnyV3_49_0 {
1580
1579
  export interface AIExperimentalV3_49_0 {
1581
1580
  agents?: AgentMapV3_49_0;
1582
1581
  guards?: GuardMapV3_49_0;
1582
+ tools?: ToolMapV3_49_0;
1583
1583
  }
1584
1584
  export interface AgentMapV3_49_0 {
1585
1585
  [k: string]: AgentJSONV3_49_0;
@@ -1619,11 +1619,7 @@ export interface AgentMemoryV3_49_0 {
1619
1619
  sessionMemory: AgentSessionMemoryV3_49_0;
1620
1620
  }
1621
1621
  export interface AgentSessionMemoryV3_49_0 {
1622
- memoryLocations: MemoryLocationsV3_49_0;
1623
- }
1624
- export interface AgentSessionMemoryLocationV3_49_0 {
1625
- key: string;
1626
- shape: string;
1622
+ shape?: string;
1627
1623
  }
1628
1624
  /**
1629
1625
  * Configuration for the start of an agent's execution
@@ -1692,6 +1688,10 @@ export interface AgentAIStateInputTemplateV3_49_0 {
1692
1688
  type: 'template';
1693
1689
  inputTemplate: string;
1694
1690
  }
1691
+ /**
1692
+ * This interface was referenced by `ToolMapV3_49_0`'s JSON-Schema definition
1693
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1694
+ */
1695
1695
  export interface AgentToolConfigV3_49_0 {
1696
1696
  ref: string;
1697
1697
  description?: string;
@@ -1763,17 +1763,17 @@ export interface AgentChatHistoryClearV3_49_0 {
1763
1763
  }
1764
1764
  export interface AgentStateSessionMemoryLocationContentV3_49_0 {
1765
1765
  type: 'content';
1766
- memoryKey: string;
1766
+ memoryPath?: string;
1767
1767
  path?: string;
1768
1768
  }
1769
1769
  export interface AgentStateSessionMemoryLocationArtifactV3_49_0 {
1770
1770
  type: 'artifactValue';
1771
- memoryKey: string;
1771
+ memoryPath?: string;
1772
1772
  artifactPath?: string;
1773
1773
  }
1774
1774
  export interface AgentStateSessionMemoryLocationStaticValueV3_49_0 {
1775
1775
  type: 'staticValue';
1776
- memoryKey: string;
1776
+ memoryPath?: string;
1777
1777
  value?: string;
1778
1778
  }
1779
1779
  export interface AgentGuardV3_49_0 {
@@ -1833,6 +1833,9 @@ export interface SensitiveInformationPolicyV3_49_0 {
1833
1833
  export interface ContextualGroundingPolicyV3_49_0 {
1834
1834
  filtersConfig: FilterV3_49_01;
1835
1835
  }
1836
+ export interface ToolMapV3_49_0 {
1837
+ [k: string]: AgentToolConfigV3_49_0;
1838
+ }
1836
1839
  /**
1837
1840
  * This interface was referenced by `ProjectSchemaJSONV3_49_0`'s JSON-Schema
1838
1841
  * via the `definition` "formMap".
@@ -277,7 +277,6 @@ export type ShapeSchemaV3_50_0 = ShapeSchemaAllOfV3_50_0 | ShapeSchemaExtendsV3_
277
277
  export type AgentAPIV3_50_0 = AgentAPIChatV3_50_0 | AgentAPIGenerateV3_50_0;
278
278
  export type InteractionTimeoutMillisecondsV3_50_0 = number;
279
279
  export type InteractionTimeoutMillisecondsV3_50_01 = number;
280
- export type MemoryLocationsV3_50_0 = AgentSessionMemoryLocationV3_50_0[];
281
280
  export type VariablesV3_50_0 = AgentVariableV3_50_0[];
282
281
  export type AgentExecutionV3_50_0 = AgentExecutionGraphQLV3_50_0 | AgentExecutionGenerateV3_50_0 | AgentExecutionChatV3_50_0;
283
282
  export type AgentAIStateInputV3_50_0 = AgentAIStateInputArgumentV3_50_0 | AgentAIStateInputTemplateV3_50_0;
@@ -1632,6 +1631,7 @@ export interface ShapeSchemaAnyV3_50_0 {
1632
1631
  export interface AIExperimentalV3_50_0 {
1633
1632
  agents?: AgentMapV3_50_0;
1634
1633
  guards?: GuardMapV3_50_0;
1634
+ tools?: ToolMapV3_50_0;
1635
1635
  }
1636
1636
  export interface AgentMapV3_50_0 {
1637
1637
  [k: string]: AgentJSONV3_50_0;
@@ -1671,11 +1671,7 @@ export interface AgentMemoryV3_50_0 {
1671
1671
  sessionMemory: AgentSessionMemoryV3_50_0;
1672
1672
  }
1673
1673
  export interface AgentSessionMemoryV3_50_0 {
1674
- memoryLocations: MemoryLocationsV3_50_0;
1675
- }
1676
- export interface AgentSessionMemoryLocationV3_50_0 {
1677
- key: string;
1678
- shape: string;
1674
+ shape?: string;
1679
1675
  }
1680
1676
  /**
1681
1677
  * Configuration for the start of an agent's execution
@@ -1744,6 +1740,10 @@ export interface AgentAIStateInputTemplateV3_50_0 {
1744
1740
  type: 'template';
1745
1741
  inputTemplate: string;
1746
1742
  }
1743
+ /**
1744
+ * This interface was referenced by `ToolMapV3_50_0`'s JSON-Schema definition
1745
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1746
+ */
1747
1747
  export interface AgentToolConfigV3_50_0 {
1748
1748
  ref: string;
1749
1749
  description?: string;
@@ -1815,17 +1815,17 @@ export interface AgentChatHistoryClearV3_50_0 {
1815
1815
  }
1816
1816
  export interface AgentStateSessionMemoryLocationContentV3_50_0 {
1817
1817
  type: 'content';
1818
- memoryKey: string;
1818
+ memoryPath?: string;
1819
1819
  path?: string;
1820
1820
  }
1821
1821
  export interface AgentStateSessionMemoryLocationArtifactV3_50_0 {
1822
1822
  type: 'artifactValue';
1823
- memoryKey: string;
1823
+ memoryPath?: string;
1824
1824
  artifactPath?: string;
1825
1825
  }
1826
1826
  export interface AgentStateSessionMemoryLocationStaticValueV3_50_0 {
1827
1827
  type: 'staticValue';
1828
- memoryKey: string;
1828
+ memoryPath?: string;
1829
1829
  value?: string;
1830
1830
  }
1831
1831
  export interface AgentGuardV3_50_0 {
@@ -1885,6 +1885,9 @@ export interface SensitiveInformationPolicyV3_50_0 {
1885
1885
  export interface ContextualGroundingPolicyV3_50_0 {
1886
1886
  filtersConfig: FilterV3_50_01;
1887
1887
  }
1888
+ export interface ToolMapV3_50_0 {
1889
+ [k: string]: AgentToolConfigV3_50_0;
1890
+ }
1888
1891
  /**
1889
1892
  * This interface was referenced by `ProjectSchemaJSONV3_50_0`'s JSON-Schema
1890
1893
  * via the `definition` "formMap".
@@ -277,7 +277,6 @@ export type ShapeSchemaV3_51_0 = ShapeSchemaAllOfV3_51_0 | ShapeSchemaExtendsV3_
277
277
  export type AgentAPIV3_51_0 = AgentAPIChatV3_51_0 | AgentAPIGenerateV3_51_0;
278
278
  export type InteractionTimeoutMillisecondsV3_51_0 = number;
279
279
  export type InteractionTimeoutMillisecondsV3_51_01 = number;
280
- export type MemoryLocationsV3_51_0 = AgentSessionMemoryLocationV3_51_0[];
281
280
  export type VariablesV3_51_0 = AgentVariableV3_51_0[];
282
281
  export type AgentExecutionV3_51_0 = AgentExecutionGraphQLV3_51_0 | AgentExecutionGenerateV3_51_0 | AgentExecutionChatV3_51_0;
283
282
  export type AgentAIStateInputV3_51_0 = AgentAIStateInputArgumentV3_51_0 | AgentAIStateInputTemplateV3_51_0;
@@ -1632,6 +1631,7 @@ export interface ShapeSchemaAnyV3_51_0 {
1632
1631
  export interface AIExperimentalV3_51_0 {
1633
1632
  agents?: AgentMapV3_51_0;
1634
1633
  guards?: GuardMapV3_51_0;
1634
+ tools?: ToolMapV3_51_0;
1635
1635
  }
1636
1636
  export interface AgentMapV3_51_0 {
1637
1637
  [k: string]: AgentJSONV3_51_0;
@@ -1671,11 +1671,7 @@ export interface AgentMemoryV3_51_0 {
1671
1671
  sessionMemory: AgentSessionMemoryV3_51_0;
1672
1672
  }
1673
1673
  export interface AgentSessionMemoryV3_51_0 {
1674
- memoryLocations: MemoryLocationsV3_51_0;
1675
- }
1676
- export interface AgentSessionMemoryLocationV3_51_0 {
1677
- key: string;
1678
- shape: string;
1674
+ shape?: string;
1679
1675
  }
1680
1676
  /**
1681
1677
  * Configuration for the start of an agent's execution
@@ -1744,6 +1740,10 @@ export interface AgentAIStateInputTemplateV3_51_0 {
1744
1740
  type: 'template';
1745
1741
  inputTemplate: string;
1746
1742
  }
1743
+ /**
1744
+ * This interface was referenced by `ToolMapV3_51_0`'s JSON-Schema definition
1745
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1746
+ */
1747
1747
  export interface AgentToolConfigV3_51_0 {
1748
1748
  ref: string;
1749
1749
  description?: string;
@@ -1815,17 +1815,17 @@ export interface AgentChatHistoryClearV3_51_0 {
1815
1815
  }
1816
1816
  export interface AgentStateSessionMemoryLocationContentV3_51_0 {
1817
1817
  type: 'content';
1818
- memoryKey: string;
1818
+ memoryPath?: string;
1819
1819
  path?: string;
1820
1820
  }
1821
1821
  export interface AgentStateSessionMemoryLocationArtifactV3_51_0 {
1822
1822
  type: 'artifactValue';
1823
- memoryKey: string;
1823
+ memoryPath?: string;
1824
1824
  artifactPath?: string;
1825
1825
  }
1826
1826
  export interface AgentStateSessionMemoryLocationStaticValueV3_51_0 {
1827
1827
  type: 'staticValue';
1828
- memoryKey: string;
1828
+ memoryPath?: string;
1829
1829
  value?: string;
1830
1830
  }
1831
1831
  export interface AgentGuardV3_51_0 {
@@ -1885,6 +1885,9 @@ export interface SensitiveInformationPolicyV3_51_0 {
1885
1885
  export interface ContextualGroundingPolicyV3_51_0 {
1886
1886
  filtersConfig: FilterV3_51_01;
1887
1887
  }
1888
+ export interface ToolMapV3_51_0 {
1889
+ [k: string]: AgentToolConfigV3_51_0;
1890
+ }
1888
1891
  /**
1889
1892
  * This interface was referenced by `ProjectSchemaJSONV3_51_0`'s JSON-Schema
1890
1893
  * via the `definition` "formMap".
@@ -277,7 +277,6 @@ export type ShapeSchemaV3_52_0 = ShapeSchemaAllOfV3_52_0 | ShapeSchemaExtendsV3_
277
277
  export type AgentAPIV3_52_0 = AgentAPIChatV3_52_0 | AgentAPIGenerateV3_52_0;
278
278
  export type InteractionTimeoutMillisecondsV3_52_0 = number;
279
279
  export type InteractionTimeoutMillisecondsV3_52_01 = number;
280
- export type MemoryLocationsV3_52_0 = AgentSessionMemoryLocationV3_52_0[];
281
280
  export type VariablesV3_52_0 = AgentVariableV3_52_0[];
282
281
  export type AgentExecutionV3_52_0 = AgentExecutionGraphQLV3_52_0 | AgentExecutionGenerateV3_52_0 | AgentExecutionChatV3_52_0;
283
282
  export type AgentAIStateInputV3_52_0 = AgentAIStateInputArgumentV3_52_0 | AgentAIStateInputTemplateV3_52_0;
@@ -1632,6 +1631,7 @@ export interface ShapeSchemaAnyV3_52_0 {
1632
1631
  export interface AIExperimentalV3_52_0 {
1633
1632
  agents?: AgentMapV3_52_0;
1634
1633
  guards?: GuardMapV3_52_0;
1634
+ tools?: ToolMapV3_52_0;
1635
1635
  }
1636
1636
  export interface AgentMapV3_52_0 {
1637
1637
  [k: string]: AgentJSONV3_52_0;
@@ -1671,11 +1671,7 @@ export interface AgentMemoryV3_52_0 {
1671
1671
  sessionMemory: AgentSessionMemoryV3_52_0;
1672
1672
  }
1673
1673
  export interface AgentSessionMemoryV3_52_0 {
1674
- memoryLocations: MemoryLocationsV3_52_0;
1675
- }
1676
- export interface AgentSessionMemoryLocationV3_52_0 {
1677
- key: string;
1678
- shape: string;
1674
+ shape?: string;
1679
1675
  }
1680
1676
  /**
1681
1677
  * Configuration for the start of an agent's execution
@@ -1744,6 +1740,10 @@ export interface AgentAIStateInputTemplateV3_52_0 {
1744
1740
  type: 'template';
1745
1741
  inputTemplate: string;
1746
1742
  }
1743
+ /**
1744
+ * This interface was referenced by `ToolMapV3_52_0`'s JSON-Schema definition
1745
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1746
+ */
1747
1747
  export interface AgentToolConfigV3_52_0 {
1748
1748
  ref: string;
1749
1749
  description?: string;
@@ -1815,17 +1815,17 @@ export interface AgentChatHistoryClearV3_52_0 {
1815
1815
  }
1816
1816
  export interface AgentStateSessionMemoryLocationContentV3_52_0 {
1817
1817
  type: 'content';
1818
- memoryKey: string;
1818
+ memoryPath?: string;
1819
1819
  path?: string;
1820
1820
  }
1821
1821
  export interface AgentStateSessionMemoryLocationArtifactV3_52_0 {
1822
1822
  type: 'artifactValue';
1823
- memoryKey: string;
1823
+ memoryPath?: string;
1824
1824
  artifactPath?: string;
1825
1825
  }
1826
1826
  export interface AgentStateSessionMemoryLocationStaticValueV3_52_0 {
1827
1827
  type: 'staticValue';
1828
- memoryKey: string;
1828
+ memoryPath?: string;
1829
1829
  value?: string;
1830
1830
  }
1831
1831
  export interface AgentGuardV3_52_0 {
@@ -1885,6 +1885,9 @@ export interface SensitiveInformationPolicyV3_52_0 {
1885
1885
  export interface ContextualGroundingPolicyV3_52_0 {
1886
1886
  filtersConfig: FilterV3_52_01;
1887
1887
  }
1888
+ export interface ToolMapV3_52_0 {
1889
+ [k: string]: AgentToolConfigV3_52_0;
1890
+ }
1888
1891
  /**
1889
1892
  * This interface was referenced by `ProjectSchemaJSONV3_52_0`'s JSON-Schema
1890
1893
  * via the `definition` "formMap".
@@ -286,7 +286,6 @@ export type ShapeSchemaV3_53_0 = ShapeSchemaAllOfV3_53_0 | ShapeSchemaExtendsV3_
286
286
  export type AgentAPIV3_53_0 = AgentAPIChatV3_53_0 | AgentAPIGenerateV3_53_0;
287
287
  export type InteractionTimeoutMillisecondsV3_53_0 = number;
288
288
  export type InteractionTimeoutMillisecondsV3_53_01 = number;
289
- export type MemoryLocationsV3_53_0 = AgentSessionMemoryLocationV3_53_0[];
290
289
  export type VariablesV3_53_0 = AgentVariableV3_53_0[];
291
290
  export type AgentExecutionV3_53_0 = AgentExecutionGraphQLV3_53_0 | AgentExecutionGenerateV3_53_0 | AgentExecutionChatV3_53_0;
292
291
  export type AgentAIStateInputV3_53_0 = AgentAIStateInputArgumentV3_53_0 | AgentAIStateInputTemplateV3_53_0;
@@ -1713,6 +1712,7 @@ export interface ShapeSchemaAnyV3_53_0 {
1713
1712
  export interface AIExperimentalV3_53_0 {
1714
1713
  agents?: AgentMapV3_53_0;
1715
1714
  guards?: GuardMapV3_53_0;
1715
+ tools?: ToolMapV3_53_0;
1716
1716
  }
1717
1717
  export interface AgentMapV3_53_0 {
1718
1718
  [k: string]: AgentJSONV3_53_0;
@@ -1752,11 +1752,7 @@ export interface AgentMemoryV3_53_0 {
1752
1752
  sessionMemory: AgentSessionMemoryV3_53_0;
1753
1753
  }
1754
1754
  export interface AgentSessionMemoryV3_53_0 {
1755
- memoryLocations: MemoryLocationsV3_53_0;
1756
- }
1757
- export interface AgentSessionMemoryLocationV3_53_0 {
1758
- key: string;
1759
- shape: string;
1755
+ shape?: string;
1760
1756
  }
1761
1757
  /**
1762
1758
  * Configuration for the start of an agent's execution
@@ -1825,6 +1821,10 @@ export interface AgentAIStateInputTemplateV3_53_0 {
1825
1821
  type: 'template';
1826
1822
  inputTemplate: string;
1827
1823
  }
1824
+ /**
1825
+ * This interface was referenced by `ToolMapV3_53_0`'s JSON-Schema definition
1826
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1827
+ */
1828
1828
  export interface AgentToolConfigV3_53_0 {
1829
1829
  ref: string;
1830
1830
  description?: string;
@@ -1896,17 +1896,17 @@ export interface AgentChatHistoryClearV3_53_0 {
1896
1896
  }
1897
1897
  export interface AgentStateSessionMemoryLocationContentV3_53_0 {
1898
1898
  type: 'content';
1899
- memoryKey: string;
1899
+ memoryPath?: string;
1900
1900
  path?: string;
1901
1901
  }
1902
1902
  export interface AgentStateSessionMemoryLocationArtifactV3_53_0 {
1903
1903
  type: 'artifactValue';
1904
- memoryKey: string;
1904
+ memoryPath?: string;
1905
1905
  artifactPath?: string;
1906
1906
  }
1907
1907
  export interface AgentStateSessionMemoryLocationStaticValueV3_53_0 {
1908
1908
  type: 'staticValue';
1909
- memoryKey: string;
1909
+ memoryPath?: string;
1910
1910
  value?: string;
1911
1911
  }
1912
1912
  export interface AgentGuardV3_53_0 {
@@ -1966,6 +1966,9 @@ export interface SensitiveInformationPolicyV3_53_0 {
1966
1966
  export interface ContextualGroundingPolicyV3_53_0 {
1967
1967
  filtersConfig: FilterV3_53_01;
1968
1968
  }
1969
+ export interface ToolMapV3_53_0 {
1970
+ [k: string]: AgentToolConfigV3_53_0;
1971
+ }
1969
1972
  /**
1970
1973
  * This interface was referenced by `ProjectSchemaJSONV3_53_0`'s JSON-Schema
1971
1974
  * via the `definition` "formMap".
@@ -288,7 +288,8 @@ export type CacheTriggerConfigV3_54_0 = CacheScheduleTriggerConfigV3_54_0 | Cach
288
288
  */
289
289
  export type ShapeSchemaV3_54_0 = ShapeSchemaAllOfV3_54_0 | ShapeSchemaExtendsV3_54_0 | ShapeSchemaOneOfV3_54_0 | ShapeSchemaEnumV3_54_0 | ObjectSchemaV3_54_0 | ShapeSchemaAnyV3_54_0;
290
290
  export type AgentAPIV3_54_0 = AgentAPIChatV3_54_0 | AgentAPIGenerateV3_54_0;
291
- export type MemoryLocationsV3_54_0 = AgentSessionMemoryLocationV3_54_0[];
291
+ export type InteractionTimeoutMillisecondsV3_54_0 = number;
292
+ export type InteractionTimeoutMillisecondsV3_54_01 = number;
292
293
  export type VariablesV3_54_0 = AgentVariableV3_54_0[];
293
294
  export type AgentExecutionV3_54_0 = AgentExecutionGraphQLV3_54_0 | AgentExecutionGenerateV3_54_0 | AgentExecutionChatV3_54_0;
294
295
  export type AgentAIStateInputV3_54_0 = AgentAIStateInputArgumentV3_54_0 | AgentAIStateInputTemplateV3_54_0;
@@ -1730,6 +1731,7 @@ export interface ShapeSchemaAnyV3_54_0 {
1730
1731
  export interface AIExperimentalV3_54_0 {
1731
1732
  agents?: AgentMapV3_54_0;
1732
1733
  guards?: GuardMapV3_54_0;
1734
+ tools?: ToolMapV3_54_0;
1733
1735
  }
1734
1736
  export interface AgentMapV3_54_0 {
1735
1737
  [k: string]: AgentJSONV3_54_0;
@@ -1751,6 +1753,7 @@ export interface AgentJSONV3_54_0 {
1751
1753
  }
1752
1754
  export interface AgentAPIChatV3_54_0 {
1753
1755
  type: 'chat';
1756
+ interactionTimeout?: InteractionTimeoutMillisecondsV3_54_0;
1754
1757
  arguments?: AgentAPIArgumentV3_54_0[];
1755
1758
  }
1756
1759
  export interface AgentAPIArgumentV3_54_0 {
@@ -1761,17 +1764,14 @@ export interface AgentAPIArgumentV3_54_0 {
1761
1764
  }
1762
1765
  export interface AgentAPIGenerateV3_54_0 {
1763
1766
  type: 'generate';
1767
+ interactionTimeout?: InteractionTimeoutMillisecondsV3_54_01;
1764
1768
  arguments?: AgentAPIArgumentV3_54_0[];
1765
1769
  }
1766
1770
  export interface AgentMemoryV3_54_0 {
1767
1771
  sessionMemory: AgentSessionMemoryV3_54_0;
1768
1772
  }
1769
1773
  export interface AgentSessionMemoryV3_54_0 {
1770
- memoryLocations: MemoryLocationsV3_54_0;
1771
- }
1772
- export interface AgentSessionMemoryLocationV3_54_0 {
1773
- key: string;
1774
- shape: string;
1774
+ shape?: string;
1775
1775
  }
1776
1776
  /**
1777
1777
  * Configuration for the start of an agent's execution
@@ -1840,6 +1840,10 @@ export interface AgentAIStateInputTemplateV3_54_0 {
1840
1840
  type: 'template';
1841
1841
  inputTemplate: string;
1842
1842
  }
1843
+ /**
1844
+ * This interface was referenced by `ToolMapV3_54_0`'s JSON-Schema definition
1845
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1846
+ */
1843
1847
  export interface AgentToolConfigV3_54_0 {
1844
1848
  ref: string;
1845
1849
  description?: string;
@@ -1911,17 +1915,17 @@ export interface AgentChatHistoryClearV3_54_0 {
1911
1915
  }
1912
1916
  export interface AgentStateSessionMemoryLocationContentV3_54_0 {
1913
1917
  type: 'content';
1914
- memoryKey: string;
1918
+ memoryPath?: string;
1915
1919
  path?: string;
1916
1920
  }
1917
1921
  export interface AgentStateSessionMemoryLocationArtifactV3_54_0 {
1918
1922
  type: 'artifactValue';
1919
- memoryKey: string;
1923
+ memoryPath?: string;
1920
1924
  artifactPath?: string;
1921
1925
  }
1922
1926
  export interface AgentStateSessionMemoryLocationStaticValueV3_54_0 {
1923
1927
  type: 'staticValue';
1924
- memoryKey: string;
1928
+ memoryPath?: string;
1925
1929
  value?: string;
1926
1930
  }
1927
1931
  export interface AgentGuardV3_54_0 {
@@ -1981,6 +1985,9 @@ export interface SensitiveInformationPolicyV3_54_0 {
1981
1985
  export interface ContextualGroundingPolicyV3_54_0 {
1982
1986
  filtersConfig: FilterV3_54_01;
1983
1987
  }
1988
+ export interface ToolMapV3_54_0 {
1989
+ [k: string]: AgentToolConfigV3_54_0;
1990
+ }
1984
1991
  /**
1985
1992
  * This interface was referenced by `ProjectSchemaJSONV3_54_0`'s JSON-Schema
1986
1993
  * via the `definition` "formMap".
package/dist/refs.d.ts CHANGED
@@ -167,7 +167,7 @@ export declare function anyRefToShapeSchemaPath(context: ServicesContext, refSch
167
167
  /**
168
168
  * Helper fn to omit `ref` props from the target schema, and then extend it with the source schema.
169
169
  */
170
- export declare const omitRefAndExtend: (targetSchema: PropertySchema, sourceSchema: PropertySchema) => import("lodash").Omit<PropertySchema, "@ref" | "$ref"> & PropertySchema;
170
+ export declare const omitRefAndExtend: (targetSchema: PropertySchema, sourceSchema: PropertySchema) => import("lodash").Omit<PropertySchema, "$ref" | "@ref"> & PropertySchema;
171
171
  /**
172
172
  * If there is a $ref, this will insert a property schema from the top level
173
173
  * in place of the reference.
@@ -1,5 +1,5 @@
1
1
  import type { FromSchema } from 'json-schema-to-ts';
2
- export declare const ragQueryArgsSchema: {
2
+ export declare const embeddingSearchArgsSchema: {
3
3
  readonly type: "object";
4
4
  readonly properties: {
5
5
  readonly text: {
@@ -33,17 +33,22 @@ export declare const ragQueryArgsSchema: {
33
33
  readonly additionalProperties: false;
34
34
  };
35
35
  };
36
+ readonly threshold: {
37
+ readonly type: "number";
38
+ readonly description: "The minimum score a document must have to be returned.";
39
+ };
36
40
  };
37
41
  readonly required: ["text"];
38
42
  readonly additionalProperties: false;
39
43
  };
40
- export type RagQueryArgs = FromSchema<typeof ragQueryArgsSchema>;
41
- export declare const validateRagQueryArgs: import("ajv").ValidateFunction<{
44
+ export type EmbeddingSearchArgs = FromSchema<typeof embeddingSearchArgsSchema>;
45
+ export declare const validateEmbeddingSearchArgs: import("ajv").ValidateFunction<{
42
46
  sort?: {
43
47
  field: string;
44
48
  order: "asc" | "desc";
45
49
  }[] | undefined;
46
50
  size?: number | undefined;
47
51
  from?: number | undefined;
52
+ threshold?: number | undefined;
48
53
  text: string;
49
54
  }>;
@@ -1,5 +1,5 @@
1
1
  import { createTypedValidator } from '@takeshape/json-schema';
2
- export const ragQueryArgsSchema = {
2
+ export const embeddingSearchArgsSchema = {
3
3
  type: 'object',
4
4
  properties: {
5
5
  text: {
@@ -32,9 +32,15 @@ export const ragQueryArgsSchema = {
32
32
  required: ['field', 'order'],
33
33
  additionalProperties: false
34
34
  }
35
+ },
36
+ threshold: {
37
+ type: 'number',
38
+ description: 'The minimum score a document must have to be returned.'
35
39
  }
36
40
  },
37
41
  required: ['text'],
38
42
  additionalProperties: false
39
43
  };
40
- export const validateRagQueryArgs = createTypedValidator(ragQueryArgsSchema, { useDefaults: true });
44
+ export const validateEmbeddingSearchArgs = createTypedValidator(embeddingSearchArgsSchema, {
45
+ useDefaults: true
46
+ });
@@ -46,6 +46,72 @@ export declare function getArgsReference(projectSchema: ServicesContext, argsSch
46
46
  export declare function getArgsReferenceWithPath(context: ServicesContext, argsSchema: SchemaWithArgs, schemaPath?: SchemaPath): Maybe<RefItemWithPath>;
47
47
  export declare function getArgsShapeSchema(context: ServicesShapesContext, argsSchema: SchemaWithArgs): Maybe<ShapeSchema>;
48
48
  export declare function shapeToPropertySchema(projectSchema: ProjectSchemaJSON, shape: ShapeJSON): PropertySchema;
49
+ /**
50
+ * Currently this is not 100% valid JSON schema, but its output can be used with createSchemaValidator
51
+ */
52
+ export declare function shapeToJsonSchema(projectSchema: ProjectSchemaJSON, shape: ShapeJSON): {
53
+ definitions: Record<string, PropertySchema>;
54
+ $ref?: string;
55
+ title?: string;
56
+ description?: string;
57
+ default?: any;
58
+ readOnly?: boolean;
59
+ multipleOf?: number;
60
+ maximum?: number;
61
+ exclusiveMaximum?: number;
62
+ minimum?: number;
63
+ exclusiveMinimum?: number;
64
+ maxLength?: import("./project-schema/latest.ts").NonNegativeInteger;
65
+ minLength?: import("./project-schema/latest.ts").NonNegativeIntegerDefault0;
66
+ pattern?: string;
67
+ additionalItems?: PropertySchema;
68
+ items?: PropertySchema;
69
+ maxItems?: import("./project-schema/latest.ts").NonNegativeInteger;
70
+ minItems?: import("./project-schema/latest.ts").NonNegativeIntegerDefault0;
71
+ uniqueItems?: boolean;
72
+ contains?: PropertySchema;
73
+ maxProperties?: import("./project-schema/latest.ts").NonNegativeInteger;
74
+ minProperties?: import("./project-schema/latest.ts").NonNegativeIntegerDefault0;
75
+ required?: import("./project-schema/latest.ts").StringArray;
76
+ additionalProperties?: PropertySchema | false;
77
+ properties?: {
78
+ [k: string]: PropertySchema;
79
+ };
80
+ const?: any;
81
+ enum?: any[];
82
+ type?: import("./project-schema/latest.ts").SimpleTypes | import("./project-schema/latest.ts").SimpleTypes[];
83
+ format?: string;
84
+ contentMediaType?: string;
85
+ contentEncoding?: string;
86
+ allOf?: import("./project-schema/latest.ts").SchemaArray;
87
+ discriminator?: {
88
+ propertyName?: string;
89
+ [k: string]: any;
90
+ };
91
+ oneOf?: import("./project-schema/latest.ts").SchemaArray;
92
+ extends?: import("./project-schema/latest.ts").ObjectOrRefArray;
93
+ '@backreference'?: import("./project-schema/latest.ts").BackReference;
94
+ '@input'?: PropertySchema;
95
+ '@output'?: PropertySchema;
96
+ '@syncLocaleStructure'?: boolean;
97
+ '@sensitive'?: boolean;
98
+ '@draftjs'?: boolean;
99
+ '@l10n'?: boolean;
100
+ '@key'?: string;
101
+ '@workflow'?: string;
102
+ '@mapping'?: FieldMapping;
103
+ '@tag'?: string;
104
+ '@tags'?: string[];
105
+ '@deprecationReason'?: string;
106
+ '@args'?: import("./project-schema/latest.ts").Args;
107
+ '@resolver'?: import("./project-schema/latest.ts").Resolver;
108
+ '@dependencies'?: import("./project-schema/latest.ts").Dependencies;
109
+ '@ref'?: import("./project-schema/latest.ts").Ref;
110
+ '@derivedFrom'?: string;
111
+ '@indexed'?: import("./project-schema/latest.ts").Indexed;
112
+ '@graphql'?: import("./project-schema/latest.ts").GraphQLConfig;
113
+ $id: string;
114
+ };
49
115
  export declare function projectSchemaToJSONSchema(projectSchema: ProjectSchemaJSON): {
50
116
  definitions: Record<string, PropertySchema>;
51
117
  };
@@ -471,7 +471,7 @@ export function getArgsShapeSchema(context, argsSchema) {
471
471
  }
472
472
  }
473
473
  }
474
- const createShapeToPropertySchema = (projectSchema, definitions, definitionNames, { useShapeIdDiscriminator }) => {
474
+ const createShapeToPropertySchema = (projectSchema, definitions, definitionNames, { useShapeIdDiscriminator, additionalProperties }) => {
475
475
  const rewriteRefs = (shape) => {
476
476
  const handleSchema = (propSchema) => {
477
477
  // Unwrap array schema
@@ -508,11 +508,16 @@ const createShapeToPropertySchema = (projectSchema, definitions, definitionNames
508
508
  if (!definitionNames.has(shapeName)) {
509
509
  definitionNames.add(shapeName);
510
510
  const rewritten = rewriteRefs(shape);
511
- if (useShapeIdDiscriminator && isObjectSchema(rewritten)) {
512
- rewritten.properties._shapeId = {
513
- type: 'string',
514
- enum: [shape.id]
515
- };
511
+ if (isObjectSchema(rewritten)) {
512
+ if (useShapeIdDiscriminator) {
513
+ rewritten.properties._shapeId = {
514
+ type: 'string',
515
+ enum: [shape.id]
516
+ };
517
+ }
518
+ if (additionalProperties !== undefined) {
519
+ rewritten.additionalProperties = additionalProperties;
520
+ }
516
521
  }
517
522
  definitions[shapeName] = rewritten;
518
523
  }
@@ -534,6 +539,9 @@ const createShapeToPropertySchema = (projectSchema, definitions, definitionNames
534
539
  for (const schema of Object.values(shapeSchemaCopy.properties)) {
535
540
  handleSchema(schema);
536
541
  }
542
+ if (additionalProperties !== undefined) {
543
+ shapeSchemaCopy.additionalProperties = additionalProperties;
544
+ }
537
545
  return shapeSchemaCopy;
538
546
  };
539
547
  return rewriteRefs;
@@ -549,6 +557,22 @@ export function shapeToPropertySchema(projectSchema, shape) {
549
557
  definitions
550
558
  };
551
559
  }
560
+ /**
561
+ * Currently this is not 100% valid JSON schema, but its output can be used with createSchemaValidator
562
+ */
563
+ export function shapeToJsonSchema(projectSchema, shape) {
564
+ const definitions = {};
565
+ const definitionNames = new Set();
566
+ const convert = createShapeToPropertySchema(projectSchema, definitions, definitionNames, {
567
+ useShapeIdDiscriminator: false,
568
+ additionalProperties: false
569
+ });
570
+ return {
571
+ $id: shape.id,
572
+ ...convert(shape),
573
+ definitions
574
+ };
575
+ }
552
576
  export function projectSchemaToJSONSchema(projectSchema) {
553
577
  const definitions = {};
554
578
  const definitionNames = new Set();
@@ -106,29 +106,11 @@
106
106
  "title": "Agent Session Memory",
107
107
  "type": "object",
108
108
  "properties": {
109
- "memoryLocations": {
110
- "title": "Memory Locations",
111
- "type": "array",
112
- "items": {
113
- "$ref": "#/definitions/agentSessionMemoryLocation"
114
- }
115
- }
116
- },
117
- "required": ["memoryLocations"],
118
- "additionalProperties": false
119
- },
120
- "agentSessionMemoryLocation": {
121
- "title": "Agent Session Memory Location",
122
- "type": "object",
123
- "properties": {
124
- "key": {
125
- "type": "string"
126
- },
127
109
  "shape": {
128
110
  "type": "string"
129
111
  }
130
112
  },
131
- "required": ["key", "shape"],
113
+ "required": [],
132
114
  "additionalProperties": false
133
115
  },
134
116
  "agentVariable": {
@@ -309,14 +291,14 @@
309
291
  "type": {
310
292
  "enum": ["staticValue"]
311
293
  },
312
- "memoryKey": {
294
+ "memoryPath": {
313
295
  "type": "string"
314
296
  },
315
297
  "value": {
316
298
  "type": "string"
317
299
  }
318
300
  },
319
- "required": ["type", "memoryKey"],
301
+ "required": ["type"],
320
302
  "additionalProperties": false
321
303
  },
322
304
  "agentStateSessionMemoryLocationArtifact": {
@@ -326,14 +308,14 @@
326
308
  "type": {
327
309
  "enum": ["artifactValue"]
328
310
  },
329
- "memoryKey": {
311
+ "memoryPath": {
330
312
  "type": "string"
331
313
  },
332
314
  "artifactPath": {
333
315
  "type": "string"
334
316
  }
335
317
  },
336
- "required": ["type", "memoryKey"],
318
+ "required": ["type"],
337
319
  "additionalProperties": false
338
320
  },
339
321
  "agentStateSessionMemoryLocationContent": {
@@ -343,14 +325,14 @@
343
325
  "type": {
344
326
  "enum": ["content"]
345
327
  },
346
- "memoryKey": {
328
+ "memoryPath": {
347
329
  "type": "string"
348
330
  },
349
331
  "path": {
350
332
  "type": "string"
351
333
  }
352
334
  },
353
- "required": ["type", "memoryKey"],
335
+ "required": ["type"],
354
336
  "additionalProperties": false
355
337
  },
356
338
  "agentAiStateInputArg": {
@@ -736,6 +718,16 @@
736
718
  },
737
719
  "additionalProperties": false
738
720
  },
721
+ "toolMap": {
722
+ "title": "Tool Map",
723
+ "type": "object",
724
+ "patternProperties": {
725
+ "^[0-9A-Za-z_]+$": {
726
+ "$ref": "#/definitions/agentToolConfig"
727
+ }
728
+ },
729
+ "additionalProperties": false
730
+ },
739
731
  "aiExperimental": {
740
732
  "title": "AI Experimental",
741
733
  "type": "object",
@@ -747,6 +739,10 @@
747
739
  "guards": {
748
740
  "$ref": "#/definitions/guardMap",
749
741
  "description": "A Guard is a configuration for an AI guardrail that can check inputs and outputs and provide safety and compliance."
742
+ },
743
+ "tools": {
744
+ "$ref": "#/definitions/toolMap",
745
+ "description": "A Tool is a configuration for an AI tool which can query or mutate data."
750
746
  }
751
747
  },
752
748
  "additionalProperties": false
@@ -0,0 +1,7 @@
1
+ import type { ProjectSchemaJSON, ShapeJSON } from './project-schema/latest.ts';
2
+ export interface GetShapePathsArgs {
3
+ includeRoot?: boolean;
4
+ prefix?: string;
5
+ depthLimit?: number;
6
+ }
7
+ export declare function getShapePaths(projectSchema: ProjectSchemaJSON, shape: ShapeJSON, args?: GetShapePathsArgs): string[];
@@ -0,0 +1,28 @@
1
+ import { dereferenceSchema } from "./refs.js";
2
+ import { isArraySchema, isObjectSchema } from "./types/utils.js";
3
+ export function getShapePaths(projectSchema, shape, args = {}) {
4
+ const { includeRoot = false, prefix = '', depthLimit = 2 } = args;
5
+ const options = [];
6
+ const visit = (propertySchema, path, depth) => {
7
+ if (depth > depthLimit) {
8
+ return;
9
+ }
10
+ if (depth !== 0 || includeRoot) {
11
+ options.push(path.join('.'));
12
+ }
13
+ const schema = dereferenceSchema(projectSchema, propertySchema);
14
+ if (isArraySchema(schema)) {
15
+ if (isObjectSchema(schema.items)) {
16
+ visit(schema.items, path, depth + 1);
17
+ }
18
+ }
19
+ else if (isObjectSchema(schema)) {
20
+ for (const [name, propSchema] of Object.entries(schema.properties)) {
21
+ const newPath = [...path, propSchema.type === 'array' ? `${name}[0]` : name];
22
+ visit(propSchema, newPath, depth + 1);
23
+ }
24
+ }
25
+ };
26
+ visit(shape.schema, prefix ? [prefix] : [], 0);
27
+ return options;
28
+ }
@@ -204,9 +204,7 @@
204
204
  ]
205
205
  },
206
206
  "memory": {
207
- "sessionMemory": {
208
- "memoryLocations": []
209
- }
207
+ "sessionMemory": {}
210
208
  },
211
209
  "states": {
212
210
  "bbb": {
@@ -186,9 +186,7 @@
186
186
  ]
187
187
  },
188
188
  "memory": {
189
- "sessionMemory": {
190
- "memoryLocations": []
191
- }
189
+ "sessionMemory": {}
192
190
  },
193
191
  "states": {
194
192
  "bbb": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/schema",
3
- "version": "11.80.0",
3
+ "version": "11.82.0",
4
4
  "description": "TakeShape Schema",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {
@@ -57,9 +57,9 @@
57
57
  "p-reduce": "^2.1.0",
58
58
  "semver": "^7.3.2",
59
59
  "tiny-invariant": "^1.2.0",
60
- "@takeshape/errors": "11.80.0",
61
- "@takeshape/util": "11.80.0",
62
- "@takeshape/json-schema": "11.80.0"
60
+ "@takeshape/json-schema": "11.82.0",
61
+ "@takeshape/errors": "11.82.0",
62
+ "@takeshape/util": "11.82.0"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@takeshape/json-schema-to-typescript": "^11.0.0",
@@ -76,7 +76,7 @@
76
76
  "json-schema-to-ts": "^3.1.1",
77
77
  "meow": "^9.0.0",
78
78
  "shortid": "^2.2.15",
79
- "@takeshape/infra": "11.80.0"
79
+ "@takeshape/infra": "11.82.0"
80
80
  },
81
81
  "engines": {
82
82
  "node": ">=20"