perstack 0.0.91 → 0.0.92

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 object$2, A as runCommandInputSchema, At as createId, B as _instanceof, C as skipDelegates, Ct as $constructor, D as stopRunByError, Dt as defaultMaxRetries, E as stopRunByDelegate, Et as PerstackError, F as expertSchema, G as custom, H as any, I as checkpointSchema, J as lazy, K as discriminatedUnion, L as number$1, M as perstackConfigSchema, N as lockfileSchema, O as stopRunByExceededMaxSteps, Ot as defaultPerstackApiBaseUrl, P as jobSchema, Q as number, R as ZodOptional$1, S as runSettingSchema, St as normalizeParams, T as startRun, Tt as knownModels, U as array$1, V as _null, W as boolean, X as looseObject, Y as literal, Z as never, _ as proceedToInteractiveTools, _t as parseAsync, a as getFilteredEnv, at as tuple, b as retry, bt as clone, c as createGeneralToolActivity, ct as url, d as completeRun, dt as toJSONSchema, et as optional, f as continueToNextStep, ft as describe$1, g as finishToolCall, gt as parse$1, h as finishMcpTools, ht as $ZodType, i as validateEventFilter, it as string, j as startCommandInputSchema, k as stopRunByInteractiveTool, kt as defaultTimeout, l as attemptCompletion$1, lt as safeParseAsync$2, m as createStreamingEvent, mt as $ZodObject, n as parseWithFriendlyError, nt as record, o as BASE_SKILL_PREFIX, ot as union, p as createRuntimeEvent, pt as meta$1, q as intersection, r as createFilteredEventListener, rt as strictObject, s as createBaseToolActivity, st as unknown, t as createApiClient, tt as preprocess, u as callTools, ut as datetime, v as resolveToolResults, vt as safeParse$1, w as startGeneration, wt as NEVER, x as runParamsSchema, xt as defineLazy, y as resumeFromStop, yt as safeParseAsync$1, z as _enum } from "../dist-Bww5wViz.js";
3
+ import { $ as object$2, A as runCommandInputSchema, At as createId, B as _instanceof, C as skipDelegates, Ct as $constructor, D as stopRunByError, Dt as defaultMaxRetries, E as stopRunByDelegate, Et as PerstackError, F as expertSchema, G as custom, H as any, I as checkpointSchema, J as lazy, K as discriminatedUnion, L as number$1, M as perstackConfigSchema, N as lockfileSchema, O as stopRunByExceededMaxSteps, Ot as defaultPerstackApiBaseUrl, P as jobSchema, Q as number, R as ZodOptional$1, S as runSettingSchema, St as normalizeParams, T as startRun, Tt as knownModels, U as array$1, V as _null, W as boolean, X as looseObject, Y as literal, Z as never, _ as proceedToInteractiveTools, _t as parseAsync, a as getFilteredEnv, at as tuple, b as retry, bt as clone, c as createGeneralToolActivity, ct as url, d as completeRun, dt as toJSONSchema, et as optional, f as continueToNextStep, ft as describe$1, g as finishToolCall, gt as parse$1, h as finishMcpTools, ht as $ZodType, i as validateEventFilter, it as string, j as startCommandInputSchema, k as stopRunByInteractiveTool, kt as defaultTimeout, l as attemptCompletion$1, lt as safeParseAsync$2, m as createStreamingEvent, mt as $ZodObject, n as parseWithFriendlyError, nt as record, o as BASE_SKILL_PREFIX, ot as union, p as createRuntimeEvent, pt as meta$1, q as intersection, r as createFilteredEventListener, rt as strictObject, s as createBaseToolActivity, st as unknown, t as createApiClient, tt as preprocess, u as callTools, ut as datetime, v as resolveToolResults, vt as safeParse$1, w as startGeneration, wt as NEVER, x as runParamsSchema, xt as defineLazy, y as resumeFromStop, yt as safeParseAsync$1, z as _enum } from "../dist-V21w4o7U.js";
4
4
  import { t as require_token_error } from "../token-error-CfavTss_.js";
5
5
  import fs, { constants, lstat, mkdir, open, readFile, stat, writeFile } from "node:fs/promises";
6
6
  import path, { dirname, extname } from "node:path";
@@ -16310,7 +16310,7 @@ const EMPTY_COMPLETION_RESULT = { completion: {
16310
16310
  //#endregion
16311
16311
  //#region ../base/package.json
16312
16312
  var name$5 = "@perstack/base";
16313
- var version$2 = "0.0.59";
16313
+ var version$2 = "0.0.61";
16314
16314
 
16315
16315
  //#endregion
16316
16316
  //#region ../base/src/tools/todo.ts
@@ -16723,11 +16723,47 @@ function registerRemoveDelegate(server, callbacks) {
16723
16723
  }
16724
16724
  });
