@openape/apes 1.31.0 → 1.31.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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ResolvedCommand } from '@openape/shapes';
2
2
  export { AdapterMeta, BuiltGrantRequest, GrantRequestOptions, LoadedAdapter, RegistryEntry, RegistryIndex, ResolvedCapability, ResolvedCommand, ShapesAdapter, ShapesOperation, appendAuditLog, buildExactCommandGrantRequest, buildStructuredCliGrantRequest, extractShellCommandString, fetchRegistry, findAdapter, findConflictingAdapters, getInstalledDigest, installAdapter, isInstalled, loadAdapter, loadOrInstallAdapter, parseShellCommand, removeAdapter, resolveAdapterPath, resolveCapabilityRequest, resolveCommand, searchAdapters, tryLoadAdapter } from '@openape/shapes';
3
- export { ApeShellResult, ChatMessage, RpcSessionMap, RunOptions, RunResult, RunStreamHandlers, RuntimeConfig, TOOLS, ToolDefinition, TraceEntry, runApeShell, runLoop, taskTools } from '@openape/agent-runtime';
3
+ export { ApeShellResult, ChatMessage, RpcSessionMap, RunOptions, RunResult, RunStreamHandlers, RuntimeConfig, TOOLS, ToolDefinition, TraceEntry, addReadRoot, runApeShell, runLoop, taskTools } from '@openape/agent-runtime';
4
4
 
