@openape/apes 0.27.0 → 0.28.0

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/cli.js CHANGED
@@ -2010,7 +2010,8 @@ function buildAgentAuthJson(input) {
2010
2010
  idp: input.idp,
2011
2011
  access_token: input.accessToken,
2012
2012
  email: input.email,
2013
- expires_at: input.expiresAt
2013
+ expires_at: input.expiresAt,
2014
+ owner_email: input.ownerEmail
2014
2015
  }, null, 2)}
2015
2016
  `;
2016
2017
  }
@@ -2422,56 +2423,6 @@ import { join as join4 } from "path";
2422
2423
  import { defineCommand as defineCommand23 } from "citty";
2423
2424
  import consola21 from "consola";
2424
2425
 
2425
- // src/lib/chat-room.ts
2426
- var DEFAULT_CHAT_ENDPOINT = "https://chat.openape.ai";
2427
- function chatEndpoint() {
2428
- return (process.env.APE_CHAT_ENDPOINT ?? DEFAULT_CHAT_ENDPOINT).replace(/\/$/, "");
2429
- }
2430
- async function chatFetch(bearer, path2, init) {
2431
- const url = `${chatEndpoint()}${path2}`;
2432
- const res = await fetch(url, {
2433
- method: init?.method ?? "GET",
2434
- headers: {
2435
- Authorization: `Bearer ${bearer}`,
2436
- "Content-Type": "application/json"
2437
- },
2438
- body: init?.body !== void 0 ? JSON.stringify(init.body) : void 0
2439
- });
2440
- if (!res.ok) {
2441
- const detail = await res.text().catch(() => "");
2442
- throw new Error(`chat.openape.ai ${init?.method ?? "GET"} ${path2} \u2192 ${res.status}: ${detail.slice(0, 200)}`);
2443
- }
2444
- return await res.json();
2445
- }
2446
- async function listRooms(bearer) {
2447
- return chatFetch(bearer, "/api/rooms");
2448
- }
2449
- async function listMembers(bearer, roomId) {
2450
- return chatFetch(bearer, `/api/rooms/${encodeURIComponent(roomId)}/members`);
2451
- }
2452
- async function findExistingDm(bearer, callerEmail, peerEmail) {
2453
- const rooms = await listRooms(bearer);
2454
- for (const room of rooms) {
2455
- if (room.kind !== "dm") continue;
2456
- const members = await listMembers(bearer, room.id);
2457
- if (members.length !== 2) continue;
2458
- const emails = new Set(members.map((m) => m.userEmail.toLowerCase()));
2459
- if (emails.has(callerEmail.toLowerCase()) && emails.has(peerEmail.toLowerCase())) {
2460
- return room;
2461
- }
2462
- }
2463
- return null;
2464
- }
2465
- async function ensureDmWith(opts) {
2466
- const existing = await findExistingDm(opts.callerBearer, opts.callerEmail, opts.peerEmail);
2467
- if (existing) return { roomId: existing.id, created: false };
2468
- const room = await chatFetch(opts.callerBearer, "/api/rooms", {
2469
- method: "POST",
2470
- body: { name: opts.peerEmail, kind: "dm", members: [opts.peerEmail] }
2471
- });
2472
- return { roomId: room.id, created: true };
2473
- }
2474
-
2475
2426
  // src/lib/keygen.ts
2476
2427
  import { Buffer as Buffer4 } from "buffer";
2477
2428
  import { existsSync as existsSync5, mkdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
@@ -2789,7 +2740,8 @@ and try again.`
2789
2740
  idp,
2790
2741
  accessToken: token,
2791
2742
  email: registration.email,
2792
- expiresAt: Math.floor(Date.now() / 1e3) + expiresIn
2743
+ expiresAt: Math.floor(Date.now() / 1e3) + expiresIn,
2744
+ ownerEmail: auth.email
2793
2745
  });
2794
2746
  const includeClaudeHook = !args["no-claude-hook"];