16725
16725
  }
16726
+ function registerCreateExpert(server, callbacks) {
16727
+ server.registerTool("createExpert", {
16728
+ title: "Create expert",
16729
+ description: "Dynamically create an expert definition in memory. Returns the expert key so you can add it as a delegate.",
16730
+ inputSchema: {
16731
+ key: string().describe("Unique expert key (kebab-case)"),
16732
+ instruction: string().describe("System instruction for the expert"),
16733
+ description: string().optional().describe("Human-readable description"),
16734
+ version: string().optional().describe("Semantic version (defaults to 1.0.0)"),
16735
+ skills: record(string(), object$2({
16736
+ type: _enum(["mcpStdioSkill", "mcpSseSkill"]).describe("Skill transport type"),
16737
+ command: string().optional().describe("Command to execute (for stdio skills)"),
16738
+ packageName: string().optional().describe("Package name for npx/uvx (for stdio skills)"),
16739
+ args: array$1(string()).optional().describe("Additional command arguments"),
16740
+ requiredEnv: array$1(string()).optional().describe("Required environment variable names"),
16741
+ endpoint: string().optional().describe("SSE endpoint URL (for SSE skills)"),
16742
+ description: string().optional().describe("Human-readable description"),
16743
+ rule: string().optional().describe("Usage rules for the LLM"),
16744
+ pick: array$1(string()).optional().describe("Tool names to include (whitelist)"),
16745
+ omit: array$1(string()).optional().describe("Tool names to exclude (blacklist)"),
16746
+ lazyInit: boolean().optional().describe("Lazy initialization")
16747
+ })).optional().describe("Skills map (defaults to @perstack/base)"),
16748
+ delegates: array$1(string()).optional().describe("Expert keys to delegate to"),
16749
+ tags: array$1(string()).optional().describe("Tags for categorization"),
16750
+ providerTools: array$1(string()).optional().describe("Provider-specific tool names")
16751
+ }
16752
+ }, async (input) => {
16753
+ try {
16754
+ return successToolResult(await callbacks.createExpert(input));
16755
+ } catch (e) {
16756
+ if (e instanceof Error) return errorToolResult(e);
16757
+ throw e;
16758
+ }
16759
+ });
16760
+ }
16726
16761
  function registerSkillManagementTools(server, callbacks) {
16727
16762
  registerAddSkill(server, callbacks);
16728
16763
  registerRemoveSkill(server, callbacks);
16729
16764
  registerAddDelegate(server, callbacks);
16730
16765
  registerRemoveDelegate(server, callbacks);
16766
+ registerCreateExpert(server, callbacks);
16731
16767
  }
16732
16768
 
16733
16769
  //#endregion
@@ -19169,6 +19205,9 @@ var InMemoryBaseSkillAdapter = class extends SkillAdapter {
19169
19205
  },
19170
19206
  removeDelegate: () => {
19171
19207
  throw new Error("Skill management not initialized");
19208
+ },
19209
+ createExpert: () => {
19210
+ throw new Error("Skill management not initialized");
19172
19211
  }
19173
19212
  };
19174
19213
  constructor(skill, onLifecycleEvent, options) {
@@ -19714,7 +19753,31 @@ var SkillManager = class SkillManager {
19714
19753
  await sm.addDelegate(delegateExpert);
19715
19754
  return { delegateToolName: sm.getAdapters().get(delegateExpert.name)?.getToolDefinitions()[0]?.name ?? delegateExpert.name };
19716
19755
  },
19717
- removeDelegate: (name) => sm.removeDelegate(name)
19756
+ removeDelegate: (name) => sm.removeDelegate(name),
19757
+ createExpert: async (input) => {
19758
+ const skills = input.skills ? {
19759
+ "@perstack/base": input.skills["@perstack/base"] ?? {
19760
+ type: "mcpStdioSkill",
19761
+ command: "npx",
19762
+ packageName: "@perstack/base",
19763
+ pick: ["attemptCompletion"]
19764
+ },
19765
+ ...input.skills
19766
+ } : void 0;
19767
+ const expert = expertSchema.parse({
19768
+ key: input.key,
19769
+ name: input.key,
19770
+ version: input.version ?? "1.0.0",
19771
+ description: input.description,
19772
+ instruction: input.instruction,
19773
+ skills,
19774
+ delegates: input.delegates,
19775
+ tags: input.tags,
19776
+ providerTools: input.providerTools
19777
+ });
19778
+ experts[expert.key] = expert;
19779
+ return { expertKey: expert.key };
19780
+ }
19718
19781
  });
19719
19782
  break;
19720
19783
  }
