@polka-codes/cli-shared 0.7.22 → 0.7.24

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 +7 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31093,11 +31093,10 @@ class AgentBase {
31093
31093
  ai;
31094
31094
  config;
31095
31095
  handlers;
31096
- #messages;
31096
+ #messages = [];
31097
31097
  #originalTask;
31098
- constructor(name2, ai, config, messages = []) {
31098
+ constructor(name2, ai, config) {
31099
31099
  this.ai = ai;
31100
- this.#messages = messages;
31101
31100
  if (config.agents && config.agents.length > 0) {
31102
31101
  const agents = agentsPrompt(config.agents, name2);
31103
31102
  config.systemPrompt += `
@@ -31114,7 +31113,7 @@ ${agents}`;
31114
31113
  return this.#messages;
31115
31114
  }
31116
31115
  setMessages(messages) {
31117
- this.#messages = messages;
31116
+ this.#messages = [...messages];
31118
31117
  }
31119
31118
  async#callback(event) {
31120
31119
  await this.config.callback?.(event);
@@ -31124,19 +31123,13 @@ ${agents}`;
31124
31123
  this.#callback({ kind: "StartTask" /* StartTask */, agent: this, systemPrompt: this.config.systemPrompt });
31125
31124
  return await this.#processLoop(prompt);
31126
31125
  }
31127
- async step(promp, messages) {
31128
- if (messages) {
31129
- this.#messages = messages;
31130
- }
31126
+ async step(prompt) {
31131
31127
  if (this.#messages.length === 0) {
31132
31128
  this.#callback({ kind: "StartTask" /* StartTask */, agent: this, systemPrompt: this.config.systemPrompt });
31133
31129
  }
31134
- return await this.#request(promp);
31130
+ return await this.#request(prompt);
31135
31131
  }
31136
- async handleStepResponse(response, messages) {
31137
- if (messages) {
31138
- this.#messages = messages;
31139
- }
31132
+ async handleStepResponse(response) {
31140
31133
  return this.#handleResponse(response);
31141
31134
  }
31142
31135
  async#processLoop(userMessage) {
@@ -31203,7 +31196,7 @@ ${agents}`;
31203
31196
  content: currentAssistantMessage
31204
31197
  });
31205
31198
  const ret = parseAssistantMessage(currentAssistantMessage, this.config.tools, this.config.toolNamePrefix);
31206
- await this.#callback({ kind: "EndRequest" /* EndRequest */, agent: this });
31199
+ await this.#callback({ kind: "EndRequest" /* EndRequest */, agent: this, message: currentAssistantMessage });
31207
31200
  return ret;
31208
31201
  }
31209
31202
  async#handleResponse(response) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli-shared",
3
- "version": "0.7.22",
3
+ "version": "0.7.24",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",