usebeeline 0.0.34 → 0.0.35

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 +43 -12
  2. package/package.json +1 -1
@@ -14576,6 +14576,12 @@ async function wait(ms, signal) {
14576
14576
  // apps/body/dist/monolith-room-turn.js
14577
14577
  import { mkdir as mkdir4 } from "node:fs/promises";
14578
14578
  import { homedir as homedir6 } from "node:os";
14579
+
14580
+ // packages/api-contract/dist/scheduled-prompts.js
14581
+ var SCHEDULE_SCHEDULER_NAME = "Beeline Scheduler";
14582
+ var SCHEDULED_PROMPT_PREFIX = "Scheduled: ";
14583
+
14584
+ // apps/body/dist/monolith-room-turn.js
14579
14585
  function isRoomMcpPermissionRequest(request) {
14580
14586
  if (isSquireMcpPermissionRequest(request))
14581
14587
  return false;
@@ -14584,6 +14590,16 @@ function isRoomMcpPermissionRequest(request) {
14584
14590
  function roomPrincipalMayAddressAgent(authority, humanPermitted) {
14585
14591
  return authority.member && (authority.principalKind === "agent" || authority.principalKind === "human" && humanPermitted);
14586
14592
  }
14593
+ function isScheduledPrompt(item, agentId) {
14594
+ return item.type === "system" && item.body.startsWith(SCHEDULED_PROMPT_PREFIX) && item.mentionIds.includes(agentId);
14595
+ }
14596
+ function inboxItemTriggersTurn(item, agentId) {
14597
+ if (item.authorId === agentId)
14598
+ return false;
14599
+ if (!item.mentionIds.includes(agentId))
14600
+ return false;
14601
+ return item.type === "message" || isScheduledPrompt(item, agentId);
14602
+ }
14587
14603
  function escapeRegExp(value) {
14588
14604
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
14589
14605
  }
@@ -14823,7 +14839,7 @@ var MonolithRoomTurnLoop = class {
14823
14839
  this.turnInstructionPrefix,
14824
14840
  transcript ? `Room conversation so far:
14825
14841
  ${transcript}` : "",
14826
- `Newest human message from ${names.get(item.authorId) ?? item.authorId.slice(0, 12)}:`,
14842
+ `Newest message from ${isScheduledPrompt(item, this.agent.publicKey) ? SCHEDULE_SCHEDULER_NAME : names.get(item.authorId) ?? item.authorId.slice(0, 12)}:`,
14827
14843
  roomMessagePrompt("", item.body, item.attachments),
14828
14844
  [
14829
14845
  "Write only the substantive Room message you want the human to read.",
@@ -14947,18 +14963,17 @@ ${transcript}` : "",
14947
14963
  limit: 200
14948
14964
  });
14949
14965
  for (const item of inbox.items) {
14950
- if (item.authorId === this.agent.publicKey || item.type !== "message")
14951
- continue;
14952
- const addressed = item.mentionIds.includes(this.agent.publicKey);
14953
- if (!addressed)
14954
- continue;
14955
- const authority = await api.execute("getRoomAuthority", {
14956
- roomId,
14957
- principalId: item.authorId
14958
- });
14959
- const humanPermitted = authority.principalKind === "human" ? await this.currentPrincipalCanDrive(this.options.workspaceId, item.authorId) : false;
14960
- if (!roomPrincipalMayAddressAgent(authority, humanPermitted))
14966
+ if (!inboxItemTriggersTurn(item, this.agent.publicKey))
14961
14967
  continue;
14968
+ if (!isScheduledPrompt(item, this.agent.publicKey)) {
14969
+ const authority = await api.execute("getRoomAuthority", {
14970
+ roomId,
14971
+ principalId: item.authorId
14972
+ });
14973
+ const humanPermitted = authority.principalKind === "human" ? await this.currentPrincipalCanDrive(this.options.workspaceId, item.authorId) : false;
14974
+ if (!roomPrincipalMayAddressAgent(authority, humanPermitted))
14975
+ continue;
14976
+ }
14962
14977
  const active = this.activeTurn;
14963
14978
  if (!active)
14964
14979
  this.startPrompt(item);
@@ -16535,6 +16550,22 @@ ${manual}
16535
16550
  // apps/body/dist/device-pairing.js
16536
16551
  var DEFAULT_BODY_IDENTITY_NAME2 = "beeline-body";
16537
16552
  async function completeDevicePairing(grant, options = {}) {
16553
+ try {
16554
+ return await pairDevice(grant, options);
16555
+ } catch (error) {
16556
+ await rollbackPairing(grant, options.fetchImpl).catch(() => void 0);
16557
+ throw error;
16558
+ }
16559
+ }
16560
+ async function rollbackPairing(grant, fetchImpl) {
16561
+ const doFetch = fetchImpl ?? fetch;
16562
+ await doFetch(new URL("/v1/auth/daemon/rollback", grant.monolithBaseUrl), {
16563
+ method: "POST",
16564
+ headers: { "content-type": "application/json" },
16565
+ body: JSON.stringify({ exchangeToken: grant.daemonExchangeToken })
16566
+ });
16567
+ }
16568
+ async function pairDevice(grant, options = {}) {
16538
16569
  const selectedAgent = options.selectedAgent ?? await selectPairAgentCommand({
16539
16570
  explicitKind: grant.harness,
16540
16571
  env: process.env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "usebeeline",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "Connect an AI coding agent to Beeline with one command.",
5
5
  "repository": {
6
6
  "type": "git",