perstack 0.0.126 → 0.0.127

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
@@ -21092,7 +21092,7 @@ async function expertVersionsHandler(scopeName, options) {
21092
21092
  }
21093
21093
  //#endregion
21094
21094
  //#region ../../packages/runtime/package.json
21095
- var version$1 = "0.0.137";
21095
+ var version$1 = "0.0.138";
21096
21096
  //#endregion
21097
21097
  //#region ../../packages/runtime/src/helpers/usage.ts
21098
21098
  function createEmptyUsage() {
@@ -92481,22 +92481,22 @@ var import_dist = (/* @__PURE__ */ __commonJSMin(((exports) => {
92481
92481
  }
92482
92482
  exports.dedent = dedent;
92483
92483
  })))();
92484
- function getEnvironmentSection(startedAt) {
92485
- const lines = [`- Current time: ${new Date(startedAt).toISOString()}`, `- Working directory: ${process.cwd()}`];
92484
+ function getEnvironmentSection() {
92485
+ const lines = [`- Platform: ${os.platform()} ${os.release()} (${os.arch()})`];
92486
92486
  if (process.env.PERSTACK_SANDBOX === "1") lines.push("- Sandbox: This is an isolated container environment (Ubuntu). You can freely install packages with `sudo apt-get install` and run arbitrary commands without affecting the host system.");
92487
92487
  return `Environment:\n${lines.join("\n")}`;
92488
92488
  }
92489
- function getDelegateMetaInstruction(startedAt) {
92489
+ function getDelegateMetaInstruction() {
92490
92490
  return import_dist.dedent`
92491
92491
  Before starting work, investigate the workspace and understand the current state. Then use the todo tool to create a plan of action. Work through the todos step by step, marking each completed as you go.
92492
92492
 
92493
92493
  When the task is complete, call attemptCompletion with a result parameter containing your final response.
92494
92494
  When you cannot help, call attemptCompletion without a result.
92495
92495
 
92496
- ${getEnvironmentSection(startedAt)}
92496
+ ${getEnvironmentSection()}
92497
92497
  `;
92498
92498
  }
92499
- function getCoordinatorMetaInstruction(startedAt) {
92499
+ function getCoordinatorMetaInstruction() {
92500
92500
  return import_dist.dedent`
92501
92501
  Your role:
92502
92502
  - Act as the coordinator for the given task: define the task, set goals, and delegate.
@@ -92532,14 +92532,14 @@ function getCoordinatorMetaInstruction(startedAt) {
92532
92532
  When the task is complete, call attemptCompletion with a result parameter containing your final response.
92533
92533
  When you cannot help, call attemptCompletion without a result.
92534
92534
 
92535
- ${getEnvironmentSection(startedAt)}
92535
+ ${getEnvironmentSection()}
92536
92536
  `;
92537
92537
  }
92538
- function createInstructionMessage(expert, startedAt) {
92538
+ function createInstructionMessage(expert) {
92539
92539
  const preamble = import_dist.dedent`
92540
92540
  You are Perstack, an AI expert that tackles tasks requested by users by utilizing all available tools.
92541
92541
 
92542
- ${isCoordinatorExpert(expert.name) ? getCoordinatorMetaInstruction(startedAt) : getDelegateMetaInstruction(startedAt)}
92542
+ ${isCoordinatorExpert(expert.name) ? getCoordinatorMetaInstruction() : getDelegateMetaInstruction()}
92543
92543
  `;
92544
92544
  const contents = [{
92545
92545
  id: createId(),
@@ -92597,7 +92597,7 @@ async function initLogic({ setting, checkpoint }) {
92597
92597
  if (!setting.model) throw new Error("Model is not resolved");
92598
92598
  return startRun(setting, checkpoint, {
92599
92599
  initialCheckpoint: checkpoint,
92600
- inputMessages: [createInstructionMessage(expert, setting.startedAt), createUserMessage([{
92600
+ inputMessages: [createInstructionMessage(expert), createUserMessage([{
92601
92601
  type: "textPart",
92602
92602
  text: setting.input.text
92603
92603
  }])],
@@ -121243,7 +121243,7 @@ function useDelegationTree() {
121243
121243
  formattedCachedInputTokens: formatTokenCount(state.jobCachedInputTokens),
121244
121244
  formattedOutputTokens: formatTokenCount(state.jobOutputTokens),
121245
121245
  providerName: state.providerName,
121246
- cacheHitRate: state.jobInputTokens + state.jobCachedInputTokens > 0 ? (state.jobCachedInputTokens / (state.jobInputTokens + state.jobCachedInputTokens) * 100).toFixed(2) : "0.00"
121246
+ cacheHitRate: state.jobInputTokens > 0 ? (state.jobCachedInputTokens / state.jobInputTokens * 100).toFixed(2) : "0.00"
121247
121247
  };
121248
121248
  }
121249
121249
  //#endregion
@@ -121441,16 +121441,17 @@ const InterfacePanel = ({ query, runStatus, onSubmit, delegationTreeState, runni
121441
121441
  dimColor: true,
121442
121442
  children: [
121443
121443
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Tokens: " }),
121444
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: ["In ", formattedInputTokens] }),
121445
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [" · Out ", formattedOutputTokens] }),
121446
121444
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
121447
- " ",
121448
- "· Cache ",
121445
+ "In ",
121446
+ formattedInputTokens,
121447
+ " (Cached ",
121449
121448
  formattedCachedInputTokens,
121450
- "/",
121449
+ ", Cache Hit",
121450
+ " ",
121451
121451
  cacheHitRate,
121452
- "%"
121452
+ "%)"
121453
121453
  ] }),
121454
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [" · Out ", formattedOutputTokens] }),
121454
121455
  formattedReasoningTokens !== "0" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [" · Reasoning ", formattedReasoningTokens] }) : null
121455
121456
  ]
121456
121457
  })
@@ -121946,8 +121947,7 @@ function statusColor$3(status) {
121946
121947
  }
121947
121948
  function JobInfoContent({ job }) {
121948
121949
  const duration = formatDuration$1(job.startedAt, job.finishedAt);
121949
- const totalInput = job.usage.inputTokens + (job.usage.cachedInputTokens ?? 0);
121950
- const cacheRate = totalInput > 0 ? (job.usage.cachedInputTokens ?? 0) / totalInput * 100 : 0;
121950
+ const cacheRate = job.usage.inputTokens > 0 ? (job.usage.cachedInputTokens ?? 0) / job.usage.inputTokens * 100 : 0;
121951
121951
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
121952
121952
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
121953
121953
  wrap: "truncate",
@@ -121989,16 +121989,17 @@ function JobInfoContent({ job }) {
121989
121989
  children: [
121990
121990
  "Tokens: In ",
121991
121991
  formatTokenCount(job.usage.inputTokens),
121992
- " · Out",
121993
- " ",
121994
- formatTokenCount(job.usage.outputTokens),
121995
121992
  (job.usage.cachedInputTokens ?? 0) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
121996
- " · Cache ",
121993
+ " ",
121994
+ "(Cached ",
121997
121995
  formatTokenCount(job.usage.cachedInputTokens ?? 0),
121998
- "/",
121996
+ ", Cache Hit",
121997
+ " ",
121999
121998
  cacheRate.toFixed(2),
122000
- "%"
122001
- ] }) : null
121999
+ "%)"
122000
+ ] }) : null,
122001
+ " · Out ",
122002
+ formatTokenCount(job.usage.outputTokens)
122002
122003
  ]