@@ -20990,7 +21053,7 @@ async function buildOutput(fetcher, options, filterOptions, storagePath) {
20990
21053
 
20991
21054
  //#endregion
20992
21055
  //#region ../../packages/runtime/package.json
20993
- var version$1 = "0.0.106";
21056
+ var version$1 = "0.0.108";
20994
21057
 
20995
21058
  //#endregion
20996
21059
  //#region ../../packages/runtime/src/helpers/usage.ts
@@ -54557,7 +54620,7 @@ function createOpenAI(options = {}) {
54557
54620
  var openai = createOpenAI();
54558
54621
 
54559
54622
  //#endregion
54560
- //#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
54623
+ //#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
54561
54624
  function convertToOllamaCompletionPrompt({ prompt, user = "user", assistant = "assistant" }) {
54562
54625
  let text = "";
54563
54626
  if (prompt[0].role === "system") {
@@ -76538,7 +76601,7 @@ function validateRuntimeVersion(experts) {
76538
76601
  //#endregion
76539
76602
  //#region ../../packages/runtime/src/helpers/setup-experts.ts
76540
76603
  async function setupExperts(setting, resolveExpertToRun) {
76541
- const resolveFn = resolveExpertToRun ?? (await import("../resolve-expert-CqKhWCpK.js")).resolveExpertToRun;
76604
+ const resolveFn = resolveExpertToRun ?? (await import("../resolve-expert-Cqhb7H8o.js")).resolveExpertToRun;
76542
76605
  const { expertKey } = setting;
76543
76606
  const experts = { ...setting.experts };
76544
76607
  const clientOptions = {
@@ -76841,7 +76904,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
76841
76904
  }));
76842
76905
 
76843
76906
  //#endregion
76844
- //#region ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.46_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
76907
+ //#region ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.47_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
76845
76908
  var import_dist$1 = require_dist$1();
76846
76909
  var symbol$1 = Symbol.for("vercel.ai.gateway.error");
76847
76910
  var _a$1, _b;
@@ -77725,7 +77788,7 @@ async function getVercelRequestId() {
77725
77788
  var _a9;
77726
77789
  return (_a9 = (0, import_dist$1.getContext)().headers) == null ? void 0 : _a9["x-vercel-id"];
77727
77790
  }
77728
- var VERSION$2 = "3.0.46";
77791
+ var VERSION$2 = "3.0.47";
77729
77792
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
77730
77793
  function createGatewayProvider(options = {}) {
77731
77794
  var _a9, _b9;
@@ -78746,7 +78809,7 @@ var TraceAPI = function() {
78746
78809
  var trace = TraceAPI.getInstance();
78747
78810
 
78748
78811
  //#endregion
78749
- //#region ../../node_modules/.pnpm/ai@6.0.86_zod@4.3.6/node_modules/ai/dist/index.mjs
78812
+ //#region ../../node_modules/.pnpm/ai@6.0.87_zod@4.3.6/node_modules/ai/dist/index.mjs
78750
78813
  var __defProp = Object.defineProperty;
78751
78814
  var __export = (target, all) => {
78752
78815
  for (var name21 in all) __defProp(target, name21, {
@@ -79282,7 +79345,7 @@ function detectMediaType({ data, signatures }) {
79282
79345
  const bytes = typeof processedData === "string" ? convertBase64ToUint8Array(processedData.substring(0, Math.min(processedData.length, 24))) : processedData;
79283
79346
  for (const signature of signatures) if (bytes.length >= signature.bytesPrefix.length && signature.bytesPrefix.every((byte, index) => byte === null || bytes[index] === byte)) return signature.mediaType;
79284
79347
  }
79285
- var VERSION = "6.0.86";
79348
+ var VERSION = "6.0.87";
79286
79349
  var download = async ({ url, maxBytes, abortSignal }) => {
79287
79350
  var _a21;
79288
79351
  const urlText = url.toString();
@@ -90147,43 +90210,65 @@ var DelegationExecutor = class {
90147
90210
  async executeSingleDelegation(delegation, parentSetting, parentContext, parentExpert, runFn, parentOptions) {
90148
90211
  const { expert, toolCallId, toolName, query } = delegation;
90149
90212
  const delegateRunId = createId();
90150
- const resultCheckpoint = await runFn({
90151
- setting: {
90152
- ...parentSetting,
90153
- runId: delegateRunId,
90154
- expertKey: expert.key,
90155
- input: { text: query }
90213
+ const delegateSetting = {
90214
+ ...parentSetting,
90215
+ runId: delegateRunId,
90216
+ expertKey: expert.key,
90217
+ input: { text: query }
90218
+ };
90219
+ const delegateCheckpoint = {
90220
+ id: createId(),
90221
+ jobId: parentSetting.jobId,
90222
+ runId: delegateRunId,
90223
+ status: "init",
90224
+ stepNumber: parentContext.stepNumber,
90225
+ messages: [],
90226
+ expert: {
90227
+ key: expert.key,
90228
+ name: expert.name,
90229
+ version: expert.version
90156
90230
  },
90157
- checkpoint: {
90158
- id: createId(),
90159
- jobId: parentSetting.jobId,
90160
- runId: delegateRunId,
90161
- status: "init",
90162
- stepNumber: parentContext.stepNumber,
90163
- messages: [],
90231
+ delegatedBy: {
90164
90232
  expert: {
90165
- key: expert.key,
90166
- name: expert.name,
90167
- version: expert.version
90168
- },
90169
- delegatedBy: {
90170
- expert: {
90171
- key: parentExpert.key,
90172
- name: parentExpert.name,
90173
- version: parentExpert.version
90174
- },
90175
- toolCallId,
90176
- toolName,
90177
- checkpointId: parentContext.id,
90178
- runId: parentSetting.runId
90233
+ key: parentExpert.key,
90234
+ name: parentExpert.name,
90235
+ version: parentExpert.version
90179
90236
  },
90180
- usage: createEmptyUsage(),
90181
- contextWindow: parentContext.contextWindow
90182
- }
90183
- }, {
90184
- ...parentOptions,
90185
- returnOnDelegationComplete: true
90186
- });
90237
+ toolCallId,
90238
+ toolName,
90239
+ checkpointId: parentContext.id,
90240
+ runId: parentSetting.runId
90241
+ },
90242
+ usage: createEmptyUsage(),
90243
+ contextWindow: parentContext.contextWindow
90244
+ };
90245
+ let resultCheckpoint;
90246
+ try {
90247
+ resultCheckpoint = await runFn({
90248
+ setting: delegateSetting,
90249
+ checkpoint: delegateCheckpoint
90250
+ }, {
90251
+ ...parentOptions,
90252
+ returnOnDelegationComplete: true
90253
+ });
90254
+ } catch (error) {
90255
+ return {
90256
+ toolCallId,
90257
+ toolName,
90258
+ expertKey: expert.key,
90259
+ text: `Delegation to ${expert.key} failed: ${error instanceof Error ? error.message : String(error)}`,
90260
+ stepNumber: parentContext.stepNumber,
90261
+ deltaUsage: createEmptyUsage()
90262
+ };
90263
+ }
90264
+ if (resultCheckpoint.status !== "completed") return {
90265
+ toolCallId,
90266
+ toolName,
90267
+ expertKey: expert.key,
90268
+ text: `Delegation to ${expert.key} ended with status: ${resultCheckpoint.status}`,
90269
+ stepNumber: resultCheckpoint.stepNumber,
90270
+ deltaUsage: resultCheckpoint.usage
90271
+ };
90187
90272
  return this.extractDelegationResult(resultCheckpoint, toolCallId, toolName, expert.key);
90188
90273
  }
90189
90274
  extractDelegationResult(checkpoint, toolCallId, toolName, expertKey) {
@@ -90309,7 +90394,11 @@ async function run(runInput, options) {
90309
90394
  if (!delegateTo || delegateTo.length === 0) throw new Error("No delegations found in checkpoint");
90310
90395
  const executor = new DelegationExecutor();
90311
90396
  const context = extractDelegationContext(resultCheckpoint);
90312
- const delegationResult = await executor.execute(delegateTo, setting, context, runResult.expertToRun, run, options);
90397
+ const updatedSetting = {
90398
+ ...setting,
90399
+ experts: runResult.experts
90400
+ };
90401
+ const delegationResult = await executor.execute(delegateTo, updatedSetting, context, runResult.expertToRun, run, options);
90313
90402
  setting = delegationResult.nextSetting;
90314
90403
  checkpoint = delegationResult.nextCheckpoint;
90315
90404
  break;
@@ -90587,6 +90676,7 @@ async function runHandler(expertKey, query, options, handlerOptions) {
90587
90676
  resumeFrom: input.options.resumeFrom,
90588
90677
  expertKey: input.expertKey
90589
90678
  });
90679
+ if (handlerOptions?.additionalEnv) Object.assign(env, handlerOptions.additionalEnv(env));
90590
90680
  const lockfile = handlerOptions.lockfile;
90591
90681
  await run({
90592
90682
  setting: {
@@ -114102,6 +114192,17 @@ var EventQueue = class EventQueue {
114102
114192
  }
114103
114193
  };
114104
114194
 
114195
+ //#endregion
114196
+ //#region ../../packages/tui-components/src/colors.ts
114197
+ const colors = {
114198
+ primary: "white",
114199
+ muted: "gray",
114200
+ accent: "cyan",
114201
+ success: "green",
114202
+ warn: "yellow",
114203
+ destructive: "red"
114204
+ };
114205
+
114105
114206
  //#endregion
114106
114207
  //#region ../../packages/tui-components/src/constants.ts
114107
114208
  const UI_CONSTANTS = {
@@ -114435,7 +114536,7 @@ const ActionRowSimple = ({ indicatorColor, text, textDimColor = false }) => /* @
114435
114536
  color: indicatorColor,
114436
114537
  children: INDICATOR.BULLET
114437
114538
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114438
- color: "white",
114539
+ color: colors.primary,
114439
114540
  dimColor: textDimColor,
114440
114541
  children: text
114441
114542
  })]
@@ -114453,11 +114554,11 @@ const ActionRow = ({ indicatorColor, label, summary, children }) => /* @__PURE__
114453
114554
  children: INDICATOR.BULLET
114454
114555
  }),
114455
114556
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114456
- color: "white",
114557
+ color: colors.primary,
114457
114558
  children: label
114458
114559
  }),
114459
114560
  summary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114460
- color: "white",
114561
+ color: colors.primary,
114461
114562
  dimColor: true,
114462
114563
  children: summary
114463
114564
  })
@@ -114569,10 +114670,10 @@ const ListBrowser = ({ title, items, renderItem, onSelect, emptyMessage = "No it
114569
114670
  flexDirection: "column",
114570
114671
  children: [
114571
114672
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114572
- color: "cyan",
114673
+ color: colors.accent,
114573
114674
  children: title
114574
114675
  }), items.length > maxItems && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
114575
- color: "gray",
114676
+ color: colors.muted,
114576
114677
  children: [
114577
114678
  " ",
114578
114679
  "(",
@@ -114583,13 +114684,13 @@ const ListBrowser = ({ title, items, renderItem, onSelect, emptyMessage = "No it
114583
114684
  ]
114584
114685
  })] }),
114585
114686
  hasMoreAbove && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114586
- color: "gray",
114687
+ color: colors.muted,
114587
114688
  children: INDICATOR.ELLIPSIS
114588
114689
  }),
114589
114690
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
114590
114691
  flexDirection: "column",
114591
114692
  children: displayItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114592
- color: "gray",
114693
+ color: colors.muted,
114593
114694
  children: emptyMessage
114594
114695
  }) : displayItems.map((item, index) => {
114595
114696
  const actualIndex = scrollOffset + index;
@@ -114597,7 +114698,7 @@ const ListBrowser = ({ title, items, renderItem, onSelect, emptyMessage = "No it
114597
114698
  })
114598
114699
  }),
114599
114700
  hasMoreBelow && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114600
- color: "gray",
114701
+ color: colors.muted,
114601
114702
  children: INDICATOR.ELLIPSIS
114602
114703
  })
114603
114704
  ]
@@ -114620,7 +114721,7 @@ const BrowsingCheckpointsInput = ({ job, checkpoints, onCheckpointSelect, onChec
114620
114721
  return false;
114621
114722
  },
114622
114723
  renderItem: (cp, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
114623
- color: isSelected ? "cyan" : "gray",
114724
+ color: isSelected ? colors.accent : colors.muted,
114624
114725
  children: [
114625
114726
  isSelected ? ">" : " ",
114626
114727
  " Step ",
@@ -114655,29 +114756,29 @@ const BrowsingEventDetailInput = ({ event, onBack }) => {
114655
114756
  marginLeft: 2,
114656
114757
  children: [
114657
114758
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114658
- color: "gray",
114759
+ color: colors.muted,
114659
114760
  children: "Type: "
114660
114761
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114661
- color: "cyan",
114762
+ color: colors.accent,
114662
114763
  children: event.type
114663
114764
  })] }),
114664
114765
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114665
- color: "gray",
114766
+ color: colors.muted,
114666
114767
  children: "Step: "
114667
114768
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: event.stepNumber })] }),
114668
114769
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114669
- color: "gray",
114770
+ color: colors.muted,
114670
114771
  children: "Timestamp: "
114671
114772
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: formatTimestamp(event.timestamp) })] }),
114672
114773
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114673
- color: "gray",
114774
+ color: colors.muted,
114674
114775
  children: "ID: "
114675
114776
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114676
114777
  dimColor: true,
114677
114778
  children: event.id
114678
114779
  })] }),
114679
114780
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114680
- color: "gray",
114781
+ color: colors.muted,
114681
114782
  children: "Run ID: "
114682
114783
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
114683
114784
  dimColor: true,
@@ -114697,7 +114798,7 @@ const BrowsingEventsInput = ({ checkpoint, events, onEventSelect, onBack }) => /
114697
114798
  onBack,
114698
114799
  emptyMessage: "No events found",
114699
114800
  renderItem: (ev, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
114700
- color: isSelected ? "cyan" : "gray",
114801
+ color: isSelected ? colors.accent : colors.muted,
114701
114802
  children: [
114702
114803
  isSelected ? ">" : " ",
114703
114804
  " [",
@@ -115379,17 +115480,17 @@ const useExpertSelector = (options) => {
115379
115480
  const ExpertList = ({ experts, selectedIndex, showSource = false, inline = false, maxItems }) => {
115380
115481
  const displayExperts = maxItems ? experts.slice(0, maxItems) : experts;
115381
115482
  if (displayExperts.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115382
- color: "gray",
115483
+ color: colors.muted,
115383
115484
  children: "No experts found."
115384
115485
  });
115385
115486
  const items = displayExperts.map((expert, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
115386
- color: index === selectedIndex ? "cyan" : "gray",
115487
+ color: index === selectedIndex ? colors.accent : colors.muted,
115387
115488
  children: [
115388
115489
  index === selectedIndex ? ">" : " ",
115389
115490
  " ",
115390
115491
  showSource ? expert.key : expert.name,
115391
115492
  showSource && expert.source && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" ", /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
115392
- color: expert.source === "configured" ? "green" : "yellow",
115493
+ color: expert.source === "configured" ? colors.success : colors.warn,
115393
115494
  children: [
115394
115495
  "[",
115395
115496
  expert.source === "configured" ? "config" : "recent",
@@ -115419,7 +115520,7 @@ const ExpertSelectorBase = ({ experts, hint, onExpertSelect, showSource = false,
115419
115520
  children: [!inputMode && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
115420
115521
  flexDirection: "column",
115421
115522
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115422
- color: "cyan",
115523
+ color: colors.accent,
115423
115524
  children: hint
115424
115525
  }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpertList, {
115425
115526
  experts,
@@ -115430,15 +115531,15 @@ const ExpertSelectorBase = ({ experts, hint, onExpertSelect, showSource = false,
115430
115531
  })]
115431
115532
  }), inputMode && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [
115432
115533
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115433
- color: "gray",
115534
+ color: colors.muted,
115434
115535
  children: "Expert: "
115435
115536
  }),
115436
115537
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115437
- color: "white",
115538
+ color: colors.primary,
115438
115539
  children: input
115439
115540
  }),
115440
115541
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115441
- color: "cyan",
115542
+ color: colors.accent,
115442
115543
  children: "_"
115443
115544
  })
115444
115545
  ] })]
@@ -115484,7 +115585,7 @@ const BrowsingHistoryInput = ({ jobs, onJobSelect, onJobResume, onSwitchToExpert
115484
115585
  return false;
115485
115586
  },
115486
115587
  renderItem: (job, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
115487
- color: isSelected ? "cyan" : "gray",
115588
+ color: isSelected ? colors.accent : colors.muted,
115488
115589
  children: [
115489
115590
  isSelected ? ">" : " ",
115490
115591
  " ",
@@ -115566,12 +115667,13 @@ function renderParallelGroup(group) {
115566
115667
  });
115567
115668
  }
115568
115669
  function renderReasoning(text) {
115670
+ const lines = text.split("\n");
115569
115671
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115570
- indicatorColor: "white",
115672
+ indicatorColor: colors.primary,
115571
115673
  label: "Reasoning",
115572
115674
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
115573
115675
  flexDirection: "column",
115574
- children: text.split("\n").map((line, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115676
+ children: lines.map((line, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115575
115677
  dimColor: true,
115576
115678
  wrap: "wrap",
115577
115679
  children: line
@@ -115580,11 +115682,11 @@ function renderReasoning(text) {
115580
115682
  });
115581
115683
  }
115582
115684
  function renderAction(action) {
115583
- const color = action.type === "error" || "error" in action && action.error ? "red" : "green";
115685
+ const color = action.type === "error" || "error" in action && action.error ? colors.destructive : colors.success;
115584
115686
  switch (action.type) {
115585
115687
  case "query": return renderQuery(action.text, action.runId);
115586
115688
  case "retry": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115587
- indicatorColor: "yellow",
115689
+ indicatorColor: colors.warn,
115588
115690
  label: "Retry",
115589
115691
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115590
115692
  dimColor: true,
@@ -115592,22 +115694,22 @@ function renderAction(action) {
115592
115694
  })
115593
115695
  });
115594
115696
  case "complete": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115595
- indicatorColor: "green",
115697
+ indicatorColor: colors.success,
115596
115698
  label: "Run Results",
115597
115699
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: action.text })
115598
115700
  });
115599
115701
  case "attemptCompletion": {
115600
115702
  if (action.error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115601
- indicatorColor: "red",
115703
+ indicatorColor: colors.destructive,
115602
115704
  label: "Completion Failed",
115603
115705
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115604
- color: "red",
115706
+ color: colors.destructive,
115605
115707
  children: action.error
115606
115708
  })
115607
115709
  });
115608
115710
  const remaining = action.remainingTodos?.filter((t) => !t.completed) ?? [];
115609
115711
  if (remaining.length > 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115610
- indicatorColor: "yellow",
115712
+ indicatorColor: colors.warn,
115611
115713
  label: "Completion Blocked",
115612
115714
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
115613
115715
  dimColor: true,
@@ -115619,7 +115721,7 @@ function renderAction(action) {
115619
115721
  })
115620
115722
  });
115621
115723
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115622
- indicatorColor: "green",
115724
+ indicatorColor: colors.success,
115623
115725
  text: "Completion Accepted"
115624
115726
  });
115625
115727
  }
@@ -115651,7 +115753,7 @@ function renderAction(action) {
115651
115753
  });
115652
115754
  case "exec": return renderExec(action, color);
115653
115755
  case "delegate": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115654
- indicatorColor: "yellow",
115756
+ indicatorColor: colors.warn,
115655
115757
  label: action.delegateExpertKey,
115656
115758
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115657
115759
  dimColor: true,
@@ -115659,17 +115761,49 @@ function renderAction(action) {
115659
115761
  })
115660
115762
  });
115661
115763
  case "delegationComplete": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115662
- indicatorColor: "green",
115764
+ indicatorColor: colors.success,
115663
115765
  text: `Delegation Complete (${action.count} delegate${action.count > 1 ? "s" : ""} returned)`
115664
115766
  });
115665
115767
  case "interactiveTool": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115666
- indicatorColor: "yellow",
115768
+ indicatorColor: colors.warn,
115667
115769
  label: `Interactive: ${action.toolName}`,
115668
115770
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115669
115771
  dimColor: true,
115670
115772
  children: truncateText(JSON.stringify(action.args), UI_CONSTANTS.TRUNCATE_TEXT_MEDIUM)
115671
115773
  })
115672
115774
  });
115775
+ case "addSkill": {
115776
+ const skillColor = action.error ? colors.destructive : colors.accent;
115777
+ const toolsSummary = action.tools ? `${action.tools.length} tool${action.tools.length !== 1 ? "s" : ""}: ${action.tools.join(", ")}` : void 0;
115778
+ if (toolsSummary) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115779
+ indicatorColor: skillColor,
115780
+ label: `Add Skill ${action.name}`,
115781
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115782
+ dimColor: true,
115783
+ children: truncateText(toolsSummary, UI_CONSTANTS.TRUNCATE_TEXT_MEDIUM)
115784
+ })
115785
+ });
115786
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115787
+ indicatorColor: skillColor,
115788
+ text: `Add Skill ${action.name}`
115789
+ });
115790
+ }
115791
+ case "removeSkill": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115792
+ indicatorColor: action.error ? colors.destructive : colors.accent,
115793
+ text: `Remove Skill ${action.skillName}`
115794
+ });
115795
+ case "addDelegate": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115796
+ indicatorColor: action.error ? colors.destructive : colors.accent,
115797
+ text: `Add Delegate ${action.targetExpertKey}`
115798
+ });
115799
+ case "removeDelegate": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115800
+ indicatorColor: action.error ? colors.destructive : colors.accent,
115801
+ text: `Remove Delegate ${action.expertName}`
115802
+ });
115803
+ case "createExpert": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRowSimple, {
115804
+ indicatorColor: action.error ? colors.destructive : colors.accent,
115805
+ text: `Create Expert ${action.description ? `${action.targetKey} - ${truncateText(action.description, UI_CONSTANTS.TRUNCATE_TEXT_MEDIUM)}` : action.targetKey}`
115806
+ });
115673
115807
  case "generalTool": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115674
115808
  indicatorColor: color,
115675
115809
  label: action.toolName,
@@ -115679,10 +115813,10 @@ function renderAction(action) {
115679
115813
  })
115680
115814
  });
115681
115815
  case "error": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115682
- indicatorColor: "red",
115816
+ indicatorColor: colors.destructive,
115683
115817
  label: action.errorName ?? "Error",
115684
115818
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115685
- color: "red",
115819
+ color: colors.destructive,
115686
115820
  children: action.error ?? "Unknown error"
115687
115821
  })
115688
115822
  });
@@ -115754,7 +115888,7 @@ function renderReadTextFile(action, color) {
115754
115888
  flexDirection: "row",
115755
115889
  gap: 1,
115756
115890
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115757
- color: "white",
115891
+ color: colors.primary,
115758
115892
  dimColor: true,
115759
115893
  children: line
115760
115894
  })
@@ -115775,11 +115909,11 @@ function renderWriteTextFile(action, color) {
115775
115909
  flexDirection: "row",
115776
115910
  gap: 1,
115777
115911
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115778
- color: "green",
115912
+ color: colors.success,
115779
115913
  dimColor: true,
115780
115914
  children: "+"
115781
115915
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115782
- color: "white",
115916
+ color: colors.primary,
115783
115917
  dimColor: true,
115784
115918
  children: line
115785
115919
  })]
@@ -115801,11 +115935,11 @@ function renderEditTextFile(action, color) {
115801
115935
  flexDirection: "row",
115802
115936
  gap: 1,
115803
115937
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115804
- color: "red",
115938
+ color: colors.destructive,
115805
115939
  dimColor: true,
115806
115940
  children: "-"
115807
115941
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115808
- color: "white",
115942
+ color: colors.primary,
115809
115943
  dimColor: true,
115810
115944
  children: line
115811
115945
  })]
@@ -115813,7 +115947,7 @@ function renderEditTextFile(action, color) {
115813
115947
  flexDirection: "row",
115814
115948
  gap: 1,
115815
115949
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115816
- color: "green",
115950
+ color: colors.success,
115817
115951
  dimColor: true,
115818
115952
  children: "+"
115819
115953
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
@@ -115850,10 +115984,11 @@ function renderExec(action, color) {
115850
115984
  }
115851
115985
  function renderQuery(text, runId) {
115852
115986
  const lines = text.split("\n");
115987
+ const shortRunId = runId.slice(0, 8);
115853
115988
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, {
115854
- indicatorColor: "cyan",
115989
+ indicatorColor: colors.accent,
115855
115990
  label: "Query",
115856
- summary: `(${runId.slice(0, 8)})`,
115991
+ summary: `(${shortRunId})`,
115857
115992
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
115858
115993
  flexDirection: "column",
115859
115994
  children: lines.map((line, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
@@ -115960,15 +116095,15 @@ const InterfacePanel = ({ runtimeInfo, runStatus, streaming, onSubmit }) => {
115960
116095
  useInput(handleInput);
115961
116096
  let statusLabel;
115962
116097
  if (runStatus === "waiting") statusLabel = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115963
- color: "cyan",
116098
+ color: colors.accent,
115964
116099
  children: "Waiting for query..."
115965
116100
  });
115966
116101
  else if (runStatus === "completed") statusLabel = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115967
- color: "green",
116102
+ color: colors.success,
115968
116103
  children: "Completed"
115969
116104
  });
115970
116105
  else if (runStatus === "stopped") statusLabel = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
115971
- color: "yellow",
116106
+ color: colors.warn,
115972
116107
  children: "Stopped"
115973
116108
  });
115974
116109
  else if (streamingPhase === "reasoning") statusLabel = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Streaming Reasoning..." });
@@ -115980,14 +116115,14 @@ const InterfacePanel = ({ runtimeInfo, runStatus, streaming, onSubmit }) => {
115980
116115
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
115981
116116
  flexDirection: "column",
115982
116117
  borderStyle: "single",
115983
- borderColor: "gray",
116118
+ borderColor: colors.muted,
115984
116119
  borderTop: true,
115985
116120
  borderBottom: false,
115986
116121
  borderLeft: false,
115987
116122
  borderRight: false,
115988
116123
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
115989
116124
  spinner ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
115990
- color: "cyan",
116125
+ color: colors.accent,
115991
116126
  children: [spinner, " "]
115992
116127
  }) : null,
115993
116128
  statusLabel,
@@ -116008,12 +116143,12 @@ const InterfacePanel = ({ runtimeInfo, runStatus, streaming, onSubmit }) => {
116008
116143
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [usagePercent, "%"] })
116009
116144
  ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
116010
116145
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
116011
- color: "gray",
116146
+ color: colors.muted,
116012
116147
  children: "> "
116013
116148
  }),
116014
116149
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: input }),
116015
116150
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
116016
- color: "cyan",
116151
+ color: colors.accent,
116017
116152
  children: "_"
116018
116153
  })
116019
116154
  ] })]
@@ -116570,7 +116705,7 @@ async function startHandler(expertKey, query, options, handlerOptions) {
116570
116705
  //#endregion
116571
116706
  //#region package.json
116572
116707
  var name = "perstack";
116573
- var version = "0.0.91";
116708
+ var version = "0.0.92";
116574
116709
  var description = "PerStack CLI";
116575
116710
 
116576
116711
  //#endregion