@takeshape/schema 11.38.0 → 11.40.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.
package/dist/agents.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { type AgentJSON } from './project-schema';
1
+ import { type AgentAPIArgument, type AgentJSON } from './project-schema';
2
2
  export declare const END_AGENT_EXECUTION = "endAgentExecution";
3
+ export declare const BUILT_IN_CHAT_ARGS: AgentAPIArgument[];
4
+ export declare const BUILT_IN_CHAT_ARG_NAMES: string[];
3
5
  export type AgentEndTransition = {
4
6
  type: 'done' | 'progress';
5
7
  originStateId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/agents.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,SAAS,EAA4B,MAAM,kBAAkB,CAAC;AAE3E,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAwBF,eAAO,MAAM,sBAAsB,UAAW,SAAS,+BAA2B,kBAAkB,EAUnG,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAW,SAAS,+BAA2B,IAAI,MAAM,CAKtF,CAAC;AAEF,eAAO,MAAM,+BAA+B,cAAe,MAAM,KAAG,MAEnE,CAAC"}
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/agents.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAA4B,MAAM,kBAAkB,CAAC;AAElG,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAUhD,CAAC;AAEF,eAAO,MAAM,uBAAuB,UAA6C,CAAC;AAElF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAwBF,eAAO,MAAM,sBAAsB,UAAW,SAAS,+BAA2B,kBAAkB,EAUnG,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAW,SAAS,+BAA2B,IAAI,MAAM,CAKtF,CAAC;AAEF,eAAO,MAAM,+BAA+B,cAAe,MAAM,KAAG,MAEnE,CAAC"}
package/dist/agents.js CHANGED
@@ -3,10 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getInspectAgentSessionQueryName = exports.getAgentEndTransitions = exports.getAgentEndStates = exports.END_AGENT_EXECUTION = void 0;
6
+ exports.getInspectAgentSessionQueryName = exports.getAgentEndTransitions = exports.getAgentEndStates = exports.END_AGENT_EXECUTION = exports.BUILT_IN_CHAT_ARG_NAMES = exports.BUILT_IN_CHAT_ARGS = void 0;
7
7
  var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  const END_AGENT_EXECUTION = exports.END_AGENT_EXECUTION = 'endAgentExecution';
10
+ const BUILT_IN_CHAT_ARGS = exports.BUILT_IN_CHAT_ARGS = [{
11
+ argName: 'input',
12
+ argType: 'string',
13
+ required: true
14
+ }, {
15
+ argName: 'sessionId',
16
+ argType: 'sessionId'
17
+ }];
18
+ const BUILT_IN_CHAT_ARG_NAMES = exports.BUILT_IN_CHAT_ARG_NAMES = BUILT_IN_CHAT_ARGS.map(arg => arg.argName);
10
19
  const transitionCanEnd = (transition, includeSuspend = false) => {
11
20
  if (!transition || transition.length === 0) {
12
21
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-schema.d.ts","sourceRoot":"","sources":["../../src/builtin-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAC,KAAK,OAAO,EAAC,MAAM,eAAe,CAAC;AAE3C,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEjD;AAID,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEnE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAEnE;AAED,eAAO,MAAM,SAAS,EAAE,SAKvB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QA0X3B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,OAsN1B,CAAC"}
1
+ {"version":3,"file":"builtin-schema.d.ts","sourceRoot":"","sources":["../../src/builtin-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAC,KAAK,OAAO,EAAC,MAAM,eAAe,CAAC;AAE3C,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEjD;AAID,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEnE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAEnE;AAED,eAAO,MAAM,SAAS,EAAE,SAKvB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QA2X3B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,OAsN1B,CAAC"}
@@ -425,6 +425,9 @@ const builtInShapes = exports.builtInShapes = {
425
425
  },
426
426
  done: {
427
427
  type: 'boolean'
428
+ },
429
+ artifact: {
430
+ type: 'object'
428
431
  }
429
432
  },
430
433
  required: ['content']
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "required": ["type"],
58
58
  "additionalProperties": false
59
- },
59
+ },
60
60
  "agentApiGenerate": {
61
61
  "title": "Agent API Generate",
62
62
  "type": "object",
@@ -73,7 +73,7 @@
73
73
  },
74
74
  "required": ["type"],
75
75
  "additionalProperties": false
76
- },
76
+ },
77
77
  "agentVariable": {
78
78
  "title": "Agent Variable",
79
79
  "type": "object",
@@ -263,7 +263,8 @@
263
263
  "type": "object",
264
264
  "properties": {
265
265
  "name": {
266
- "type": "string"
266
+ "type": "string",
267
+ "pattern": "^[a-zA-Z][0-9A-Za-z_]*$"
267
268
  },
268
269
  "variables": {
269
270
  "title": "Variables",
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAC,MAAM,KAAK,CAAC;AAGvD,OAAO,EAAwB,KAAK,yBAAyB,EAAC,MAAM,mBAAmB,CAAC;AAMxF,OAAO,EAEL,KAAK,YAAY,EAKlB,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,WAAW,CAAC;AA6B3C,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EAelB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAC,mBAAmB,EAAE,UAAU,EAAc,MAAM,eAAe,CAAC;AAChF,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAM1D,eAAO,MAAM,iBAAiB,aAAiE,CAAC;AA0gChG,MAAM,MAAM,sBAAsB,GAC9B;IAAC,KAAK,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAC,GAC9D;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,yBAAyB,EAAE,CAAA;CAAC,CAAC;AAE3E,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,yBAAyB,CAuB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C;IAAC,MAAM,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAC,GAC7D;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,yBAAyB,EAAE,CAAA;CAAC,CAAC;AAE3E;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,OAAO,GAAG,mCAAmC,CAIrG;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,OAAO,GAAG,mBAAmB,CAQxF"}
package/dist/validate.js CHANGED
@@ -809,13 +809,24 @@ function validateAgents(projectSchema) {
809
809
  return errors;
810
810
  }
811
811
  for (const [agentName, agent] of Object.entries(agents)) {
812
+ const stateNames = new Set();
812
813
  for (const [stateId, state] of Object.entries(agent.states)) {
814
+ const statePath = ['ai-experimental', 'agents', agentName, 'states', stateId];
815
+ if (stateNames.has(state.name)) {
816
+ errors.push({
817
+ path: [...statePath, 'name'],
818
+ type: 'conflict',
819
+ message: `Duplicate state name "${state.name}"`
820
+ });
821
+ } else {
822
+ stateNames.add(state.name);
823
+ }
813
824
  if (state.execution.type === 'generate' || state.execution.type === 'chat') {
814
825
  if (!state.execution.tools) {
815
826
  continue;
816
827
  }
817
828
  state.execution.tools.forEach((tool, toolIndex) => {
818
- pushErrors(errors, validateAIToolConfig(projectSchema, getNamespace, tool, ['ai-experimental', 'agents', agentName, 'states', stateId, 'execution', 'tools', toolIndex, 'ref']));
829
+ pushErrors(errors, validateAIToolConfig(projectSchema, getNamespace, tool, [...statePath, 'execution', 'tools', toolIndex, 'ref']));
819
830
  });
820
831
  }
821
832
  }
package/es/agents.js CHANGED
@@ -1,5 +1,14 @@
1
1
  import upperFirst from 'lodash/upperFirst';
2
2
  export const END_AGENT_EXECUTION = 'endAgentExecution';
3
+ export const BUILT_IN_CHAT_ARGS = [{
4
+ argName: 'input',
5
+ argType: 'string',
6
+ required: true
7
+ }, {
8
+ argName: 'sessionId',
9
+ argType: 'sessionId'
10
+ }];
11
+ export const BUILT_IN_CHAT_ARG_NAMES = BUILT_IN_CHAT_ARGS.map(arg => arg.argName);
3
12
  const transitionCanEnd = (transition, includeSuspend = false) => {
4
13
  if (!transition || transition.length === 0) {
5
14
  return true;
@@ -415,6 +415,9 @@ export const builtInShapes = {
415
415
  },
416
416
  done: {
417
417
  type: 'boolean'
418
+ },
419
+ artifact: {
420
+ type: 'object'
418
421
  }
419
422
  },
420
423
  required: ['content']
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "required": ["type"],
58
58
  "additionalProperties": false
59
- },
59
+ },
60
60
  "agentApiGenerate": {
61
61
  "title": "Agent API Generate",
62
62
  "type": "object",
@@ -73,7 +73,7 @@
73
73
  },
74
74
  "required": ["type"],
75
75
  "additionalProperties": false
76
- },
76
+ },
77
77
  "agentVariable": {
78
78
  "title": "Agent Variable",
79
79
  "type": "object",
@@ -263,7 +263,8 @@
263
263
  "type": "object",
264
264
  "properties": {
265
265
  "name": {
266
- "type": "string"
266
+ "type": "string",
267
+ "pattern": "^[a-zA-Z][0-9A-Za-z_]*$"
267
268
  },
268
269
  "variables": {
269
270
  "title": "Variables",
package/es/validate.js CHANGED
@@ -794,13 +794,24 @@ function validateAgents(projectSchema) {
794
794
  return errors;
795
795
  }
796
796
  for (const [agentName, agent] of Object.entries(agents)) {
797
+ const stateNames = new Set();
797
798
  for (const [stateId, state] of Object.entries(agent.states)) {
799
+ const statePath = ['ai-experimental', 'agents', agentName, 'states', stateId];
800
+ if (stateNames.has(state.name)) {
801
+ errors.push({
802
+ path: [...statePath, 'name'],
803
+ type: 'conflict',
804
+ message: `Duplicate state name "${state.name}"`
805
+ });
806
+ } else {
807
+ stateNames.add(state.name);
808
+ }
798
809
  if (state.execution.type === 'generate' || state.execution.type === 'chat') {
799
810
  if (!state.execution.tools) {
800
811
  continue;
801
812
  }
802
813
  state.execution.tools.forEach((tool, toolIndex) => {
803
- pushErrors(errors, validateAIToolConfig(projectSchema, getNamespace, tool, ['ai-experimental', 'agents', agentName, 'states', stateId, 'execution', 'tools', toolIndex, 'ref']));
814
+ pushErrors(errors, validateAIToolConfig(projectSchema, getNamespace, tool, [...statePath, 'execution', 'tools', toolIndex, 'ref']));
804
815
  });
805
816
  }
806
817
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/schema",
3
- "version": "11.38.0",
3
+ "version": "11.40.0",
4
4
  "description": "TakeShape Schema",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {
@@ -28,9 +28,9 @@
28
28
  "p-reduce": "^2.1.0",
29
29
  "semver": "^7.3.2",
30
30
  "tiny-invariant": "^1.2.0",
31
- "@takeshape/errors": "11.38.0",
32
- "@takeshape/json-schema": "11.38.0",
33
- "@takeshape/util": "11.38.0"
31
+ "@takeshape/errors": "11.40.0",
32
+ "@takeshape/json-schema": "11.40.0",
33
+ "@takeshape/util": "11.40.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@takeshape/json-schema-to-typescript": "^11.0.0",
@@ -46,7 +46,7 @@
46
46
  "meow": "^9.0.0",
47
47
  "p-map": "^5.0.0",
48
48
  "shortid": "^2.2.15",
49
- "@takeshape/infra": "11.38.0"
49
+ "@takeshape/infra": "11.40.0"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=20"