usebeeline 0.0.71 → 0.0.84

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/usebeeline.mjs +29 -11
  2. package/package.json +1 -1
@@ -18058,6 +18058,9 @@ async function runServerCommandIntake(options) {
18058
18058
  let busy;
18059
18059
  let wake;
18060
18060
  let pushIntakeAcknowledged = false;
18061
+ let reconciliation;
18062
+ let reconciliationError;
18063
+ let stopped = false;
18061
18064
  const pending = new Map(first.commands.map((command) => [command.id, command]));
18062
18065
  const claimed = /* @__PURE__ */ new Set();
18063
18066
  const notify2 = (commands = []) => {
@@ -18066,6 +18069,21 @@ async function runServerCommandIntake(options) {
18066
18069
  pending.set(command.id, command);
18067
18070
  wake?.(false);
18068
18071
  };
18072
+ const requestReconciliation = () => {
18073
+ if (reconciliation)
18074
+ return;
18075
+ reconciliation = api.execute("getAgentCommands", { roomId }).then((page) => {
18076
+ if (page.commandProtocol !== 1)
18077
+ throw new Error("server command protocol changed; refusing intake");
18078
+ if (!stopped)
18079
+ notify2(page.commands);
18080
+ }).catch((error) => {
18081
+ reconciliationError = error;
18082
+ wake?.(false);
18083
+ }).finally(() => {
18084
+ reconciliation = void 0;
18085
+ });
18086
+ };
18069
18087
  options.onWake?.(notify2);
18070
18088
  const off = api.liveSubscribe?.(roomId, void 0, void 0, (connected, capabilities) => {
18071
18089
  const acknowledged = connected && capabilities?.pushIntake === true;
@@ -18078,6 +18096,8 @@ async function runServerCommandIntake(options) {
18078
18096
  }, options.presence, notify2);
18079
18097
  try {
18080
18098
  while (!signal?.aborted) {
18099
+ if (reconciliationError)
18100
+ throw reconciliationError;
18081
18101
  if (options.closed && await options.closed())
18082
18102
  return;
18083
18103
  for (const command of [...pending.values()]) {
@@ -18085,6 +18105,7 @@ async function runServerCommandIntake(options) {
18085
18105
  if (busy && command.action !== "stop")
18086
18106
  continue;
18087
18107
  pending.delete(command.id);
18108
+ claimed.add(command.id);
18088
18109
  try {
18089
18110
  await api.execute("claimAgentCommand", {
18090
18111
  roomId,
@@ -18092,10 +18113,10 @@ async function runServerCommandIntake(options) {
18092
18113
  generationId: context.generationId
18093
18114
  });
18094
18115
  } catch (error) {
18116
+ claimed.delete(command.id);
18095
18117
  options.onError?.(error);
18096
18118
  continue;
18097
18119
  }
18098
- claimed.add(command.id);
18099
18120
  if (command.action === "stop") {
18100
18121
  options.stop(command.turnRequestId);
18101
18122
  await api.execute("acknowledgeAgentCommand", {
@@ -18133,14 +18154,11 @@ async function runServerCommandIntake(options) {
18133
18154
  });
18134
18155
  if (signal?.aborted)
18135
18156
  break;
18136
- if (reconcile) {
18137
- const page = await api.execute("getAgentCommands", { roomId });
18138
- if (page.commandProtocol !== 1)
18139
- throw new Error("server command protocol changed; refusing intake");
18140
- notify2(page.commands);
18141
- }
18157
+ if (reconcile)
18158
+ requestReconciliation();
18142
18159
  }
18143
18160
  } finally {
18161
+ stopped = true;
18144
18162
  off?.();
18145
18163
  options.onWake?.(void 0);
18146
18164
  if (context.current)
@@ -21364,8 +21382,6 @@ var MonolithRoomTurnLoop = class {
21364
21382
  const buildPrompt = () => [
21365
21383
  this.turnInstructionPrefix,
21366
21384
  WarmTranscript.render(this.warmTranscript.select(this.sessionId, transcriptRows), "Room conversation so far:", "New in the Room since your last turn (the earlier conversation is already in this session):"),
21367
- `Newest message from ${inboxItemAuthorName(item, this.agent.publicKey, names)}:`,
21368
- roomMessagePrompt("", inboxItemPromptBody(item, this.agent.publicKey), item.attachments, delivered, this.acceptsImages()),
21369
21385
  grantDecision ? [
21370
21386
  "This is the answer to your grant request; your paused work resumes now.",
21371
21387
  "If it was approved and it is a command grant, run it with run_granted_command and the exact argv.",
@@ -21375,9 +21391,11 @@ var MonolithRoomTurnLoop = class {
21375
21391
  [
21376
21392
  "Write only the substantive Room message you want the human to read.",
21377
21393
  "Do not repeat or paraphrase these instructions.",
21378
- "If the newest message is only a nudge to respond, answer the most recent unanswered human message in the conversation instead of echoing the nudge.",
21394
+ "If the current task is only a nudge to respond, answer the most recent unanswered human message in the conversation instead of echoing the nudge.",
21379
21395
  MAINTAIN_ASSIGNED_IDENTITY_DIRECTIVE
21380
- ].join(" ")
21396
+ ].join(" "),
21397
+ `Current task selected by the server from ${inboxItemAuthorName(item, this.agent.publicKey, names)}:`,
21398
+ roomMessagePrompt("", inboxItemPromptBody(item, this.agent.publicKey), item.attachments, delivered, this.acceptsImages())
21381
21399
  ].filter(Boolean).join("\n\n");
21382
21400
  const stream = new AgentTurnStream({
21383
21401
  api,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "usebeeline",
3
- "version": "0.0.71",
3
+ "version": "0.0.84",
4
4
  "description": "Connect an AI coding agent to Beeline with one command.",
5
5
  "homepage": "https://usebeeline.app",
6
6
  "bugs": {