@mnemom/mnemom 0.7.2 → 0.8.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.
- package/dist/commands/agents.d.ts +0 -14
- package/dist/commands/agents.js +35 -295
- package/dist/commands/auth.js +2 -7
- package/dist/commands/card.d.ts +21 -8
- package/dist/commands/card.js +328 -275
- package/dist/commands/integrity.js +6 -6
- package/dist/commands/license.js +14 -29
- package/dist/commands/logs.js +8 -8
- package/dist/commands/policy.d.ts +10 -23
- package/dist/commands/policy.js +20 -533
- package/dist/commands/protection.d.ts +14 -0
- package/dist/commands/protection.js +308 -0
- package/dist/commands/status.js +42 -50
- package/dist/index.js +114 -160
- package/dist/lib/api.d.ts +41 -0
- package/dist/lib/api.js +131 -1
- package/dist/lib/auth.d.ts +30 -21
- package/dist/lib/auth.js +95 -49
- package/dist/lib/config.d.ts +11 -98
- package/dist/lib/config.js +12 -220
- package/dist/lib/model-cache.js +5 -6
- package/dist/smoltbot-shim.js +1 -1
- package/package.json +2 -2
- package/dist/commands/init.d.ts +0 -7
- package/dist/commands/init.js +0 -763
- package/dist/commands/migrate-config.d.ts +0 -2
- package/dist/commands/migrate-config.js +0 -72
- package/dist/commands/register.d.ts +0 -6
- package/dist/commands/register.js +0 -362
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
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
|
|
5
|
+
const agentId = await resolveAgentId(agentName);
|
|
6
6
|
console.log("\nFetching integrity score...\n");
|
|
7
7
|
try {
|
|
8
|
-
const integrity = await getIntegrity(
|
|
8
|
+
const integrity = await getIntegrity(agentId);
|
|
9
9
|
const scorePercent = (integrity.score * 100).toFixed(1);
|
|
10
10
|
const scoreBar = generateScoreBar(integrity.score);
|
|
11
11
|
console.log(fmt.header("Integrity Score"));
|
|
@@ -15,7 +15,7 @@ export async function integrityCommand(agentName) {
|
|
|
15
15
|
console.log(` ${fmt.label("Violations:", ` ${integrity.violations}`)} ${fmt.error("")}`);
|
|
16
16
|
console.log(` ${fmt.label("Updated: ", integrity.last_updated)}`);
|
|
17
17
|
if (integrity.violations > 0) {
|
|
18
|
-
console.log("\n" + fmt.warn("You have integrity violations. Run `
|
|
18
|
+
console.log("\n" + fmt.warn("You have integrity violations. Run `mnemom logs` to investigate.") + "\n");
|
|
19
19
|
}
|
|
20
20
|
else if (integrity.total_traces === 0) {
|
|
21
21
|
console.log("\nNo traces recorded yet. Start using Claude to build your integrity score.\n");
|
|
@@ -43,7 +43,7 @@ export async function integrityCommand(agentName) {
|
|
|
43
43
|
function generateScoreBar(score) {
|
|
44
44
|
const filled = Math.round(score * 10);
|
|
45
45
|
const empty = 10 - filled;
|
|
46
|
-
const filledChar = "
|
|
47
|
-
const emptyChar = "
|
|
46
|
+
const filledChar = "\u2588";
|
|
47
|
+
const emptyChar = "\u2591";
|
|
48
48
|
return `[${filledChar.repeat(filled)}${emptyChar.repeat(empty)}]`;
|
|
49
49
|
}
|
package/dist/commands/license.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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:
|
|
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
|
|
72
|
-
|
|
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
|
-
|
|
93
|
-
|
|
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 '
|
|
89
|
+
console.log("Use 'mnemom license activate <jwt>' to activate a license.\n");
|
|
100
90
|
return;
|
|
101
91
|
}
|
|
102
|
-
const claims = decodeJwtPayload(
|
|
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
|
-
|
|
131
|
-
|
|
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(
|
|
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(
|
|
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
|
|
160
|
-
|
|
161
|
-
saveConfig(config);
|
|
145
|
+
// Remove from auth store
|
|
146
|
+
clearLicenseJwt();
|
|
162
147
|
console.log("\nLicense deactivated and removed from local configuration.\n");
|
|
163
148
|
}
|
package/dist/commands/logs.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
6
|
-
const
|
|
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(
|
|
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="${
|
|
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:
|
|
23
|
-
console.log(`Dashboard: https://mnemon.ai/dashboard/${
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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;
|