@openape/apes 0.30.0 → 0.31.1

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.
@@ -12,7 +12,7 @@ import {
12
12
  loadConfig,
13
13
  saveAuth,
14
14
  saveConfig
15
- } from "./chunk-IDPV5SNB.js";
15
+ } from "./chunk-OBF7IMQ2.js";
16
16
  export {
17
17
  AUTH_FILE,
18
18
  CONFIG_DIR,
@@ -27,4 +27,4 @@ export {
27
27
  saveAuth,
28
28
  saveConfig
29
29
  };
30
- //# sourceMappingURL=config-JH2IEPIR.js.map
30
+ //# sourceMappingURL=config-MOB5DJ6H.js.map
@@ -8,8 +8,8 @@ import {
8
8
  getAgentChallengeEndpoint,
9
9
  getDelegationsEndpoint,
10
10
  getGrantsEndpoint
11
- } from "./chunk-7NUT2PFT.js";
12
- import "./chunk-IDPV5SNB.js";
11
+ } from "./chunk-N3THIFIS.js";
12
+ import "./chunk-OBF7IMQ2.js";
13
13
  export {
14
14
  ApiError,
15
15
  apiFetch,
@@ -20,4 +20,4 @@ export {
20
20
  getDelegationsEndpoint,
21
21
  getGrantsEndpoint
22
22
  };
23
- //# sourceMappingURL=http-JZT4XV5I.js.map
23
+ //# sourceMappingURL=http-5F7FX4V7.js.map
package/dist/index.d.ts CHANGED
@@ -243,6 +243,18 @@ interface AuthData {
243
243
  refresh_token?: string;
244
244
  email: string;
245
245
  expires_at: number;
246
+ /**
247
+ * Set by `apes login --key …` (and `apes agents spawn`), absolute
248
+ * path to the Ed25519 key the agent signs challenges with. Lets
249
+ * `@openape/cli-auth` refresh agent tokens in-process; see #259.
250
+ */
251
+ key_path?: string;
252
+ /**
253
+ * Email of the human who owns this agent — written by
254
+ * `apes agents spawn`. The chat-bridge reads it for owner-only
255
+ * contact handshakes. Optional for human auth.json files.
256
+ */
257
+ owner_email?: string;
246
258
  }
247
259
  interface ApesConfig {
248
260
  defaults?: {
package/dist/index.js CHANGED
@@ -31,12 +31,12 @@ import {
31
31
  tryLoadAdapter,
32
32
  verifyAndExecute,
33
33
  waitForGrantStatus
34
- } from "./chunk-IT6T6AKX.js";
34
+ } from "./chunk-DYSFQ26B.js";
35
35
  import {
36
36
  ApiError,
37
37
  apiFetch,
38
38
  discoverEndpoints
39
- } from "./chunk-7NUT2PFT.js";
39
+ } from "./chunk-N3THIFIS.js";
40
40
  import {
41
41
  clearAuth,
42
42
  getAuthToken,
@@ -46,7 +46,7 @@ import {
46
46
  loadConfig,
47
47
  saveAuth,
48
48
  saveConfig
49
- } from "./chunk-IDPV5SNB.js";
49
+ } from "./chunk-OBF7IMQ2.js";
50
50
  export {
51
51
  ApiError,
52
52
  CliError,
@@ -3,7 +3,7 @@ import {
3
3
  checkSudoRejection,
4
4
  isApesSelfDispatch,
5
5
  notifyGrantPending
6
- } from "./chunk-EDYICCBC.js";
6
+ } from "./chunk-3COOEDPF.js";
7
7
  import {
8
8
  appendAuditLog,
9
9
  createShapesGrant,
@@ -14,14 +14,14 @@ import {
14
14
  resolveCommand,
15
15
  verifyAndConsume,
16
16
  waitForGrantStatus
17
- } from "./chunk-IT6T6AKX.js";
17
+ } from "./chunk-DYSFQ26B.js";
18
18
  import {
19
19
  apiFetch,
20
20
  getGrantsEndpoint
21
- } from "./chunk-7NUT2PFT.js";
21
+ } from "./chunk-N3THIFIS.js";
22
22
  import {
23
23
  loadAuth
24
- } from "./chunk-IDPV5SNB.js";
24
+ } from "./chunk-OBF7IMQ2.js";
25
25
 
