@takeshape/schema 11.80.2 → 11.82.2

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;
@@ -1772,11 +1771,7 @@ export interface AgentMemory {
1772
1771
  sessionMemory: AgentSessionMemory;
1773
1772
  }
1774
1773
  export interface AgentSessionMemory {
1775
- memoryLocations: MemoryLocations;
1776
- }
1777
- export interface AgentSessionMemoryLocation {
1778
- key: string;
1779
- shape: string;
1774
+ shape?: string;
1780
1775
  }
1781
1776
  /**
1782
1777
  * Configuration for the start of an agent's execution
@@ -1920,17 +1915,17 @@ export interface AgentChatHistoryClear {
1920
1915
  }
1921
1916
  export interface AgentStateSessionMemoryLocationContent {
1922
1917
  type: 'content';
1923
- memoryKey: string;
1918
+ memoryPath?: string;
1924
1919
  path?: string;
1925
1920
  }
1926
1921
  export interface AgentStateSessionMemoryLocationArtifact {
1927
1922
  type: 'artifactValue';
1928
- memoryKey: string;
1923
+ memoryPath?: string;
1929
1924
  artifactPath?: string;
1930
1925
  }
1931
1926
  export interface AgentStateSessionMemoryLocationStaticValue {
1932
1927
  type: 'staticValue';
1933
- memoryKey: string;
1928
+ memoryPath?: string;
1934
1929
  value?: string;
1935
1930
  }
1936
1931
  export interface AgentGuard {
@@ -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;
@@ -1620,11 +1619,7 @@ export interface AgentMemoryV3_48_0 {
1620
1619
  sessionMemory: AgentSessionMemoryV3_48_0;
1621
1620
  }
1622
1621
  export interface AgentSessionMemoryV3_48_0 {
1623
- memoryLocations: MemoryLocationsV3_48_0;
1624
- }
1625
- export interface AgentSessionMemoryLocationV3_48_0 {
1626
- key: string;
1627
- shape: string;
1622
+ shape?: string;
1628
1623
  }
1629
1624
  /**
1630
1625
  * Configuration for the start of an agent's execution
@@ -1768,17 +1763,17 @@ export interface AgentChatHistoryClearV3_48_0 {
1768
1763
  }
1769
1764
  export interface AgentStateSessionMemoryLocationContentV3_48_0 {
1770
1765
  type: 'content';
1771
- memoryKey: string;
1766
+ memoryPath?: string;
1772
1767
  path?: string;
1773
1768
  }
1774
1769
  export interface AgentStateSessionMemoryLocationArtifactV3_48_0 {
1775
1770
  type: 'artifactValue';
1776
- memoryKey: string;
1771
+ memoryPath?: string;
1777
1772
  artifactPath?: string;
1778
1773
  }
1779
1774
  export interface AgentStateSessionMemoryLocationStaticValueV3_48_0 {
1780
1775
  type: 'staticValue';
1781
- memoryKey: string;
1776
+ memoryPath?: string;
1782
1777
  value?: string;
1783
1778
  }
1784
1779
  export interface AgentGuardV3_48_0 {
@@ -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;
@@ -1620,11 +1619,7 @@ export interface AgentMemoryV3_49_0 {
1620
1619
  sessionMemory: AgentSessionMemoryV3_49_0;
1621
1620
  }
1622
1621
  export interface AgentSessionMemoryV3_49_0 {
1623
- memoryLocations: MemoryLocationsV3_49_0;
1624
- }
1625
- export interface AgentSessionMemoryLocationV3_49_0 {
1626
- key: string;
1627
- shape: string;
1622
+ shape?: string;
1628
1623
  }
1629
1624
  /**
1630
1625
  * Configuration for the start of an agent's execution
@@ -1768,17 +1763,17 @@ export interface AgentChatHistoryClearV3_49_0 {
1768
1763
  }
1769
1764
  export interface AgentStateSessionMemoryLocationContentV3_49_0 {
1770
1765
  type: 'content';
1771
- memoryKey: string;
1766
+ memoryPath?: string;
1772
1767
  path?: string;
1773
1768
  }
1774
1769
  export interface AgentStateSessionMemoryLocationArtifactV3_49_0 {
1775
1770
  type: 'artifactValue';
1776
- memoryKey: string;
1771
+ memoryPath?: string;
1777
1772
  artifactPath?: string;
1778
1773
  }
1779
1774
  export interface AgentStateSessionMemoryLocationStaticValueV3_49_0 {
1780
1775
  type: 'staticValue';
1781
- memoryKey: string;
1776
+ memoryPath?: string;
1782
1777
  value?: string;
1783
1778
  }
1784
1779
  export interface AgentGuardV3_49_0 {
@@ -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;
@@ -1672,11 +1671,7 @@ export interface AgentMemoryV3_50_0 {
1672
1671
  sessionMemory: AgentSessionMemoryV3_50_0;
1673
1672
  }
1674
1673
  export interface AgentSessionMemoryV3_50_0 {
1675
- memoryLocations: MemoryLocationsV3_50_0;
1676
- }
1677
- export interface AgentSessionMemoryLocationV3_50_0 {
1678
- key: string;
1679
- shape: string;
1674
+ shape?: string;
1680
1675
  }
1681
1676
  /**
1682
1677
  * Configuration for the start of an agent's execution
@@ -1820,17 +1815,17 @@ export interface AgentChatHistoryClearV3_50_0 {
1820
1815
  }
1821
1816
  export interface AgentStateSessionMemoryLocationContentV3_50_0 {
1822
1817
  type: 'content';
1823
- memoryKey: string;
1818
+ memoryPath?: string;
1824
1819
  path?: string;
1825
1820
  }
1826
1821
  export interface AgentStateSessionMemoryLocationArtifactV3_50_0 {
1827
1822
  type: 'artifactValue';
1828
- memoryKey: string;
1823
+ memoryPath?: string;
1829
1824
  artifactPath?: string;
1830
1825
  }
1831
1826
  export interface AgentStateSessionMemoryLocationStaticValueV3_50_0 {
1832
1827
  type: 'staticValue';
1833
- memoryKey: string;
1828
+ memoryPath?: string;
1834
1829
  value?: string;
1835
1830
  }
1836
1831
  export interface AgentGuardV3_50_0 {
@@ -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;
@@ -1672,11 +1671,7 @@ export interface AgentMemoryV3_51_0 {
1672
1671
  sessionMemory: AgentSessionMemoryV3_51_0;
1673
1672
  }
1674
1673
  export interface AgentSessionMemoryV3_51_0 {
1675
- memoryLocations: MemoryLocationsV3_51_0;
1676
- }
1677
- export interface AgentSessionMemoryLocationV3_51_0 {
1678
- key: string;
1679
- shape: string;
1674
+ shape?: string;
1680
1675
  }
1681
1676
  /**
1682
1677
  * Configuration for the start of an agent's execution
@@ -1820,17 +1815,17 @@ export interface AgentChatHistoryClearV3_51_0 {
1820
1815
  }
1821
1816
  export interface AgentStateSessionMemoryLocationContentV3_51_0 {
1822
1817
  type: 'content';
1823
- memoryKey: string;
1818
+ memoryPath?: string;
1824
1819
  path?: string;
1825
1820
  }
1826
1821
  export interface AgentStateSessionMemoryLocationArtifactV3_51_0 {
1827
1822
  type: 'artifactValue';
1828
- memoryKey: string;
1823
+ memoryPath?: string;
1829
1824
  artifactPath?: string;
1830
1825
  }
1831
1826
  export interface AgentStateSessionMemoryLocationStaticValueV3_51_0 {
1832
1827
  type: 'staticValue';
1833
- memoryKey: string;
1828
+ memoryPath?: string;
1834
1829
  value?: string;
1835
1830
  }
1836
1831
  export interface AgentGuardV3_51_0 {
@@ -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;
@@ -1672,11 +1671,7 @@ export interface AgentMemoryV3_52_0 {
1672
1671
  sessionMemory: AgentSessionMemoryV3_52_0;
1673
1672
  }
1674
1673
  export interface AgentSessionMemoryV3_52_0 {
1675
- memoryLocations: MemoryLocationsV3_52_0;
1676
- }
1677
- export interface AgentSessionMemoryLocationV3_52_0 {
1678
- key: string;
1679
- shape: string;
1674
+ shape?: string;
1680
1675
  }
1681
1676
  /**
1682
1677
  * Configuration for the start of an agent's execution
@@ -1820,17 +1815,17 @@ export interface AgentChatHistoryClearV3_52_0 {
1820
1815
  }
1821
1816
  export interface AgentStateSessionMemoryLocationContentV3_52_0 {
1822
1817
  type: 'content';
1823
- memoryKey: string;
1818
+ memoryPath?: string;
1824
1819
  path?: string;
1825
1820
  }
1826
1821
  export interface AgentStateSessionMemoryLocationArtifactV3_52_0 {
1827
1822
  type: 'artifactValue';
1828
- memoryKey: string;
1823
+ memoryPath?: string;
1829
1824
  artifactPath?: string;
1830
1825
  }
1831
1826
  export interface AgentStateSessionMemoryLocationStaticValueV3_52_0 {
1832
1827
  type: 'staticValue';
1833
- memoryKey: string;
1828
+ memoryPath?: string;
1834
1829
  value?: string;
1835
1830
  }
1836
1831
  export interface AgentGuardV3_52_0 {
@@ -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;
@@ -1753,11 +1752,7 @@ export interface AgentMemoryV3_53_0 {
1753
1752
  sessionMemory: AgentSessionMemoryV3_53_0;
1754
1753
  }
1755
1754
  export interface AgentSessionMemoryV3_53_0 {
1756
- memoryLocations: MemoryLocationsV3_53_0;
1757
- }
1758
- export interface AgentSessionMemoryLocationV3_53_0 {
1759
- key: string;
1760
- shape: string;
1755
+ shape?: string;
1761
1756
  }
1762
1757
  /**
1763
1758
  * Configuration for the start of an agent's execution
@@ -1901,17 +1896,17 @@ export interface AgentChatHistoryClearV3_53_0 {
1901
1896
  }
1902
1897
  export interface AgentStateSessionMemoryLocationContentV3_53_0 {
1903
1898
  type: 'content';
1904
- memoryKey: string;
1899
+ memoryPath?: string;
1905
1900
  path?: string;
1906
1901
  }
1907
1902
  export interface AgentStateSessionMemoryLocationArtifactV3_53_0 {
1908
1903
  type: 'artifactValue';
1909
- memoryKey: string;
1904
+ memoryPath?: string;
1910
1905
  artifactPath?: string;
1911
1906
  }
1912
1907
  export interface AgentStateSessionMemoryLocationStaticValueV3_53_0 {
1913
1908
  type: 'staticValue';
1914
- memoryKey: string;
1909
+ memoryPath?: string;
1915
1910
  value?: string;
1916
1911
  }
1917
1912
  export interface AgentGuardV3_53_0 {
@@ -290,7 +290,6 @@ export type ShapeSchemaV3_54_0 = ShapeSchemaAllOfV3_54_0 | ShapeSchemaExtendsV3_
290
290
  export type AgentAPIV3_54_0 = AgentAPIChatV3_54_0 | AgentAPIGenerateV3_54_0;
291
291
  export type InteractionTimeoutMillisecondsV3_54_0 = number;
292
292
  export type InteractionTimeoutMillisecondsV3_54_01 = number;
293
- export type MemoryLocationsV3_54_0 = AgentSessionMemoryLocationV3_54_0[];
294
293
  export type VariablesV3_54_0 = AgentVariableV3_54_0[];
295
294
  export type AgentExecutionV3_54_0 = AgentExecutionGraphQLV3_54_0 | AgentExecutionGenerateV3_54_0 | AgentExecutionChatV3_54_0;
296
295
  export type AgentAIStateInputV3_54_0 = AgentAIStateInputArgumentV3_54_0 | AgentAIStateInputTemplateV3_54_0;
@@ -1772,11 +1771,7 @@ export interface AgentMemoryV3_54_0 {
1772
1771
  sessionMemory: AgentSessionMemoryV3_54_0;
1773
1772
  }
1774
1773
  export interface AgentSessionMemoryV3_54_0 {
1775
- memoryLocations: MemoryLocationsV3_54_0;
1776
- }
1777
- export interface AgentSessionMemoryLocationV3_54_0 {
1778
- key: string;
1779
- shape: string;
1774
+ shape?: string;
1780
1775
  }
1781
1776
  /**
1782
1777
  * Configuration for the start of an agent's execution
@@ -1920,17 +1915,17 @@ export interface AgentChatHistoryClearV3_54_0 {
1920
1915
  }
1921
1916
  export interface AgentStateSessionMemoryLocationContentV3_54_0 {
1922
1917
  type: 'content';
1923
- memoryKey: string;
1918
+ memoryPath?: string;
1924
1919
  path?: string;
1925
1920
  }
1926
1921
  export interface AgentStateSessionMemoryLocationArtifactV3_54_0 {
1927
1922
  type: 'artifactValue';
1928
- memoryKey: string;
1923
+ memoryPath?: string;
1929
1924
  artifactPath?: string;
1930
1925
  }
1931
1926
  export interface AgentStateSessionMemoryLocationStaticValueV3_54_0 {
1932
1927
  type: 'staticValue';
1933
- memoryKey: string;
1928
+ memoryPath?: string;
1934
1929
  value?: string;
1935
1930
  }
1936
1931
  export interface AgentGuardV3_54_0 {
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": {
@@ -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.2",
3
+ "version": "11.82.2",
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.2",
61
- "@takeshape/util": "11.80.2",
62
- "@takeshape/json-schema": "11.80.2"
60
+ "@takeshape/errors": "11.82.2",
61
+ "@takeshape/json-schema": "11.82.2",
62
+ "@takeshape/util": "11.82.2"
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.2"
79
+ "@takeshape/infra": "11.82.2"
80
80
  },
81
81
  "engines": {
82
82
  "node": ">=20"