@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/eval.cjs
CHANGED
|
@@ -2268,6 +2268,24 @@ function salvagePartial(schema, raw) {
|
|
|
2268
2268
|
}
|
|
2269
2269
|
return out;
|
|
2270
2270
|
}
|
|
2271
|
+
async function runReasoningPhase(options, deps) {
|
|
2272
|
+
const reasoningOptions = {
|
|
2273
|
+
model: options.model,
|
|
2274
|
+
local: options.local,
|
|
2275
|
+
...options.systemPrompt !== void 0 ? { systemPrompt: options.systemPrompt } : {},
|
|
2276
|
+
...options.apiKey !== void 0 ? { apiKey: options.apiKey } : {},
|
|
2277
|
+
...options.providers !== void 0 ? { providers: options.providers } : {}
|
|
2278
|
+
};
|
|
2279
|
+
const reasoningAgent = await deps.create(reasoningOptions);
|
|
2280
|
+
try {
|
|
2281
|
+
const run = await reasoningAgent.send(options.prompt);
|
|
2282
|
+
const result = await run.wait();
|
|
2283
|
+
const text = result.result;
|
|
2284
|
+
return typeof text === "string" ? text : options.prompt;
|
|
2285
|
+
} finally {
|
|
2286
|
+
await disposeAndDeleteTransient(reasoningAgent, deps.delete);
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2271
2289
|
async function generateObjectImpl(options, deps) {
|
|
2272
2290
|
const { jsonSchema, maxRetries, initialUsage } = setupStructuredOutput(
|
|
2273
2291
|
options.schema,
|
|
@@ -2290,8 +2308,11 @@ async function generateObjectImpl(options, deps) {
|
|
|
2290
2308
|
}
|
|
2291
2309
|
throw new CaptureSentinel(input);
|
|
2292
2310
|
});
|
|
2311
|
+
const reasoningText = options.structuringModel !== void 0 ? await runReasoningPhase(options, deps) : void 0;
|
|
2312
|
+
const structuringModel = options.structuringModel ?? options.model;
|
|
2313
|
+
const structuringPrompt = reasoningText ?? options.prompt;
|
|
2293
2314
|
const agentOptions = buildTransientAgentOptions({
|
|
2294
|
-
model:
|
|
2315
|
+
model: structuringModel,
|
|
2295
2316
|
local: options.local,
|
|
2296
2317
|
outputTool,
|
|
2297
2318
|
...options.systemPrompt !== void 0 ? { systemPrompt: options.systemPrompt } : {},
|
|
@@ -2300,7 +2321,7 @@ async function generateObjectImpl(options, deps) {
|
|
|
2300
2321
|
});
|
|
2301
2322
|
const agent = await deps.create(agentOptions);
|
|
2302
2323
|
try {
|
|
2303
|
-
const userMessage = buildToolPrompt(
|
|
2324
|
+
const userMessage = buildToolPrompt(structuringPrompt);
|
|
2304
2325
|
let lastParseError;
|
|
2305
2326
|
for (let attempt = 0; attempt <= maxRetries; attempt += 1) {
|
|
2306
2327
|
capturedRaw = void 0;
|
|
@@ -8336,23 +8357,27 @@ function tryParseSkill(raw, fallbackName, source, options) {
|
|
|
8336
8357
|
|
|
8337
8358
|
// src/internal/runtime/skills/skills-manager.ts
|
|
8338
8359
|
var SkillsManager = class {
|
|
8339
|
-
constructor(cwd, _enabled, settingSourcesIncludeProject) {
|
|
8360
|
+
constructor(cwd, _enabled, settingSourcesIncludeProject, skillsDir, inline) {
|
|
8340
8361
|
this.cwd = cwd;
|
|
8341
8362
|
this.settingSourcesIncludeProject = settingSourcesIncludeProject;
|
|
8363
|
+
this.skillsDir = skillsDir;
|
|
8364
|
+
this.inline = inline;
|
|
8342
8365
|
}
|
|
8343
8366
|
cwd;
|
|
8344
8367
|
settingSourcesIncludeProject;
|
|
8368
|
+
skillsDir;
|
|
8369
|
+
inline;
|
|
8345
8370
|
skills = [];
|
|
8346
8371
|
async initialize() {
|
|
8347
8372
|
if (!this.settingSourcesIncludeProject) {
|
|
8348
|
-
this.skills = [];
|
|
8373
|
+
this.skills = this.mergeInline([]);
|
|
8349
8374
|
return;
|
|
8350
8375
|
}
|
|
8351
8376
|
await this.refresh();
|
|
8352
8377
|
}
|
|
8353
8378
|
async refresh() {
|
|
8354
|
-
const skillsRoot = path.join(this.cwd, ".theokit", "skills");
|
|
8355
|
-
|
|
8379
|
+
const skillsRoot = this.skillsDir ?? path.join(this.cwd, ".theokit", "skills");
|
|
8380
|
+
const discovered = await discoverSkills(skillsRoot, {
|
|
8356
8381
|
onInvalidSkill: (info) => {
|
|
8357
8382
|
process.stderr.write(
|
|
8358
8383
|
`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
|
|
@@ -8360,6 +8385,13 @@ var SkillsManager = class {
|
|
|
8360
8385
|
);
|
|
8361
8386
|
}
|
|
8362
8387
|
});
|
|
8388
|
+
this.skills = this.mergeInline(discovered);
|
|
8389
|
+
}
|
|
8390
|
+
/** M22 — merge inline skills over discovered ones; inline wins on a name conflict. */
|
|
8391
|
+
mergeInline(discovered) {
|
|
8392
|
+
if (this.inline === void 0 || this.inline.length === 0) return discovered;
|
|
8393
|
+
const inlineNames = new Set(this.inline.map((s) => s.name));
|
|
8394
|
+
return [...discovered.filter((s) => !inlineNames.has(s.name)), ...this.inline];
|
|
8363
8395
|
}
|
|
8364
8396
|
list() {
|
|
8365
8397
|
return Promise.resolve(this.skills);
|
|
@@ -8404,7 +8436,10 @@ function bootstrapSubmanagers(args) {
|
|
|
8404
8436
|
out.skillsManager = new SkillsManager(
|
|
8405
8437
|
args.workspaceCwd,
|
|
8406
8438
|
args.options.skills?.enabled,
|
|
8407
|
-
args.settingSourcesIncludeProject
|
|
8439
|
+
args.settingSourcesIncludeProject,
|
|
8440
|
+
// M22 — custom skills directory + inline (code-defined) skills.
|
|
8441
|
+
args.options.skills?.skillsDir,
|
|
8442
|
+
args.options.skills?.inline
|
|
8408
8443
|
);
|
|
8409
8444
|
const localSkills = out.skillsManager;
|
|
8410
8445
|
out.skills = { list: () => localSkills.list() };
|