26
26
  // src/shell/orchestrator.ts
27
27
  import { hostname } from "os";
@@ -777,4 +777,4 @@ async function runInteractiveShell() {
777
777
  export {
778
778
  runInteractiveShell
779
779
  };
780
- //# sourceMappingURL=orchestrator-RWTALOSA.js.map
780
+ //# sourceMappingURL=orchestrator-EH6V5ATG.js.map
@@ -5,16 +5,16 @@ import {
5
5
  loadAdapter,
6
6
  resolveCommand,
7
7
  verifyAndExecute
8
- } from "./chunk-IT6T6AKX.js";
8
+ } from "./chunk-DYSFQ26B.js";
9
9
  import {
10
10
  apiFetch,
11
11
  getGrantsEndpoint
12
- } from "./chunk-7NUT2PFT.js";
12
+ } from "./chunk-N3THIFIS.js";
13
13
  import {
14
14
  getAuthToken,
15
15
  getIdpUrl,
16
16
  getRequesterIdentity
17
- } from "./chunk-IDPV5SNB.js";
17
+ } from "./chunk-OBF7IMQ2.js";
18
18
 
19
19
  // src/commands/mcp/server.ts
20
20
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -303,7 +303,7 @@ function registerAdapterTools(server) {
303
303
  async function startMcpServer(transport, port) {
304
304
  const server = new McpServer({
305
305
  name: "apes",
306
- version: true ? "0.30.0" : "0.1.0"
306
+ version: true ? "0.31.1" : "0.1.0"
307
307
  });
308
308
  registerStaticTools(server);
309
309
  registerAdapterTools(server);
@@ -331,4 +331,4 @@ async function startMcpServer(transport, port) {
331
331
  export {
332
332
  startMcpServer
333
333
  };
334
- //# sourceMappingURL=server-43TJLWMB.js.map
334
+ //# sourceMappingURL=server-KH5SZIFE.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openape/apes",
3
- "version": "0.30.0",
3
+ "version": "0.31.1",
4
4
  "turbo": {
5
5
  "tags": [
6
6
  "publishable"
@@ -31,9 +31,9 @@
31
31
  "@lydell/node-pty": "1.2.0-beta.12",
32
32
  "shell-quote": "^1.8.3",
33
33
  "zod": "^4.3.6",
34
- "@openape/proxy": "0.4.0",
35
- "@openape/grants": "0.11.2",
36
- "@openape/core": "0.13.2"
34
+ "@openape/proxy": "0.4.1",
35
+ "@openape/core": "0.14.0",
36
+ "@openape/grants": "0.11.3"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^25.3.5",
@@ -44,7 +44,7 @@
44
44
  "tsup": "^8.5.1",
45
45
  "typescript": "^5.8.2",
46
46
  "vitest": "^3.2.4",
47
- "@openape/server": "0.3.0"
47
+ "@openape/server": "0.3.2"
48
48
  },
49
49
  "license": "MIT",
50
50
  "author": "Patrick Hofmann <phofmann@delta-mind.at>",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/config.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport interface AuthData {\n idp: string\n access_token: string\n refresh_token?: string\n email: string\n expires_at: number\n}\n\nexport interface ApesConfig {\n defaults?: {\n idp?: string\n approval?: string\n /**\n * Audience for the `apes run` async info block. `agent` (default)\n * emits verbose agent-facing instructions with a polling protocol;\n * `human` emits a short friendly block. Env var `APES_USER` wins.\n */\n user?: 'agent' | 'human'\n /**\n * Poll interval (seconds) embedded in the agent-mode instructions.\n * Default 10. Env var `APES_GRANT_POLL_INTERVAL` wins. Stored as a\n * string in TOML because the hand-rolled parser only handles quoted\n * values — casting to number happens at read time.\n */\n grant_poll_interval_seconds?: string\n /**\n * Maximum poll duration (minutes) embedded in the agent-mode\n * instructions. Default 5. Env var `APES_GRANT_POLL_MAX_MINUTES` wins.\n */\n grant_poll_max_minutes?: string\n /**\n * Exit code emitted by `apes run` / `ape-shell -c` when the async\n * default path creates a pending grant. Default `75` (`EX_TEMPFAIL`\n * from sysexits.h — \"temporary failure, retry later\"). Set to `0`\n * to restore the pre-0.10.0 exit-0 behaviour. Env var\n * `APES_ASYNC_EXIT_CODE` wins. Valid range 0–255.\n */\n async_exit_code?: string\n }\n agent?: {\n key?: string\n email?: string\n }\n notifications?: {\n pending_command?: string\n }\n /**\n * Generic-fallback mode: when `apes run -- <cli>` is called with a CLI\n * that has no registered shape, fall through to a synthetic adapter that\n * requests a single-use, forced-high-risk grant for the exact argv.\n * See `shapes/generic.ts`.\n */\n generic?: {\n /**\n * Master switch. Default `true` (permissive). Set to `false` to restore\n * the legacy \"No adapter found\" hard-fail. Stored as string in TOML\n * (hand-parser limitation) and parsed as `value !== 'false'` at read time.\n */\n enabled?: string\n /** Override the audit-log location. Default `~/.config/apes/generic-calls.log`. Tilde-expanded at read time. */\n audit_log?: string\n }\n}\n\nconst CONFIG_DIR = join(homedir(), '.config', 'apes')\nconst AUTH_FILE = join(CONFIG_DIR, 'auth.json')\nconst CONFIG_FILE = join(CONFIG_DIR, 'config.toml')\n\nfunction ensureDir() {\n if (!existsSync(CONFIG_DIR)) {\n mkdirSync(CONFIG_DIR, { recursive: true })\n }\n}\n\nexport function loadAuth(): AuthData | null {\n if (!existsSync(AUTH_FILE))\n return null\n try {\n return JSON.parse(readFileSync(AUTH_FILE, 'utf-8'))\n }\n catch {\n return null\n }\n}\n\nexport function saveAuth(data: AuthData): void {\n ensureDir()\n writeFileSync(AUTH_FILE, JSON.stringify(data, null, 2), { mode: 0o600 })\n}\n\nexport function clearAuth(): void {\n if (existsSync(AUTH_FILE)) {\n writeFileSync(AUTH_FILE, '', { mode: 0o600 })\n }\n // Also wipe the [agent] section from config.toml so logout disables\n // auto-refresh. Preserves [defaults] so the IdP URL stays configured.\n if (existsSync(CONFIG_FILE)) {\n const existing = loadConfig()\n if (existing.agent) {\n const { agent: _removed, ...rest } = existing\n saveConfig(rest)\n }\n }\n}\n\nexport function loadConfig(): ApesConfig {\n if (!existsSync(CONFIG_FILE))\n return {}\n try {\n return parseTOML(readFileSync(CONFIG_FILE, 'utf-8'))\n }\n catch {\n return {}\n }\n}\n\nfunction parseTOML(content: string): ApesConfig {\n const config: ApesConfig = {}\n let section = ''\n\n for (const line of content.split('\\n')) {\n const trimmed = line.trim()\n if (!trimmed || trimmed.startsWith('#'))\n continue\n\n const sectionMatch = trimmed.match(/^\\[(.+)\\]$/)\n if (sectionMatch) {\n section = sectionMatch[1]!\n continue\n }\n\n // Accept quoted strings and bare booleans/tokens — the generic section\n // uses `enabled = false` (no quotes) which the quoted-only match would\n // silently drop.\n const kvQuoted = trimmed.match(/^(\\w+)\\s*=\\s*\"(.*)\"$/)\n const kvBare = trimmed.match(/^(\\w+)\\s*=\\s*([^\"\\s]\\S*)$/)\n const kvMatch = kvQuoted ?? kvBare\n if (kvMatch) {\n const [, key, value] = kvMatch\n if (section === 'defaults') {\n config.defaults = config.defaults || {}\n ;(config.defaults as Record<string, string>)[key!] = value!\n }\n else if (section === 'agent') {\n config.agent = config.agent || {}\n ;(config.agent as Record<string, string>)[key!] = value!\n }\n else if (section === 'notifications') {\n config.notifications = config.notifications || {}\n ;(config.notifications as Record<string, string>)[key!] = value!\n }\n else if (section === 'generic') {\n config.generic = config.generic || {}\n ;(config.generic as Record<string, string>)[key!] = value!\n }\n }\n }\n\n return config\n}\n\nexport function saveConfig(config: ApesConfig): void {\n ensureDir()\n const lines: string[] = []\n\n if (config.defaults) {\n lines.push('[defaults]')\n for (const [key, value] of Object.entries(config.defaults)) {\n if (value)\n lines.push(`${key} = \"${value}\"`)\n }\n lines.push('')\n }\n\n if (config.agent) {\n lines.push('[agent]')\n for (const [key, value] of Object.entries(config.agent)) {\n if (value)\n lines.push(`${key} = \"${value}\"`)\n }\n lines.push('')\n }\n\n if (config.notifications) {\n lines.push('[notifications]')\n for (const [key, value] of Object.entries(config.notifications)) {\n if (value)\n lines.push(`${key} = \"${value}\"`)\n }\n lines.push('')\n }\n\n if (config.generic) {\n lines.push('[generic]')\n for (const [key, value] of Object.entries(config.generic)) {\n if (value)\n lines.push(`${key} = \"${value}\"`)\n }\n lines.push('')\n }\n\n writeFileSync(CONFIG_FILE, lines.join('\\n'), { mode: 0o600 })\n}\n\n/**\n * Is generic-fallback enabled? Permissive default: `true` unless the user\n * explicitly sets `[generic] enabled = false`.\n */\nexport function isGenericFallbackEnabled(config?: ApesConfig): boolean {\n const cfg = config ?? loadConfig()\n const raw = cfg.generic?.enabled\n if (raw === undefined) return true\n return raw !== 'false'\n}\n\n/**\n * Resolve the audit-log path for generic calls, expanding `~` to `$HOME`.\n */\nexport function getGenericAuditLogPath(config?: ApesConfig): string {\n const cfg = config ?? loadConfig()\n const raw = cfg.generic?.audit_log\n const path = raw && raw.length > 0\n ? raw\n : join(homedir(), '.config', 'apes', 'generic-calls.log')\n return path.startsWith('~/')\n ? join(homedir(), path.slice(2))\n : path\n}\n\nexport function getIdpUrl(explicit?: string): string | null {\n if (explicit)\n return explicit\n if (process.env.APES_IDP)\n return process.env.APES_IDP\n\n const auth = loadAuth()\n if (auth?.idp)\n return auth.idp\n\n const config = loadConfig()\n if (config.defaults?.idp)\n return config.defaults.idp\n\n return null\n}\n\nexport function getAuthToken(): string | null {\n const auth = loadAuth()\n if (!auth)\n return null\n\n // Check expiry (with 30s buffer)\n if (auth.expires_at && Date.now() / 1000 > auth.expires_at - 30) {\n return null // expired\n }\n\n return auth.access_token\n}\n\nexport function getRequesterIdentity(): string | null {\n return loadAuth()?.email ?? null\n}\n\nexport { CONFIG_DIR, AUTH_FILE }\n"],"mappings":";;;AAAA,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,SAAS,eAAe;AACxB,SAAS,YAAY;AAkErB,IAAM,aAAa,KAAK,QAAQ,GAAG,WAAW,MAAM;AACpD,IAAM,YAAY,KAAK,YAAY,WAAW;AAC9C,IAAM,cAAc,KAAK,YAAY,aAAa;AAElD,SAAS,YAAY;AACnB,MAAI,CAAC,WAAW,UAAU,GAAG;AAC3B,cAAU,YAAY,EAAE,WAAW,KAAK,CAAC;AAAA,EAC3C;AACF;AAEO,SAAS,WAA4B;AAC1C,MAAI,CAAC,WAAW,SAAS;AACvB,WAAO;AACT,MAAI;AACF,WAAO,KAAK,MAAM,aAAa,WAAW,OAAO,CAAC;AAAA,EACpD,QACM;AACJ,WAAO;AAAA,EACT;AACF;AAEO,SAAS,SAAS,MAAsB;AAC7C,YAAU;AACV,gBAAc,WAAW,KAAK,UAAU,MAAM,MAAM,CAAC,GAAG,EAAE,MAAM,IAAM,CAAC;AACzE;AAEO,SAAS,YAAkB;AAChC,MAAI,WAAW,SAAS,GAAG;AACzB,kBAAc,WAAW,IAAI,EAAE,MAAM,IAAM,CAAC;AAAA,EAC9C;AAGA,MAAI,WAAW,WAAW,GAAG;AAC3B,UAAM,WAAW,WAAW;AAC5B,QAAI,SAAS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