@mnemom/mnemom 0.14.2 → 0.14.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/commands/agents.js +1 -1
- package/dist/commands/integrity.js +3 -3
- package/dist/index.js +27 -4
- package/package.json +1 -1
package/dist/commands/agents.js
CHANGED
|
@@ -2,14 +2,14 @@ import { resolveAgentId, getIntegrity, MnemomApiError } from "../lib/api.js";
|
|
|
2
2
|
import { fmt } from "../lib/format.js";
|
|
3
3
|
export async function integrityCommand(agentName) {
|
|
4
4
|
const agentId = await resolveAgentId(agentName);
|
|
5
|
-
console.log("\nFetching
|
|
5
|
+
console.log("\nFetching agent activity...\n");
|
|
6
6
|
try {
|
|
7
7
|
const integrity = await getIntegrity(agentId);
|
|
8
8
|
// Field names match the docs.mnemom.ai canonical IntegrityScore schema:
|
|
9
9
|
// integrity_score (in [0,1]), total_traces, verified_traces, violation_count.
|
|
10
10
|
const scorePercent = (integrity.integrity_score * 100).toFixed(1);
|
|
11
11
|
const scoreBar = generateScoreBar(integrity.integrity_score);
|
|
12
|
-
console.log(fmt.header("
|
|
12
|
+
console.log(fmt.header("Agent Activity (AAP)"));
|
|
13
13
|
console.log(` ${fmt.label("Score: ", `${scorePercent}% ${scoreBar}`)}`);
|
|
14
14
|
console.log(` ${fmt.label("Total: ", `${integrity.total_traces} traces`)}`);
|
|
15
15
|
console.log(` ${fmt.label("Verified: ", `${integrity.verified_traces}`)}`);
|
|
@@ -30,7 +30,7 @@ export async function integrityCommand(agentName) {
|
|
|
30
30
|
// undocumented 404 to a synthetic 500 carrying spec_deviation.original_status,
|
|
31
31
|
// and effectiveStatus surfaces the true status (=== status when documented).
|
|
32
32
|
if (error instanceof MnemomApiError && error.effectiveStatus === 404) {
|
|
33
|
-
console.log(fmt.header("
|
|
33
|
+
console.log(fmt.header("Agent Activity (AAP)"));
|
|
34
34
|
console.log(` ${fmt.label("Score: ", "N/A")}`);
|
|
35
35
|
console.log(` ${fmt.label("Total: ", "0 traces")}`);
|
|
36
36
|
console.log(` ${fmt.label("Verified: ", "0")}`);
|
package/dist/index.js
CHANGED
|
@@ -109,10 +109,11 @@ const cardCmd = program.command("card").description("Manage alignment card");
|
|
|
109
109
|
cardCmd
|
|
110
110
|
.command("show")
|
|
111
111
|
.description("Display alignment card (YAML)")
|
|
112
|
-
.
|
|
112
|
+
.option("--agent <name>", "Agent name or ID (or set MNEMOM_AGENT)")
|
|
113
|
+
.action(async (subOpts) => {
|
|
113
114
|
try {
|
|
114
115
|
const opts = program.opts();
|
|
115
|
-
await cardShowCommand(opts.agent);
|
|
116
|
+
await cardShowCommand(subOpts.agent ?? opts.agent);
|
|
116
117
|
}
|
|
117
118
|
catch (error) {
|
|
118
119
|
console.error("Error:", error instanceof Error ? error.message : error);
|
|
@@ -122,11 +123,14 @@ cardCmd
|
|
|
122
123
|
cardCmd
|
|
123
124
|
.command("edit")
|
|
124
125
|
.description("Edit alignment card in $EDITOR")
|
|
126
|
+
.option("--agent <name>", "Agent name or ID (or set MNEMOM_AGENT)")
|
|
125
127
|
.option("--idempotency-key <uuid>", "Reuse a specific Idempotency-Key (for retries; default: auto)")
|
|
126
128
|
.action(async (subOpts) => {
|
|
127
129
|
try {
|
|
128
130
|
const opts = program.opts();
|
|
129
|
-
await cardEditCommand(opts.agent, {
|
|
131
|
+
await cardEditCommand(subOpts.agent ?? opts.agent, {
|
|
132
|
+
idempotencyKey: subOpts.idempotencyKey,
|
|
133
|
+
});
|
|
130
134
|
}
|
|
131
135
|
catch (error) {
|
|
132
136
|
console.error("Error:", error instanceof Error ? error.message : error);
|
|
@@ -137,11 +141,14 @@ cardCmd
|
|
|
137
141
|
.command("publish")
|
|
138
142
|
.argument("<file>", "Path to alignment card file (YAML or JSON)")
|
|
139
143
|
.description("Publish alignment card")
|
|
144
|
+
.option("--agent <name>", "Agent name or ID (or set MNEMOM_AGENT)")
|
|
140
145
|
.option("--idempotency-key <uuid>", "Reuse a specific Idempotency-Key (for retries; default: auto)")
|
|
141
146
|
.action(async (file, subOpts) => {
|
|
142
147
|
try {
|
|
143
148
|
const opts = program.opts();
|
|
144
|
-
await cardPublishCommand(file, opts.agent, {
|
|
149
|
+
await cardPublishCommand(file, subOpts.agent ?? opts.agent, {
|
|
150
|
+
idempotencyKey: subOpts.idempotencyKey,
|
|
151
|
+
});
|
|
145
152
|
}
|
|
146
153
|
catch (error) {
|
|
147
154
|
console.error("Error:", error instanceof Error ? error.message : error);
|
|
@@ -531,6 +538,17 @@ advisoriesCmd
|
|
|
531
538
|
.option("--json", "Output JSON")
|
|
532
539
|
.action(async (options) => {
|
|
533
540
|
try {
|
|
541
|
+
// The program-level `--agent` shadows this subcommand's own `--agent`
|
|
542
|
+
// (Commander binds the shared long flag to the parent program, not the
|
|
543
|
+
// subcommand — verified against commander@12), so resolve the agent
|
|
544
|
+
// scope here from the explicit sources: the subcommand flag and the
|
|
545
|
+
// global `--agent`. Fall back to MNEMOM_AGENT only when `--team` is NOT
|
|
546
|
+
// set — a stray env var alongside an explicit `--team` must not inject
|
|
547
|
+
// an agent and spuriously trip the handler's mutual-exclusion guard,
|
|
548
|
+
// whereas an explicit `--agent` alongside `--team` should still trip
|
|
549
|
+
// it. (MNE-238)
|
|
550
|
+
const explicitAgent = options.agent ?? program.opts().agent;
|
|
551
|
+
options.agent = options.team ? explicitAgent : (explicitAgent ?? process.env.MNEMOM_AGENT);
|
|
534
552
|
await advisoriesListCommand(options);
|
|
535
553
|
}
|
|
536
554
|
catch (error) {
|
|
@@ -546,6 +564,11 @@ advisoriesCmd
|
|
|
546
564
|
.option("--json", "Output JSON")
|
|
547
565
|
.action(async (advisoryId, options) => {
|
|
548
566
|
try {
|
|
567
|
+
// Same global `--agent` shadow fix as `advisories list` (MNE-238):
|
|
568
|
+
// resolve the explicit agent (local ?? global), and fall back to
|
|
569
|
+
// MNEMOM_AGENT only when `--team` is not set.
|
|
570
|
+
const explicitAgent = options.agent ?? program.opts().agent;
|
|
571
|
+
options.agent = options.team ? explicitAgent : (explicitAgent ?? process.env.MNEMOM_AGENT);
|
|
549
572
|
await advisoriesShowCommand(advisoryId, options);
|
|
550
573
|
}
|
|
551
574
|
catch (error) {
|