@polka-codes/core 0.9.35 → 0.9.36
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/_tsup-dts-rollup.d.ts +5 -0
- package/dist/index.js +22 -3
- package/package.json +1 -1
|
@@ -321,6 +321,7 @@ declare type CommandProvider = {
|
|
|
321
321
|
stdout: string;
|
|
322
322
|
stderr: string;
|
|
323
323
|
exitCode: number;
|
|
324
|
+
summary?: string;
|
|
324
325
|
}>;
|
|
325
326
|
};
|
|
326
327
|
export { CommandProvider }
|
|
@@ -381,6 +382,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
381
382
|
budget: z.ZodOptional<z.ZodNumber>;
|
|
382
383
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
383
384
|
requestTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
385
|
+
summaryThreshold: z.ZodOptional<z.ZodNumber>;
|
|
384
386
|
scripts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
385
387
|
command: z.ZodString;
|
|
386
388
|
description: z.ZodString;
|
|
@@ -1036,6 +1038,7 @@ declare class MockProvider implements ToolProvider {
|
|
|
1036
1038
|
stdout: string;
|
|
1037
1039
|
stderr: string;
|
|
1038
1040
|
exitCode: number;
|
|
1041
|
+
summary?: string;
|
|
1039
1042
|
}>;
|
|
1040
1043
|
askFollowupQuestion(_question: string, _options?: string[]): Promise<string>;
|
|
1041
1044
|
attemptCompletion(_result: string): Promise<string | undefined>;
|
|
@@ -1931,6 +1934,8 @@ declare class UsageMeter {
|
|
|
1931
1934
|
cost: number;
|
|
1932
1935
|
messageCount: number;
|
|
1933
1936
|
};
|
|
1937
|
+
/** Merge another UsageMeter's totals into this one. */
|
|
1938
|
+
merge(other: UsageMeter): void;
|
|
1934
1939
|
/** Print a concise usage summary to console. */
|
|
1935
1940
|
printUsage(customConsole?: Console): void;
|
|
1936
1941
|
onFinishHandler(llm: LanguageModelV2): (evt: {
|
package/dist/index.js
CHANGED
|
@@ -266,14 +266,23 @@ var handler4 = async (provider, args) => {
|
|
|
266
266
|
try {
|
|
267
267
|
console.log("Executing command:", command2, "Requires approval:", requiresApproval);
|
|
268
268
|
const result = await provider.executeCommand(command2, requiresApproval);
|
|
269
|
-
|
|
269
|
+
let message = `<command>${command2}</command>
|
|
270
270
|
<command_exit_code>${result.exitCode}</command_exit_code>
|
|
271
|
-
|
|
271
|
+
`;
|
|
272
|
+
if (result.summary) {
|
|
273
|
+
message += `<command_output_summary>
|
|
274
|
+
${result.summary}
|
|
275
|
+
</command_output_summary>
|
|
276
|
+
`;
|
|
277
|
+
} else {
|
|
278
|
+
message += `<command_stdout>
|
|
272
279
|
${result.stdout}
|
|
273
280
|
</command_stdout>
|
|
274
281
|
<command_stderr>
|
|
275
282
|
${result.stderr}
|
|
276
|
-
</command_stderr
|
|
283
|
+
</command_stderr>
|
|
284
|
+
`;
|
|
285
|
+
}
|
|
277
286
|
if (result.exitCode === 0) {
|
|
278
287
|
return {
|
|
279
288
|
type: "Reply" /* Reply */,
|
|
@@ -1369,6 +1378,15 @@ var UsageMeter = class {
|
|
|
1369
1378
|
get usage() {
|
|
1370
1379
|
return { ...this.#totals };
|
|
1371
1380
|
}
|
|
1381
|
+
/** Merge another UsageMeter's totals into this one. */
|
|
1382
|
+
merge(other) {
|
|
1383
|
+
const otherUsage = other.usage;
|
|
1384
|
+
this.#totals.input += otherUsage.input;
|
|
1385
|
+
this.#totals.output += otherUsage.output;
|
|
1386
|
+
this.#totals.cachedRead += otherUsage.cachedRead;
|
|
1387
|
+
this.#totals.cost += otherUsage.cost;
|
|
1388
|
+
this.#totals.messageCount += otherUsage.messageCount;
|
|
1389
|
+
}
|
|
1372
1390
|
/** Print a concise usage summary to console. */
|
|
1373
1391
|
printUsage(customConsole = console) {
|
|
1374
1392
|
const u = this.usage;
|
|
@@ -3191,6 +3209,7 @@ var configSchema = z16.object({
|
|
|
3191
3209
|
budget: z16.number().positive().optional(),
|
|
3192
3210
|
retryCount: z16.number().int().min(0).optional(),
|
|
3193
3211
|
requestTimeoutSeconds: z16.number().int().positive().optional(),
|
|
3212
|
+
summaryThreshold: z16.number().int().positive().optional(),
|
|
3194
3213
|
scripts: z16.record(
|
|
3195
3214
|
z16.string(),
|
|
3196
3215
|
z16.string().or(
|