@takeshape/schema 11.89.0 → 11.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/agents.d.ts +7 -0
  2. package/dist/agents.js +7 -0
  3. package/dist/builtin-schema.js +3 -1
  4. package/dist/flatten-templates.js +1 -1
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/interfaces.d.ts +4 -2
  8. package/dist/interfaces.js +6 -5
  9. package/dist/migration/to/v3.34.0.js +2 -7
  10. package/dist/models/runtime-schema.js +7 -7
  11. package/dist/models/shape.d.ts +1 -0
  12. package/dist/models/shape.js +5 -2
  13. package/dist/project-schema/latest.d.ts +32 -12
  14. package/dist/project-schema/v3.48.0.d.ts +32 -12
  15. package/dist/project-schema/v3.49.0.d.ts +32 -12
  16. package/dist/project-schema/v3.50.0.d.ts +32 -12
  17. package/dist/project-schema/v3.51.0.d.ts +32 -12
  18. package/dist/project-schema/v3.52.0.d.ts +32 -12
  19. package/dist/project-schema/v3.53.0.d.ts +32 -12
  20. package/dist/project-schema/v3.54.0.d.ts +32 -12
  21. package/dist/project-schema/v3.55.0.d.ts +32 -12
  22. package/dist/refs.d.ts +30 -51
  23. package/dist/refs.js +101 -137
  24. package/dist/relationships.d.ts +1 -1
  25. package/dist/relationships.js +22 -31
  26. package/dist/schema-util.d.ts +4 -16
  27. package/dist/schema-util.js +12 -45
  28. package/dist/schemas/project-schema/experimental.json +107 -56
  29. package/dist/service-dependencies.js +9 -9
  30. package/dist/template-shapes/templates.d.ts +10 -10
  31. package/dist/template-shapes/templates.js +6 -9
  32. package/dist/template-shapes/where.js +9 -11
  33. package/dist/types/types.d.ts +0 -14
  34. package/dist/types/types.js +0 -8
  35. package/dist/types/utils.d.ts +2 -8
  36. package/dist/types/utils.js +1 -14
  37. package/dist/unions.js +2 -2
  38. package/dist/util/expressions.d.ts +13 -2
  39. package/dist/util/expressions.js +32 -0
  40. package/dist/util/form-config.js +1 -1
  41. package/dist/util/get-conflicting-properties.js +2 -2
  42. package/dist/util/has-arg.js +2 -2
  43. package/dist/util/is-asset-property.d.ts +3 -0
  44. package/dist/util/is-asset-property.js +11 -0
  45. package/dist/util/merge.js +1 -1
  46. package/dist/validate/validate.js +39 -20
  47. package/examples/latest/agent-schema.json +4 -2
  48. package/examples/source/agent-schema.json +4 -2
  49. package/package.json +6 -5
package/dist/agents.d.ts CHANGED
@@ -1,5 +1,12 @@
1
1
  import type { AgentAPI, AgentAPIArgument, AgentJSON, Args, ProjectSchemaJSON } from './project-schema/index.ts';
2
+ /**
3
+ * Special transition destination ID for agent transitions that end the agent execution.
4
+ */
2
5
  export declare const END_AGENT_EXECUTION = "endAgentExecution";
6
+ /**
7
+ * Special history strategy ID that indicates the history should be cleared.
8
+ */
9
+ export declare const CLEAR_HISTORY_STRATEGY_ID = "clearHistory";
3
10
  export declare const BUILT_IN_CHAT_ARGS: AgentAPIArgument[];
4
11
  export declare const BUILT_IN_CHAT_ARG_NAMES: string[];
