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