@cryer/star-cli 0.3.4 → 0.3.5

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/README.md CHANGED
@@ -52,6 +52,11 @@ Config file: `~/.star-cli/config.toml` (project-level override: `.star/config.to
52
52
  defaultModel = "gpt"
53
53
  permissionMode = "ask" # ask | auto | readonly | yolo | plan
54
54
  contextMaxTokens = 100000
55
+ # Max model round-trips ("steps") per turn between progress checkpoints — one
56
+ # step is a reply plus the tool calls it asked for; retries and auto-continue
57
+ # nudges don't count. Reaching the cap while tools still execute resets it
58
+ # with a notice instead of stopping the turn; 0 disables the cap entirely.
59
+ maxSteps = 100
55
60
  # compactThresholdTokens = 80000 # optional auto-compaction trigger in tokens; defaults to the
56
61
  # context window. /compact always compacts, regardless of this.
57
62
  contextCompaction = "summary" # summary | truncate — how over-budget history is compacted
package/README.zh-CN.md CHANGED
@@ -52,6 +52,10 @@ star -p "hi" # non-interactive print mode
52
52
  defaultModel = "gpt"
53
53
  permissionMode = "ask" # ask | auto | readonly | yolo | plan
54
54
  contextMaxTokens = 100000
55
+ # 每回合在进度检查点之间允许的最大模型往返("step")数——一个 step 是
56
+ # 一次回复加上它请求的所有工具调用;重试和 auto-continue nudge 不占 step。
57
+ # 到达上限时若工具仍在执行,会发提示并重置额度而不是终止回合;0 表示完全不限。
58
+ maxSteps = 100
55
59
  # compactThresholdTokens = 80000 # optional auto-compaction trigger in tokens; defaults to the
56
60
  # context window. /compact always compacts, regardless of this.
57
61
  contextCompaction = "summary" # summary | truncate — how over-budget history is compacted
@@ -68,7 +68,13 @@ var ConfigSchema = z.object({
68
68
  permissionMode: z.enum(["auto", "ask", "readonly", "yolo", "plan"]).default("ask"),
69
69
  providers: z.array(ProviderConfigSchema).default([]),
70
70
  models: z.array(ModelConfigSchema).default([]),
71
- maxSteps: z.number().int().positive().default(50),
71
+ // Cap on model round-trips ("steps") per turn between progress checkpoints.
72
+ // One step is a streamed reply plus every tool call it asked for — stream
73
+ // retries and auto-continue nudges do not consume steps. Reaching the cap
74
+ // while tools still execute resets the budget with a notice; the turn stops
75
+ // only when no tool ran since the last checkpoint (the doom-loop
76
+ // signature). 0 disables the cap entirely (opencode/codex have none).
77
+ maxSteps: z.number().int().min(0).default(100),
72
78
  contextMaxTokens: z.number().int().positive().default(1e5),
73
79
  // Token threshold at which the agent loop auto-compacts the history.
74
80
  // Defaults to the effective context window (compact only when full); set a
@@ -2924,7 +2930,7 @@ var MAX_SUBAGENT_DEPTH = 1;
2924
2930
  var MAX_REPORT_CHARS = 2e4;
2925
2931
  var SUBAGENT_PROMPT = "You are a subagent spawned to handle a focused subtask on behalf of the main agent. Work autonomously with the tools available to you, then finish with a concise report of what you found or did. Your final text is returned to the main agent as the tool result \u2014 make it self-contained.";
2926
2932
  async function runSubagent(deps, args, cwd, signal) {
2927
- const { AgentLoop: AgentLoop2 } = await import("./loop-SDZVEQND.js");
2933
+ const { AgentLoop: AgentLoop2 } = await import("./loop-H5RYTO2O.js");
2928
2934
  const child = new AgentLoop2({
2929
2935
  model: deps.model,
2930
2936
  registry: createDefaultRegistry(),
@@ -3475,7 +3481,27 @@ var AgentLoop = class {
3475
3481
  let lastWasNudge = false;
3476
3482
  let usedToolsThisTurn = false;
3477
3483
  let openTodos = [];
3478
- for (let step = 0; step < config.maxSteps; step++) {
3484
+ const maxSteps = config.maxSteps;
3485
+ let step = 0;
3486
+ let toolExecutedSinceCheckpoint = false;
3487
+ for (; ; ) {
3488
+ if (maxSteps > 0 && step >= maxSteps) {
3489
+ if (!toolExecutedSinceCheckpoint) {
3490
+ yield {
3491
+ type: "error",
3492
+ error: new Error(
3493
+ `Max steps (${maxSteps}) reached with no tool execution since the last checkpoint, stopping.`
3494
+ )
3495
+ };
3496
+ return;
3497
+ }
3498
+ toolExecutedSinceCheckpoint = false;
3499
+ step = 0;
3500
+ yield {
3501
+ type: "notice",
3502
+ message: `maxSteps (${maxSteps}) reached and the turn is still making progress; continuing. Press Esc to interrupt.`
3503
+ };
3504
+ }
3479
3505
  if ((this.opts.subagentDepth ?? 0) === 0) {
3480
3506
  for (const finished of defaultAgentTasks.drainNotifications()) {
3481
3507
  const label = finished.description ? ` "${finished.description}"` : "";
@@ -3663,6 +3689,8 @@ ${finished.result}`
3663
3689
  const refusal = this.doomLoopRefusal(call);
3664
3690
  if (refusal !== null) {
3665
3691
  yield { type: "notice", message: refusal };
3692
+ } else {
3693
+ toolExecutedSinceCheckpoint = true;
3666
3694
  }
3667
3695
  const result = refusal !== null ? { content: refusal, isError: true } : await this.executeTool(call, signal);
3668
3696
  const toolMessage = {
@@ -3712,11 +3740,8 @@ ${finished.result}`
3712
3740
  }
3713
3741
  }
3714
3742
  if (signal.aborted) return;
3743
+ step++;
3715
3744
  }
3716
- yield {
3717
- type: "error",
3718
- error: new Error(`Max steps (${config.maxSteps}) reached, stopping.`)
3719
- };
3720
3745
  }
3721
3746
  // The permission mode can change at runtime, so the system message is
3722
3747
  // recomputed at the start of every turn instead of being frozen by the
@@ -3952,4 +3977,4 @@ export {
3952
3977
  PLAN_MODE_PROMPT,
3953
3978
  AgentLoop
3954
3979
  };
3955
- //# sourceMappingURL=chunk-K3R42LOX.js.map
3980
+ //# sourceMappingURL=chunk-OIDB2E5J.js.map