@polka-codes/cli 0.9.37 → 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.
Files changed (2) hide show
  1. package/dist/index.js +59 -36
  2. 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", resume);
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 resume(socket) {
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.37";
58611
+ var version = "0.9.38";
58612
58612
 
58613
58613
  // src/commands/chat.ts
58614
58614
  import { readFile as readFile3 } from "node:fs/promises";
@@ -87178,7 +87178,13 @@ var makeAgentStepSpecHandler = (getModelFn) => ({
87178
87178
  const handleExitReason = async (reason) => {
87179
87179
  switch (reason.type) {
87180
87180
  case "Pause":
87181
- return { type: "paused", state: { messages: agent.messages } };
87181
+ return {
87182
+ type: "paused",
87183
+ state: {
87184
+ messages: agent.messages,
87185
+ usage: usageMeter.usage
87186
+ }
87187
+ };
87182
87188
  case "UsageExceeded":
87183
87189
  return { type: "error", error: new Error("Usage limit exceeded") };
87184
87190
  case "Exit" /* Exit */: {
@@ -87287,6 +87293,13 @@ class StepsBuilder {
87287
87293
  step
87288
87294
  });
87289
87295
  }
87296
+ loop(id, config2) {
87297
+ return this.step({
87298
+ ...config2,
87299
+ id,
87300
+ type: "loop"
87301
+ });
87302
+ }
87290
87303
  custom(idOrSpec, run) {
87291
87304
  if (typeof idOrSpec === "string") {
87292
87305
  if (!run) {
@@ -87300,6 +87313,13 @@ class StepsBuilder {
87300
87313
  }
87301
87314
  return this.step(idOrSpec);
87302
87315
  }
87316
+ workflow(id, config2) {
87317
+ return this.step({
87318
+ ...config2,
87319
+ id,
87320
+ type: "workflow"
87321
+ });
87322
+ }
87303
87323
  agent(id, spec2) {
87304
87324
  return this.step({
87305
87325
  ...spec2,
@@ -87307,6 +87327,13 @@ class StepsBuilder {
87307
87327
  type: "agent"
87308
87328
  });
87309
87329
  }
87330
+ branch(id, config2) {
87331
+ return this.step({
87332
+ ...config2,
87333
+ id,
87334
+ type: "branch"
87335
+ });
87336
+ }
87310
87337
  }
87311
87338
  var builder = () => {
87312
87339
  return new StepsBuilder;
@@ -87340,6 +87367,29 @@ var runStep = async (step, input, context, resumedState, allOutputs) => {
87340
87367
  }
87341
87368
  };
87342
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
+
87343
87393
  // ../core/src/workflow/steps.ts
87344
87394
  var combineHandlers = (...handlers) => {
87345
87395
  const allHandlers = {};
@@ -87403,28 +87453,6 @@ var customStepSpecHandler = {
87403
87453
  };
87404
87454
  }
87405
87455
  };
87406
- // ../core/src/workflow/workflow.ts
87407
- var run = async (workflow, context, handler15, input) => {
87408
- const rootStep = handler15(workflow.step, handler15);
87409
- const result = await runStep(rootStep, input, context, undefined, {});
87410
- switch (result.type) {
87411
- case "paused":
87412
- return {
87413
- type: "paused",
87414
- state: result.state
87415
- };
87416
- case "error":
87417
- return {
87418
- type: "error",
87419
- error: result.error
87420
- };
87421
- case "success":
87422
- return {
87423
- type: "success",
87424
- output: result.output
87425
- };
87426
- }
87427
- };
87428
87456
  // src/commands/chat.ts
87429
87457
  var import_lodash6 = __toESM(require_lodash(), 1);
87430
87458
 
@@ -106610,6 +106638,7 @@ Core Objective
106610
106638
  - Extract and report ONLY the key lines that communicate failures, warnings, and actionable issues.
106611
106639
  - Ignore routine noise: progress bars, spinners, timestamps, banners, environment echoes, compilation start/finish messages, and other benign status lines.
106612
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.
106613
106642
 
106614
106643
  General Rules
106615
106644
  1) Preprocessing
@@ -106635,7 +106664,8 @@ General Rules
106635
106664
  - Notes:
106636
106665
  - Within each section, use compact bullet points ("- ").
106637
106666
  - Quote key lines verbatim when they carry the signal (file:line:col, codes, rule names, assertion diffs).
106638
- - Never include large code blocks; include at most 1-2 context lines around a key message when indispensable, marked with "...".
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.
106639
106669
 
106640
106670
  4) What to Include vs Ignore (by tool/type)
106641
106671
  A) Test Runners (jest, mocha, vitest, pytest, nose, unittest, go test, rspec, junit, maven-surefire, gradle test)
@@ -106674,6 +106704,7 @@ General Rules
106674
106704
  - Error type/name and message.
106675
106705
  - Top 1-3 stack frames in user code; include "Caused by" chains.
106676
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.
106677
106708
  Ignore:
106678
106709
  - Long internal/framework stacks unless they are the only frames available.
106679
106710
  Example bullet:
@@ -106720,7 +106751,7 @@ General Rules
106720
106751
  - When possible, group by file or rule to reduce noise.
106721
106752
 
106722
106753
  6) Stack Traces
106723
- - Keep only the topmost relevant frames pointing to project files (e.g., paths under src/, app/, lib/).
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.
106724
106755
  - Omit frames from node:internal, <anonymous>, site-packages/dist-packages unless they are the only frames.
106725
106756
 
106726
106757
  7) Timeouts/Resource Failures
@@ -106736,8 +106767,6 @@ General Rules
106736
106767
  - Use short bullets; avoid prose paragraphs.
106737
106768
  - ASCII only; no emojis; no tables.
106738
106769
 
106739
- 10) Optional Next Actions
106740
- - 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").
106741
106770
 
106742
106771
  Detection Heuristics (non-exhaustive)
106743
106772
  - Errors: lines containing "error", "ERR!", "E ", "fatal", "Traceback", "Exception", "undefined reference", "cannot find symbol", "not found", "Segmentation fault", "panic:", "stack overflow".
@@ -106759,12 +106788,6 @@ Output Template
106759
106788
  Warnings:
106760
106789
  - <file:line:col> <rule/code>: <short message>
106761
106790
 
106762
- Notes:
106763
- - <concise note if indispensable>
106764
-
106765
- Next actions:
106766
- - <up to 3 short, concrete steps>
106767
-
106768
106791
  Final Requirements
106769
106792
  - Be concise, avoid repeating the same information.
106770
106793
  - Ensure accuracy; never invent details not present in the input.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli",
3
- "version": "0.9.37",
3
+ "version": "0.9.38",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",