@polka-codes/cli 0.9.36 → 0.9.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/index.js +64 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25374,7 +25374,7 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
25374
25374
|
req.emit("proxyConnect", connect);
|
|
25375
25375
|
this.emit("proxyConnect", connect, req);
|
|
25376
25376
|
if (connect.statusCode === 200) {
|
|
25377
|
-
req.once("socket",
|
|
25377
|
+
req.once("socket", resume2);
|
|
25378
25378
|
if (opts.secureEndpoint) {
|
|
25379
25379
|
debug("Upgrading socket connection to TLS");
|
|
25380
25380
|
return tls.connect({
|
|
@@ -25398,7 +25398,7 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
25398
25398
|
}
|
|
25399
25399
|
HttpsProxyAgent.protocols = ["http", "https"];
|
|
25400
25400
|
exports.HttpsProxyAgent = HttpsProxyAgent;
|
|
25401
|
-
function
|
|
25401
|
+
function resume2(socket) {
|
|
25402
25402
|
socket.resume();
|
|
25403
25403
|
}
|
|
25404
25404
|
function omit2(obj, ...keys) {
|
|
@@ -58608,7 +58608,7 @@ var {
|
|
|
58608
58608
|
Help
|
|
58609
58609
|
} = import__.default;
|
|
58610
58610
|
// package.json
|
|
58611
|
-
var version = "0.9.
|
|
58611
|
+
var version = "0.9.38";
|
|
58612
58612
|
|
|
58613
58613
|
// src/commands/chat.ts
|
|
58614
58614
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
@@ -85621,6 +85621,7 @@ Request timeout after ${requestTimeoutSeconds} seconds. Canceling current reques
|
|
|
85621
85621
|
};
|
|
85622
85622
|
try {
|
|
85623
85623
|
resetTimeout();
|
|
85624
|
+
const usageMeterOnFinishHandler = this.config.usageMeter.onFinishHandler(this.ai);
|
|
85624
85625
|
const streamTextOptions = {
|
|
85625
85626
|
model: this.ai,
|
|
85626
85627
|
temperature: 0,
|
|
@@ -85639,7 +85640,10 @@ Request timeout after ${requestTimeoutSeconds} seconds. Canceling current reques
|
|
|
85639
85640
|
break;
|
|
85640
85641
|
}
|
|
85641
85642
|
},
|
|
85642
|
-
onFinish:
|
|
85643
|
+
onFinish: (evt) => {
|
|
85644
|
+
usageMeterOnFinishHandler(evt);
|
|
85645
|
+
this.#callback({ kind: "Usage" /* Usage */, agent: this, usage: evt.totalUsage });
|
|
85646
|
+
},
|
|
85643
85647
|
onError: async (error43) => {
|
|
85644
85648
|
console.error("Error in stream:", error43);
|
|
85645
85649
|
},
|
|
@@ -87174,7 +87178,13 @@ var makeAgentStepSpecHandler = (getModelFn) => ({
|
|
|
87174
87178
|
const handleExitReason = async (reason) => {
|
|
87175
87179
|
switch (reason.type) {
|
|
87176
87180
|
case "Pause":
|
|
87177
|
-
return {
|
|
87181
|
+
return {
|
|
87182
|
+
type: "paused",
|
|
87183
|
+
state: {
|
|
87184
|
+
messages: agent.messages,
|
|
87185
|
+
usage: usageMeter.usage
|
|
87186
|
+
}
|
|
87187
|
+
};
|
|
87178
87188
|
case "UsageExceeded":
|
|
87179
87189
|
return { type: "error", error: new Error("Usage limit exceeded") };
|
|
87180
87190
|
case "Exit" /* Exit */: {
|
|
@@ -87283,6 +87293,13 @@ class StepsBuilder {
|
|
|
87283
87293
|
step
|
|
87284
87294
|
});
|
|
87285
87295
|
}
|
|
87296
|
+
loop(id, config2) {
|
|
87297
|
+
return this.step({
|
|
87298
|
+
...config2,
|
|
87299
|
+
id,
|
|
87300
|
+
type: "loop"
|
|
87301
|
+
});
|
|
87302
|
+
}
|
|
87286
87303
|
custom(idOrSpec, run) {
|
|
87287
87304
|
if (typeof idOrSpec === "string") {
|
|
87288
87305
|
if (!run) {
|
|
@@ -87296,6 +87313,13 @@ class StepsBuilder {
|
|
|
87296
87313
|
}
|
|
87297
87314
|
return this.step(idOrSpec);
|
|
87298
87315
|
}
|
|
87316
|
+
workflow(id, config2) {
|
|
87317
|
+
return this.step({
|
|
87318
|
+
...config2,
|
|
87319
|
+
id,
|
|
87320
|
+
type: "workflow"
|
|
87321
|
+
});
|
|
87322
|
+
}
|
|
87299
87323
|
agent(id, spec2) {
|
|
87300
87324
|
return this.step({
|
|
87301
87325
|
...spec2,
|
|
@@ -87303,6 +87327,13 @@ class StepsBuilder {
|
|
|
87303
87327
|
type: "agent"
|
|
87304
87328
|
});
|
|
87305
87329
|
}
|
|
87330
|
+
branch(id, config2) {
|
|
87331
|
+
return this.step({
|
|
87332
|
+
...config2,
|
|
87333
|
+
id,
|
|
87334
|
+
type: "branch"
|
|
87335
|
+
});
|
|
87336
|
+
}
|
|
87306
87337
|
}
|
|
87307
87338
|
var builder = () => {
|
|
87308
87339
|
return new StepsBuilder;
|
|
@@ -87336,6 +87367,29 @@ var runStep = async (step, input, context, resumedState, allOutputs) => {
|
|
|
87336
87367
|
}
|
|
87337
87368
|
};
|
|
87338
87369
|
|
|
87370
|
+
// ../core/src/workflow/workflow.ts
|
|
87371
|
+
var run = async (workflow, context, handler15, input) => {
|
|
87372
|
+
const rootStep = handler15(workflow.step, handler15);
|
|
87373
|
+
const result = await runStep(rootStep, input, context, undefined, {});
|
|
87374
|
+
switch (result.type) {
|
|
87375
|
+
case "paused":
|
|
87376
|
+
return {
|
|
87377
|
+
type: "paused",
|
|
87378
|
+
state: result.state
|
|
87379
|
+
};
|
|
87380
|
+
case "error":
|
|
87381
|
+
return {
|
|
87382
|
+
type: "error",
|
|
87383
|
+
error: result.error
|
|
87384
|
+
};
|
|
87385
|
+
case "success":
|
|
87386
|
+
return {
|
|
87387
|
+
type: "success",
|
|
87388
|
+
output: result.output
|
|
87389
|
+
};
|
|
87390
|
+
}
|
|
87391
|
+
};
|
|
87392
|
+
|
|
87339
87393
|
// ../core/src/workflow/steps.ts
|
|
87340
87394
|
var combineHandlers = (...handlers) => {
|
|
87341
87395
|
const allHandlers = {};
|
|
@@ -87399,28 +87453,6 @@ var customStepSpecHandler = {
|
|
|
87399
87453
|
};
|
|
87400
87454
|
}
|
|
87401
87455
|
};
|
|
87402
|
-
// ../core/src/workflow/workflow.ts
|
|
87403
|
-
var run = async (workflow, context, handler15, input) => {
|
|
87404
|
-
const rootStep = handler15(workflow.step, handler15);
|
|
87405
|
-
const result = await runStep(rootStep, input, context, undefined, {});
|
|
87406
|
-
switch (result.type) {
|
|
87407
|
-
case "paused":
|
|
87408
|
-
return {
|
|
87409
|
-
type: "paused",
|
|
87410
|
-
state: result.state
|
|
87411
|
-
};
|
|
87412
|
-
case "error":
|
|
87413
|
-
return {
|
|
87414
|
-
type: "error",
|
|
87415
|
-
error: result.error
|
|
87416
|
-
};
|
|
87417
|
-
case "success":
|
|
87418
|
-
return {
|
|
87419
|
-
type: "success",
|
|
87420
|
-
output: result.output
|
|
87421
|
-
};
|
|
87422
|
-
}
|
|
87423
|
-
};
|
|
87424
87456
|
// src/commands/chat.ts
|
|
87425
87457
|
var import_lodash6 = __toESM(require_lodash(), 1);
|
|
87426
87458
|
|
|
@@ -106606,6 +106638,7 @@ Core Objective
|
|
|
106606
106638
|
- Extract and report ONLY the key lines that communicate failures, warnings, and actionable issues.
|
|
106607
106639
|
- Ignore routine noise: progress bars, spinners, timestamps, banners, environment echoes, compilation start/finish messages, and other benign status lines.
|
|
106608
106640
|
- Prefer brevity and accuracy. Do not ask questions. Do not repeat yourself.
|
|
106641
|
+
- Preserve the minimal set of surrounding lines (command headers, "Traceback" prologues, "Caused by" chains) required to fully understand each surfaced error or warning.
|
|
106609
106642
|
|
|
106610
106643
|
General Rules
|
|
106611
106644
|
1) Preprocessing
|
|
@@ -106631,7 +106664,8 @@ General Rules
|
|
|
106631
106664
|
- Notes:
|
|
106632
106665
|
- Within each section, use compact bullet points ("- ").
|
|
106633
106666
|
- Quote key lines verbatim when they carry the signal (file:line:col, codes, rule names, assertion diffs).
|
|
106634
|
-
-
|
|
106667
|
+
- When a diagnostic spans multiple lines or relies on nearby context (command invocation, "Traceback", "Caused by"), keep the contiguous block together in the bullet. Indent continuation lines with two spaces. Only elide middle lines if the block exceeds ~20 lines; show the start and end with "..." when doing so.
|
|
106668
|
+
- Never include unrelated large code blocks; when context is long, limit it to the diagnostic itself and collapse the middle with "..." if needed.
|
|
106635
106669
|
|
|
106636
106670
|
4) What to Include vs Ignore (by tool/type)
|
|
106637
106671
|
A) Test Runners (jest, mocha, vitest, pytest, nose, unittest, go test, rspec, junit, maven-surefire, gradle test)
|
|
@@ -106670,6 +106704,7 @@ General Rules
|
|
|
106670
106704
|
- Error type/name and message.
|
|
106671
106705
|
- Top 1-3 stack frames in user code; include "Caused by" chains.
|
|
106672
106706
|
- Non-zero exit status if visible.
|
|
106707
|
+
- Immediate context like the command that failed, "Traceback" introductions, and leading log lines that explain the failure.
|
|
106673
106708
|
Ignore:
|
|
106674
106709
|
- Long internal/framework stacks unless they are the only frames available.
|
|
106675
106710
|
Example bullet:
|
|
@@ -106716,7 +106751,7 @@ General Rules
|
|
|
106716
106751
|
- When possible, group by file or rule to reduce noise.
|
|
106717
106752
|
|
|
106718
106753
|
6) Stack Traces
|
|
106719
|
-
- Keep
|
|
106754
|
+
- Keep the Traceback/exception header and the topmost relevant frames pointing to project files (e.g., paths under src/, app/, lib/); retain tail frames when they convey the ultimate cause.
|
|
106720
106755
|
- Omit frames from node:internal, <anonymous>, site-packages/dist-packages unless they are the only frames.
|
|
106721
106756
|
|
|
106722
106757
|
7) Timeouts/Resource Failures
|
|
@@ -106732,8 +106767,6 @@ General Rules
|
|
|
106732
106767
|
- Use short bullets; avoid prose paragraphs.
|
|
106733
106768
|
- ASCII only; no emojis; no tables.
|
|
106734
106769
|
|
|
106735
|
-
10) Optional Next Actions
|
|
106736
|
-
- If and only if issues exist, append a short "Next actions:" section with up to 3 bullets of direct, obvious steps derived from the messages (e.g., "Fix missing import in src/foo.ts line 12").
|
|
106737
106770
|
|
|
106738
106771
|
Detection Heuristics (non-exhaustive)
|
|
106739
106772
|
- Errors: lines containing "error", "ERR!", "E ", "fatal", "Traceback", "Exception", "undefined reference", "cannot find symbol", "not found", "Segmentation fault", "panic:", "stack overflow".
|
|
@@ -106755,12 +106788,6 @@ Output Template
|
|
|
106755
106788
|
Warnings:
|
|
106756
106789
|
- <file:line:col> <rule/code>: <short message>
|
|
106757
106790
|
|
|
106758
|
-
Notes:
|
|
106759
|
-
- <concise note if indispensable>
|
|
106760
|
-
|
|
106761
|
-
Next actions:
|
|
106762
|
-
- <up to 3 short, concrete steps>
|
|
106763
|
-
|
|
106764
106791
|
Final Requirements
|
|
106765
106792
|
- Be concise, avoid repeating the same information.
|
|
106766
106793
|
- Ensure accuracy; never invent details not present in the input.
|