@mnemom/mnemom 0.7.2 → 0.9.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.
@@ -1,21 +1,22 @@
1
- import { requireAgent } from "../lib/config.js";
1
+ import { resolveAgentId } from "../lib/api.js";
2
2
  import { getIntegrity } from "../lib/api.js";
3
3
  import { fmt } from "../lib/format.js";
4
4
  export async function integrityCommand(agentName) {
5
- const agent = await requireAgent(agentName);
5
+ const agentId = await resolveAgentId(agentName);
6
6
  console.log("\nFetching integrity score...\n");
7
7
  try {
8
- const integrity = await getIntegrity(agent.agentId);
9
- const scorePercent = (integrity.score * 100).toFixed(1);
10
- const scoreBar = generateScoreBar(integrity.score);
8
+ const integrity = await getIntegrity(agentId);
9
+ // Field names match the docs.mnemom.ai canonical IntegrityScore schema:
10
+ // integrity_score (in [0,1]), total_traces, verified_traces, violation_count.
11
+ const scorePercent = (integrity.integrity_score * 100).toFixed(1);
12
+ const scoreBar = generateScoreBar(integrity.integrity_score);
11
13
  console.log(fmt.header("Integrity Score"));
12
14
  console.log(` ${fmt.label("Score: ", `${scorePercent}% ${scoreBar}`)}`);
13
15
  console.log(` ${fmt.label("Total: ", `${integrity.total_traces} traces`)}`);
14
- console.log(` ${fmt.label("Verified: ", `${integrity.verified}`)} ${fmt.success("")}`);
15
- console.log(` ${fmt.label("Violations:", ` ${integrity.violations}`)} ${fmt.error("")}`);
16
- console.log(` ${fmt.label("Updated: ", integrity.last_updated)}`);
17
- if (integrity.violations > 0) {
18
- console.log("\n" + fmt.warn("You have integrity violations. Run `smoltbot logs` to investigate.") + "\n");
16
+ console.log(` ${fmt.label("Verified: ", `${integrity.verified_traces}`)}`);
17
+ console.log(` ${fmt.label("Violations:", ` ${integrity.violation_count}`)}`);
18
+ if (integrity.violation_count > 0) {
19
+ console.log("\n" + fmt.warn("You have integrity violations. Run `mnemom logs` to investigate.") + "\n");
19
20
  }
20
21
  else if (integrity.total_traces === 0) {
21
22
  console.log("\nNo traces recorded yet. Start using Claude to build your integrity score.\n");
@@ -43,7 +44,7 @@ export async function integrityCommand(agentName) {
43
44
  function generateScoreBar(score) {
44
45
  const filled = Math.round(score * 10);
45
46
  const empty = 10 - filled;
46
- const filledChar = "";
47
- const emptyChar = "";
47
+ const filledChar = "\u2588";
48
+ const emptyChar = "\u2591";
48
49
  return `[${filledChar.repeat(filled)}${emptyChar.repeat(empty)}]`;
49
50
  }
@@ -1,4 +1,4 @@
1
- import { loadConfig, saveConfig, configExists } from "../lib/config.js";
1
+ import { getLicenseJwt, saveLicenseJwt, clearLicenseJwt } from "../lib/auth.js";
2
2
  import { API_BASE } from "../lib/api.js";
3
3
  import { fmt } from "../lib/format.js";
4
4
  /** Sanitize file-sourced data before use in outbound HTTP requests. */
@@ -24,7 +24,7 @@ function decodeJwtPayload(jwt) {
24
24
  export async function licenseActivateCommand(jwt) {
25
25
  if (!jwt || jwt.trim() === "") {
26
26
  console.error("Error: License JWT is required");
27
- console.error("Usage: smoltbot license activate <jwt>");
27
+ console.error("Usage: mnemom license activate <jwt>");
28
28
  process.exit(1);
29
29
  }
30
30
  // Decode claims
@@ -68,14 +68,8 @@ export async function licenseActivateCommand(jwt) {
68
68
  console.log(" Warning: Could not reach API for validation.");
69
69
  console.log(" License stored locally (offline mode).\n");
70
70
  }
71
- // Store in config
72
- const config = loadConfig();
73
- if (!config) {
74
- console.log("No configuration found. Run 'smoltbot init' first.");
75
- process.exit(1);
76
- }
77
- config.licenseJwt = jwt;
78
- saveConfig(config);
71
+ // Store in auth store
72
+ saveLicenseJwt(jwt);
79
73
  // Display info
80
74
  const expiresAt = claims.exp ? new Date(claims.exp * 1000) : null;
81
75
  const daysRemaining = expiresAt ? Math.floor((expiresAt.getTime() - Date.now()) / 86400000) : "unknown";
@@ -89,17 +83,13 @@ export async function licenseActivateCommand(jwt) {
89
83
  console.log();
90
84
  }
91
85
  export async function licenseStatusCommand() {
92
- if (!configExists()) {
93
- console.error("Error: No smoltbot configuration found. Run 'smoltbot init' first.");
94
- process.exit(1);
95
- }
96
- const config = loadConfig();
97
- if (!config?.licenseJwt) {
86
+ const licenseJwt = getLicenseJwt();
87
+ if (!licenseJwt) {
98
88
  console.log("\nNo enterprise license configured.");
99
- console.log("Use 'smoltbot license activate <jwt>' to activate a license.\n");
89
+ console.log("Use 'mnemom license activate <jwt>' to activate a license.\n");
100
90
  return;
101
91
  }
102
- const claims = decodeJwtPayload(config.licenseJwt);
92
+ const claims = decodeJwtPayload(licenseJwt);
103
93
  if (!claims) {
104
94
  console.error("Error: Stored license JWT is invalid");
105
95
  process.exit(1);
@@ -127,17 +117,13 @@ export async function licenseStatusCommand() {
127
117
  }
128
118
  }
129
119
  export async function licenseDeactivateCommand() {
130
- if (!configExists()) {
131
- console.error("Error: No smoltbot configuration found.");
132
- process.exit(1);
133
- }
134
- const config = loadConfig();
135
- if (!config?.licenseJwt) {
120
+ const licenseJwt = getLicenseJwt();
121
+ if (!licenseJwt) {
136
122
  console.log("\nNo enterprise license to deactivate.\n");
137
123
  return;
138
124
  }
139
125
  // Try to deactivate via API
140
- const claims = decodeJwtPayload(config.licenseJwt);
126
+ const claims = decodeJwtPayload(licenseJwt);
141
127
  if (claims) {
142
128
  try {
143
129
  const hostname = (await import("node:os")).hostname();
@@ -146,7 +132,7 @@ export async function licenseDeactivateCommand() {
146
132
  method: "POST",
147
133
  headers: { "Content-Type": "application/json" },
148
134
  body: sanitizeForHttp(JSON.stringify({
149
- license: String(config.licenseJwt),
135
+ license: String(licenseJwt),
150
136
  instance_id: hostname,
151
137
  instance_metadata: { deactivating: true },
152
138
  })),
@@ -156,8 +142,7 @@ export async function licenseDeactivateCommand() {
156
142
  // Best-effort
157
143
  }
158
144
  }
159
- // Remove from config
160
- delete config.licenseJwt;
161
- saveConfig(config);
145
+ // Remove from auth store
146
+ clearLicenseJwt();
162
147
  console.log("\nLicense deactivated and removed from local configuration.\n");
163
148
  }
@@ -1,26 +1,26 @@
1
- import { requireAgent, loadConfig } from "../lib/config.js";
2
- import { getTraces } from "../lib/api.js";
1
+ import { resolveAgentId, getTraces } from "../lib/api.js";
2
+ import { getGatewayUrl } from "../lib/config.js";
3
3
  import { fmt } from "../lib/format.js";
4
4
  export async function logsCommand(options = {}) {
5
- const agent = await requireAgent(options.agentName);
6
- const config = loadConfig();
5
+ const agentId = await resolveAgentId(options.agentName);
6
+ const gatewayUrl = getGatewayUrl();
7
7
  const limit = options.limit || 10;
8
8
  console.log("\nFetching traces...\n");
9
9
  try {
10
- const traces = await getTraces(agent.agentId, limit);
10
+ const traces = await getTraces(agentId, limit);
11
11
  if (traces.length === 0) {
12
12
  console.log(fmt.header("No traces found"));
13
13
  console.log("\nStart using Claude to generate traces.\n");
14
14
  console.log("Make sure ANTHROPIC_BASE_URL is set correctly:\n");
15
- console.log(` export ANTHROPIC_BASE_URL="${config.gateway || "https://gateway.mnemon.ai"}/v1/proxy/${agent.agentId}"\n`);
15
+ console.log(` export ANTHROPIC_BASE_URL="${gatewayUrl}/v1/proxy/${agentId}"\n`);
16
16
  return;
17
17
  }
18
18
  console.log(fmt.header(`Recent Traces (${traces.length})`));
19
19
  for (const trace of traces) {
20
20
  displayTrace(trace);
21
21
  }
22
- console.log(`\nView more: smoltbot logs --limit ${limit + 10}`);
23
- console.log(`Dashboard: https://mnemon.ai/dashboard/${agent.agentId}\n`);
22
+ console.log(`\nView more: mnemom logs --limit ${limit + 10}`);
23
+ console.log(`Dashboard: https://mnemon.ai/dashboard/${agentId}\n`);
24
24
  }
25
25
  catch (error) {
26
26
  const message = error instanceof Error ? error.message : String(error);
@@ -1,29 +1,16 @@
1
1
  /**
2
- * smoltbot policy init scaffold a policy.json with commented examples
3
- */
4
- export declare function policyInitCommand(): Promise<void>;
5
- /**
6
- * smoltbot policy validate <file> — local-only validation
7
- */
8
- export declare function policyValidateCommand(file: string): Promise<void>;
9
- /**
10
- * smoltbot policy publish <file> — validate + upload to API
11
- */
12
- export declare function policyPublishCommand(file: string, agentName?: string): Promise<void>;
13
- /**
14
- * smoltbot policy list — list active policies for current agent
15
- */
16
- export declare function policyListCommand(agentName?: string): Promise<void>;
17
- /**
18
- * smoltbot policy test <file> --against-traces — dry-run against historical traces
19
- */
20
- export declare function policyTestCommand(file: string, agentName?: string): Promise<void>;
21
- /**
22
- * smoltbot policy evaluate <policy-file> --card <card-file> --tools <tools> — local CI/CD evaluation
2
+ * The `policy` command group has been removed in UC-9.
3
+ * Policy capabilities are now part of the alignment card.
23
4
  *
24
- * Runs entirely locally using the embedded policy engine. No API key needed.
5
+ * Each exported function is a stub that prints a helpful migration message.
6
+ * The exports are preserved so index.ts imports don't break.
25
7
  */
26
- export declare function policyEvaluateCommand(file: string, options: {
8
+ export declare function policyInitCommand(): Promise<void>;
9
+ export declare function policyValidateCommand(_file: string): Promise<void>;
10
+ export declare function policyPublishCommand(_file: string, _agentName?: string): Promise<void>;
11
+ export declare function policyListCommand(_agentName?: string): Promise<void>;
12
+ export declare function policyTestCommand(_file: string, _agentName?: string): Promise<void>;
13
+ export declare function policyEvaluateCommand(_file: string, _options: {
27
14
  card?: string;
28
15
  tools?: string;
29
16
  toolManifest?: string;