5
5
  interface SimilarGrantsInfo {
6
6
  similar_grants: Array<{
@@ -143,6 +143,34 @@ declare function apiFetch<T = unknown>(path: string, options?: {
143
143
  token?: string;
144
144
  }): Promise<T>;
145
145
 
146
+ interface MaterializeOptions {
147
+ dir?: string;
148
+ keyPath?: string;
149
+ /** Target env map (defaults to process.env). Injected in tests. */
150
+ env?: NodeJS.ProcessEnv;
151
+ /** Env names applied by a previous materialize, to drop on revoke. */
152
+ previouslyApplied?: Iterable<string>;
153
+ log?: (line: string) => void;
154
+ }
155
+ interface MaterializeResult {
156
+ applied: string[];
157
+ failed: string[];
158
+ }
159
+ /**
160
+ * Open every sealed blob in the secrets dir and set the corresponding
161
+ * env var. Any env that was applied before but whose blob is now gone
162
+ * (revoke) is deleted. Best-effort per blob — a corrupt/foreign blob
163
+ * is logged and skipped, never throws.
164
+ */
165
+ declare function materializeSecrets(opts?: MaterializeOptions): MaterializeResult;
166
+ /**
167
+ * Materialize once, then fs.watch the secrets dir and re-materialize
168
+ * on any change (rotate/revoke take effect live — the user's M2 v1
169
+ * choice). Returns a stop function. Safe to call when the dir doesn't
170
+ * exist yet (watch attaches once it appears on the next agent start).
171
+ */
172
+ declare function startSecretsWatcher(opts?: MaterializeOptions): () => void;
173
+
146
174
  /**
147
175
  * Parse a human-readable duration string into seconds.
148
176
  * Supported formats: 30s, 5m, 1h, 7d
@@ -158,4 +186,4 @@ declare class CliExit extends Error {
158
186
  constructor(exitCode?: number);
159
187
  }
160
188
 
161
- export { type ApesConfig, ApiError, type AuthData, CliError, CliExit, apiFetch, clearAuth, createShapesGrant, discoverEndpoints, extractOption, extractWrappedCommand, fetchGrantToken, findExistingGrant, getAuthToken, getIdpUrl, getRequesterIdentity, loadAuth, loadConfig, parseDuration, saveAuth, saveConfig, verifyAndExecute, waitForGrantStatus };
189
+ export { type ApesConfig, ApiError, type AuthData, CliError, CliExit, apiFetch, clearAuth, createShapesGrant, discoverEndpoints, extractOption, extractWrappedCommand, fetchGrantToken, findExistingGrant, getAuthToken, getIdpUrl, getRequesterIdentity, loadAuth, loadConfig, materializeSecrets, parseDuration, saveAuth, saveConfig, startSecretsWatcher, verifyAndExecute, waitForGrantStatus };
package/dist/index.js CHANGED
@@ -2,8 +2,10 @@
2
2
  import {
3
3
  CliError,
4
4
  CliExit,
5
- parseDuration
6
- } from "./chunk-QMMRZPD2.js";
5
+ materializeSecrets,
6
+ parseDuration,
7
+ startSecretsWatcher
8
+ } from "./chunk-3LH4FT4R.js";
7
9
  import {
8
10
  createShapesGrant,
9
11
  extractOption,
@@ -51,13 +53,14 @@ import {
51
53
  searchAdapters,
52
54
  tryLoadAdapter
53
55
  } from "@openape/shapes";
54
- import { runLoop, RpcSessionMap, taskTools, TOOLS, runApeShell } from "@openape/agent-runtime";
56
+ import { runLoop, RpcSessionMap, taskTools, TOOLS, runApeShell, addReadRoot } from "@openape/agent-runtime";
55
57
  export {
56
58
  ApiError,
57
59
  CliError,
58
60
  CliExit,
59
61
  RpcSessionMap,
60
62
  TOOLS,
63
+ addReadRoot,
61
64
  apiFetch,
62
65
  appendAuditLog,
63
66
  buildExactCommandGrantRequest,
@@ -83,6 +86,7 @@ export {
83
86
  loadAuth,
84
87
  loadConfig,
85
88
  loadOrInstallAdapter,
89
+ materializeSecrets,
86
90
  parseDuration,
87
91
  parseShellCommand,
88
92
  removeAdapter,
@@ -94,6 +98,7 @@ export {
94
98
  saveAuth,
95
99
  saveConfig,
96
100
  searchAdapters,
101
+ startSecretsWatcher,
97
102
  taskTools,
98
103
  tryLoadAdapter,
99
104
  verifyAndExecute,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Pure shapes library — re-exported from @openape/shapes\nexport {\n appendAuditLog,\n buildExactCommandGrantRequest,\n buildStructuredCliGrantRequest,\n extractShellCommandString,\n fetchRegistry,\n findAdapter,\n findConflictingAdapters,\n getInstalledDigest,\n installAdapter,\n isInstalled,\n loadAdapter,\n loadOrInstallAdapter,\n parseShellCommand,\n removeAdapter,\n resolveAdapterPath,\n resolveCapabilityRequest,\n resolveCommand,\n searchAdapters,\n tryLoadAdapter,\n} from '@openape/shapes'\n\nexport type {\n AdapterMeta,\n BuiltGrantRequest,\n GrantRequestOptions,\n LoadedAdapter,\n RegistryEntry,\n RegistryIndex,\n ResolvedCapability,\n ResolvedCommand,\n ShapesAdapter,\n ShapesOperation,\n} from '@openape/shapes'\n\n// Grant-orchestration + CLI glue — stayed in apes\nexport { createShapesGrant, fetchGrantToken, findExistingGrant, verifyAndExecute, waitForGrantStatus } from './shapes/grants.js'\nexport { extractOption, extractWrappedCommand } from './shapes/commands/explain.js'\n\n// Apes-specific exports\nexport { loadAuth, saveAuth, clearAuth, loadConfig, saveConfig, getIdpUrl, getAuthToken, getRequesterIdentity } from './config'\nexport type { AuthData, ApesConfig } from './config'\nexport { apiFetch, discoverEndpoints, ApiError } from './http'\nexport { parseDuration } from './duration'\nexport { CliError, CliExit } from './errors'\n\n// Agent-runtime: callable in-process from the chat-bridge so it doesn't\n// need to spawn `apes agents serve --rpc` per turn. Same loop the\n// stdio-RPC server runs internally — see commands/agents/serve.ts.\nexport { runLoop, RpcSessionMap, taskTools, TOOLS, runApeShell } from '@openape/agent-runtime'\nexport type {\n ChatMessage,\n RunOptions,\n RunResult,\n RuntimeConfig,\n RunStreamHandlers,\n TraceEntry,\n ToolDefinition,\n ApeShellResult,\n} from '@openape/agent-runtime'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA6BP,SAAS,SAAS,eAAe,WAAW,OAAO,mBAAmB;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Pure shapes library — re-exported from @openape/shapes\nexport {\n appendAuditLog,\n buildExactCommandGrantRequest,\n buildStructuredCliGrantRequest,\n extractShellCommandString,\n fetchRegistry,\n findAdapter,\n findConflictingAdapters,\n getInstalledDigest,\n installAdapter,\n isInstalled,\n loadAdapter,\n loadOrInstallAdapter,\n parseShellCommand,\n removeAdapter,\n resolveAdapterPath,\n resolveCapabilityRequest,\n resolveCommand,\n searchAdapters,\n tryLoadAdapter,\n} from '@openape/shapes'\n\nexport type {\n AdapterMeta,\n BuiltGrantRequest,\n GrantRequestOptions,\n LoadedAdapter,\n RegistryEntry,\n RegistryIndex,\n ResolvedCapability,\n ResolvedCommand,\n ShapesAdapter,\n ShapesOperation,\n} from '@openape/shapes'\n\n// Grant-orchestration + CLI glue — stayed in apes\nexport { createShapesGrant, fetchGrantToken, findExistingGrant, verifyAndExecute, waitForGrantStatus } from './shapes/grants.js'\nexport { extractOption, extractWrappedCommand } from './shapes/commands/explain.js'\n\n// Apes-specific exports\nexport { loadAuth, saveAuth, clearAuth, loadConfig, saveConfig, getIdpUrl, getAuthToken, getRequesterIdentity } from './config'\nexport type { AuthData, ApesConfig } from './config'\nexport { apiFetch, discoverEndpoints, ApiError } from './http'\nexport { materializeSecrets, startSecretsWatcher } from './lib/agent-secrets-runtime'\nexport { parseDuration } from './duration'\nexport { CliError, CliExit } from './errors'\n\n// Agent-runtime: callable in-process from the chat-bridge so it doesn't\n// need to spawn `apes agents serve --rpc` per turn. Same loop the\n// stdio-RPC server runs internally — see commands/agents/serve.ts.\nexport { runLoop, RpcSessionMap, taskTools, TOOLS, runApeShell, addReadRoot } from '@openape/agent-runtime'\nexport type {\n ChatMessage,\n RunOptions,\n RunResult,\n RuntimeConfig,\n RunStreamHandlers,\n TraceEntry,\n ToolDefinition,\n ApeShellResult,\n} from '@openape/agent-runtime'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA8BP,SAAS,SAAS,eAAe,WAAW,OAAO,aAAa,mBAAmB;","names":[]}
@@ -305,7 +305,7 @@ function registerAdapterTools(server) {
305
305
  async function startMcpServer(transport, port) {
306
306
  const server = new McpServer({
307
307
  name: "apes",
308
- version: true ? "1.31.0" : "0.1.0"
308
+ version: true ? "1.31.2" : "0.1.0"
309
309
  });
310
310
  registerStaticTools(server);
311
311
  registerAdapterTools(server);
@@ -333,4 +333,4 @@ async function startMcpServer(transport, port) {
333
333
  export {
334
334
  startMcpServer
335
335
  };
336
- //# sourceMappingURL=server-MDXOGP2U.js.map
336
+ //# sourceMappingURL=server-OSX5LE4W.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openape/apes",
3
- "version": "1.31.0",
3
+ "version": "1.31.2",
4
4
  "turbo": {
5
5
  "tags": [
6
6
  "publishable"
@@ -31,12 +31,12 @@
31
31
  "@lydell/node-pty": "1.2.0-beta.12",
32
32
  "shell-quote": "^1.8.4",
33
33
  "zod": "^4.3.6",
34
- "@openape/cli-auth": "0.5.0",
34
+ "@openape/cli-auth": "0.5.1",
35
35
  "@openape/core": "0.18.0",
36
- "@openape/agent-runtime": "0.2.2",
37
- "@openape/shapes": "0.7.1",
38
36
  "@openape/grants": "0.12.1",
39
- "@openape/proxy": "0.4.6"
37
+ "@openape/agent-runtime": "0.2.2",
38
+ "@openape/proxy": "0.4.6",
39
+ "@openape/shapes": "0.7.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "^25.3.5",
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/errors.ts
4
- var CliError = class extends Error {
5
- constructor(message, exitCode = 1) {
6
- super(message);
7
- this.exitCode = exitCode;
8
- this.name = "CliError";
9
- }
10
- exitCode;
11
- };
12
- var CliExit = class extends Error {
13
- constructor(exitCode = 0) {
14
- super("");
15
- this.exitCode = exitCode;
16
- this.name = "CliExit";
17
- }
18
- exitCode;
19
- };
20
-
21
- // src/duration.ts
22
- function parseDuration(value) {
23
- const match = value.match(/^(\d+)\s*([smhd])$/);
24
- if (!match) {
25
- throw new Error(`Invalid duration format: "${value}". Use e.g. 30m, 1h, 7d`);
26
- }
27
- const amount = Number.parseInt(match[1], 10);
28
- switch (match[2]) {
29
- case "s":
30
- return amount;
31
- case "m":
32
- return amount * 60;
33
- case "h":
34
- return amount * 3600;
35
- case "d":
36
- return amount * 86400;
37
- default:
38
- throw new Error(`Unknown duration unit: ${match[2]}`);
39
- }
40
- }
41
-
42
- export {
43
- CliError,
44
- CliExit,
45
- parseDuration
46
- };
47
- //# sourceMappingURL=chunk-QMMRZPD2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/errors.ts","../src/duration.ts"],"sourcesContent":["export class CliError extends Error {\n constructor(message: string, public exitCode: number = 1) {\n super(message)\n this.name = 'CliError'\n }\n}\n\nexport class CliExit extends Error {\n constructor(public exitCode: number = 0) {\n super('')\n this.name = 'CliExit'\n }\n}\n","/**\n * Parse a human-readable duration string into seconds.\n * Supported formats: 30s, 5m, 1h, 7d\n */\nexport function parseDuration(value: string): number {\n const match = value.match(/^(\\d+)\\s*([smhd])$/)\n if (!match) {\n throw new Error(`Invalid duration format: \"${value}\". Use e.g. 30m, 1h, 7d`)\n }\n const amount = Number.parseInt(match[1]!, 10)\n switch (match[2]) {\n case 's': return amount\n case 'm': return amount * 60\n case 'h': return amount * 3600\n case 'd': return amount * 86400\n default: throw new Error(`Unknown duration unit: ${match[2]}`)\n }\n}\n"],"mappings":";;;AAAO,IAAM,WAAN,cAAuB,MAAM;AAAA,EAClC,YAAY,SAAwB,WAAmB,GAAG;AACxD,UAAM,OAAO;AADqB;AAElC,SAAK,OAAO;AAAA,EACd;AAAA,EAHoC;AAItC;AAEO,IAAM,UAAN,cAAsB,MAAM;AAAA,EACjC,YAAmB,WAAmB,GAAG;AACvC,UAAM,EAAE;AADS;AAEjB,SAAK,OAAO;AAAA,EACd;AAAA,EAHmB;AAIrB;;;ACRO,SAAS,cAAc,OAAuB;AACnD,QAAM,QAAQ,MAAM,MAAM,oBAAoB;AAC9C,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,6BAA6B,KAAK,yBAAyB;AAAA,EAC7E;AACA,QAAM,SAAS,OAAO,SAAS,MAAM,CAAC,GAAI,EAAE;AAC5C,UAAQ,MAAM,CAAC,GAAG;AAAA,IAChB,KAAK;AAAK,aAAO;AAAA,IACjB,KAAK;AAAK,aAAO,SAAS;AAAA,IAC1B,KAAK;AAAK,aAAO,SAAS;AAAA,IAC1B,KAAK;AAAK,aAAO,SAAS;AAAA,IAC1B;AAAS,YAAM,IAAI,MAAM,0BAA0B,MAAM,CAAC,CAAC,EAAE;AAAA,EAC/D;AACF;","names":[]}