@openape/apes 0.9.2 → 0.9.3

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/index.d.ts CHANGED
@@ -231,6 +231,24 @@ interface ApesConfig {
231
231
  defaults?: {
232
232
  idp?: string;
233
233
  approval?: string;
234
+ /**
235
+ * Audience for the `apes run` async info block. `agent` (default)
236
+ * emits verbose agent-facing instructions with a polling protocol;
237
+ * `human` emits a short friendly block. Env var `APES_USER` wins.
238
+ */
239
+ user?: 'agent' | 'human';
240
+ /**
241
+ * Poll interval (seconds) embedded in the agent-mode instructions.
242
+ * Default 10. Env var `APES_GRANT_POLL_INTERVAL` wins. Stored as a
243
+ * string in TOML because the hand-rolled parser only handles quoted
244
+ * values — casting to number happens at read time.
245
+ */
246
+ grant_poll_interval_seconds?: string;
247
+ /**
248
+ * Maximum poll duration (minutes) embedded in the agent-mode
249
+ * instructions. Default 5. Env var `APES_GRANT_POLL_MAX_MINUTES` wins.
250
+ */
251
+ grant_poll_max_minutes?: string;
234
252
  };
235
253
  agent?: {
236
254
  key?: string;
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ import {
34
34
  tryLoadAdapter,
35
35
  verifyAndExecute,
36
36
  waitForGrantStatus
37
- } from "./chunk-UQ673USC.js";
37
+ } from "./chunk-D3OMN7RV.js";
38
38
  import {
39
39
  clearAuth,
40
40
  getAuthToken,
@@ -44,7 +44,7 @@ import {
44
44
  loadConfig,
45
45
  saveAuth,
46
46
  saveConfig
47
- } from "./chunk-AZVY3X7Q.js";
47
+ } from "./chunk-ILKZ5HGV.js";
48
48
  export {
49
49
  ApiError,
50
50
  CliError,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  notifyGrantPending
4
- } from "./chunk-LSKHTHUY.js";
4
+ } from "./chunk-5FV5KXEX.js";
5
5
  import {
6
6
  apiFetch,
7
7
  appendAuditLog,
@@ -14,10 +14,10 @@ import {
14
14
  resolveCommand,
15
15
  verifyAndConsume,
16
16
  waitForGrantStatus
17
- } from "./chunk-UQ673USC.js";
17
+ } from "./chunk-D3OMN7RV.js";
18
18
  import {
19
19
  loadAuth
20
- } from "./chunk-AZVY3X7Q.js";
20
+ } from "./chunk-ILKZ5HGV.js";
21
21
 
22
22
  // src/shell/orchestrator.ts
23
23
  import { hostname } from "os";
@@ -772,4 +772,4 @@ async function runInteractiveShell() {
772
772
  export {
773
773
  runInteractiveShell
774
774
  };
775
- //# sourceMappingURL=orchestrator-GJ5V4XDT.js.map
775
+ //# sourceMappingURL=orchestrator-MVOSHEI2.js.map
@@ -7,12 +7,12 @@ import {
7
7
  loadAdapter,
8
8
  resolveCommand,
9
9
  verifyAndExecute
10
- } from "./chunk-UQ673USC.js";
10
+ } from "./chunk-D3OMN7RV.js";
11
11
  import {
12
12
  getAuthToken,
13
13
  getIdpUrl,
14
14
  getRequesterIdentity
15
- } from "./chunk-AZVY3X7Q.js";
15
+ } from "./chunk-ILKZ5HGV.js";
16
16
 
17
17
  // src/commands/mcp/server.ts
18
18
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -301,7 +301,7 @@ function registerAdapterTools(server) {
301
301
  async function startMcpServer(transport, port) {
302
302
  const server = new McpServer({
303
303
  name: "apes",
304
- version: true ? "0.9.2" : "0.1.0"
304
+ version: true ? "0.9.3" : "0.1.0"
305
305
  });
306
306
  registerStaticTools(server);
307
307
  registerAdapterTools(server);
@@ -329,4 +329,4 @@ async function startMcpServer(transport, port) {
329
329
  export {
330
330
  startMcpServer
331
331
  };
332
- //# sourceMappingURL=server-UA3JNXXZ.js.map
332
+ //# sourceMappingURL=server-2IMH7YQX.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openape/apes",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "turbo": {
5
5
  "tags": [
6
6
  "publishable"
@@ -31,8 +31,8 @@
31
31
  "node-pty": "^1.1.0",
32
32
  "shell-quote": "^1.8.3",
33
33
  "zod": "^4.3.6",
34
- "@openape/grants": "0.8.0",
35
- "@openape/core": "0.12.0"
34
+ "@openape/core": "0.12.0",
35
+ "@openape/grants": "0.8.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^25.3.5",
@@ -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 agent?: {\n key?: string\n email?: string\n }\n notifications?: {\n pending_command?: 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 const kvMatch = trimmed.match(/^(\\w+)\\s*=\\s*\"(.+)\"$/)\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 }\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 writeFileSync(CONFIG_FILE, lines.join('\\n'), { mode: 0o600 })\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;AAwBrB,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,OAAO;AAClB,YAAM,EAAE,OAAO,UAAU,GAAG,KAAK,IAAI;AACrC,iBAAW,IAAI;AAAA,IACjB;AAAA,EACF;AACF;AAEO,SAAS,aAAyB;AACvC,MAAI,CAAC,WAAW,WAAW;AACzB,WAAO,CAAC;AACV,MAAI;AACF,WAAO,UAAU,aAAa,aAAa,OAAO,CAAC;AAAA,EACrD,QACM;AACJ,WAAO,CAAC;AAAA,EACV;AACF;AAEA,S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