2795
2747
  const claudeOauthToken = await resolveClaudeToken({
@@ -2827,20 +2779,8 @@ and try again.`
2827
2779
  execFileSync4(apes, ["run", "--as", "root", "--wait", "--", "bash", scriptPath], { stdio: "inherit" });
2828
2780
  consola21.success(`Agent ${name} spawned.`);
2829
2781
  if (args.bridge) {
2830
- try {
2831
- consola21.start("Setting up direct chat with the agent\u2026");
2832
- const result = await ensureDmWith({
2833
- callerBearer: auth.access_token,
2834
- callerEmail: auth.email,
2835
- peerEmail: registration.email
2836
- });
2837
- consola21.success(
2838
- result.created ? `Created direct chat with ${registration.email}` : `Direct chat with ${registration.email} already existed`
2839
- );
2840
- } catch (err) {
2841
- const msg = err instanceof Error ? err.message : String(err);
2842
- consola21.warn(`Could not auto-create direct chat: ${msg}`);
2843
- }
2782
+ consola21.info(`On first boot, the bridge will send you a contact request from ${registration.email}.`);
2783
+ consola21.info("Open chat.openape.ai and accept it to start chatting with the agent.");
2844
2784
  }
2845
2785
  console.log("");
2846
2786
  console.log("Run as the agent with:");
@@ -4148,7 +4088,7 @@ var mcpCommand = defineCommand32({
4148
4088
  if (transport !== "stdio" && transport !== "sse") {
4149
4089
  throw new Error('Transport must be "stdio" or "sse"');
4150
4090
  }
4151
- const { startMcpServer } = await import("./server-TNWUMXYI.js");
4091
+ const { startMcpServer } = await import("./server-GWZM6VS3.js");
4152
4092
  await startMcpServer(transport, port);
4153
4093
  }
4154
4094
  });
@@ -4786,7 +4726,7 @@ async function bestEffortGrantCount(idp) {
4786
4726
  }
4787
4727
  }
4788
4728
  async function runHealth(args) {
4789
- const version = true ? "0.27.0" : "0.0.0";
4729
+ const version = true ? "0.28.0" : "0.0.0";
4790
4730
  const auth = loadAuth();
4791
4731
  if (!auth) {
4792
4732
  throw new CliError("Not logged in. Run `apes login` first.", 1);
@@ -5059,10 +4999,10 @@ if (shellRewrite) {
5059
4999
  if (shellRewrite.action === "rewrite") {
5060
5000
  process.argv = shellRewrite.argv;
5061
5001
  } else if (shellRewrite.action === "version") {
5062
- console.log(`ape-shell ${"0.27.0"} (OpenApe DDISA shell wrapper)`);
5002
+ console.log(`ape-shell ${"0.28.0"} (OpenApe DDISA shell wrapper)`);
5063
5003
  process.exit(0);
5064
5004
  } else if (shellRewrite.action === "help") {
5065
- console.log(`ape-shell ${"0.27.0"} \u2014 OpenApe DDISA shell wrapper`);
5005
+ console.log(`ape-shell ${"0.28.0"} \u2014 OpenApe DDISA shell wrapper`);
5066
5006
  console.log("");
5067
5007
  console.log("Usage:");
5068
5008
  console.log(" ape-shell Start interactive grant-mediated REPL");
@@ -5120,7 +5060,7 @@ var configCommand = defineCommand44({
5120
5060
  var main = defineCommand44({
5121
5061
  meta: {
5122
5062
  name: "apes",
5123
- version: "0.27.0",
5063
+ version: "0.28.0",
5124
5064
  description: "Unified CLI for OpenApe"
5125
5065
  },
5126
5066
  subCommands: {
@@ -5175,7 +5115,7 @@ async function maybeRefreshAuth() {
5175
5115
  }
5176
5116
  }
5177
5117
  await maybeRefreshAuth();
5178
- await maybeWarnStaleVersion("0.27.0").catch(() => {
5118
+ await maybeWarnStaleVersion("0.28.0").catch(() => {
5179
5119
  });
5180
5120
  runMain(main).catch((err) => {
5181
5121
  if (err instanceof CliExit) {