@theokit/sdk 2.19.0 → 2.20.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/CHANGELOG.md +8 -0
- package/dist/a2a/index.cjs +42 -7
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +42 -7
- package/dist/a2a/index.js.map +1 -1
- package/dist/create-skill.d.ts +29 -0
- package/dist/{cron-D_wK1S-0.d.cts → cron-B8fqui49.d.cts} +58 -1
- package/dist/{cron-Cep07kTz.d.ts → cron-D2yLOrk2.d.ts} +58 -1
- package/dist/cron.cjs +42 -7
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +42 -7
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +42 -7
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +42 -7
- package/dist/eval.js.map +1 -1
- package/dist/generate-object.d.ts +16 -2
- package/dist/index.cjs +105 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +104 -8
- package/dist/index.js.map +1 -1
- package/dist/types/agent.d.ts +10 -0
- package/package.json +14 -14
package/dist/a2a/index.js
CHANGED
|
@@ -6804,23 +6804,27 @@ var init_skills_manager = __esm({
|
|
|
6804
6804
|
"src/internal/runtime/skills/skills-manager.ts"() {
|
|
6805
6805
|
init_discover_skills();
|
|
6806
6806
|
SkillsManager = class {
|
|
6807
|
-
constructor(cwd, _enabled, settingSourcesIncludeProject) {
|
|
6807
|
+
constructor(cwd, _enabled, settingSourcesIncludeProject, skillsDir, inline) {
|
|
6808
6808
|
this.cwd = cwd;
|
|
6809
6809
|
this.settingSourcesIncludeProject = settingSourcesIncludeProject;
|
|
6810
|
+
this.skillsDir = skillsDir;
|
|
6811
|
+
this.inline = inline;
|
|
6810
6812
|
}
|
|
6811
6813
|
cwd;
|
|
6812
6814
|
settingSourcesIncludeProject;
|
|
6815
|
+
skillsDir;
|
|
6816
|
+
inline;
|
|
6813
6817
|
skills = [];
|
|
6814
6818
|
async initialize() {
|
|
6815
6819
|
if (!this.settingSourcesIncludeProject) {
|
|
6816
|
-
this.skills = [];
|
|
6820
|
+
this.skills = this.mergeInline([]);
|
|
6817
6821
|
return;
|
|
6818
6822
|
}
|
|
6819
6823
|
await this.refresh();
|
|
6820
6824
|
}
|
|
6821
6825
|
async refresh() {
|
|
6822
|
-
const skillsRoot = join(this.cwd, ".theokit", "skills");
|
|
6823
|
-
|
|
6826
|
+
const skillsRoot = this.skillsDir ?? join(this.cwd, ".theokit", "skills");
|
|
6827
|
+
const discovered = await discoverSkills(skillsRoot, {
|
|
6824
6828
|
onInvalidSkill: (info) => {
|
|
6825
6829
|
process.stderr.write(
|
|
6826
6830
|
`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
|
|
@@ -6828,6 +6832,13 @@ var init_skills_manager = __esm({
|
|
|
6828
6832
|
);
|
|
6829
6833
|
}
|
|
6830
6834
|
});
|
|
6835
|
+
this.skills = this.mergeInline(discovered);
|
|
6836
|
+
}
|
|
6837
|
+
/** M22 — merge inline skills over discovered ones; inline wins on a name conflict. */
|
|
6838
|
+
mergeInline(discovered) {
|
|
6839
|
+
if (this.inline === void 0 || this.inline.length === 0) return discovered;
|
|
6840
|
+
const inlineNames = new Set(this.inline.map((s) => s.name));
|
|
6841
|
+
return [...discovered.filter((s) => !inlineNames.has(s.name)), ...this.inline];
|
|
6831
6842
|
}
|
|
6832
6843
|
list() {
|
|
6833
6844
|
return Promise.resolve(this.skills);
|
|
@@ -6874,7 +6885,10 @@ function bootstrapSubmanagers(args) {
|
|
|
6874
6885
|
out.skillsManager = new SkillsManager(
|
|
6875
6886
|
args.workspaceCwd,
|
|
6876
6887
|
args.options.skills?.enabled,
|
|
6877
|
-
args.settingSourcesIncludeProject
|
|
6888
|
+
args.settingSourcesIncludeProject,
|
|
6889
|
+
// M22 — custom skills directory + inline (code-defined) skills.
|
|
6890
|
+
args.options.skills?.skillsDir,
|
|
6891
|
+
args.options.skills?.inline
|
|
6878
6892
|
);
|
|
6879
6893
|
const localSkills = out.skillsManager;
|
|
6880
6894
|
out.skills = { list: () => localSkills.list() };
|
|
@@ -17167,6 +17181,24 @@ function salvagePartial(schema, raw) {
|
|
|
17167
17181
|
}
|
|
17168
17182
|
return out;
|
|
17169
17183
|
}
|
|
17184
|
+
async function runReasoningPhase(options, deps) {
|
|
17185
|
+
const reasoningOptions = {
|
|
17186
|
+
model: options.model,
|
|
17187
|
+
local: options.local,
|
|
17188
|
+
...options.systemPrompt !== void 0 ? { systemPrompt: options.systemPrompt } : {},
|
|
17189
|
+
...options.apiKey !== void 0 ? { apiKey: options.apiKey } : {},
|
|
17190
|
+
...options.providers !== void 0 ? { providers: options.providers } : {}
|
|
17191
|
+
};
|
|
17192
|
+
const reasoningAgent = await deps.create(reasoningOptions);
|
|
17193
|
+
try {
|
|
17194
|
+
const run = await reasoningAgent.send(options.prompt);
|
|
17195
|
+
const result = await run.wait();
|
|
17196
|
+
const text = result.result;
|
|
17197
|
+
return typeof text === "string" ? text : options.prompt;
|
|
17198
|
+
} finally {
|
|
17199
|
+
await disposeAndDeleteTransient(reasoningAgent, deps.delete);
|
|
17200
|
+
}
|
|
17201
|
+
}
|
|
17170
17202
|
async function generateObjectImpl(options, deps) {
|
|
17171
17203
|
const { jsonSchema, maxRetries, initialUsage } = setupStructuredOutput(
|
|
17172
17204
|
options.schema,
|
|
@@ -17189,8 +17221,11 @@ async function generateObjectImpl(options, deps) {
|
|
|
17189
17221
|
}
|
|
17190
17222
|
throw new CaptureSentinel(input);
|
|
17191
17223
|
});
|
|
17224
|
+
const reasoningText = options.structuringModel !== void 0 ? await runReasoningPhase(options, deps) : void 0;
|
|
17225
|
+
const structuringModel = options.structuringModel ?? options.model;
|
|
17226
|
+
const structuringPrompt = reasoningText ?? options.prompt;
|
|
17192
17227
|
const agentOptions = buildTransientAgentOptions({
|
|
17193
|
-
model:
|
|
17228
|
+
model: structuringModel,
|
|
17194
17229
|
local: options.local,
|
|
17195
17230
|
outputTool,
|
|
17196
17231
|
...options.systemPrompt !== void 0 ? { systemPrompt: options.systemPrompt } : {},
|
|
@@ -17199,7 +17234,7 @@ async function generateObjectImpl(options, deps) {
|
|
|
17199
17234
|
});
|
|
17200
17235
|
const agent = await deps.create(agentOptions);
|
|
17201
17236
|
try {
|
|
17202
|
-
const userMessage = buildToolPrompt(
|
|
17237
|
+
const userMessage = buildToolPrompt(structuringPrompt);
|
|
17203
17238
|
let lastParseError;
|
|
17204
17239
|
for (let attempt = 0; attempt <= maxRetries; attempt += 1) {
|
|
17205
17240
|
capturedRaw = void 0;
|