bit-office 0.1.6 → 0.1.7

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 CHANGED
@@ -4640,6 +4640,7 @@ var AgentSession = class {
4640
4640
  role;
4641
4641
  personality;
4642
4642
  backend;
4643
+ palette;
4643
4644
  process = null;
4644
4645
  currentTaskId = null;
4645
4646
  currentCwd = null;
@@ -4650,6 +4651,7 @@ var AgentSession = class {
4650
4651
  pendingApprovals = /* @__PURE__ */ new Map();
4651
4652
  workspace;
4652
4653
  stdoutBuffer = "";
4654
+ stderrBuffer = "";
4653
4655
  hasHistory = false;
4654
4656
  onDelegation = null;
4655
4657
  constructor(agentId, name, role, personality, workspace, resumeHistory, backendId) {
@@ -4675,6 +4677,7 @@ var AgentSession = class {
4675
4677
  const cwd = repoPath ?? this.workspace;
4676
4678
  this.currentCwd = cwd;
4677
4679
  this.stdoutBuffer = "";
4680
+ this.stderrBuffer = "";
4678
4681
  publishEvent({
4679
4682
  type: "TASK_STARTED",
4680
4683
  agentId: this.agentId,
@@ -4722,6 +4725,7 @@ var AgentSession = class {
4722
4725
  });
4723
4726
  this.process.stderr?.on("data", (data) => {
4724
4727
  const chunk = data.toString();
4728
+ this.stderrBuffer += chunk;
4725
4729
  const lines = chunk.split("\n").filter((l) => l.trim());
4726
4730
  if (lines.length > 0) {
4727
4731
  publishEvent({
@@ -4739,7 +4743,7 @@ var AgentSession = class {
4739
4743
  this.currentTaskId = null;
4740
4744
  const wasCancelled = this.cancelled;
4741
4745
  this.cancelled = false;
4742
- console.log(`[Agent ${this.agentId}] Process exited: code=${code}, cancelled=${wasCancelled}, output=${this.stdoutBuffer.length} bytes`);
4746
+ console.log(`[Agent ${this.agentId}] ${this.backend.name} exited: code=${code}, cancelled=${wasCancelled}`);
4743
4747
  try {
4744
4748
  if (wasCancelled) {
4745
4749
  this.setStatus("idle");
@@ -4760,7 +4764,7 @@ var AgentSession = class {
4760
4764
  type: "TASK_FAILED",
4761
4765
  agentId: this.agentId,
4762
4766
  taskId: completedTaskId,
4763
- error: this.stdoutBuffer.slice(0, 300) || `Process exited with code ${code}`
4767
+ error: this.stdoutBuffer.slice(0, 300) || this.stderrBuffer.slice(-300) || `Process exited with code ${code}`
4764
4768
  });
4765
4769
  setTimeout(() => this.setStatus("idle"), 3e3);
4766
4770
  }
@@ -4871,12 +4875,13 @@ var AgentSession = class {
4871
4875
  // src/agent-manager.ts
4872
4876
  var AgentManager = class {
4873
4877
  agents = /* @__PURE__ */ new Map();
4874
- create(agentId, name, role, personality, workspace, resumeHistory, backendId) {
4878
+ create(agentId, name, role, personality, workspace, resumeHistory, backendId, palette) {
4875
4879
  const existing = this.agents.get(agentId);
4876
4880
  if (existing) {
4877
4881
  existing.destroy();
4878
4882
  }
4879
4883
  const session = new AgentSession(agentId, name, role, personality, workspace, resumeHistory, backendId);
4884
+ session.palette = palette;
4880
4885
  this.agents.set(agentId, session);
4881
4886
  return session;
4882
4887
  }
@@ -4961,7 +4966,6 @@ var telegramChannel = {
4961
4966
  const ba = { bot, preset, agentId, chatIds: /* @__PURE__ */ new Set() };
4962
4967
  botAgents.push(ba);
4963
4968
  if (!agentManager.get(agentId)) {
4964
- agentManager.create(agentId, preset.name, preset.role, preset.personality);
4965
4969
  commandHandler({
4966
4970
  type: "CREATE_AGENT",
4967
4971
  agentId,
@@ -5154,7 +5158,7 @@ function handleCommand(parsed) {
5154
5158
  case "CREATE_AGENT": {
5155
5159
  const backendId = parsed.backend ?? config.defaultBackend;
5156
5160
  console.log(`[Gateway] Creating agent: ${parsed.agentId} (${parsed.name} - ${parsed.role}) backend=${backendId}`);
5157
- const session = agentManager.create(parsed.agentId, parsed.name, parsed.role, parsed.personality, void 0, false, backendId);
5161
+ const session = agentManager.create(parsed.agentId, parsed.name, parsed.role, parsed.personality, void 0, false, backendId, parsed.palette);
5158
5162
  wireDelegation(session);
5159
5163
  publishEvent({
5160
5164
  type: "AGENT_CREATED",
@@ -5235,6 +5239,7 @@ function handleCommand(parsed) {
5235
5239
  agentId: agent.agentId,
5236
5240
  name: agent.name,
5237
5241
  role: agent.role,
5242
+ palette: agent.palette,
5238
5243
  personality: agent.personality,
5239
5244
  backend: agent.backend.id
5240
5245
  });
@@ -5295,5 +5300,6 @@ function cleanup() {
5295
5300
  }
5296
5301
  process.on("SIGINT", cleanup);
5297
5302
  process.on("SIGTERM", cleanup);
5303
+ process.on("SIGHUP", cleanup);
5298
5304
  main().catch(console.error);
5299
5305
  //# sourceMappingURL=index.js.map