@openape/apes 0.26.1 → 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,57 +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 findRoomByName(bearer, name) {
|
|
2447
|
-
const rooms = await chatFetch(bearer, "/api/rooms");
|
|
2448
|
-
return rooms.find((r) => r.name === name) ?? null;
|
|
2449
|
-
}
|
|
2450
|
-
async function createRoom(bearer, name) {
|
|
2451
|
-
return chatFetch(bearer, "/api/rooms", {
|
|
2452
|
-
method: "POST",
|
|
2453
|
-
body: { name, kind: "channel", members: [] }
|
|
2454
|
-
});
|
|
2455
|
-
}
|
|
2456
|
-
async function addMember(bearer, roomId, email, role = "member") {
|
|
2457
|
-
await chatFetch(bearer, `/api/rooms/${encodeURIComponent(roomId)}/members`, {
|
|
2458
|
-
method: "POST",
|
|
2459
|
-
body: { email, role }
|
|
2460
|
-
});
|
|
2461
|
-
}
|
|
2462
|
-
async function ensureRoomMembership(opts) {
|
|
2463
|
-
const existing = await findRoomByName(opts.callerBearer, opts.roomName);
|
|
2464
|
-
let room;
|
|
2465
|
-
let created = false;
|
|
2466
|
-
if (existing) {
|
|
2467
|
-
room = existing;
|
|
2468
|
-
} else {
|
|
2469
|
-
room = await createRoom(opts.callerBearer, opts.roomName);
|
|
2470
|
-
created = true;
|
|
2471
|
-
}
|
|
2472
|
-
await addMember(opts.callerBearer, room.id, opts.agentEmail);
|
|
2473
|
-
return { roomId: room.id, created };
|
|
2474
|
-
}
|
|
2475
|
-
|
|
2476
2426
|
// src/lib/keygen.ts
|
|
2477
2427
|
import { Buffer as Buffer4 } from "buffer";
|
|
2478
2428
|
import { existsSync as existsSync5, mkdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
@@ -2727,10 +2677,6 @@ var spawnAgentCommand = defineCommand23({
|
|
|
2727
2677
|
"bridge-base-url": {
|
|
2728
2678
|
type: "string",
|
|
2729
2679
|
description: "Override LITELLM_BASE_URL for the bridge (default: read from ~/litellm/.env or http://127.0.0.1:4000/v1)."
|
|
2730
|
-
},
|
|
2731
|
-
"bridge-room": {
|
|
2732
|
-
type: "string",
|
|
2733
|
-
description: "After spawn, create (or find) a chat.openape.ai room with this name and add the new agent as a member. Uses the spawning user's IdP bearer."
|
|
2734
2680
|
}
|
|
2735
2681
|
},
|
|
2736
2682
|
async run({ args }) {
|
|
@@ -2794,7 +2740,8 @@ and try again.`
|
|
|
2794
2740
|
idp,
|
|
2795
2741
|
accessToken: token,
|
|
2796
2742
|
email: registration.email,
|
|
2797
|
-
expiresAt: Math.floor(Date.now() / 1e3) + expiresIn
|
|
2743
|
+
expiresAt: Math.floor(Date.now() / 1e3) + expiresIn,
|
|
2744
|
+
ownerEmail: auth.email
|
|
2798
2745
|
});
|
|
2799
2746
|
const includeClaudeHook = !args["no-claude-hook"];
|
|
2800
2747
|
const claudeOauthToken = await resolveClaudeToken({
|
|
@@ -2831,23 +2778,9 @@ and try again.`
|
|
|
2831
2778
|
consola21.info("You will be asked to approve the as=root grant in your DDISA inbox; this command blocks until you do.");
|
|
2832
2779
|
execFileSync4(apes, ["run", "--as", "root", "--wait", "--", "bash", scriptPath], { stdio: "inherit" });
|
|
2833
2780
|
consola21.success(`Agent ${name} spawned.`);
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
consola21.start(`Inviting agent into chat.openape.ai room "${bridgeRoom}"\u2026`);
|
|
2838
|
-
const result = await ensureRoomMembership({
|
|
2839
|
-
callerBearer: auth.access_token,
|
|
2840
|
-
roomName: bridgeRoom,
|
|
2841
|
-
agentEmail: registration.email
|
|
2842
|
-
});
|
|
2843
|
-
consola21.success(
|
|
2844
|
-
result.created ? `Created room ${result.roomId} and added ${registration.email}` : `Room ${result.roomId} already existed; added ${registration.email}`
|
|
2845
|
-
);
|
|
2846
|
-
} catch (err) {
|
|
2847
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
2848
|
-
consola21.warn(`Could not auto-create / invite to chat room: ${msg}`);
|
|
2849
|
-
consola21.info("Add the agent manually with: ape-chat members add <agent-email>");
|
|
2850
|
-
}
|
|
2781
|
+
if (args.bridge) {
|
|
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.");
|
|
2851
2784
|
}
|
|
2852
2785
|
console.log("");
|
|
2853
2786
|
console.log("Run as the agent with:");
|
|
@@ -4155,7 +4088,7 @@ var mcpCommand = defineCommand32({
|
|
|
4155
4088
|
if (transport !== "stdio" && transport !== "sse") {
|
|
4156
4089
|
throw new Error('Transport must be "stdio" or "sse"');
|
|
4157
4090
|
}
|
|
4158
|
-
const { startMcpServer } = await import("./server-
|
|
4091
|
+
const { startMcpServer } = await import("./server-GWZM6VS3.js");
|
|
4159
4092
|
await startMcpServer(transport, port);
|
|
4160
4093
|
}
|
|
4161
4094
|
});
|
|
@@ -4793,7 +4726,7 @@ async function bestEffortGrantCount(idp) {
|
|
|
4793
4726
|
}
|
|
4794
4727
|
}
|
|
4795
4728
|
async function runHealth(args) {
|
|
4796
|
-
const version = true ? "0.
|
|
4729
|
+
const version = true ? "0.28.0" : "0.0.0";
|
|
4797
4730
|
const auth = loadAuth();
|
|
4798
4731
|
if (!auth) {
|
|
4799
4732
|
throw new CliError("Not logged in. Run `apes login` first.", 1);
|
|
@@ -5066,10 +4999,10 @@ if (shellRewrite) {
|
|
|
5066
4999
|
if (shellRewrite.action === "rewrite") {
|
|
5067
5000
|
process.argv = shellRewrite.argv;
|
|
5068
5001
|
} else if (shellRewrite.action === "version") {
|
|
5069
|
-
console.log(`ape-shell ${"0.
|
|
5002
|
+
console.log(`ape-shell ${"0.28.0"} (OpenApe DDISA shell wrapper)`);
|
|
5070
5003
|
process.exit(0);
|
|
5071
5004
|
} else if (shellRewrite.action === "help") {
|
|
5072
|
-
console.log(`ape-shell ${"0.
|
|
5005
|
+
console.log(`ape-shell ${"0.28.0"} \u2014 OpenApe DDISA shell wrapper`);
|
|
5073
5006
|
console.log("");
|
|
5074
5007
|
console.log("Usage:");
|
|
5075
5008
|
console.log(" ape-shell Start interactive grant-mediated REPL");
|
|
@@ -5127,7 +5060,7 @@ var configCommand = defineCommand44({
|
|
|
5127
5060
|
var main = defineCommand44({
|
|
5128
5061
|
meta: {
|
|
5129
5062
|
name: "apes",
|
|
5130
|
-
version: "0.
|
|
5063
|
+
version: "0.28.0",
|
|
5131
5064
|
description: "Unified CLI for OpenApe"
|
|
5132
5065
|
},
|
|
5133
5066
|
subCommands: {
|
|
@@ -5182,7 +5115,7 @@ async function maybeRefreshAuth() {
|
|
|
5182
5115
|
}
|
|
5183
5116
|
}
|
|
5184
5117
|
await maybeRefreshAuth();
|
|
5185
|
-
await maybeWarnStaleVersion("0.
|
|
5118
|
+
await maybeWarnStaleVersion("0.28.0").catch(() => {
|
|
5186
5119
|
});
|
|
5187
5120
|
runMain(main).catch((err) => {
|
|
5188
5121
|
if (err instanceof CliExit) {
|