create-expert 0.0.36 → 0.0.37

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/bin/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "../chunk-D_gEzPfs.js";
3
- import { $ as custom, A as startCommandInputSchema, At as normalizeParams, C as startGeneration, Ct as $ZodType, D as stopRunByExceededMaxSteps, Dt as safeParseAsync$1, E as stopRunByError, Et as safeParse$1, Ft as defaultMaxRetries, G as ZodOptional$1, It as defaultTimeout, J as _null, K as _enum, Lt as createId, M as lockfileSchema, Mt as NEVER, N as jobSchema, Nt as knownModels, O as stopRunByInteractiveTool, Ot as clone, P as checkpointSchema, Pt as PerstackError, Q as boolean, S as skipDelegates, St as $ZodObject, T as stopRunByDelegate, Tt as parseAsync, W as number$1, X as any, Z as array$1, _ as resolveToolResults, _t as safeParseAsync$2, a as BASE_SKILL_PREFIX, at as never, b as runParamsSchema, bt as describe$1, c as attemptCompletion$1, ct as optional, d as continueToNextStep, dt as strictObject, et as discriminatedUnion, f as createRuntimeEvent, ft as string, g as proceedToInteractiveTools, gt as url, h as finishToolCall, ht as unknown, i as getFilteredEnv, it as looseObject, j as perstackConfigSchema, jt as $constructor, k as runCommandInputSchema, kt as defineLazy, l as callTools, lt as preprocess, m as finishMcpTools, mt as union, n as createFilteredEventListener, nt as lazy, o as createBaseToolActivity, ot as number, p as createStreamingEvent, pt as tuple, q as _instanceof, r as validateEventFilter, rt as literal, s as createGeneralToolActivity, st as object$2, t as parseWithFriendlyError, tt as intersection, u as completeRun, ut as record, v as resumeFromStop, vt as datetime, w as startRun, wt as parse$1, x as runSettingSchema, xt as meta$1, y as retry, yt as toJSONSchema } from "../src-DVhxRHrP.js";
3
+ import { $ as boolean, A as startCommandInputSchema, At as defineLazy, C as startGeneration, Ct as $ZodObject, D as stopRunByExceededMaxSteps, Dt as safeParse$1, E as stopRunByError, Et as parseAsync, F as checkpointSchema, Ft as PerstackError, G as number$1, It as defaultMaxRetries, J as _instanceof, K as ZodOptional$1, Lt as defaultTimeout, M as lockfileSchema, Mt as $constructor, N as jobSchema, Nt as NEVER, O as stopRunByInteractiveTool, Ot as safeParseAsync$1, P as expertSchema, Pt as knownModels, Q as array$1, Rt as createId, S as skipDelegates, St as meta$1, T as stopRunByDelegate, Tt as parse$1, Y as _null, Z as any, _ as resolveToolResults, _t as url, a as BASE_SKILL_PREFIX, at as looseObject, b as runParamsSchema, bt as toJSONSchema, c as attemptCompletion$1, ct as object$2, d as continueToNextStep, dt as record, et as custom, f as createRuntimeEvent, ft as strictObject, g as proceedToInteractiveTools, gt as unknown, h as finishToolCall, ht as union, i as getFilteredEnv, it as literal, j as perstackConfigSchema, jt as normalizeParams, k as runCommandInputSchema, kt as clone, l as callTools, lt as optional, m as finishMcpTools, mt as tuple, n as createFilteredEventListener, nt as intersection, o as createBaseToolActivity, ot as never, p as createStreamingEvent, pt as string, q as _enum, r as validateEventFilter, rt as lazy, s as createGeneralToolActivity, st as number, t as parseWithFriendlyError, tt as discriminatedUnion, u as completeRun, ut as preprocess, v as resumeFromStop, vt as safeParseAsync$2, w as startRun, wt as $ZodType, x as runSettingSchema, xt as describe$1, y as retry, yt as datetime } from "../src-D-q0VJ6r.js";
4
4
  import { t as require_token_error } from "../token-error-CfavTss_.js";
5
5
  import * as fs$2 from "node:fs";
6
6
  import fs, { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, writeFileSync } from "node:fs";
@@ -16305,7 +16305,7 @@ const EMPTY_COMPLETION_RESULT = { completion: {
16305
16305
  //#endregion
16306
16306
  //#region ../base/package.json
16307
16307
  var name$5 = "@perstack/base";
16308
- var version$2 = "0.0.59";
16308
+ var version$2 = "0.0.60";
16309
16309
 
16310
16310
  //#endregion
16311
16311
  //#region ../base/src/tools/todo.ts
@@ -16718,11 +16718,47 @@ function registerRemoveDelegate(server, callbacks) {
16718
16718
  }
16719
16719
  });
16720
16720
  }
