@mnemom/mnemom 0.12.1 → 0.14.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.
@@ -6,7 +6,7 @@
6
6
  * `mnemom-api/src/webhooks/handlers.ts` for the requirement.
7
7
  */
8
8
  import { getApiUrl } from "./config.js";
9
- import { newIdempotencyKey } from "./api.js";
9
+ import { newIdempotencyKey, parseApiErrorBody, MnemomApiError } from "./api.js";
10
10
  import { resolveAuth, forceRefreshAccessToken } from "./auth.js";
11
11
  const API_BASE = getApiUrl();
12
12
  function validateUrl(url) {
@@ -39,11 +39,16 @@ async function fetchWithAuthRetry(url, buildInit) {
39
39
  async function unwrap(response, action) {
40
40
  if (!response.ok) {
41
41
  if (response.status === 401) {
42
- throw new Error("Not authenticated. Run `mnemom login` or set MNEMOM_API_KEY.");
42
+ throw new MnemomApiError(401, "Not authenticated. Run `mnemom login` or set MNEMOM_API_KEY.");
43
43
  }
44
- const err = (await response.json().catch(() => ({})));
45
- const msg = err.message || err.error || `${action} failed: HTTP ${response.status}`;
46
- throw new Error(`${response.status}: ${msg}`);
44
+ // Shared envelope parser (tolerates nested {error:{code,message}} + flat
45
+ // {error:"msg"} see lib/api.ts). Preserves the "${status}: ${msg}" form.
46
+ const parsed = await parseApiErrorBody(response);
47
+ const msg = parsed.message || `${action} failed: HTTP ${response.status}`;
48
+ throw new MnemomApiError(response.status, `${response.status}: ${msg}`, {
49
+ code: parsed.code,
50
+ details: parsed.details,
51
+ });
47
52
  }
48
53
  return (await response.json());
49
54
  }
@@ -0,0 +1 @@
1
+ export declare const CLI_VERSION: string;
@@ -0,0 +1,16 @@
1
+ import { readFileSync } from "node:fs";
2
+ /**
3
+ * Single source of truth for the CLI version.
4
+ *
5
+ * Read from package.json at module load so every surface — `mnemom --version`,
6
+ * the license-activation `cli_version` metadata, and anything added later —
7
+ * stays in lockstep. Previously three values drifted: `--version` reported
8
+ * "0.9.1", license activation sent "2.1.0", and package.json was "0.12.1".
9
+ *
10
+ * The path is resolved relative to THIS module via import.meta.url, so it is
11
+ * correct in both `tsx` dev (src/version.ts → ../package.json) and the built/
12
+ * published CLI (dist/version.js → ../package.json). No tsconfig
13
+ * resolveJsonModule needed — this is a runtime fs read, not a JSON import.
14
+ */
15
+ const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
16
+ export const CLI_VERSION = pkg.version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mnemom/mnemom",
3
- "version": "0.12.1",
3
+ "version": "0.14.0",
4
4
  "description": "Transparent AI agent tracing",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,6 +10,8 @@
10
10
  "scripts": {
11
11
  "build": "npm install --prefix ../shared/policy-engine && npm run build --prefix ../shared/policy-engine && tsc",
12
12
  "dev": "tsx src/index.ts",
13
+ "gen:command-tree": "tsx scripts/gen-command-tree.mjs",
14
+ "check:command-tree": "tsx scripts/gen-command-tree.mjs --check",
13
15
  "test": "vitest"
14
16
  },
15
17
  "dependencies": {
@@ -51,7 +53,10 @@
51
53
  "type": "git",
52
54
  "url": "https://github.com/mnemom/mnemom-platform"
53
55
  },
54
- "homepage": "https://mnemom.ai",
56
+ "homepage": "https://docs.mnemom.ai",
57
+ "bugs": {
58
+ "email": "security@mnemom.ai"
59
+ },
55
60
  "publishConfig": {
56
61
  "access": "public"
57
62
  },