@ai-setting/roy-agent-cli 1.5.79 → 1.5.81

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.
@@ -7320,7 +7320,7 @@ var require_dist = __commonJS((exports) => {
7320
7320
  var require_package = __commonJS((exports, module) => {
7321
7321
  module.exports = {
7322
7322
  name: "@ai-setting/roy-agent-cli",
7323
- version: "1.5.79",
7323
+ version: "1.5.81",
7324
7324
  type: "module",
7325
7325
  description: "CLI for roy-agent - Non-interactive command execution",
7326
7326
  main: "./dist/index.js",
@@ -7347,7 +7347,7 @@ var require_package = __commonJS((exports, module) => {
7347
7347
  },
7348
7348
  dependencies: {
7349
7349
  "@ai-setting/roy-agent-coder-harness": "^1.5.48",
7350
- "@ai-setting/roy-agent-core": "^1.5.78",
7350
+ "@ai-setting/roy-agent-core": "^1.5.80",
7351
7351
  "@ai-setting/roy-agent-ontology-harness": "^1.5.47",
7352
7352
  chalk: "^5.6.2",
7353
7353
  commander: "^14.0.3",
@@ -8037,9 +8037,10 @@ class ContextHandlerService {
8037
8037
  traceId
8038
8038
  }
8039
8039
  });
8040
- let lastError;
8040
+ let compactCount = 0;
8041
+ const MAX_COMPACT_RETRIES = 10;
8041
8042
  try {
8042
- for (let attempt = 0;attempt <= this.maxRetries; attempt++) {
8043
+ while (true) {
8043
8044
  try {
8044
8045
  const result = await this.env.handle_query(query, context);
8045
8046
  if (span) {
@@ -8048,25 +8049,25 @@ class ContextHandlerService {
8048
8049
  return result;
8049
8050
  } catch (error) {
8050
8051
  if (error instanceof ContextError && error.code === ErrorCodes.CONTEXT_THRESHOLD_EXCEEDED) {
8051
- lastError = error;
8052
- if (attempt >= this.maxRetries) {
8053
- logger3.error("Context threshold exceeded after max retries", {
8054
- attempt,
8055
- maxRetries: this.maxRetries
8056
- });
8052
+ if (!this.autoCompact) {
8053
+ logger3.warn("Auto compact disabled, propagating error");
8057
8054
  if (span) {
8058
8055
  span?.end(undefined, error);
8059
8056
  }
8060
8057
  throw error;
8061
8058
  }
8062
- if (!this.autoCompact) {
8063
- logger3.warn("Auto compact disabled, propagating error");
8059
+ if (compactCount >= MAX_COMPACT_RETRIES) {
8060
+ logger3.error("Context threshold exceeded after max compact retries", {
8061
+ compactCount,
8062
+ maxCompactRetries: MAX_COMPACT_RETRIES
8063
+ });
8064
8064
  if (span) {
8065
8065
  span?.end(undefined, error);
8066
8066
  }
8067
8067
  throw error;
8068
8068
  }
8069
- logger3.info(`Context threshold exceeded, compacting (attempt ${attempt + 1}/${this.maxRetries + 1})`);
8069
+ compactCount++;
8070
+ logger3.info(`Context threshold exceeded, compacting (compact #${compactCount})`);
8070
8071
  this.env.pushEnvEvent({
8071
8072
  type: "context.threshold_exceeded",
8072
8073
  metadata: {
@@ -8076,7 +8077,7 @@ class ContextHandlerService {
8076
8077
  payload: {
8077
8078
  totalTokens: error.usage?.totalTokens,
8078
8079
  contextWindow: error.contextWindow,
8079
- attempt: attempt + 1
8080
+ compactCount
8080
8081
  }
8081
8082
  });
8082
8083
  const compactResult = await this.compactSessionWithTwoPhases(context?.sessionId, query);
@@ -8098,7 +8099,6 @@ class ContextHandlerService {
8098
8099
  throw error;
8099
8100
  }
8100
8101
  }
8101
- throw lastError ?? new Error("Unexpected exit from handleQueryWithContext");
8102
8102
  } finally {
8103
8103
  if (span) {
8104
8104
  tracer?.endSpan(span);
@@ -10814,6 +10814,22 @@ var MessagesCommand = {
10814
10814
  lines.push(chalk10.green(`[Node Resume] Response: ${part.response}`));
10815
10815
  } else if (part.type === "workflow-node-start") {
10816
10816
  lines.push(chalk10.blue(`[Node Start] ${part.nodeId}`));
10817
+ } else if (part.type === "workflow-node-end") {
10818
+ const status = part.error ? "❌" : "✅";
10819
+ lines.push(chalk10.green(`${status} [Node End] ${part.nodeId}`));
10820
+ if (part.output) {
10821
+ const outputStr = typeof part.output === "string" ? part.output.slice(0, 300) : JSON.stringify(part.output, null, 2).slice(0, 300);
10822
+ lines.push(...outputStr.split(`
10823
+ `).slice(0, 6).map((l) => chalk10.gray(` ${l}`)));
10824
+ if (outputStr.length >= 300)
10825
+ lines.push(chalk10.gray(" ..."));
10826
+ }
10827
+ if (part.error) {
10828
+ lines.push(chalk10.red(` Error: ${part.error}`));
10829
+ }
10830
+ if (part.durationMs !== undefined) {
10831
+ lines.push(chalk10.gray(` Duration: ${part.durationMs}ms`));
10832
+ }
10817
10833
  }
10818
10834
  }
10819
10835
  } else if (m.content) {
package/dist/index.js CHANGED
@@ -7319,7 +7319,7 @@ var require_dist = __commonJS((exports) => {
7319
7319
  var require_package = __commonJS((exports, module) => {
7320
7320
  module.exports = {
7321
7321
  name: "@ai-setting/roy-agent-cli",
7322
- version: "1.5.79",
7322
+ version: "1.5.81",
7323
7323
  type: "module",
7324
7324
  description: "CLI for roy-agent - Non-interactive command execution",
7325
7325
  main: "./dist/index.js",
@@ -7346,7 +7346,7 @@ var require_package = __commonJS((exports, module) => {
7346
7346
  },
7347
7347
  dependencies: {
7348
7348
  "@ai-setting/roy-agent-coder-harness": "^1.5.48",
7349
- "@ai-setting/roy-agent-core": "^1.5.78",
7349
+ "@ai-setting/roy-agent-core": "^1.5.80",
7350
7350
  "@ai-setting/roy-agent-ontology-harness": "^1.5.47",
7351
7351
  chalk: "^5.6.2",
7352
7352
  commander: "^14.0.3",
@@ -8036,9 +8036,10 @@ class ContextHandlerService {
8036
8036
  traceId
8037
8037
  }
8038
8038
  });
8039
- let lastError;
8039
+ let compactCount = 0;
8040
+ const MAX_COMPACT_RETRIES = 10;
8040
8041
  try {
8041
- for (let attempt = 0;attempt <= this.maxRetries; attempt++) {
8042
+ while (true) {
8042
8043
  try {
8043
8044
  const result = await this.env.handle_query(query, context);
8044
8045
  if (span) {
@@ -8047,25 +8048,25 @@ class ContextHandlerService {
8047
8048
  return result;
8048
8049
  } catch (error) {
8049
8050
  if (error instanceof ContextError && error.code === ErrorCodes.CONTEXT_THRESHOLD_EXCEEDED) {
8050
- lastError = error;
8051
- if (attempt >= this.maxRetries) {
8052
- logger3.error("Context threshold exceeded after max retries", {
8053
- attempt,
8054
- maxRetries: this.maxRetries
8055
- });
8051
+ if (!this.autoCompact) {
8052
+ logger3.warn("Auto compact disabled, propagating error");
8056
8053
  if (span) {
8057
8054
  span?.end(undefined, error);
8058
8055
  }
8059
8056
  throw error;
8060
8057
  }
8061
- if (!this.autoCompact) {
8062
- logger3.warn("Auto compact disabled, propagating error");
8058
+ if (compactCount >= MAX_COMPACT_RETRIES) {
8059
+ logger3.error("Context threshold exceeded after max compact retries", {
8060
+ compactCount,
8061
+ maxCompactRetries: MAX_COMPACT_RETRIES
8062
+ });
8063
8063
  if (span) {
8064
8064
  span?.end(undefined, error);
8065
8065
  }
8066
8066
  throw error;
8067
8067
  }
8068
- logger3.info(`Context threshold exceeded, compacting (attempt ${attempt + 1}/${this.maxRetries + 1})`);
8068
+ compactCount++;
8069
+ logger3.info(`Context threshold exceeded, compacting (compact #${compactCount})`);
8069
8070
  this.env.pushEnvEvent({
8070
8071
  type: "context.threshold_exceeded",
8071
8072
  metadata: {
@@ -8075,7 +8076,7 @@ class ContextHandlerService {
8075
8076
  payload: {
8076
8077
  totalTokens: error.usage?.totalTokens,
8077
8078
  contextWindow: error.contextWindow,
8078
- attempt: attempt + 1
8079
+ compactCount
8079
8080
  }
8080
8081
  });
8081
8082
  const compactResult = await this.compactSessionWithTwoPhases(context?.sessionId, query);
@@ -8097,7 +8098,6 @@ class ContextHandlerService {
8097
8098
  throw error;
8098
8099
  }
8099
8100
  }
8100
- throw lastError ?? new Error("Unexpected exit from handleQueryWithContext");
8101
8101
  } finally {
8102
8102
  if (span) {
8103
8103
  tracer?.endSpan(span);
@@ -10813,6 +10813,22 @@ var MessagesCommand = {
10813
10813
  lines.push(chalk10.green(`[Node Resume] Response: ${part.response}`));
10814
10814
  } else if (part.type === "workflow-node-start") {
10815
10815
  lines.push(chalk10.blue(`[Node Start] ${part.nodeId}`));
10816
+ } else if (part.type === "workflow-node-end") {
10817
+ const status = part.error ? "❌" : "✅";
10818
+ lines.push(chalk10.green(`${status} [Node End] ${part.nodeId}`));
10819
+ if (part.output) {
10820
+ const outputStr = typeof part.output === "string" ? part.output.slice(0, 300) : JSON.stringify(part.output, null, 2).slice(0, 300);
10821
+ lines.push(...outputStr.split(`
10822
+ `).slice(0, 6).map((l) => chalk10.gray(` ${l}`)));
10823
+ if (outputStr.length >= 300)
10824
+ lines.push(chalk10.gray(" ..."));
10825
+ }
10826
+ if (part.error) {
10827
+ lines.push(chalk10.red(` Error: ${part.error}`));
10828
+ }
10829
+ if (part.durationMs !== undefined) {
10830
+ lines.push(chalk10.gray(` Duration: ${part.durationMs}ms`));
10831
+ }
10816
10832
  }
10817
10833
  }
10818
10834
  } else if (m.content) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-cli",
3
- "version": "1.5.79",
3
+ "version": "1.5.81",
4
4
  "type": "module",
5
5
  "description": "CLI for roy-agent - Non-interactive command execution",
6
6
  "main": "./dist/index.js",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@ai-setting/roy-agent-coder-harness": "^1.5.48",
30
- "@ai-setting/roy-agent-core": "^1.5.78",
30
+ "@ai-setting/roy-agent-core": "^1.5.80",
31
31
  "@ai-setting/roy-agent-ontology-harness": "^1.5.47",
32
32
  "chalk": "^5.6.2",
33
33
  "commander": "^14.0.3",