5
12
  export type AgentEndTransition = {
package/dist/agents.js CHANGED
@@ -1,7 +1,14 @@
1
1
  import uniq from 'lodash/uniq.js';
2
2
  import uniqBy from 'lodash/uniqBy.js';
3
3
  import upperFirst from 'lodash/upperFirst.js';
4
+ /**
5
+ * Special transition destination ID for agent transitions that end the agent execution.
6
+ */
4
7
  export const END_AGENT_EXECUTION = 'endAgentExecution';
8
+ /**
9
+ * Special history strategy ID that indicates the history should be cleared.
10
+ */
11
+ export const CLEAR_HISTORY_STRATEGY_ID = 'clearHistory';
5
12
  export const BUILT_IN_CHAT_ARGS = [
6
13
  {
7
14
  argName: 'input',
@@ -382,7 +382,9 @@ export const builtInShapes = {
382
382
  chatSessionIds: { type: 'object' },
383
383
  sessionMemory: { type: 'object' },
384
384
  stateOutputs: { type: 'object' },
385
- currentValue: { type: 'object' }
385
+ currentValue: { type: 'object' },
386
+ userHistory: { type: 'array', items: { type: 'object' } },
387
+ agentHistory: { type: 'array', items: { type: 'object' } }
386
388
  }
387
389
  }
388
390
  },
@@ -11,7 +11,7 @@ export function flattenTemplates(projectSchema) {
11
11
  const newSchema = deepClone(projectSchema);
12
12
  for (const ref of templateRefs) {
13
13
  if (ref.template && isValidTemplate(ref.template)) {
14
- const { shapeName, dependencies } = resolveTemplate(newSchema, ref.template, refItemToNamespacedShapeName(ref));
14
+ const { shapeName, dependencies } = resolveTemplate(newSchema, ref.template, refItemToNamespacedShapeName(newSchema, ref));
15
15
  set(newSchema, ref.path, ref.path[ref.path.length - 1] === '@ref' ? `local:${shapeName}` : shapeName);
16
16
  Object.assign(newSchema.shapes, dependencies);
17
17
  }
package/dist/index.d.ts CHANGED
@@ -43,6 +43,7 @@ export * from './util/form-config.ts';
43
43
  export * from './util/get-conflicting-properties.ts';
44
44
  export * from './util/get-return-shape.ts';
45
45
  export * from './util/has-arg.ts';
46
+ export * from './util/is-asset-property.ts';
46
47
  export * from './util/merge.ts';
47
48
  export * from './util/patch-schema.ts';
48
49
  export * from './util/shapes.ts';
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ export * from "./util/form-config.js";
41
41
  export * from "./util/get-conflicting-properties.js";
42
42
  export * from "./util/get-return-shape.js";
43
43
  export * from "./util/has-arg.js";
44
+ export * from "./util/is-asset-property.js";
44
45
  export * from "./util/merge.js";
45
46
  export * from "./util/patch-schema.js";
46
47
  export * from "./util/shapes.js";
@@ -1,6 +1,8 @@
1
1
  import type { OneOfSchema, ProjectSchemaJSON, PropertySchema, ShapeJSON, ShapeMap } from './project-schema/index.ts';
2
- import type { RefItem, ServicesShapesContext } from './refs.ts';
3
- export declare function isInterfaceShape(shape?: ShapeJSON): boolean;
2
+ import { type RefItem, type ServicesShapesContext } from './refs.ts';
3
+ export declare function isInterfaceShape(shape?: ShapeJSON): shape is ShapeJSON & {
4
+ type: 'interface';
5
+ };
4
6
  export type ImplementationShapeMap = Record<string, Set<ShapeJSON>>;
5
7
  export type ImplementationShapeNameMap = Record<string, Set<string>>;
6
8
  export declare function isInterfaceRef(context: ServicesShapesContext, propertySchema: PropertySchema): boolean;
@@ -1,6 +1,6 @@
1
1
  import { isDefined } from '@takeshape/util';
2
2
  import mapValues from 'lodash/mapValues.js';
3
- import { getRef, normalizeRefExpression, refExpressionToRefItem, refItemToNamespacedShapeName, refItemToShape, shapeToRefItem } from "./refs.js";
3
+ import { getRef, getShapeByRef, normalizeRefExpression, parseRef, refItemToNamespacedShapeName, refItemToShape, shapeToRefItem } from "./refs.js";
4
4
  import { isUnionSchema } from "./unions.js";
5
5
  export function isInterfaceShape(shape) {
6
6
  return shape?.type === 'interface';
@@ -36,7 +36,8 @@ export function pruneUnusedInterfaces(projectSchema, shapeMap) {
36
36
  return mapValues(shapeMap, (shape) => {
37
37
  const { interfaces } = shape;
38
38
  if (interfaces?.length) {
39
- const filteredInterfaces = interfaces.filter((refExpression) => shapeMap[refItemToNamespacedShapeName(refExpressionToRefItem(projectSchema, refExpression))]);
39
+ const context = { ...projectSchema, shapes: shapeMap };
40
+ const filteredInterfaces = interfaces.filter((refExpression) => getShapeByRef(context, refExpression));
40
41
  if (interfaces.length !== filteredInterfaces.length) {
41
42
  return { ...shape, interfaces: filteredInterfaces };
42
43
  }
@@ -45,13 +46,13 @@ export function pruneUnusedInterfaces(projectSchema, shapeMap) {
45
46
  });
46
47
  }
47
48
  function compareRefItems(refItem1, refItem2) {
48
- return refItem1.typeName === refItem2.typeName && refItem1.serviceKey === refItem2.serviceKey;
49
+ return refItem1.shapeName === refItem2.shapeName && refItem1.layerId === refItem2.layerId;
49
50
  }
50
51
  export function getImplementingShapes(context, interfaceRef) {
51
52
  const shapeMap = context.shapes;
52
53
  const implementingShapes = [];
53
54
  for (const shape of Object.values(shapeMap)) {
54
- if (shape.interfaces?.find((interfaceRefExpression) => compareRefItems(refExpressionToRefItem(context, interfaceRefExpression), interfaceRef))) {
55
+ if (shape.interfaces?.find((interfaceRefExpression) => compareRefItems(parseRef(context, interfaceRefExpression), interfaceRef))) {
55
56
  implementingShapes.push(shape);
56
57
  }
57
58
  }
@@ -74,7 +75,7 @@ export function getPossibleShapeNames(projectSchema, shape) {
74
75
  names = shape.schema.oneOf
75
76
  .map((member) => {
76
77
  const ref = getRef(projectSchema, member);
77
- return ref && refItemToNamespacedShapeName(ref);
78
+ return ref && refItemToNamespacedShapeName(projectSchema, ref);
78
79
  })
79
80
  .filter(isDefined);
80
81
  }
@@ -3,15 +3,10 @@ import set from 'lodash/fp/set.js';
3
3
  import unset from 'lodash/fp/unset.js';
4
4
  import upperFirst from 'lodash/upperFirst.js';
5
5
  import { SERVICE_OBJECT_PATTERN_NAME } from "../../constants.js";
6
- import { getRefOrItemsRef } from "../../refs.js";
6
+ import { getRefOrItemsRef, refItemToNamespacedShapeName } from "../../refs.js";
7
7
  import { createSchemaPropertyAccessor } from "../../schema-util.js";
8
8
  import { CURRENT_SCHEMA_VERSION } from "../../schemas/index.js";
9
9
  import { getServiceObjectFields } from "../../services/services.js";
10
- // Inline utilities for posterity
11
- function refItemToShapeName(refItem) {
12
- const { serviceNamespace, typeName } = refItem;
13
- return serviceNamespace ? `${serviceNamespace}_${typeName}` : typeName;
14
- }
15
10
  // Map of form studio widgets and their replacements in the shape editor
16
11
  const widgetMigrations = {
17
12
  object: 'shapeObject',
@@ -39,7 +34,7 @@ export function normalizeForms(projectSchema) {
39
34
  if (propSchema) {
40
35
  const ref = getRefOrItemsRef(projectSchema, propSchema);
41
36
  if (ref && propConfig.properties && propConfig.widget !== 'shopify') {
42
- const nestedShapeName = refItemToShapeName(ref);
37
+ const nestedShapeName = refItemToNamespacedShapeName(projectSchema, ref);
43
38
  normalizedForms[nestedShapeName] = { default: deepClone(propConfig) };
44
39
  storeSourceForm(shapeName, formConfig, propName);
45
40
  normalizeNested(nestedShapeName, propConfig);
@@ -1,4 +1,4 @@
1
- import { dereferenceSchema, getQuery, normalizePropertyRef, normalizeRefExpression, parsePropertyRef, refExpressionToRefItem, refItemToNamespacedShapeName } from "../refs.js";
1
+ import { dereferenceSchema, getQuery, normalizePropertyRef, normalizeRefExpression, parsePropertyRef, parseRef, refItemToNamespacedShapeName } from "../refs.js";
2
2
  import { buildRuntimeSchema } from "../runtime-schema.js";
3
3
  import { getShape } from "../util/shapes.js";
4
4
  import { Query } from './query.js';
@@ -18,16 +18,16 @@ class ProjectSchemaRefResolver {
18
18
  const shapeRef = normalizeRefExpression(this.#runtimeSchemaJson, rawShapeRef);
19
19
  let shape = this.#shapeCache.get(shapeRef);
20
20
  if (!shape) {
21
- const refItem = refExpressionToRefItem(this.#runtimeSchemaJson, rawShapeRef);
21
+ const refItem = parseRef(this.#runtimeSchemaJson, rawShapeRef);
22
22
  if (refItem) {
23
- const namespacedName = refItemToNamespacedShapeName(refItem);
23
+ const namespacedName = refItemToNamespacedShapeName(this.#runtimeSchemaJson, refItem);
24
24
  const shapeJson = getShape(this.#runtimeSchemaJson, namespacedName);
25
25
  if (shapeJson) {
26
26
  shape = new Shape(this, refItem, shapeJson);
27
27
  this.#shapeCache.set(shapeRef, shape);
28
28
  }
29
- else if (refItem.serviceKey !== 'local') {
30
- const layerSchema = this.#layers[refItem.serviceKey]?.schema;
29
+ else if (refItem.layerId !== 'local') {
30
+ const layerSchema = this.#layers[refItem.layerId]?.schema;
31
31
  if (layerSchema) {
32
32
  const shapeJson = getShape(layerSchema, namespacedName);
33
33
  if (shapeJson) {
@@ -51,8 +51,8 @@ class ProjectSchemaRefResolver {
51
51
  }
52
52
  else {
53
53
  const parsedRef = parsePropertyRef(queryRef);
54
- if (parsedRef && parsedRef.serviceId !== 'local') {
55
- const layerSchema = this.#layers[parsedRef.serviceId]?.schema;
54
+ if (parsedRef && parsedRef.layerId !== 'local') {
55
+ const layerSchema = this.#layers[parsedRef.layerId]?.schema;
56
56
  if (layerSchema) {
57
57
  const queryEntry = getQuery(layerSchema, parsedRef.propertyName);
58
58
  if (queryEntry) {
@@ -7,5 +7,6 @@ export declare class Shape {
7
7
  get name(): string;
8
8
  get ref(): string;
9
9
  get refItem(): RefItem;
10
+ get json(): ShapeJSON;
10
11
  getObjectSchema(): import("../project-schema/latest.ts").ObjectSchema | undefined;
11
12
  }
@@ -1,4 +1,4 @@
1
- import { refItemToAtRef } from "../refs.js";
1
+ import { serializeRef } from "../refs.js";
2
2
  import { isObjectSchema } from "../types/utils.js";
3
3
  export class Shape {
4
4
  #refResolver;
@@ -14,11 +14,14 @@ export class Shape {
14
14
  return this.#shape.name;
15
15
  }
16
16
  get ref() {
17
- return refItemToAtRef(this.#ref);
17
+ return serializeRef(this.#ref);
18
18
  }
19
19
  get refItem() {
20
20
  return this.#ref;
21
21
  }
22
+ get json() {
23
+ return this.#shape;
24
+ }
22
25
  getObjectSchema() {
23
26
  if (!this.#dereferencedSchema) {
24
27
  this.#dereferencedSchema = this.#refResolver.dereferenceSchema(this.#shape.schema);
@@ -360,10 +360,11 @@ export type RemovePropertyKeyPatterns = MinimatchPattern[];
360
360
  * Remove Markdown formatting from the LLM response
361
361
  */
362
362
  export type StripMarkdown = boolean;
363
- export type AgentChatHistoryConfig = AgentChatHistoryRetain | AgentChatHistorySummarize | AgentChatHistoryClear;
364
363
  export type AgentStateSessionMemoryLocation = AgentStateSessionMemoryLocationContent | AgentStateSessionMemoryLocationArtifact | AgentStateSessionMemoryLocationStaticValue;
365
364
  export type AgentStateSessionMemory = AgentStateSessionMemoryLocation[];
366
365
  export type GuardID = string;
366
+ export type Variables1 = AgentVariable[];
367
+ export type HistoryStrategyExecution = HistoryStrategyExecutionReplace | HistoryStrategyExecutionSummarize;
367
368
  /**
368
369
  * The human-readable name of the Guard.
369
370
  */
@@ -1763,6 +1764,7 @@ export interface AgentJSON {
1763
1764
  start: AgentStart;
1764
1765
  states: AgentStates;
1765
1766
  guards?: AgentGuard[];
1767
+ historyStrategies?: HistoryStrategyMap;
1766
1768
  }
1767
1769
  export interface AgentAPIChat {
1768
1770
  type: 'chat';
@@ -1800,6 +1802,7 @@ export interface AgentTransitionStep {
1800
1802
  suspend?: boolean;
1801
1803
  condition?: string;
1802
1804
  limit?: number;
1805
+ historyStrategy?: string;
1803
1806
  }
1804
1807
  /**
1805
1808
  * States that are traversed during the execution of an agent.
@@ -1901,19 +1904,8 @@ export interface AgentExecutionChat {
1901
1904
  input: AgentAIStateInput;
1902
1905
  artifact?: string;
1903
1906
  tools?: AgentToolConfig[];
1904
- history?: AgentChatHistoryConfig;
1905
1907
  options?: AgentGenerateOptions;
1906
1908
  }
1907
- export interface AgentChatHistoryRetain {
1908
- type: 'retain';
1909
- }
1910
- export interface AgentChatHistorySummarize {
1911
- type: 'summarize';
1912
- toolCalls: 'retain' | 'clear';
1913
- }
1914
- export interface AgentChatHistoryClear {
1915
- type: 'clear';
1916
- }
1917
1909
  export interface AgentStateSessionMemoryLocationContent {
1918
1910
  type: 'content';
1919
1911
  memoryPath?: string;
@@ -1932,6 +1924,34 @@ export interface AgentStateSessionMemoryLocationStaticValue {
1932
1924
  export interface AgentGuard {
1933
1925
  guardId: GuardID;
1934
1926
  }
1927
+ export interface HistoryStrategyMap {
1928
+ [k: string]: HistoryStrategy;
1929
+ }
1930
+ /**
1931
+ * This interface was referenced by `HistoryStrategyMap`'s JSON-Schema definition
1932
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1933
+ */
1934
+ export interface HistoryStrategy {
1935
+ name: string;
1936
+ variables?: Variables1;
1937
+ filter?: HistoryStrategyFilter;
1938
+ execution: HistoryStrategyExecution;
1939
+ }
1940
+ export interface HistoryStrategyFilter {
1941
+ toolCalls?: 'retain' | 'clear';
1942
+ }
1943
+ export interface HistoryStrategyExecutionReplace {
1944
+ type: 'replace';
1945
+ template: string;
1946
+ }
1947
+ export interface HistoryStrategyExecutionSummarize {
1948
+ type: 'generate';
1949
+ service: string;
1950
+ model: string;
1951
+ systemPrompt: string;
1952
+ tools?: AgentToolConfig[];
1953
+ options?: AgentGenerateOptions;
1954
+ }
1935
1955
  export interface GuardMap {
1936
1956
  [k: string]: GuardJSON;
1937
1957
  }
@@ -335,10 +335,11 @@ export type RemovePropertyKeyPatternsV3_48_0 = MinimatchPatternV3_48_0[];
335
335
  * Remove Markdown formatting from the LLM response
336
336
  */
337
337
  export type StripMarkdownV3_48_0 = boolean;
338
- export type AgentChatHistoryConfigV3_48_0 = AgentChatHistoryRetainV3_48_0 | AgentChatHistorySummarizeV3_48_0 | AgentChatHistoryClearV3_48_0;
339
338
  export type AgentStateSessionMemoryLocationV3_48_0 = AgentStateSessionMemoryLocationContentV3_48_0 | AgentStateSessionMemoryLocationArtifactV3_48_0 | AgentStateSessionMemoryLocationStaticValueV3_48_0;
340
339
  export type AgentStateSessionMemoryV3_48_0 = AgentStateSessionMemoryLocationV3_48_0[];
341
340
  export type GuardIDV3_48_0 = string;
341
+ export type VariablesV3_48_01 = AgentVariableV3_48_0[];
342
+ export type HistoryStrategyExecutionV3_48_0 = HistoryStrategyExecutionReplaceV3_48_0 | HistoryStrategyExecutionSummarizeV3_48_0;
342
343
  /**
343
344
  * The human-readable name of the Guard.
344
345
  */
@@ -1611,6 +1612,7 @@ export interface AgentJSONV3_48_0 {
1611
1612
  start: AgentStartV3_48_0;
1612
1613
  states: AgentStatesV3_48_0;
1613
1614
  guards?: AgentGuardV3_48_0[];
1615
+ historyStrategies?: HistoryStrategyMapV3_48_0;
1614
1616
  }
1615
1617
  export interface AgentAPIChatV3_48_0 {
1616
1618
  type: 'chat';
@@ -1648,6 +1650,7 @@ export interface AgentTransitionStepV3_48_0 {
1648
1650
  suspend?: boolean;
1649
1651
  condition?: string;
1650
1652
  limit?: number;
1653
+ historyStrategy?: string;
1651
1654
  }
1652
1655
  /**
1653
1656
  * States that are traversed during the execution of an agent.
@@ -1749,19 +1752,8 @@ export interface AgentExecutionChatV3_48_0 {
1749
1752
  input: AgentAIStateInputV3_48_0;
1750
1753
  artifact?: string;
1751
1754
  tools?: AgentToolConfigV3_48_0[];
1752
- history?: AgentChatHistoryConfigV3_48_0;
1753
1755
  options?: AgentGenerateOptionsV3_48_0;
1754
1756
  }
1755
- export interface AgentChatHistoryRetainV3_48_0 {
1756
- type: 'retain';
1757
- }
1758
- export interface AgentChatHistorySummarizeV3_48_0 {
1759
- type: 'summarize';
1760
- toolCalls: 'retain' | 'clear';
1761
- }
1762
- export interface AgentChatHistoryClearV3_48_0 {
1763
- type: 'clear';
1764
- }
1765
1757
  export interface AgentStateSessionMemoryLocationContentV3_48_0 {
1766
1758
  type: 'content';
1767
1759
  memoryPath?: string;
@@ -1780,6 +1772,34 @@ export interface AgentStateSessionMemoryLocationStaticValueV3_48_0 {
1780
1772
  export interface AgentGuardV3_48_0 {
1781
1773
  guardId: GuardIDV3_48_0;
1782
1774
  }
1775
+ export interface HistoryStrategyMapV3_48_0 {
1776
+ [k: string]: HistoryStrategyV3_48_0;
1777
+ }
1778
+ /**
1779
+ * This interface was referenced by `HistoryStrategyMapV3_48_0`'s JSON-Schema definition
1780
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1781
+ */
1782
+ export interface HistoryStrategyV3_48_0 {
1783
+ name: string;
1784
+ variables?: VariablesV3_48_01;
1785
+ filter?: HistoryStrategyFilterV3_48_0;
1786
+ execution: HistoryStrategyExecutionV3_48_0;
1787
+ }
1788
+ export interface HistoryStrategyFilterV3_48_0 {
1789
+ toolCalls?: 'retain' | 'clear';
1790
+ }
1791
+ export interface HistoryStrategyExecutionReplaceV3_48_0 {
1792
+ type: 'replace';
1793
+ template: string;
1794
+ }
1795
+ export interface HistoryStrategyExecutionSummarizeV3_48_0 {
1796
+ type: 'generate';
1797
+ service: string;
1798
+ model: string;
1799
+ systemPrompt: string;
1800
+ tools?: AgentToolConfigV3_48_0[];
1801
+ options?: AgentGenerateOptionsV3_48_0;
1802
+ }
1783
1803
  export interface GuardMapV3_48_0 {
1784
1804
  [k: string]: GuardJSONV3_48_0;
1785
1805
  }
@@ -335,10 +335,11 @@ export type RemovePropertyKeyPatternsV3_49_0 = MinimatchPatternV3_49_0[];
335
335
  * Remove Markdown formatting from the LLM response
336
336
  */
337
337
  export type StripMarkdownV3_49_0 = boolean;
338
- export type AgentChatHistoryConfigV3_49_0 = AgentChatHistoryRetainV3_49_0 | AgentChatHistorySummarizeV3_49_0 | AgentChatHistoryClearV3_49_0;
339
338
  export type AgentStateSessionMemoryLocationV3_49_0 = AgentStateSessionMemoryLocationContentV3_49_0 | AgentStateSessionMemoryLocationArtifactV3_49_0 | AgentStateSessionMemoryLocationStaticValueV3_49_0;
340
339
  export type AgentStateSessionMemoryV3_49_0 = AgentStateSessionMemoryLocationV3_49_0[];
341
340
  export type GuardIDV3_49_0 = string;
341
+ export type VariablesV3_49_01 = AgentVariableV3_49_0[];
342
+ export type HistoryStrategyExecutionV3_49_0 = HistoryStrategyExecutionReplaceV3_49_0 | HistoryStrategyExecutionSummarizeV3_49_0;
342
343
  /**
343
344
  * The human-readable name of the Guard.
344
345
  */
@@ -1611,6 +1612,7 @@ export interface AgentJSONV3_49_0 {
1611
1612
  start: AgentStartV3_49_0;
1612
1613
  states: AgentStatesV3_49_0;
1613
1614
  guards?: AgentGuardV3_49_0[];
1615
+ historyStrategies?: HistoryStrategyMapV3_49_0;
1614
1616
  }
1615
1617
  export interface AgentAPIChatV3_49_0 {
1616
1618
  type: 'chat';
@@ -1648,6 +1650,7 @@ export interface AgentTransitionStepV3_49_0 {
1648
1650
  suspend?: boolean;
1649
1651
  condition?: string;
1650
1652
  limit?: number;
1653
+ historyStrategy?: string;
1651
1654
  }
1652
1655
  /**
1653
1656
  * States that are traversed during the execution of an agent.
@@ -1749,19 +1752,8 @@ export interface AgentExecutionChatV3_49_0 {
1749
1752
  input: AgentAIStateInputV3_49_0;
1750
1753
  artifact?: string;
1751
1754
  tools?: AgentToolConfigV3_49_0[];
1752
- history?: AgentChatHistoryConfigV3_49_0;
1753
1755
  options?: AgentGenerateOptionsV3_49_0;
1754
1756
  }
1755
- export interface AgentChatHistoryRetainV3_49_0 {
1756
- type: 'retain';
1757
- }
1758
- export interface AgentChatHistorySummarizeV3_49_0 {
1759
- type: 'summarize';
1760
- toolCalls: 'retain' | 'clear';
1761
- }
1762
- export interface AgentChatHistoryClearV3_49_0 {
1763
- type: 'clear';
1764
- }
1765
1757
  export interface AgentStateSessionMemoryLocationContentV3_49_0 {
1766
1758
  type: 'content';
1767
1759
  memoryPath?: string;
@@ -1780,6 +1772,34 @@ export interface AgentStateSessionMemoryLocationStaticValueV3_49_0 {
1780
1772
  export interface AgentGuardV3_49_0 {
1781
1773
  guardId: GuardIDV3_49_0;
1782
1774
  }
1775
+ export interface HistoryStrategyMapV3_49_0 {
1776
+ [k: string]: HistoryStrategyV3_49_0;
1777
+ }
1778
+ /**
1779
+ * This interface was referenced by `HistoryStrategyMapV3_49_0`'s JSON-Schema definition
1780
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1781
+ */
1782
+ export interface HistoryStrategyV3_49_0 {
1783
+ name: string;
1784
+ variables?: VariablesV3_49_01;
1785
+ filter?: HistoryStrategyFilterV3_49_0;
1786
+ execution: HistoryStrategyExecutionV3_49_0;
1787
+ }
1788
+ export interface HistoryStrategyFilterV3_49_0 {
1789
+ toolCalls?: 'retain' | 'clear';
1790
+ }
1791
+ export interface HistoryStrategyExecutionReplaceV3_49_0 {
1792
+ type: 'replace';
1793
+ template: string;
1794
+ }
1795
+ export interface HistoryStrategyExecutionSummarizeV3_49_0 {
1796
+ type: 'generate';
1797
+ service: string;
1798
+ model: string;
1799
+ systemPrompt: string;
1800
+ tools?: AgentToolConfigV3_49_0[];
1801
+ options?: AgentGenerateOptionsV3_49_0;
1802
+ }
1783
1803
  export interface GuardMapV3_49_0 {
1784
1804
  [k: string]: GuardJSONV3_49_0;
1785
1805
  }
@@ -347,10 +347,11 @@ export type RemovePropertyKeyPatternsV3_50_0 = MinimatchPatternV3_50_0[];
347
347
  * Remove Markdown formatting from the LLM response
348
348
  */
349
349
  export type StripMarkdownV3_50_0 = boolean;
350
- export type AgentChatHistoryConfigV3_50_0 = AgentChatHistoryRetainV3_50_0 | AgentChatHistorySummarizeV3_50_0 | AgentChatHistoryClearV3_50_0;
351
350
  export type AgentStateSessionMemoryLocationV3_50_0 = AgentStateSessionMemoryLocationContentV3_50_0 | AgentStateSessionMemoryLocationArtifactV3_50_0 | AgentStateSessionMemoryLocationStaticValueV3_50_0;
352
351
  export type AgentStateSessionMemoryV3_50_0 = AgentStateSessionMemoryLocationV3_50_0[];
353
352
  export type GuardIDV3_50_0 = string;
353
+ export type VariablesV3_50_01 = AgentVariableV3_50_0[];
354
+ export type HistoryStrategyExecutionV3_50_0 = HistoryStrategyExecutionReplaceV3_50_0 | HistoryStrategyExecutionSummarizeV3_50_0;
354
355
  /**
355
356
  * The human-readable name of the Guard.
356
357
  */
@@ -1663,6 +1664,7 @@ export interface AgentJSONV3_50_0 {
1663
1664
  start: AgentStartV3_50_0;
1664
1665
  states: AgentStatesV3_50_0;
1665
1666
  guards?: AgentGuardV3_50_0[];
1667
+ historyStrategies?: HistoryStrategyMapV3_50_0;
1666
1668
  }
1667
1669
  export interface AgentAPIChatV3_50_0 {
1668
1670
  type: 'chat';
@@ -1700,6 +1702,7 @@ export interface AgentTransitionStepV3_50_0 {
1700
1702
  suspend?: boolean;
1701
1703
  condition?: string;
1702
1704
  limit?: number;
1705
+ historyStrategy?: string;
1703
1706
  }
1704
1707
  /**
1705
1708
  * States that are traversed during the execution of an agent.
@@ -1801,19 +1804,8 @@ export interface AgentExecutionChatV3_50_0 {
1801
1804
  input: AgentAIStateInputV3_50_0;
1802
1805
  artifact?: string;
1803
1806
  tools?: AgentToolConfigV3_50_0[];
1804
- history?: AgentChatHistoryConfigV3_50_0;
1805
1807
  options?: AgentGenerateOptionsV3_50_0;
1806
1808
  }
1807
- export interface AgentChatHistoryRetainV3_50_0 {
1808
- type: 'retain';
1809
- }
1810
- export interface AgentChatHistorySummarizeV3_50_0 {
1811
- type: 'summarize';
1812
- toolCalls: 'retain' | 'clear';
1813
- }
1814
- export interface AgentChatHistoryClearV3_50_0 {
1815
- type: 'clear';
1816
- }
1817
1809
  export interface AgentStateSessionMemoryLocationContentV3_50_0 {
1818
1810
  type: 'content';
1819
1811
  memoryPath?: string;
@@ -1832,6 +1824,34 @@ export interface AgentStateSessionMemoryLocationStaticValueV3_50_0 {
1832
1824
  export interface AgentGuardV3_50_0 {
1833
1825
  guardId: GuardIDV3_50_0;
1834
1826
  }
1827
+ export interface HistoryStrategyMapV3_50_0 {
1828
+ [k: string]: HistoryStrategyV3_50_0;
1829
+ }
1830
+ /**
1831
+ * This interface was referenced by `HistoryStrategyMapV3_50_0`'s JSON-Schema definition
1832
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1833
+ */
1834
+ export interface HistoryStrategyV3_50_0 {
1835
+ name: string;
1836
+ variables?: VariablesV3_50_01;
1837
+ filter?: HistoryStrategyFilterV3_50_0;
1838
+ execution: HistoryStrategyExecutionV3_50_0;
1839
+ }
1840
+ export interface HistoryStrategyFilterV3_50_0 {
1841
+ toolCalls?: 'retain' | 'clear';
1842
+ }
1843
+ export interface HistoryStrategyExecutionReplaceV3_50_0 {
1844
+ type: 'replace';
1845
+ template: string;
1846
+ }
1847
+ export interface HistoryStrategyExecutionSummarizeV3_50_0 {
1848
+ type: 'generate';
1849
+ service: string;
1850
+ model: string;
1851
+ systemPrompt: string;
1852
+ tools?: AgentToolConfigV3_50_0[];
1853
+ options?: AgentGenerateOptionsV3_50_0;
1854
+ }
1835
1855
  export interface GuardMapV3_50_0 {
1836
1856
  [k: string]: GuardJSONV3_50_0;
1837
1857
  }
@@ -347,10 +347,11 @@ export type RemovePropertyKeyPatternsV3_51_0 = MinimatchPatternV3_51_0[];
347
347
  * Remove Markdown formatting from the LLM response
348
348
  */
349
349
  export type StripMarkdownV3_51_0 = boolean;
350
- export type AgentChatHistoryConfigV3_51_0 = AgentChatHistoryRetainV3_51_0 | AgentChatHistorySummarizeV3_51_0 | AgentChatHistoryClearV3_51_0;
351
350
  export type AgentStateSessionMemoryLocationV3_51_0 = AgentStateSessionMemoryLocationContentV3_51_0 | AgentStateSessionMemoryLocationArtifactV3_51_0 | AgentStateSessionMemoryLocationStaticValueV3_51_0;
352
351
  export type AgentStateSessionMemoryV3_51_0 = AgentStateSessionMemoryLocationV3_51_0[];
353
352
  export type GuardIDV3_51_0 = string;
353
+ export type VariablesV3_51_01 = AgentVariableV3_51_0[];
354
+ export type HistoryStrategyExecutionV3_51_0 = HistoryStrategyExecutionReplaceV3_51_0 | HistoryStrategyExecutionSummarizeV3_51_0;
354
355
  /**
355
356
  * The human-readable name of the Guard.
356
357
  */
@@ -1663,6 +1664,7 @@ export interface AgentJSONV3_51_0 {
1663
1664
  start: AgentStartV3_51_0;
1664
1665
  states: AgentStatesV3_51_0;
1665
1666
  guards?: AgentGuardV3_51_0[];
1667
+ historyStrategies?: HistoryStrategyMapV3_51_0;
1666
1668
  }
1667
1669
  export interface AgentAPIChatV3_51_0 {
1668
1670
  type: 'chat';
@@ -1700,6 +1702,7 @@ export interface AgentTransitionStepV3_51_0 {
1700
1702
  suspend?: boolean;
1701
1703
  condition?: string;
1702
1704
  limit?: number;
1705
+ historyStrategy?: string;
1703
1706
  }
1704
1707
  /**
1705
1708
  * States that are traversed during the execution of an agent.
@@ -1801,19 +1804,8 @@ export interface AgentExecutionChatV3_51_0 {
1801
1804
  input: AgentAIStateInputV3_51_0;
1802
1805
  artifact?: string;
1803
1806
  tools?: AgentToolConfigV3_51_0[];
1804
- history?: AgentChatHistoryConfigV3_51_0;
1805
1807
  options?: AgentGenerateOptionsV3_51_0;
1806
1808
  }
1807
- export interface AgentChatHistoryRetainV3_51_0 {
1808
- type: 'retain';
1809
- }
1810
- export interface AgentChatHistorySummarizeV3_51_0 {
1811
- type: 'summarize';
1812
- toolCalls: 'retain' | 'clear';
1813
- }
1814
- export interface AgentChatHistoryClearV3_51_0 {
1815
- type: 'clear';
1816
- }
1817
1809
  export interface AgentStateSessionMemoryLocationContentV3_51_0 {
1818
1810
  type: 'content';
1819
1811
  memoryPath?: string;
@@ -1832,6 +1824,34 @@ export interface AgentStateSessionMemoryLocationStaticValueV3_51_0 {
1832
1824
  export interface AgentGuardV3_51_0 {
1833
1825
  guardId: GuardIDV3_51_0;
1834
1826
  }
1827
+ export interface HistoryStrategyMapV3_51_0 {
1828
+ [k: string]: HistoryStrategyV3_51_0;
1829
+ }
1830
+ /**
1831
+ * This interface was referenced by `HistoryStrategyMapV3_51_0`'s JSON-Schema definition
1832
+ * via the `patternProperty` "^[0-9A-Za-z_]+$".
1833
+ */
1834
+ export interface HistoryStrategyV3_51_0 {
1835
+ name: string;
1836
+ variables?: VariablesV3_51_01;
1837
+ filter?: HistoryStrategyFilterV3_51_0;
1838
+ execution: HistoryStrategyExecutionV3_51_0;
1839
+ }
1840
+ export interface HistoryStrategyFilterV3_51_0 {
1841
+ toolCalls?: 'retain' | 'clear';
1842
+ }
1843
+ export interface HistoryStrategyExecutionReplaceV3_51_0 {
1844
+ type: 'replace';
1845
+ template: string;
1846
+ }
1847
+ export interface HistoryStrategyExecutionSummarizeV3_51_0 {
1848
+ type: 'generate';
1849
+ service: string;
1850
+ model: string;
1851
+ systemPrompt: string;
1852
+ tools?: AgentToolConfigV3_51_0[];
1853
+ options?: AgentGenerateOptionsV3_51_0;
1854
+ }
1835
1855
  export interface GuardMapV3_51_0 {
1836
1856
  [k: string]: GuardJSONV3_51_0;
1837
1857
  }