usebeeline 0.1.208 → 0.1.209-rc.2

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 +230 -13
  2. package/package.json +1 -1
@@ -817,9 +817,9 @@ function nodeVersionAtLeast(version, minimum) {
817
817
  const parts = version.split(".").map(Number);
818
818
  for (let index = 0; index < 3; index++) {
819
819
  const actual = parts[index] ?? 0;
820
- const required = minimum[index] ?? 0;
821
- if (actual !== required)
822
- return actual > required;
820
+ const required2 = minimum[index] ?? 0;
821
+ if (actual !== required2)
822
+ return actual > required2;
823
823
  }
824
824
  return true;
825
825
  }
@@ -5299,8 +5299,8 @@ var require_webidl = __commonJS({
5299
5299
  });
5300
5300
  }
5301
5301
  for (const options of converters) {
5302
- const { key, defaultValue, required, converter } = options;
5303
- if (required === true) {
5302
+ const { key, defaultValue, required: required2, converter } = options;
5303
+ if (required2 === true) {
5304
5304
  if (!Object.hasOwn(dictionary, key)) {
5305
5305
  throw webidl.errors.exception({
5306
5306
  header: prefix,
@@ -5313,7 +5313,7 @@ var require_webidl = __commonJS({
5313
5313
  if (hasDefault && value !== null) {
5314
5314
  value ??= defaultValue();
5315
5315
  }
5316
- if (required || hasDefault || value !== void 0) {
5316
+ if (required2 || hasDefault || value !== void 0) {
5317
5317
  value = converter(value, prefix, `${argument}.${key}`);
5318
5318
  if (options.allowedValues && !options.allowedValues.includes(value)) {
5319
5319
  throw webidl.errors.exception({
@@ -22398,6 +22398,48 @@ var init_artifacts = __esm({
22398
22398
  });
22399
22399
 
22400
22400
  // packages/api-contract/dist/mcp-delivery.js
22401
+ function readMemberDelivery(value) {
22402
+ if (!value || typeof value !== "object" || Array.isArray(value))
22403
+ return;
22404
+ const item = value;
22405
+ if (!["setup_unfinished", "proved_ready", "failed", "host_without_live_delivery"].includes(String(item.state)))
22406
+ return;
22407
+ if (item.mechanism !== void 0 && !["local", "events", "webhook", "on_demand"].includes(String(item.mechanism)))
22408
+ return;
22409
+ const result = { state: item.state };
22410
+ if (item.offline !== void 0) {
22411
+ if (typeof item.offline !== "boolean")
22412
+ return;
22413
+ result.offline = item.offline;
22414
+ }
22415
+ if (item.mechanism !== void 0)
22416
+ result.mechanism = item.mechanism;
22417
+ for (const key of ["host", "surface", "conversation", "generation", "failure", "reconnectUrl"]) {
22418
+ if (item[key] !== void 0) {
22419
+ if (typeof item[key] !== "string" || item[key].length > 300)
22420
+ return;
22421
+ result[key] = item[key];
22422
+ }
22423
+ }
22424
+ if (item.reconnectUrl !== void 0) {
22425
+ try {
22426
+ const url = new URL(String(item.reconnectUrl));
22427
+ if (url.protocol !== "https:" || url.username || url.password)
22428
+ return;
22429
+ } catch {
22430
+ return;
22431
+ }
22432
+ }
22433
+ if (item.proof !== void 0) {
22434
+ if (!item.proof || typeof item.proof !== "object")
22435
+ return;
22436
+ const proof = item.proof;
22437
+ if (typeof proof.generation !== "string" || typeof proof.receivedAt !== "string" || !Number.isFinite(Date.parse(proof.receivedAt)))
22438
+ return;
22439
+ result.proof = { generation: proof.generation, receivedAt: proof.receivedAt };
22440
+ }
22441
+ return result;
22442
+ }
22401
22443
  var init_mcp_delivery = __esm({
22402
22444
  "packages/api-contract/dist/mcp-delivery.js"() {
22403
22445
  "use strict";
@@ -22493,7 +22535,10 @@ var init_connector_adapter = __esm({
22493
22535
  });
22494
22536
 
22495
22537
  // packages/api-contract/dist/workbench.js
22496
- var CONNECTABLE_CONNECTOR_KINDS;
22538
+ function isConnectorKind(value) {
22539
+ return typeof value === "string" && CONNECTOR_KINDS.includes(value);
22540
+ }
22541
+ var CONNECTOR_KINDS, CONNECTABLE_CONNECTOR_KINDS;
22497
22542
  var init_workbench = __esm({
22498
22543
  "packages/api-contract/dist/workbench.js"() {
22499
22544
  "use strict";
@@ -22501,6 +22546,17 @@ var init_workbench = __esm({
22501
22546
  init_workbench_display();
22502
22547
  init_app_connections();
22503
22548
  init_connector_adapter();
22549
+ CONNECTOR_KINDS = [
22550
+ "trusty-squire",
22551
+ "link",
22552
+ "wallet",
22553
+ "tailscale",
22554
+ "google-gmail",
22555
+ "google-calendar",
22556
+ "google-drive",
22557
+ "google-youtube",
22558
+ "registry-mcp"
22559
+ ];
22504
22560
  CONNECTABLE_CONNECTOR_KINDS = [
22505
22561
  "trusty-squire",
22506
22562
  "tailscale"
@@ -22509,12 +22565,20 @@ var init_workbench = __esm({
22509
22565
  });
22510
22566
 
22511
22567
  // packages/api-contract/dist/connector-offers.js
22512
- var CONNECTOR_OFFER_WINDOW_MS, CONNECTOR_OFFER_KEY_BOUNDARY, OFFERABLE_CONNECTOR_KINDS;
22568
+ function isConnectorOfferIntent(value) {
22569
+ return CONNECTOR_OFFER_INTENTS.includes(value);
22570
+ }
22571
+ function isConnectorOfferStatus(value) {
22572
+ return CONNECTOR_OFFER_STATUSES.includes(value);
22573
+ }
22574
+ var CONNECTOR_OFFER_INTENTS, CONNECTOR_OFFER_STATUSES, CONNECTOR_OFFER_WINDOW_MS, CONNECTOR_OFFER_KEY_BOUNDARY, OFFERABLE_CONNECTOR_KINDS;
22513
22575
  var init_connector_offers = __esm({
22514
22576
  "packages/api-contract/dist/connector-offers.js"() {
22515
22577
  "use strict";
22516
22578
  init_system_message_catalog();
22517
22579
  init_workbench();
22580
+ CONNECTOR_OFFER_INTENTS = ["add", "reconnect", "switch"];
22581
+ CONNECTOR_OFFER_STATUSES = ["pending", "connecting", "accepted", "denied", "failed"];
22518
22582
  CONNECTOR_OFFER_WINDOW_MS = 2 * 6e4;
22519
22583
  CONNECTOR_OFFER_KEY_BOUNDARY = systemMessage("connector-offers.still-no-raw-key-in-chat");
22520
22584
  OFFERABLE_CONNECTOR_KINDS = [
@@ -22524,6 +22588,36 @@ var init_connector_offers = __esm({
22524
22588
  }
22525
22589
  });
22526
22590
 
22591
+ // packages/api-contract/dist/phone-view.js
22592
+ function view(spec) {
22593
+ return {
22594
+ read(value) {
22595
+ if (value === null || typeof value !== "object" || Array.isArray(value))
22596
+ return null;
22597
+ const item = value;
22598
+ const out = {};
22599
+ for (const [key, declared] of Object.entries(spec)) {
22600
+ const part = declared.read(item);
22601
+ if (part === void 0 || part === null) {
22602
+ if (declared.required)
22603
+ return null;
22604
+ continue;
22605
+ }
22606
+ out[key] = part;
22607
+ }
22608
+ return out;
22609
+ }
22610
+ };
22611
+ }
22612
+ var required, optional;
22613
+ var init_phone_view = __esm({
22614
+ "packages/api-contract/dist/phone-view.js"() {
22615
+ "use strict";
22616
+ required = (read) => ({ read, required: true });
22617
+ optional = (read) => ({ read, required: false });
22618
+ }
22619
+ });
22620
+
22527
22621
  // packages/api-contract/dist/room-choices.js
22528
22622
  var init_room_choices = __esm({
22529
22623
  "packages/api-contract/dist/room-choices.js"() {
@@ -22637,7 +22731,63 @@ var init_phone_guards_read_agent_detail_view = __esm({
22637
22731
  });
22638
22732
 
22639
22733
  // packages/api-contract/dist/phone-guards.js
22640
- var CLOSED_VIEWER;
22734
+ function record(value) {
22735
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
22736
+ }
22737
+ function integer(value) {
22738
+ return Number.isSafeInteger(value) && value >= 0;
22739
+ }
22740
+ function hex64(value) {
22741
+ return typeof value === "string" && HEX.test(value);
22742
+ }
22743
+ function uuid(value) {
22744
+ return typeof value === "string" && UUID.test(value);
22745
+ }
22746
+ function nonempty(value) {
22747
+ return typeof value === "string" && value.length > 0;
22748
+ }
22749
+ function field(key, value) {
22750
+ return value === void 0 || value === null ? {} : { [key]: value };
22751
+ }
22752
+ function oneOf(value, allowed) {
22753
+ return typeof value === "string" && allowed.includes(value) ? value : void 0;
22754
+ }
22755
+ function readIdentity(value) {
22756
+ const item = record(value);
22757
+ if (!item || !hex64(item.pubkey))
22758
+ return null;
22759
+ if (item.kind !== "human" && item.kind !== "agent")
22760
+ return null;
22761
+ if (typeof item.name !== "string")
22762
+ return null;
22763
+ return {
22764
+ pubkey: item.pubkey,
22765
+ kind: item.kind,
22766
+ name: item.name,
22767
+ ...field("handle", typeof item.handle === "string" ? item.handle : void 0),
22768
+ ...field("avatar", typeof item.avatar === "string" ? item.avatar : void 0),
22769
+ ...field("face", typeof item.face === "string" ? item.face : void 0)
22770
+ };
22771
+ }
22772
+ function readPresence(value) {
22773
+ const item = record(value);
22774
+ if (!item)
22775
+ return void 0;
22776
+ if (item.status !== "online" && item.status !== "offline")
22777
+ return void 0;
22778
+ if (!integer(item.observedAt))
22779
+ return void 0;
22780
+ return {
22781
+ status: item.status,
22782
+ observedAt: item.observedAt,
22783
+ ...field("held", item.held === true ? true : void 0),
22784
+ ...field("roomId", uuid(item.roomId) ? item.roomId : void 0)
22785
+ };
22786
+ }
22787
+ function readIdentityOnly(value) {
22788
+ return readIdentity(value) ?? void 0;
22789
+ }
22790
+ var HEX, UUID, CLOSED_VIEWER, roomHeaderFields, roomHeader, roomMemberFields, roomMember, connectorOfferFields, connectorOffer;
22641
22791
  var init_phone_guards = __esm({
22642
22792
  "packages/api-contract/dist/phone-guards.js"() {
22643
22793
  "use strict";
@@ -22646,16 +22796,70 @@ var init_phone_guards = __esm({
22646
22796
  init_agent_sign_in();
22647
22797
  init_agent_grants();
22648
22798
  init_connector_offers();
22799
+ init_phone_view();
22649
22800
  init_workbench();
22650
22801
  init_room_choices();
22651
22802
  init_phone_guards_read_choice_card();
22652
22803
  init_phone_guards_read_corner_lifecycle();
22653
22804
  init_phone_guards_read_agent_detail_view();
22805
+ HEX = /^[0-9a-f]{64}$/;
22806
+ UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
22654
22807
  CLOSED_VIEWER = {
22655
22808
  identity: { pubkey: "0".repeat(64), kind: "human", name: "" },
22656
22809
  role: "member",
22657
22810
  permissions: { send: false, manage: false }
22658
22811
  };
22812
+ roomHeaderFields = {
22813
+ id: required((item) => uuid(item.id) ? item.id : void 0),
22814
+ name: required((item) => typeof item.name === "string" ? item.name : ""),
22815
+ archived: optional((item) => typeof item.archived === "boolean" ? item.archived : void 0),
22816
+ createdAt: optional((item) => integer(item.createdAt) ? item.createdAt : void 0),
22817
+ updatedAt: optional((item) => integer(item.updatedAt) ? item.updatedAt : void 0),
22818
+ workspaceId: optional((item) => uuid(item.workspaceId) ? item.workspaceId : void 0),
22819
+ parentId: optional((item) => uuid(item.parentId) ? item.parentId : void 0),
22820
+ about: optional((item) => typeof item.about === "string" ? item.about : void 0),
22821
+ avatar: optional((item) => typeof item.avatar === "string" ? item.avatar : void 0),
22822
+ favicon: optional((item) => typeof item.favicon === "string" ? item.favicon : void 0),
22823
+ visibility: optional((item) => oneOf(item.visibility, ["public", "invite-only"])),
22824
+ reviewerAgentId: optional((item) => hex64(item.reviewerAgentId) ? item.reviewerAgentId : void 0)
22825
+ };
22826
+ roomHeader = view(roomHeaderFields);
22827
+ roomMemberFields = {
22828
+ identity: required((item) => readIdentity(item.identity) ?? void 0),
22829
+ role: required((item) => typeof item.role === "string" && item.role.length > 0 ? item.role : "member"),
22830
+ model: optional((item) => readIdentity(item.identity)?.kind === "agent" && typeof item.model === "string" ? item.model : void 0),
22831
+ presence: optional((item) => readPresence(item.presence)),
22832
+ delivery: optional((item) => readMemberDelivery(item.delivery))
22833
+ };
22834
+ roomMember = view(roomMemberFields);
22835
+ connectorOfferFields = {
22836
+ offerId: required((item) => uuid(item.offerId) ? item.offerId : void 0),
22837
+ agent: required((item) => {
22838
+ const agent = readIdentity(item.agent);
22839
+ return agent?.kind === "agent" ? agent : void 0;
22840
+ }),
22841
+ addressee: required((item) => {
22842
+ const addressee = readIdentity(item.addressee);
22843
+ return addressee?.kind === "human" ? addressee : void 0;
22844
+ }),
22845
+ connectorType: required((item) => isConnectorKind(item.connectorType) ? item.connectorType : void 0),
22846
+ connectorName: required((item) => nonempty(item.connectorName) ? item.connectorName : void 0),
22847
+ reason: required((item) => typeof item.reason === "string" ? item.reason : void 0),
22848
+ consequence: required((item) => nonempty(item.consequence) ? item.consequence : void 0),
22849
+ helper: required((item) => {
22850
+ const helper = record(item.helper);
22851
+ return helper && typeof helper.machineId === "string" && typeof helper.name === "string" ? { machineId: helper.machineId, name: helper.name } : void 0;
22852
+ }),
22853
+ status: required((item) => isConnectorOfferStatus(item.status) ? item.status : void 0),
22854
+ createdAt: required((item) => integer(item.createdAt) ? item.createdAt : void 0),
22855
+ acceptedBy: optional((item) => readIdentityOnly(item.acceptedBy)),
22856
+ acceptedAt: optional((item) => integer(item.acceptedAt) ? item.acceptedAt : void 0),
22857
+ connectorId: optional((item) => typeof item.connectorId === "string" ? item.connectorId : void 0),
22858
+ replacementMessageId: optional((item) => nonempty(item.replacementMessageId) ? item.replacementMessageId : void 0),
22859
+ intent: optional((item) => isConnectorOfferIntent(item.intent) ? item.intent : void 0),
22860
+ provider: optional((item) => typeof item.provider === "string" ? item.provider : void 0)
22861
+ };
22862
+ connectorOffer = view(connectorOfferFields);
22659
22863
  }
22660
22864
  });
22661
22865
 
@@ -22707,6 +22911,7 @@ var init_phone_operations = __esm({
22707
22911
  PHONE_READ_OPERATIONS = [
22708
22912
  ...PHONE_ROUTE_READ_OPERATIONS,
22709
22913
  "readRoomTools",
22914
+ "resolveChatLinks",
22710
22915
  "readMediaMetadata",
22711
22916
  "readMediaLink",
22712
22917
  "readMediaPlayback",
@@ -23209,6 +23414,17 @@ var init_mcp_muse_recipe = __esm({
23209
23414
  }
23210
23415
  });
23211
23416
 
23417
+ // packages/api-contract/dist/chat-links.js
23418
+ var THREAD_NAME, HANDLE, TOKEN_PATTERN;
23419
+ var init_chat_links = __esm({
23420
+ "packages/api-contract/dist/chat-links.js"() {
23421
+ "use strict";
23422
+ THREAD_NAME = String.raw`[\p{L}\p{N}](?:[\p{L}\p{M}\p{N}_-]*[\p{L}\p{M}\p{N}_])?`;
23423
+ HANDLE = String.raw`[A-Za-z0-9](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?`;
23424
+ TOKEN_PATTERN = new RegExp(String.raw`(?:↳(${THREAD_NAME})|¶(${HANDLE})-([1-9][0-9]{0,8}))(?![\p{L}\p{M}\p{N}_]|-[\p{L}\p{N}])`, "gu");
23425
+ }
23426
+ });
23427
+
23212
23428
  // packages/api-contract/dist/phone.js
23213
23429
  var init_phone = __esm({
23214
23430
  "packages/api-contract/dist/phone.js"() {
@@ -23256,6 +23472,7 @@ var init_phone = __esm({
23256
23472
  init_phone_guards();
23257
23473
  init_mcp_delivery();
23258
23474
  init_mcp_muse_recipe();
23475
+ init_chat_links();
23259
23476
  }
23260
23477
  });
23261
23478
 
@@ -26186,7 +26403,7 @@ async function convergeMachine(options = {}) {
26186
26403
  const stateRoot = env.XDG_STATE_HOME || resolve9(env.HOME || "", ".local/state");
26187
26404
  const root = resolve9(stateRoot, "beeline/agents");
26188
26405
  const configured = await Promise.all((await readdir4(root).catch(() => [])).filter((id) => /^[0-9a-f]{64}$/i.test(id)).map(async (id) => await stat(resolve9(root, id, "runtime.json")).then(() => true, () => false) && !await stat(resolve9(root, id, "stopped")).then(() => true, () => false) ? id : void 0));
26189
- const required = new Set(options.agentIds ?? configured.filter((id) => Boolean(id)));
26406
+ const required2 = new Set(options.agentIds ?? configured.filter((id) => Boolean(id)));
26190
26407
  const current = await requestMachine(stateRoot, { operation: "status" }, () => true, 1e3).catch(() => void 0);
26191
26408
  const hasControl = Boolean(current);
26192
26409
  if (options.releaseId && (!hasControl || current?.loadedRelease === options.releaseId))
@@ -26217,15 +26434,15 @@ async function convergeMachine(options = {}) {
26217
26434
  expectedRelease = status.desiredRelease;
26218
26435
  if (expectedRelease && status.loadedRelease !== expectedRelease && !(targetIdentity?.version && status.loadedIdentity?.version && targetIdentity.version !== status.loadedIdentity.version && versionAtLeast(status.loadedIdentity.version, targetIdentity.version)))
26219
26436
  return false;
26220
- const agents = Object.entries(status.agents).filter(([id, agent]) => required.has(id) || !options.agentIds && agent.enabled !== false);
26437
+ const agents = Object.entries(status.agents).filter(([id, agent]) => required2.has(id) || !options.agentIds && agent.enabled !== false);
26221
26438
  const refused = agents.filter(([, agent]) => agent.state === "needs-auth" || agent.state === "needs-config" || agent.state === "removed");
26222
26439
  if (refused.length)
26223
26440
  throw new Error(refused.map(([id, agent]) => `agent ${id}: ${agent.status}`).join("; "));
26224
- if ([...required].some((id) => !status.agents[id] || status.agents[id]?.enabled === false))
26441
+ if ([...required2].some((id) => !status.agents[id] || status.agents[id]?.enabled === false))
26225
26442
  return false;
26226
26443
  return status.processState === "serving" && agents.every(([, agent]) => agent.state === "serving");
26227
26444
  }, Math.max(1, deadlineAt - Date.now())).catch((error) => {
26228
- throw new Error(`${String(error)}${required.size ? `; enabled agents: ${[...required].join(", ")}` : ""}`);
26445
+ throw new Error(`${String(error)}${required2.size ? `; enabled agents: ${[...required2].join(", ")}` : ""}`);
26229
26446
  });
26230
26447
  }
26231
26448
  async function bootstrapMachine(env = process.env) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "usebeeline",
3
- "version": "0.1.208",
3
+ "version": "0.1.209-rc.2",
4
4
  "description": "Connect an AI coding agent to Beeline with one command.",
5
5
  "homepage": "https://usebeeline.app",
6
6
  "bugs": {