16721
+ function registerCreateExpert(server, callbacks) {
16722
+ server.registerTool("createExpert", {
16723
+ title: "Create expert",
16724
+ description: "Dynamically create an expert definition in memory. Returns the expert key so you can add it as a delegate.",
16725
+ inputSchema: {
16726
+ key: string().describe("Unique expert key (kebab-case)"),
16727
+ instruction: string().describe("System instruction for the expert"),
16728
+ description: string().optional().describe("Human-readable description"),
16729
+ version: string().optional().describe("Semantic version (defaults to 1.0.0)"),
16730
+ skills: record(string(), object$2({
16731
+ type: _enum(["mcpStdioSkill", "mcpSseSkill"]).describe("Skill transport type"),
16732
+ command: string().optional().describe("Command to execute (for stdio skills)"),
16733
+ packageName: string().optional().describe("Package name for npx/uvx (for stdio skills)"),
16734
+ args: array$1(string()).optional().describe("Additional command arguments"),
16735
+ requiredEnv: array$1(string()).optional().describe("Required environment variable names"),
16736
+ endpoint: string().optional().describe("SSE endpoint URL (for SSE skills)"),
16737
+ description: string().optional().describe("Human-readable description"),
16738
+ rule: string().optional().describe("Usage rules for the LLM"),
16739
+ pick: array$1(string()).optional().describe("Tool names to include (whitelist)"),
16740
+ omit: array$1(string()).optional().describe("Tool names to exclude (blacklist)"),
16741
+ lazyInit: boolean().optional().describe("Lazy initialization")
16742
+ })).optional().describe("Skills map (defaults to @perstack/base)"),
16743
+ delegates: array$1(string()).optional().describe("Expert keys to delegate to"),
16744
+ tags: array$1(string()).optional().describe("Tags for categorization"),
16745
+ providerTools: array$1(string()).optional().describe("Provider-specific tool names")
16746
+ }
16747
+ }, async (input) => {
16748
+ try {
16749
+ return successToolResult(await callbacks.createExpert(input));
16750
+ } catch (e) {
16751
+ if (e instanceof Error) return errorToolResult(e);
16752
+ throw e;
16753
+ }
16754
+ });
16755
+ }
16721
16756
  function registerSkillManagementTools(server, callbacks) {
16722
16757
  registerAddSkill(server, callbacks);
16723
16758
  registerRemoveSkill(server, callbacks);
16724
16759
  registerAddDelegate(server, callbacks);
16725
16760
  registerRemoveDelegate(server, callbacks);
16761
+ registerCreateExpert(server, callbacks);
16726
16762
  }
16727
16763
 
16728
16764
  //#endregion
@@ -19164,6 +19200,9 @@ var InMemoryBaseSkillAdapter = class extends SkillAdapter {
19164
19200
  },
19165
19201
  removeDelegate: () => {
19166
19202
  throw new Error("Skill management not initialized");
19203
+ },
19204
+ createExpert: () => {
19205
+ throw new Error("Skill management not initialized");
19167
19206
  }
19168
19207
  };
19169
19208
  constructor(skill, onLifecycleEvent, options) {
@@ -19709,7 +19748,22 @@ var SkillManager = class SkillManager {
19709
19748
  await sm.addDelegate(delegateExpert);
19710
19749
  return { delegateToolName: sm.getAdapters().get(delegateExpert.name)?.getToolDefinitions()[0]?.name ?? delegateExpert.name };
19711
19750
  },
19712
- removeDelegate: (name) => sm.removeDelegate(name)
19751
+ removeDelegate: (name) => sm.removeDelegate(name),
19752
+ createExpert: async (input) => {
19753
+ const expert = expertSchema.parse({
19754
+ key: input.key,
19755
+ name: input.key,
19756
+ version: input.version ?? "1.0.0",
19757
+ description: input.description,
19758
+ instruction: input.instruction,
19759
+ skills: input.skills,
19760
+ delegates: input.delegates,
19761
+ tags: input.tags,
19762
+ providerTools: input.providerTools
19763
+ });
19764
+ experts[expert.key] = expert;
19765
+ return { expertKey: expert.key };
19766
+ }
19713
19767
  });
19714
19768
  break;
19715
19769
  }
@@ -19863,7 +19917,7 @@ var SkillManager = class SkillManager {
19863
19917
 
19864
19918
  //#endregion
19865
19919
  //#region ../../packages/runtime/package.json
19866
- var version$1 = "0.0.106";
19920
+ var version$1 = "0.0.107";
19867
19921
 
19868
19922
  //#endregion
19869
19923
  //#region ../../packages/runtime/src/helpers/usage.ts
@@ -75411,7 +75465,7 @@ function validateRuntimeVersion(experts) {
75411
75465
  //#endregion
75412
75466
  //#region ../../packages/runtime/src/helpers/setup-experts.ts
75413
75467
  async function setupExperts(setting, resolveExpertToRun) {
75414
- const resolveFn = resolveExpertToRun ?? (await import("../resolve-expert-0uBE0QXU.js")).resolveExpertToRun;
75468
+ const resolveFn = resolveExpertToRun ?? (await import("../resolve-expert-DsQia0Mr.js")).resolveExpertToRun;
75415
75469
  const { expertKey } = setting;
75416
75470
  const experts = { ...setting.experts };
75417
75471
  const clientOptions = {
@@ -89182,7 +89236,11 @@ async function run(runInput, options) {
89182
89236
  if (!delegateTo || delegateTo.length === 0) throw new Error("No delegations found in checkpoint");
89183
89237
  const executor = new DelegationExecutor();
89184
89238
  const context = extractDelegationContext(resultCheckpoint);
89185
- const delegationResult = await executor.execute(delegateTo, setting, context, runResult.expertToRun, run, options);
89239
+ const updatedSetting = {
89240
+ ...setting,
89241
+ experts: runResult.experts
89242
+ };
89243
+ const delegationResult = await executor.execute(delegateTo, updatedSetting, context, runResult.expertToRun, run, options);
89186
89244
  setting = delegationResult.nextSetting;
89187
89245
  checkpoint = delegationResult.nextCheckpoint;
89188
89246
  break;
@@ -115806,7 +115864,7 @@ async function startHandler(expertKey, query, options, handlerOptions) {
115806
115864
  //#endregion
115807
115865
  //#region package.json
115808
115866
  var name = "create-expert";
115809
- var version = "0.0.36";
115867
+ var version = "0.0.37";
115810
115868
  var description = "Create and modify Perstack expert definitions";
115811
115869
 
115812
115870
  //#endregion