create-expert 0.0.36 → 0.0.38

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-C0pz_C3h.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.61";
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,31 @@ 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 skills = input.skills ? {
19754
+ "@perstack/base": input.skills["@perstack/base"] ?? {
19755
+ type: "mcpStdioSkill",
19756
+ command: "npx",
19757
+ packageName: "@perstack/base",
19758
+ pick: ["attemptCompletion"]
19759
+ },
19760
+ ...input.skills
19761
+ } : void 0;
19762
+ const expert = expertSchema.parse({
19763
+ key: input.key,
19764
+ name: input.key,
19765
+ version: input.version ?? "1.0.0",
19766
+ description: input.description,
19767
+ instruction: input.instruction,
19768
+ skills,
19769
+ delegates: input.delegates,
19770
+ tags: input.tags,
19771
+ providerTools: input.providerTools
19772
+ });
19773
+ experts[expert.key] = expert;
19774
+ return { expertKey: expert.key };
19775
+ }
19713
19776
  });
19714
19777
  break;
19715
19778
  }
@@ -19863,7 +19926,7 @@ var SkillManager = class SkillManager {
19863
19926
 
19864
19927
  //#endregion
19865
19928
  //#region ../../packages/runtime/package.json
19866
- var version$1 = "0.0.106";
19929
+ var version$1 = "0.0.108";
19867
19930
 
19868
19931
  //#endregion
19869
19932
  //#region ../../packages/runtime/src/helpers/usage.ts
@@ -53430,7 +53493,7 @@ function createOpenAI(options = {}) {
53430
53493
  var openai = createOpenAI();
53431
53494
 
53432
53495
  //#endregion
53433
- //#region ../../node_modules/.pnpm/ollama-ai-provider-v2@3.3.0_ai@6.0.86_zod@4.3.6__zod@4.3.6/node_modules/ollama-ai-provider-v2/dist/index.mjs
53496
+ //#region ../../node_modules/.pnpm/ollama-ai-provider-v2@3.3.1_ai@6.0.87_zod@4.3.6__zod@4.3.6/node_modules/ollama-ai-provider-v2/dist/index.mjs
53434
53497
  function convertToOllamaCompletionPrompt({ prompt, user = "user", assistant = "assistant" }) {
53435
53498
  let text = "";
53436
53499
  if (prompt[0].role === "system") {
@@ -75411,7 +75474,7 @@ function validateRuntimeVersion(experts) {
75411
75474
  //#endregion
75412
75475
  //#region ../../packages/runtime/src/helpers/setup-experts.ts
75413
75476
  async function setupExperts(setting, resolveExpertToRun) {
75414
- const resolveFn = resolveExpertToRun ?? (await import("../resolve-expert-0uBE0QXU.js")).resolveExpertToRun;
75477
+ const resolveFn = resolveExpertToRun ?? (await import("../resolve-expert-CTnETi9d.js")).resolveExpertToRun;
75415
75478
  const { expertKey } = setting;
75416
75479
  const experts = { ...setting.experts };
75417
75480
  const clientOptions = {
@@ -75714,7 +75777,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
75714
75777
  }));
75715
75778
 
75716
75779
  //#endregion
75717
- //#region ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.46_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
75780
+ //#region ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.47_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
75718
75781
  var import_dist$1 = require_dist$1();
75719
75782
  var symbol$1 = Symbol.for("vercel.ai.gateway.error");
75720
75783
  var _a$1, _b;
@@ -76598,7 +76661,7 @@ async function getVercelRequestId() {
76598
76661
  var _a9;
76599
76662
  return (_a9 = (0, import_dist$1.getContext)().headers) == null ? void 0 : _a9["x-vercel-id"];
76600
76663
  }
76601
- var VERSION$2 = "3.0.46";
76664
+ var VERSION$2 = "3.0.47";
76602
76665
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
76603
76666
  function createGatewayProvider(options = {}) {
76604
76667
  var _a9, _b9;
@@ -77619,7 +77682,7 @@ var TraceAPI = function() {
77619
77682
  var trace = TraceAPI.getInstance();
77620
77683
 
77621
77684
  //#endregion
77622
- //#region ../../node_modules/.pnpm/ai@6.0.86_zod@4.3.6/node_modules/ai/dist/index.mjs
77685
+ //#region ../../node_modules/.pnpm/ai@6.0.87_zod@4.3.6/node_modules/ai/dist/index.mjs
77623
77686
  var __defProp = Object.defineProperty;
77624
77687
  var __export = (target, all) => {
77625
77688
  for (var name21 in all) __defProp(target, name21, {
@@ -78155,7 +78218,7 @@ function detectMediaType({ data, signatures }) {
78155
78218
  const bytes = typeof processedData === "string" ? convertBase64ToUint8Array(processedData.substring(0, Math.min(processedData.length, 24))) : processedData;
78156
78219
  for (const signature of signatures) if (bytes.length >= signature.bytesPrefix.length && signature.bytesPrefix.every((byte, index) => byte === null || bytes[index] === byte)) return signature.mediaType;
78157
78220
  }
78158
- var VERSION = "6.0.86";
78221
+ var VERSION = "6.0.87";
78159
78222
  var download = async ({ url, maxBytes, abortSignal }) => {
78160
78223
  var _a21;
78161
78224
  const urlText = url.toString();
@@ -89020,43 +89083,65 @@ var DelegationExecutor = class {
89020
89083
  async executeSingleDelegation(delegation, parentSetting, parentContext, parentExpert, runFn, parentOptions) {
89021
89084
  const { expert, toolCallId, toolName, query } = delegation;
89022
89085
  const delegateRunId = createId();
89023
- const resultCheckpoint = await runFn({
89024
- setting: {
89025
- ...parentSetting,
89026
- runId: delegateRunId,
89027
- expertKey: expert.key,
89028
- input: { text: query }
89086
+ const delegateSetting = {
89087
+ ...parentSetting,
89088
+ runId: delegateRunId,
89089
+ expertKey: expert.key,
89090
+ input: { text: query }
89091
+ };
89092
+ const delegateCheckpoint = {
89093
+ id: createId(),
89094
+ jobId: parentSetting.jobId,
89095
+ runId: delegateRunId,
89096
+ status: "init",
89097
+ stepNumber: parentContext.stepNumber,
89098
+ messages: [],
89099
+ expert: {
89100
+ key: expert.key,
89101
+ name: expert.name,
89102
+ version: expert.version
89029
89103
  },
89030
- checkpoint: {
89031
- id: createId(),
89032
- jobId: parentSetting.jobId,
89033
- runId: delegateRunId,
89034
- status: "init",
89035
- stepNumber: parentContext.stepNumber,
89036
- messages: [],
89104
+ delegatedBy: {
89037
89105
  expert: {
89038
- key: expert.key,
89039
- name: expert.name,
89040
- version: expert.version
89041
- },
89042
- delegatedBy: {
89043
- expert: {
89044
- key: parentExpert.key,
89045
- name: parentExpert.name,
89046
- version: parentExpert.version
89047
- },
89048
- toolCallId,
89049
- toolName,
89050
- checkpointId: parentContext.id,
89051
- runId: parentSetting.runId
89106
+ key: parentExpert.key,
89107
+ name: parentExpert.name,
89108
+ version: parentExpert.version
89052
89109
  },
89053
- usage: createEmptyUsage(),
89054
- contextWindow: parentContext.contextWindow
89055
- }
89056
- }, {
89057
- ...parentOptions,
89058
- returnOnDelegationComplete: true
89059
- });
89110
+ toolCallId,
89111
+ toolName,
89112
+ checkpointId: parentContext.id,
89113
+ runId: parentSetting.runId
89114
+ },
89115
+ usage: createEmptyUsage(),
89116
+ contextWindow: parentContext.contextWindow
89117
+ };
89118
+ let resultCheckpoint;
89119
+ try {
89120
+ resultCheckpoint = await runFn({
89121
+ setting: delegateSetting,
89122
+ checkpoint: delegateCheckpoint
89123
+ }, {
89124
+ ...parentOptions,
89125
+ returnOnDelegationComplete: true
89126
+ });
89127
+ } catch (error) {
89128
+ return {
89129
+ toolCallId,
89130
+ toolName,
89131
+ expertKey: expert.key,
89132
+ text: `Delegation to ${expert.key} failed: ${error instanceof Error ? error.message : String(error)}`,
89133
+ stepNumber: parentContext.stepNumber,
89134
+ deltaUsage: createEmptyUsage()
89135
+ };
89136
+ }
89137
+ if (resultCheckpoint.status !== "completed") return {
89138
+ toolCallId,
89139
+ toolName,
89140
+ expertKey: expert.key,
89141
+ text: `Delegation to ${expert.key} ended with status: ${resultCheckpoint.status}`,
89142
+ stepNumber: resultCheckpoint.stepNumber,
89143
+ deltaUsage: resultCheckpoint.usage
89144
+ };
89060
89145
  return this.extractDelegationResult(resultCheckpoint, toolCallId, toolName, expert.key);
89061
89146
  }
89062
89147
  extractDelegationResult(checkpoint, toolCallId, toolName, expertKey) {
@@ -89182,7 +89267,11 @@ async function run(runInput, options) {
89182
89267
  if (!delegateTo || delegateTo.length === 0) throw new Error("No delegations found in checkpoint");
89183
89268
  const executor = new DelegationExecutor();
89184
89269
  const context = extractDelegationContext(resultCheckpoint);
89185
- const delegationResult = await executor.execute(delegateTo, setting, context, runResult.expertToRun, run, options);
89270
+ const updatedSetting = {
89271
+ ...setting,
89272
+ experts: runResult.experts
89273
+ };
89274
+ const delegationResult = await executor.execute(delegateTo, updatedSetting, context, runResult.expertToRun, run, options);
89186
89275
  setting = delegationResult.nextSetting;
89187
89276
  checkpoint = delegationResult.nextCheckpoint;
89188
89277
  break;
@@ -113338,6 +113427,17 @@ var EventQueue = class EventQueue {
113338
113427
  }
113339
113428
  };
113340
113429
 
113430
+ //#endregion
113431
+ //#region ../../packages/tui-components/src/colors.ts
113432
+ const colors = {
113433
+ primary: "white",
113434
+ muted: "gray",
113435
+ accent: "cyan",
113436
+ success: "green",
113437
+ warn: "yellow",
113438
+ destructive: "red"
113439
+ };
113440
+
113341
113441
  //#endregion
113342
113442
  //#region ../../packages/tui-components/src/constants.ts
113343
113443
  const UI_CONSTANTS = {
@@ -113671,7 +113771,7 @@ const ActionRowSimple = ({ indicatorColor, text, textDimColor = false }) => /* @
113671
113771
  color: indicatorColor,
113672
113772
  children: INDICATOR.BULLET
113673
113773
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113674
- color: "white",
113774
+ color: colors.primary,
113675
113775
  dimColor: textDimColor,
113676
113776
  children: text
113677
113777
  })]
@@ -113689,11 +113789,11 @@ const ActionRow = ({ indicatorColor, label, summary, children }) => /* @__PURE__
113689
113789
  children: INDICATOR.BULLET
113690
113790
  }),
113691
113791
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113692
- color: "white",
113792
+ color: colors.primary,
113693
113793
  children: label
113694
113794
  }),
113695
113795
  summary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113696
- color: "white",
113796
+ color: colors.primary,
113697
113797
  dimColor: true,
113698
113798
  children: summary
113699
113799
  })
@@ -113805,10 +113905,10 @@ const ListBrowser = ({ title, items, renderItem, onSelect, emptyMessage = "No it
113805
113905
  flexDirection: "column",
113806
113906
  children: [
113807
113907
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113808
- color: "cyan",
113908
+ color: colors.accent,
113809
113909
  children: title
113810
113910
  }), items.length > maxItems && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
113811
- color: "gray",
113911
+ color: colors.muted,
113812
113912
  children: [
113813
113913
  " ",
113814
113914
  "(",
@@ -113819,13 +113919,13 @@ const ListBrowser = ({ title, items, renderItem, onSelect, emptyMessage = "No it
113819
113919
  ]
113820
113920
  })] }),
113821
113921
  hasMoreAbove && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113822
- color: "gray",
113922
+ color: colors.muted,
113823
113923
  children: INDICATOR.ELLIPSIS
113824
113924
  }),
113825
113925
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
113826
113926
  flexDirection: "column",
113827
113927
  children: displayItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113828
- color: "gray",
113928
+ color: colors.muted,
113829
113929
  children: emptyMessage
113830
113930
  }) : displayItems.map((item, index) => {
113831
113931
  const actualIndex = scrollOffset + index;
@@ -113833,7 +113933,7 @@ const ListBrowser = ({ title, items, renderItem, onSelect, emptyMessage = "No it
113833
113933
  })
113834
113934
  }),
113835
113935
  hasMoreBelow && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113836
- color: "gray",
113936
+ color: colors.muted,
113837
113937
  children: INDICATOR.ELLIPSIS
113838
113938
  })
113839
113939
  ]
@@ -113856,7 +113956,7 @@ const BrowsingCheckpointsInput = ({ job, checkpoints, onCheckpointSelect, onChec
113856
113956
  return false;
113857
113957
  },
113858
113958
  renderItem: (cp, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
113859
- color: isSelected ? "cyan" : "gray",
113959
+ color: isSelected ? colors.accent : colors.muted,
113860
113960
  children: [
113861
113961
  isSelected ? ">" : " ",
113862
113962
  " Step ",
@@ -113891,29 +113991,29 @@ const BrowsingEventDetailInput = ({ event, onBack }) => {
113891
113991
  marginLeft: 2,
113892
113992
  children: [
113893
113993
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113894
- color: "gray",
113994
+ color: colors.muted,
113895
113995
  children: "Type: "
113896
113996
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113897
- color: "cyan",
113997
+ color: colors.accent,
113898
113998
  children: event.type
113899
113999
  })] }),
113900
114000
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113901
- color: "gray",
114001
+ color: colors.muted,
113902
114002
  children: "Step: "
113903
114003
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: event.stepNumber })] }),
113904
114004
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113905
- color: "gray",
114005
+ color: colors.muted,
113906
114006
  children: "Timestamp: "
113907
114007
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: formatTimestamp(event.timestamp) })] }),
113908
114008
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113909
- color: "gray",
114009
+ color: colors.muted,
113910
114010
  children: "ID: "
113911
114011
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113912
114012
  dimColor: true,
113913
114013
  children: event.id
113914
114014
  })] }),
113915
114015
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113916
- color: "gray",
114016
+ color: colors.muted,
113917
114017
  children: "Run ID: "
113918
114018
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
113919
114019
  dimColor: true,
@@ -113933,7 +114033,7 @@ const BrowsingEventsInput = ({ checkpoint, events, onEventSelect, onBack }) => /
113933
114033
  onBack,
113934
114034
  emptyMessage: "No events found",
113935
114035
  renderItem: (ev, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
113936
- color: isSelected ? "cyan" : "gray",
114036
+ color: isSelected ? colors.accent : colors.muted,
113937
114037
  children: [
113938
114038
  isSelected ? ">" : " ",
113939
114039
  " [",
@@ -114615,17 +114715,17 @@ const useExpertSelector = (options) => {
114615
114715
  const ExpertList = ({ experts, selectedIndex, showSource = false, inline = false, maxItems }) => {
114616
114716
  const displayExperts = maxItems ? experts.slice(0, maxItems) : experts;
114617
114717
  if (displayExperts.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114618
- color: "gray",
114718
+ color: colors.muted,
114619
114719
  children: "No experts found."
114620
114720
  });
114621
114721
  const items = displayExperts.map((expert, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
114622
- color: index === selectedIndex ? "cyan" : "gray",
114722
+ color: index === selectedIndex ? colors.accent : colors.muted,
114623
114723
  children: [
114624
114724
  index === selectedIndex ? ">" : " ",
114625
114725
  " ",
114626
114726
  showSource ? expert.key : expert.name,
114627
114727
  showSource && expert.source && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" ", /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
114628
- color: expert.source === "configured" ? "green" : "yellow",
114728
+ color: expert.source === "configured" ? colors.success : colors.warn,
114629
114729
  children: [
114630
114730
  "[",
114631
114731
  expert.source === "configured" ? "config" : "recent",
@@ -114655,7 +114755,7 @@ const ExpertSelectorBase = ({ experts, hint, onExpertSelect, showSource = false,
114655
114755
  children: [!inputMode && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
114656
114756
  flexDirection: "column",
114657
114757
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114658
- color: "cyan",
114758
+ color: colors.accent,
114659
114759
  children: hint
114660
114760
  }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpertList, {
114661
114761
  experts,
@@ -114666,15 +114766,15 @@ const ExpertSelectorBase = ({ experts, hint, onExpertSelect, showSource = false,
114666
114766
  })]
114667
114767
  }), inputMode && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [
114668
114768
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114669
- color: "gray",
114769
+ color: colors.muted,
114670
114770
  children: "Expert: "
114671
114771
  }),
114672
114772
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114673
- color: "white",
114773
+ color: colors.primary,
114674
114774
  children: input
114675
114775
  }),
114676
114776
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114677
- color: "cyan",
114777
+ color: colors.accent,
114678
114778
  children: "_"
114679
114779
  })
114680
114780
  ] })]
@@ -114720,7 +114820,7 @@ const BrowsingHistoryInput = ({ jobs, onJobSelect, onJobResume, onSwitchToExpert
114720
114820
  return false;
114721
114821
  },
114722
114822
  renderItem: (job, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
114723
- color: isSelected ? "cyan" : "gray",
114823
+ color: isSelected ? colors.accent : colors.muted,
114724
114824
  children: [
114725
114825
  isSelected ? ">" : " ",
114726
114826
  " ",
@@ -114802,12 +114902,13 @@ function renderParallelGroup(group) {
114802
114902
  });
114803
114903
  }
114804
114904
  function renderReasoning(text) {
114905
+ const lines = text.split("\n");
114805
114906
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
114806
- indicatorColor: "white",
114907
+ indicatorColor: colors.primary,
114807
114908
  label: "Reasoning",
114808
114909
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
114809
114910
  flexDirection: "column",
114810
- children: text.split("\n").map((line, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114911
+ children: lines.map((line, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114811
114912
  dimColor: true,
114812
114913
  wrap: "wrap",
114813
114914
  children: line
@@ -114816,11 +114917,11 @@ function renderReasoning(text) {
114816
114917
  });
114817
114918
  }
114818
114919
  function renderAction(action) {
114819
- const color = action.type === "error" || "error" in action && action.error ? "red" : "green";
114920
+ const color = action.type === "error" || "error" in action && action.error ? colors.destructive : colors.success;
114820
114921
  switch (action.type) {
114821
114922
  case "query": return renderQuery(action.text, action.runId);
114822
114923
  case "retry": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
114823
- indicatorColor: "yellow",
114924
+ indicatorColor: colors.warn,
114824
114925
  label: "Retry",
114825
114926
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114826
114927
  dimColor: true,
@@ -114828,22 +114929,22 @@ function renderAction(action) {
114828
114929
  })
114829
114930
  });
114830
114931
  case "complete": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
114831
- indicatorColor: "green",
114932
+ indicatorColor: colors.success,
114832
114933
  label: "Run Results",
114833
114934
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: action.text })
114834
114935
  });
114835
114936
  case "attemptCompletion": {
114836
114937
  if (action.error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
114837
- indicatorColor: "red",
114938
+ indicatorColor: colors.destructive,
114838
114939
  label: "Completion Failed",
114839
114940
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114840
- color: "red",
114941
+ color: colors.destructive,
114841
114942
  children: action.error
114842
114943
  })
114843
114944
  });
114844
114945
  const remaining = action.remainingTodos?.filter((t) => !t.completed) ?? [];
114845
114946
  if (remaining.length > 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
114846
- indicatorColor: "yellow",
114947
+ indicatorColor: colors.warn,
114847
114948
  label: "Completion Blocked",
114848
114949
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
114849
114950
  dimColor: true,
@@ -114855,7 +114956,7 @@ function renderAction(action) {
114855
114956
  })
114856
114957
  });
114857
114958
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
114858
- indicatorColor: "green",
114959
+ indicatorColor: colors.success,
114859
114960
  text: "Completion Accepted"
114860
114961
  });
114861
114962
  }
@@ -114887,7 +114988,7 @@ function renderAction(action) {
114887
114988
  });
114888
114989
  case "exec": return renderExec(action, color);
114889
114990
  case "delegate": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
114890
- indicatorColor: "yellow",
114991
+ indicatorColor: colors.warn,
114891
114992
  label: action.delegateExpertKey,
114892
114993
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114893
114994
  dimColor: true,
@@ -114895,17 +114996,49 @@ function renderAction(action) {
114895
114996
  })
114896
114997
  });
114897
114998
  case "delegationComplete": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
114898
- indicatorColor: "green",
114999
+ indicatorColor: colors.success,
114899
115000
  text: `Delegation Complete (${action.count} delegate${action.count > 1 ? "s" : ""} returned)`
114900
115001
  });
114901
115002
  case "interactiveTool": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
114902
- indicatorColor: "yellow",
115003
+ indicatorColor: colors.warn,
114903
115004
  label: `Interactive: ${action.toolName}`,
114904
115005
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114905
115006
  dimColor: true,
114906
115007
  children: truncateText(JSON.stringify(action.args), UI_CONSTANTS.TRUNCATE_TEXT_MEDIUM)
114907
115008
  })
114908
115009
  });
115010
+ case "addSkill": {
115011
+ const skillColor = action.error ? colors.destructive : colors.accent;
115012
+ const toolsSummary = action.tools ? `${action.tools.length} tool${action.tools.length !== 1 ? "s" : ""}: ${action.tools.join(", ")}` : void 0;
115013
+ if (toolsSummary) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115014
+ indicatorColor: skillColor,
115015
+ label: `Add Skill ${action.name}`,
115016
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115017
+ dimColor: true,
115018
+ children: truncateText(toolsSummary, UI_CONSTANTS.TRUNCATE_TEXT_MEDIUM)
115019
+ })
115020
+ });
115021
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115022
+ indicatorColor: skillColor,
115023
+ text: `Add Skill ${action.name}`
115024
+ });
115025
+ }
115026
+ case "removeSkill": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115027
+ indicatorColor: action.error ? colors.destructive : colors.accent,
115028
+ text: `Remove Skill ${action.skillName}`
115029
+ });
115030
+ case "addDelegate": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115031
+ indicatorColor: action.error ? colors.destructive : colors.accent,
115032
+ text: `Add Delegate ${action.targetExpertKey}`
115033
+ });
115034
+ case "removeDelegate": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115035
+ indicatorColor: action.error ? colors.destructive : colors.accent,
115036
+ text: `Remove Delegate ${action.expertName}`
115037
+ });
115038
+ case "createExpert": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115039
+ indicatorColor: action.error ? colors.destructive : colors.accent,
115040
+ text: `Create Expert ${action.description ? `${action.targetKey} - ${truncateText(action.description, UI_CONSTANTS.TRUNCATE_TEXT_MEDIUM)}` : action.targetKey}`
115041
+ });
114909
115042
  case "generalTool": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
114910
115043
  indicatorColor: color,
114911
115044
  label: action.toolName,
@@ -114915,10 +115048,10 @@ function renderAction(action) {
114915
115048
  })
114916
115049
  });
114917
115050
  case "error": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
114918
- indicatorColor: "red",
115051
+ indicatorColor: colors.destructive,
114919
115052
  label: action.errorName ?? "Error",
114920
115053
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114921
- color: "red",
115054
+ color: colors.destructive,
114922
115055
  children: action.error ?? "Unknown error"
114923
115056
  })
114924
115057
  });
@@ -114990,7 +115123,7 @@ function renderReadTextFile(action, color) {
114990
115123
  flexDirection: "row",
114991
115124
  gap: 1,
114992
115125
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114993
- color: "white",
115126
+ color: colors.primary,
114994
115127
  dimColor: true,
114995
115128
  children: line
114996
115129
  })
@@ -115011,11 +115144,11 @@ function renderWriteTextFile(action, color) {
115011
115144
  flexDirection: "row",
115012
115145
  gap: 1,
115013
115146
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115014
- color: "green",
115147
+ color: colors.success,
115015
115148
  dimColor: true,
115016
115149
  children: "+"
115017
115150
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115018
- color: "white",
115151
+ color: colors.primary,
115019
115152
  dimColor: true,
115020
115153
  children: line
115021
115154
  })]
@@ -115037,11 +115170,11 @@ function renderEditTextFile(action, color) {
115037
115170
  flexDirection: "row",
115038
115171
  gap: 1,
115039
115172
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115040
- color: "red",
115173
+ color: colors.destructive,
115041
115174
  dimColor: true,
115042
115175
  children: "-"
115043
115176
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115044
- color: "white",
115177
+ color: colors.primary,
115045
115178
  dimColor: true,
115046
115179
  children: line
115047
115180
  })]
@@ -115049,7 +115182,7 @@ function renderEditTextFile(action, color) {
115049
115182
  flexDirection: "row",
115050
115183
  gap: 1,
115051
115184
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115052
- color: "green",
115185
+ color: colors.success,
115053
115186
  dimColor: true,
115054
115187
  children: "+"
115055
115188
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
@@ -115086,10 +115219,11 @@ function renderExec(action, color) {
115086
115219
  }
115087
115220
  function renderQuery(text, runId) {
115088
115221
  const lines = text.split("\n");
115222
+ const shortRunId = runId.slice(0, 8);
115089
115223
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115090
- indicatorColor: "cyan",
115224
+ indicatorColor: colors.accent,
115091
115225
  label: "Query",
115092
- summary: `(${runId.slice(0, 8)})`,
115226
+ summary: `(${shortRunId})`,
115093
115227
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
115094
115228
  flexDirection: "column",
115095
115229
  children: lines.map((line, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
@@ -115196,15 +115330,15 @@ const InterfacePanel = ({ runtimeInfo, runStatus, streaming, onSubmit }) => {
115196
115330
  useInput(handleInput);
115197
115331
  let statusLabel;
115198
115332
  if (runStatus === "waiting") statusLabel = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115199
- color: "cyan",
115333
+ color: colors.accent,
115200
115334
  children: "Waiting for query..."
115201
115335
  });
115202
115336
  else if (runStatus === "completed") statusLabel = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115203
- color: "green",
115337
+ color: colors.success,
115204
115338
  children: "Completed"
115205
115339
  });
115206
115340
  else if (runStatus === "stopped") statusLabel = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115207
- color: "yellow",
115341
+ color: colors.warn,
115208
115342
  children: "Stopped"
115209
115343
  });
115210
115344
  else if (streamingPhase === "reasoning") statusLabel = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Streaming Reasoning..." });
@@ -115216,14 +115350,14 @@ const InterfacePanel = ({ runtimeInfo, runStatus, streaming, onSubmit }) => {
115216
115350
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
115217
115351
  flexDirection: "column",
115218
115352
  borderStyle: "single",
115219
- borderColor: "gray",
115353
+ borderColor: colors.muted,
115220
115354
  borderTop: true,
115221
115355
  borderBottom: false,
115222
115356
  borderLeft: false,
115223
115357
  borderRight: false,
115224
115358
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
115225
115359
  spinner ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
115226
- color: "cyan",
115360
+ color: colors.accent,
115227
115361
  children: [spinner, " "]
115228
115362
  }) : null,
115229
115363
  statusLabel,
@@ -115244,12 +115378,12 @@ const InterfacePanel = ({ runtimeInfo, runStatus, streaming, onSubmit }) => {
115244
115378
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [usagePercent, "%"] })
115245
115379
  ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
115246
115380
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115247
- color: "gray",
115381
+ color: colors.muted,
115248
115382
  children: "> "
115249
115383
  }),
115250
115384
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: input }),
115251
115385
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115252
- color: "cyan",
115386
+ color: colors.accent,
115253
115387
  children: "_"
115254
115388
  })
115255
115389
  ] })]
@@ -115806,7 +115940,7 @@ async function startHandler(expertKey, query, options, handlerOptions) {
115806
115940
  //#endregion
115807
115941
  //#region package.json
115808
115942
  var name = "create-expert";
115809
- var version = "0.0.36";
115943
+ var version = "0.0.38";
115810
115944
  var description = "Create and modify Perstack expert definitions";
115811
115945
 
115812
115946
  //#endregion