122003
122004
  })
122004
122005
  ] });
@@ -122038,16 +122039,17 @@ function RunInfoContent({ run, treeNode, providerName, checkpointCount, eventCou
122038
122039
  children: [
122039
122040
  "Tokens: In ",
122040
122041
  formatTokenCount(treeNode.inputTokens),
122041
- " · Out",
122042
- " ",
122043
- formatTokenCount(treeNode.outputTokens),
122044
122042
  treeNode.cachedInputTokens > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
122045
- " · Cache ",
122043
+ " ",
122044
+ "(Cached ",
122046
122045
  formatTokenCount(treeNode.cachedInputTokens),
122047
- "/",
122048
- (treeNode.cachedInputTokens / (treeNode.inputTokens + treeNode.cachedInputTokens) * 100).toFixed(2),
122049
- "%"
122050
- ] }) : null
122046
+ ", Cache Hit",
122047
+ " ",
122048
+ (treeNode.inputTokens > 0 ? treeNode.cachedInputTokens / treeNode.inputTokens * 100 : 0).toFixed(2),
122049
+ "%)"
122050
+ ] }) : null,
122051
+ " · Out ",
122052
+ formatTokenCount(treeNode.outputTokens)
122051
122053
  ]
122052
122054
  }) : null
122053
122055
  ] });
@@ -124513,7 +124515,7 @@ async function startHandler(expertKey, query, options, handlerOptions) {
124513
124515
  //#endregion
124514
124516
  //#region package.json
124515
124517
  var name = "perstack";
124516
- var version = "0.0.126";
124518
+ var version = "0.0.127";
124517
124519
  var description = "PerStack CLI";
124518
124520
  //#endregion
124519
124521
  //#region bin/cli.ts