perstack 0.0.113 → 0.0.115
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 +132 -43
- package/dist/bin/cli.js.map +1 -1
- package/dist/dist-Dbqn18AZ.js.map +1 -1
- package/package.json +7 -7
package/dist/bin/cli.js
CHANGED
|
@@ -16302,7 +16302,7 @@ const EMPTY_COMPLETION_RESULT = { completion: {
|
|
|
16302
16302
|
//#endregion
|
|
16303
16303
|
//#region ../base/package.json
|
|
16304
16304
|
var name$6 = "@perstack/base";
|
|
16305
|
-
var version$2 = "0.0.
|
|
16305
|
+
var version$2 = "0.0.78";
|
|
16306
16306
|
|
|
16307
16307
|
//#endregion
|
|
16308
16308
|
//#region ../base/src/tools/todo.ts
|
|
@@ -21310,7 +21310,7 @@ async function expertVersionsHandler(scopeName, options) {
|
|
|
21310
21310
|
|
|
21311
21311
|
//#endregion
|
|
21312
21312
|
//#region ../../packages/runtime/package.json
|
|
21313
|
-
var version$1 = "0.0.
|
|
21313
|
+
var version$1 = "0.0.131";
|
|
21314
21314
|
|
|
21315
21315
|
//#endregion
|
|
21316
21316
|
//#region ../../packages/runtime/src/helpers/usage.ts
|
|
@@ -93327,16 +93327,19 @@ async function initLogic({ setting, checkpoint }) {
|
|
|
93327
93327
|
switch (checkpoint.status) {
|
|
93328
93328
|
case "init":
|
|
93329
93329
|
if (!setting.input.text) throw new Error("Input message is undefined");
|
|
93330
|
+
if (!setting.model) throw new Error("Model is not resolved");
|
|
93330
93331
|
return startRun(setting, checkpoint, {
|
|
93331
93332
|
initialCheckpoint: checkpoint,
|
|
93332
93333
|
inputMessages: [createInstructionMessage(expert, setting.startedAt), createUserMessage([{
|
|
93333
93334
|
type: "textPart",
|
|
93334
93335
|
text: setting.input.text
|
|
93335
|
-
}])]
|
|
93336
|
+
}])],
|
|
93337
|
+
model: setting.model
|
|
93336
93338
|
});
|
|
93337
93339
|
case "stoppedByDelegate":
|
|
93338
93340
|
case "stoppedByInteractiveTool": {
|
|
93339
93341
|
if (!setting.input.interactiveToolCallResult) throw new Error("Interactive tool call result is undefined");
|
|
93342
|
+
if (!setting.model) throw new Error("Model is not resolved");
|
|
93340
93343
|
const { toolCallId, toolName, skillName, text } = setting.input.interactiveToolCallResult;
|
|
93341
93344
|
const pendingToolCalls = checkpoint.pendingToolCalls ?? [];
|
|
93342
93345
|
const newToolResult = {
|
|
@@ -93351,20 +93354,25 @@ async function initLogic({ setting, checkpoint }) {
|
|
|
93351
93354
|
};
|
|
93352
93355
|
const updatedPartialResults = [...checkpoint.partialToolResults ?? [], newToolResult];
|
|
93353
93356
|
const updatedPendingToolCalls = pendingToolCalls.filter((tc) => tc.id !== toolCallId);
|
|
93354
|
-
return resumeFromStop(setting, checkpoint, {
|
|
93355
|
-
|
|
93356
|
-
|
|
93357
|
-
|
|
93358
|
-
|
|
93357
|
+
return resumeFromStop(setting, checkpoint, {
|
|
93358
|
+
checkpoint: {
|
|
93359
|
+
...checkpoint,
|
|
93360
|
+
partialToolResults: updatedPartialResults,
|
|
93361
|
+
pendingToolCalls: updatedPendingToolCalls
|
|
93362
|
+
},
|
|
93363
|
+
model: setting.model
|
|
93364
|
+
});
|
|
93359
93365
|
}
|
|
93360
93366
|
default:
|
|
93361
93367
|
if (!setting.input.text) throw new Error("Input message is undefined");
|
|
93368
|
+
if (!setting.model) throw new Error("Model is not resolved");
|
|
93362
93369
|
return startRun(setting, checkpoint, {
|
|
93363
93370
|
initialCheckpoint: checkpoint,
|
|
93364
93371
|
inputMessages: [createUserMessage([{
|
|
93365
93372
|
type: "textPart",
|
|
93366
93373
|
text: setting.input.text
|
|
93367
|
-
}])]
|
|
93374
|
+
}])],
|
|
93375
|
+
model: setting.model
|
|
93368
93376
|
});
|
|
93369
93377
|
}
|
|
93370
93378
|
}
|
|
@@ -93941,6 +93949,7 @@ var CoordinatorExecutor = class {
|
|
|
93941
93949
|
expertName: expertToRun.name,
|
|
93942
93950
|
experts: Object.keys(experts),
|
|
93943
93951
|
model: resolvedModel,
|
|
93952
|
+
providerName: setting.providerConfig.providerName,
|
|
93944
93953
|
maxRetries: setting.maxRetries,
|
|
93945
93954
|
timeout: setting.timeout,
|
|
93946
93955
|
query: setting.input.text,
|
|
@@ -121801,6 +121810,11 @@ function createInitialDelegationTreeState() {
|
|
|
121801
121810
|
nodes: /* @__PURE__ */ new Map(),
|
|
121802
121811
|
rootRunId: void 0,
|
|
121803
121812
|
jobTotalTokens: 0,
|
|
121813
|
+
jobReasoningTokens: 0,
|
|
121814
|
+
jobInputTokens: 0,
|
|
121815
|
+
jobCachedInputTokens: 0,
|
|
121816
|
+
jobOutputTokens: 0,
|
|
121817
|
+
providerName: void 0,
|
|
121804
121818
|
jobStartedAt: void 0,
|
|
121805
121819
|
runIdAliases: /* @__PURE__ */ new Map()
|
|
121806
121820
|
};
|
|
@@ -121910,6 +121924,7 @@ function processDelegationTreeEvent(state, event) {
|
|
|
121910
121924
|
switch (event.type) {
|
|
121911
121925
|
case "initializeRuntime":
|
|
121912
121926
|
if (state.jobStartedAt === void 0) state.jobStartedAt = event.timestamp;
|
|
121927
|
+
if (state.providerName === void 0) state.providerName = event.providerName;
|
|
121913
121928
|
return true;
|
|
121914
121929
|
case "startRun": {
|
|
121915
121930
|
const initCheckpoint = event.initialCheckpoint;
|
|
@@ -121929,6 +121944,7 @@ function processDelegationTreeEvent(state, event) {
|
|
|
121929
121944
|
actionLabel: "Starting...",
|
|
121930
121945
|
actionFileArg: void 0,
|
|
121931
121946
|
contextWindowUsage: initCheckpoint.contextWindowUsage ?? 0,
|
|
121947
|
+
model: event.model,
|
|
121932
121948
|
parentRunId,
|
|
121933
121949
|
childRunIds: [],
|
|
121934
121950
|
totalTokens: 0
|
|
@@ -121956,6 +121972,7 @@ function processDelegationTreeEvent(state, event) {
|
|
|
121956
121972
|
const node = state.nodes.get(nodeId);
|
|
121957
121973
|
if (node) {
|
|
121958
121974
|
node.status = "running";
|
|
121975
|
+
node.model = event.model;
|
|
121959
121976
|
if (checkpoint.contextWindowUsage !== void 0) node.contextWindowUsage = checkpoint.contextWindowUsage;
|
|
121960
121977
|
}
|
|
121961
121978
|
return true;
|
|
@@ -121987,6 +122004,10 @@ function processDelegationTreeEvent(state, event) {
|
|
|
121987
122004
|
node.actionFileArg = fileArg;
|
|
121988
122005
|
node.totalTokens += event.usage.totalTokens;
|
|
121989
122006
|
state.jobTotalTokens += event.usage.totalTokens;
|
|
122007
|
+
state.jobReasoningTokens += event.usage.reasoningTokens;
|
|
122008
|
+
state.jobInputTokens += event.usage.inputTokens;
|
|
122009
|
+
state.jobCachedInputTokens += event.usage.cachedInputTokens;
|
|
122010
|
+
state.jobOutputTokens += event.usage.outputTokens;
|
|
121990
122011
|
}
|
|
121991
122012
|
return true;
|
|
121992
122013
|
}
|
|
@@ -122010,6 +122031,10 @@ function processDelegationTreeEvent(state, event) {
|
|
|
122010
122031
|
node.actionFileArg = void 0;
|
|
122011
122032
|
node.totalTokens += event.usage.totalTokens;
|
|
122012
122033
|
state.jobTotalTokens += event.usage.totalTokens;
|
|
122034
|
+
state.jobReasoningTokens += event.usage.reasoningTokens;
|
|
122035
|
+
state.jobInputTokens += event.usage.inputTokens;
|
|
122036
|
+
state.jobCachedInputTokens += event.usage.cachedInputTokens;
|
|
122037
|
+
state.jobOutputTokens += event.usage.outputTokens;
|
|
122013
122038
|
if (event.checkpoint.contextWindowUsage !== void 0) node.contextWindowUsage = event.checkpoint.contextWindowUsage;
|
|
122014
122039
|
}
|
|
122015
122040
|
return true;
|
|
@@ -122039,6 +122064,10 @@ function processDelegationTreeEvent(state, event) {
|
|
|
122039
122064
|
if (node) {
|
|
122040
122065
|
node.totalTokens += event.usage.totalTokens;
|
|
122041
122066
|
state.jobTotalTokens += event.usage.totalTokens;
|
|
122067
|
+
state.jobReasoningTokens += event.usage.reasoningTokens;
|
|
122068
|
+
state.jobInputTokens += event.usage.inputTokens;
|
|
122069
|
+
state.jobCachedInputTokens += event.usage.cachedInputTokens;
|
|
122070
|
+
state.jobOutputTokens += event.usage.outputTokens;
|
|
122042
122071
|
}
|
|
122043
122072
|
return true;
|
|
122044
122073
|
}
|
|
@@ -122056,7 +122085,13 @@ function useDelegationTree() {
|
|
|
122056
122085
|
state,
|
|
122057
122086
|
processEvent,
|
|
122058
122087
|
statusCounts: getStatusCounts(state),
|
|
122059
|
-
formattedTotalTokens: formatTokenCount(state.jobTotalTokens)
|
|
122088
|
+
formattedTotalTokens: formatTokenCount(state.jobTotalTokens),
|
|
122089
|
+
formattedReasoningTokens: formatTokenCount(state.jobReasoningTokens),
|
|
122090
|
+
formattedInputTokens: formatTokenCount(state.jobInputTokens),
|
|
122091
|
+
formattedCachedInputTokens: formatTokenCount(state.jobCachedInputTokens),
|
|
122092
|
+
formattedOutputTokens: formatTokenCount(state.jobOutputTokens),
|
|
122093
|
+
providerName: state.providerName,
|
|
122094
|
+
cacheHitRate: state.jobInputTokens + state.jobCachedInputTokens > 0 ? (state.jobCachedInputTokens / (state.jobInputTokens + state.jobCachedInputTokens) * 100).toFixed(2) : "0.00"
|
|
122060
122095
|
};
|
|
122061
122096
|
}
|
|
122062
122097
|
|
|
@@ -122155,15 +122190,25 @@ function TreeNodeLine({ flatNode, spinner }) {
|
|
|
122155
122190
|
color: colors.muted,
|
|
122156
122191
|
children: [" ", node.actionFileArg]
|
|
122157
122192
|
}) : null,
|
|
122158
|
-
showUsage ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
122159
|
-
|
|
122160
|
-
|
|
122161
|
-
|
|
122162
|
-
|
|
122163
|
-
|
|
122164
|
-
|
|
122165
|
-
|
|
122166
|
-
|
|
122193
|
+
showUsage ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
122194
|
+
node.model ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
122195
|
+
dimColor: true,
|
|
122196
|
+
children: " · "
|
|
122197
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
122198
|
+
dimColor: true,
|
|
122199
|
+
children: node.model
|
|
122200
|
+
})] }) : null,
|
|
122201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
122202
|
+
dimColor: true,
|
|
122203
|
+
children: " · "
|
|
122204
|
+
}),
|
|
122205
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
|
|
122206
|
+
usageIcon,
|
|
122207
|
+
" ",
|
|
122208
|
+
usagePercent,
|
|
122209
|
+
"%"
|
|
122210
|
+
] })
|
|
122211
|
+
] }) : null
|
|
122167
122212
|
] });
|
|
122168
122213
|
}
|
|
122169
122214
|
const DelegationTree = ({ state }) => {
|
|
@@ -122178,7 +122223,7 @@ const DelegationTree = ({ state }) => {
|
|
|
122178
122223
|
|
|
122179
122224
|
//#endregion
|
|
122180
122225
|
//#region ../../packages/tui-components/src/execution/components/interface-panel.tsx
|
|
122181
|
-
const InterfacePanel = ({ query, runStatus, onSubmit, delegationTreeState, runningCount, waitingCount,
|
|
122226
|
+
const InterfacePanel = ({ query, runStatus, onSubmit, delegationTreeState, runningCount, waitingCount, formattedReasoningTokens, formattedInputTokens, formattedCachedInputTokens, formattedOutputTokens, providerName, cacheHitRate, elapsedTime }) => {
|
|
122182
122227
|
const { input, handleInput } = useTextInput({
|
|
122183
122228
|
onSubmit,
|
|
122184
122229
|
canSubmit: runStatus !== "running"
|
|
@@ -122197,28 +122242,60 @@ const InterfacePanel = ({ query, runStatus, onSubmit, delegationTreeState, runni
|
|
|
122197
122242
|
isWaiting ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
122198
122243
|
color: colors.accent,
|
|
122199
122244
|
children: "Waiting for query..."
|
|
122200
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
122201
|
-
|
|
122202
|
-
|
|
122203
|
-
|
|
122204
|
-
|
|
122205
|
-
|
|
122206
|
-
|
|
122207
|
-
|
|
122208
|
-
|
|
122209
|
-
|
|
122210
|
-
|
|
122211
|
-
|
|
122212
|
-
"
|
|
122213
|
-
waitingCount,
|
|
122214
|
-
|
|
122215
|
-
|
|
122216
|
-
|
|
122217
|
-
|
|
122218
|
-
|
|
122219
|
-
|
|
122220
|
-
|
|
122221
|
-
|
|
122245
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
122246
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
122247
|
+
color: colors.success,
|
|
122248
|
+
wrap: "truncate",
|
|
122249
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
122250
|
+
bold: true,
|
|
122251
|
+
children: "Query: "
|
|
122252
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: query || "–" })]
|
|
122253
|
+
}),
|
|
122254
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
122255
|
+
dimColor: true,
|
|
122256
|
+
children: [
|
|
122257
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [runningCount, " running"] }),
|
|
122258
|
+
waitingCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
|
|
122259
|
+
" · ",
|
|
122260
|
+
waitingCount,
|
|
122261
|
+
" waiting"
|
|
122262
|
+
] }) : null,
|
|
122263
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: " · " }),
|
|
122264
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: elapsedTime }),
|
|
122265
|
+
providerName ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [" · ", providerName] }) : null
|
|
122266
|
+
]
|
|
122267
|
+
}),
|
|
122268
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
|
|
122269
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
122270
|
+
dimColor: true,
|
|
122271
|
+
children: "R "
|
|
122272
|
+
}),
|
|
122273
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: formattedReasoningTokens }),
|
|
122274
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
122275
|
+
dimColor: true,
|
|
122276
|
+
children: " · I "
|
|
122277
|
+
}),
|
|
122278
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: formattedInputTokens }),
|
|
122279
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
122280
|
+
dimColor: true,
|
|
122281
|
+
children: " · C "
|
|
122282
|
+
}),
|
|
122283
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: formattedCachedInputTokens }),
|
|
122284
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
122285
|
+
dimColor: true,
|
|
122286
|
+
children: " · O "
|
|
122287
|
+
}),
|
|
122288
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: formattedOutputTokens }),
|
|
122289
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
122290
|
+
dimColor: true,
|
|
122291
|
+
children: [
|
|
122292
|
+
" (cache: ",
|
|
122293
|
+
cacheHitRate,
|
|
122294
|
+
"%)"
|
|
122295
|
+
]
|
|
122296
|
+
})
|
|
122297
|
+
] })
|
|
122298
|
+
] }),
|
|
122222
122299
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DelegationTree, { state: delegationTreeState }),
|
|
122223
122300
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
|
|
122224
122301
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
@@ -122371,6 +122448,12 @@ const useExecutionState = (options) => {
|
|
|
122371
122448
|
runningCount: delegationTree.statusCounts.running,
|
|
122372
122449
|
waitingCount: delegationTree.statusCounts.waiting,
|
|
122373
122450
|
formattedTotalTokens: delegationTree.formattedTotalTokens,
|
|
122451
|
+
formattedReasoningTokens: delegationTree.formattedReasoningTokens,
|
|
122452
|
+
formattedInputTokens: delegationTree.formattedInputTokens,
|
|
122453
|
+
formattedCachedInputTokens: delegationTree.formattedCachedInputTokens,
|
|
122454
|
+
formattedOutputTokens: delegationTree.formattedOutputTokens,
|
|
122455
|
+
providerName: delegationTree.providerName,
|
|
122456
|
+
cacheHitRate: delegationTree.cacheHitRate,
|
|
122374
122457
|
elapsedTime
|
|
122375
122458
|
};
|
|
122376
122459
|
};
|
|
@@ -122436,6 +122519,12 @@ const ExecutionApp = (props) => {
|
|
|
122436
122519
|
runningCount: state.runningCount,
|
|
122437
122520
|
waitingCount: state.waitingCount,
|
|
122438
122521
|
formattedTotalTokens: state.formattedTotalTokens,
|
|
122522
|
+
formattedReasoningTokens: state.formattedReasoningTokens,
|
|
122523
|
+
formattedInputTokens: state.formattedInputTokens,
|
|
122524
|
+
formattedCachedInputTokens: state.formattedCachedInputTokens,
|
|
122525
|
+
formattedOutputTokens: state.formattedOutputTokens,
|
|
122526
|
+
providerName: state.providerName,
|
|
122527
|
+
cacheHitRate: state.cacheHitRate,
|
|
122439
122528
|
elapsedTime: state.elapsedTime
|
|
122440
122529
|
})]
|
|
122441
122530
|
});
|
|
@@ -122793,7 +122882,7 @@ async function startHandler(expertKey, query, options, handlerOptions) {
|
|
|
122793
122882
|
//#endregion
|
|
122794
122883
|
//#region package.json
|
|
122795
122884
|
var name = "perstack";
|
|
122796
|
-
var version = "0.0.
|
|
122885
|
+
var version = "0.0.115";
|
|
122797
122886
|
var description = "PerStack CLI";
|
|
122798
122887
|
|
|
122799
122888
|
//#endregion
|