Support: the aggregate entry for recommended usage
Support aggregates recommended construction, policies, and same-source configuration generation; Core execution does not depend on this namespace.
The most common import is the Support namespace from the root entry. When module dependencies are already clear, the needed implementations can also be imported explicitly from /support, /support/model, or /support/context. These are different navigation entries to the same public implementations, not different execution layers.
The inputs, completion, policies, and examples of each constructor are expanded in the corresponding entries; the whole of Support does not need to be learned before running an Agent. Implementations as plain objects or classes are equally valid as long as they satisfy the Core contract, and Support products do not need to be converted into plain objects.
Progressive examples for the same business case
Use the recommended implementation through the aggregate namespace
Beginner · Node.js
import { Support } from '@jangts/agent-core';
const schema = Support.defineSchema({ jsonSchema: { type: 'string' },
parse(value: unknown) { if (typeof value !== 'string') throw new TypeError('需要文本'); return value; },
});
console.log(schema.parse('你好'));2
3
4
5
import { Support } from '@jangts/agent-core';
const schema = Support.defineSchema({ jsonSchema: { type: 'string' },
parse(value) { if (typeof value !== 'string')
throw new TypeError('需要文本'); return value; },
});
console.log(schema.parse('你好'));2
3
4
5
6
Change only the import granularity; contract and call stay the same
Configuration · Node.js
import { defineSchema } from '@jangts/agent-core/support';
const schema = defineSchema({ jsonSchema: { type: 'string' },
parse(value: unknown) { if (typeof value !== 'string') throw new TypeError('需要文本'); return value; },
});
console.log(schema.parse('你好'));2
3
4
5
import { defineSchema } from '@jangts/agent-core/support';
const schema = defineSchema({ jsonSchema: { type: 'string' },
parse(value) { if (typeof value !== 'string')
throw new TypeError('需要文本'); return value; },
});
console.log(schema.parse('你好'));2
3
4
5
6