@mnemom/mnemom 0.9.1 → 0.10.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/advisories.d.ts +32 -0
- package/dist/commands/advisories.js +158 -0
- package/dist/commands/org.d.ts +23 -0
- package/dist/commands/org.js +122 -0
- package/dist/commands/posture.d.ts +71 -0
- package/dist/commands/posture.js +440 -0
- package/dist/commands/team.d.ts +56 -0
- package/dist/commands/team.js +507 -0
- package/dist/commands/validate.d.ts +23 -0
- package/dist/commands/validate.js +150 -0
- package/dist/index.js +442 -14
- package/dist/lib/api.d.ts +393 -0
- package/dist/lib/api.js +676 -5
- package/package.json +1 -1
package/dist/lib/api.d.ts
CHANGED
|
@@ -77,6 +77,166 @@ export interface AgentListItem {
|
|
|
77
77
|
key_prefix?: string | null;
|
|
78
78
|
}
|
|
79
79
|
export declare function listAgents(): Promise<AgentListItem[]>;
|
|
80
|
+
export interface OrgListItem {
|
|
81
|
+
org_id: string;
|
|
82
|
+
name: string;
|
|
83
|
+
slug: string;
|
|
84
|
+
is_personal: boolean;
|
|
85
|
+
is_owner: boolean;
|
|
86
|
+
role: string | null;
|
|
87
|
+
billing_email?: string | null;
|
|
88
|
+
company_name?: string | null;
|
|
89
|
+
accepted_at?: string | null;
|
|
90
|
+
created_at?: string | null;
|
|
91
|
+
}
|
|
92
|
+
export interface PersonalOrgRef {
|
|
93
|
+
org_id: string;
|
|
94
|
+
is_personal: true;
|
|
95
|
+
just_provisioned?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* GET /v1/orgs — list every org the user is a member of, including the
|
|
99
|
+
* personal-org-of-one (per ADR-044 Option A, GitHub model). Personal sorts
|
|
100
|
+
* first; multi-user orgs follow.
|
|
101
|
+
*/
|
|
102
|
+
export declare function listMyOrgs(): Promise<OrgListItem[]>;
|
|
103
|
+
/**
|
|
104
|
+
* GET /v1/auth/me/personal-org — accessor for the user's personal org.
|
|
105
|
+
* Idempotent: lazily provisions for legacy accounts that pre-date the
|
|
106
|
+
* mnemom-api migration 161 backfill.
|
|
107
|
+
*/
|
|
108
|
+
export declare function getMyPersonalOrg(): Promise<PersonalOrgRef>;
|
|
109
|
+
export interface TeamListItem {
|
|
110
|
+
team_id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
org_id: string;
|
|
113
|
+
org_name?: string | null;
|
|
114
|
+
description?: string | null;
|
|
115
|
+
status?: string;
|
|
116
|
+
member_count?: number;
|
|
117
|
+
visibility?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface TeamDetail {
|
|
120
|
+
team_id: string;
|
|
121
|
+
name: string;
|
|
122
|
+
org_id: string;
|
|
123
|
+
description?: string | null;
|
|
124
|
+
status?: string;
|
|
125
|
+
member_count?: number;
|
|
126
|
+
visibility?: string;
|
|
127
|
+
avatar_url?: string | null;
|
|
128
|
+
created_at?: string | null;
|
|
129
|
+
updated_at?: string | null;
|
|
130
|
+
}
|
|
131
|
+
export interface TeamTemplateBody {
|
|
132
|
+
team_id: string;
|
|
133
|
+
org_id: string;
|
|
134
|
+
name?: string;
|
|
135
|
+
template: Record<string, unknown> | null;
|
|
136
|
+
enabled: boolean;
|
|
137
|
+
agents_flagged_for_recompose?: number;
|
|
138
|
+
deleted?: boolean;
|
|
139
|
+
}
|
|
140
|
+
export type TeamTemplateKind = "alignment" | "protection";
|
|
141
|
+
/**
|
|
142
|
+
* GET /v1/orgs/:org_id/teams for every org the user is a member of,
|
|
143
|
+
* concatenated. The CLI consumer that just wants "every team I can see"
|
|
144
|
+
* doesn't need to know about org boundaries; team_id is unique anyway.
|
|
145
|
+
* Returns the flat list with org_name attached for display.
|
|
146
|
+
*/
|
|
147
|
+
export declare function listMyTeams(): Promise<TeamListItem[]>;
|
|
148
|
+
/**
|
|
149
|
+
* GET /v1/teams/:team_id — fetch a single team's row. Returns the team
|
|
150
|
+
* detail including org_id (which the CLI uses to disambiguate team_id
|
|
151
|
+
* collisions across orgs in error messages).
|
|
152
|
+
*/
|
|
153
|
+
export declare function getTeam(teamId: string): Promise<TeamDetail>;
|
|
154
|
+
/**
|
|
155
|
+
* GET /v1/teams/:team_id/(alignment|protection)-template — read the
|
|
156
|
+
* current team-scope template + its enabled flag. Returns the wire body
|
|
157
|
+
* verbatim. Empty for teams that have no template set yet (template:
|
|
158
|
+
* null, enabled: false).
|
|
159
|
+
*/
|
|
160
|
+
export declare function getTeamTemplate(teamId: string, kind: TeamTemplateKind): Promise<TeamTemplateBody>;
|
|
161
|
+
/**
|
|
162
|
+
* PUT /v1/teams/:team_id/(alignment|protection)-template — write the
|
|
163
|
+
* team-scope template. Body is YAML or JSON template content; the API
|
|
164
|
+
* accepts either via Content-Type. Idempotency-Key is required (per the
|
|
165
|
+
* idempotency-with-body-hash discipline in the API).
|
|
166
|
+
*
|
|
167
|
+
* On success returns the post-write team template body, including
|
|
168
|
+
* agents_flagged_for_recompose so the caller can surface the fan-out
|
|
169
|
+
* count to the user.
|
|
170
|
+
*/
|
|
171
|
+
export declare function putTeamTemplate(teamId: string, kind: TeamTemplateKind, yamlBody: string): Promise<TeamTemplateBody>;
|
|
172
|
+
/**
|
|
173
|
+
* DELETE /v1/teams/:team_id/(alignment|protection)-template — clear the
|
|
174
|
+
* template. Idempotent (deleting an already-cleared template is a 200).
|
|
175
|
+
* Returns the post-delete team template body with deleted=true and the
|
|
176
|
+
* recompose fan-out count.
|
|
177
|
+
*/
|
|
178
|
+
export declare function deleteTeamTemplate(teamId: string, kind: TeamTemplateKind): Promise<TeamTemplateBody>;
|
|
179
|
+
/**
|
|
180
|
+
* POST /v1/teams/:team_id/(alignment|protection)-template/preview-compose
|
|
181
|
+
* — dry-run the composer with the supplied draft against the team's
|
|
182
|
+
* current org+platform context. Returns the composed canonical output
|
|
183
|
+
* plus per-field conflicts where the draft was tightened by the
|
|
184
|
+
* org/platform floor. No DB writes.
|
|
185
|
+
*/
|
|
186
|
+
export declare function previewComposeTeamTemplate(teamId: string, kind: TeamTemplateKind, yamlBody: string): Promise<{
|
|
187
|
+
composed: Record<string, unknown>;
|
|
188
|
+
conflicts: unknown;
|
|
189
|
+
}>;
|
|
190
|
+
export interface TeamAdminGrant {
|
|
191
|
+
user_id: string;
|
|
192
|
+
granted_by: string;
|
|
193
|
+
granted_at: string;
|
|
194
|
+
}
|
|
195
|
+
export interface TeamAdminListResponse {
|
|
196
|
+
team_id: string;
|
|
197
|
+
org_id: string;
|
|
198
|
+
admins: TeamAdminGrant[];
|
|
199
|
+
count: number;
|
|
200
|
+
}
|
|
201
|
+
export interface TeamAdminGrantResponse {
|
|
202
|
+
team_id: string;
|
|
203
|
+
user_id: string;
|
|
204
|
+
granted_by: string;
|
|
205
|
+
granted_at: string;
|
|
206
|
+
revoked_at: string | null;
|
|
207
|
+
idempotent_noop: boolean;
|
|
208
|
+
}
|
|
209
|
+
export interface TeamAdminRevokeResponse {
|
|
210
|
+
team_id: string;
|
|
211
|
+
user_id: string;
|
|
212
|
+
revoked: boolean;
|
|
213
|
+
revoked_at?: string;
|
|
214
|
+
revoked_by?: string;
|
|
215
|
+
idempotent_noop?: boolean;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* POST /v1/teams/:team_id/admins — grant team_admin role on a team.
|
|
219
|
+
*
|
|
220
|
+
* Per ADR-046 §3: callable by org_owner / org_admin only. The target
|
|
221
|
+
* user must already be a member of the team's org; cross-org grants 403.
|
|
222
|
+
* Idempotent — re-granting an already-active grant returns 200 with
|
|
223
|
+
* `idempotent_noop: true`.
|
|
224
|
+
*/
|
|
225
|
+
export declare function grantTeamAdmin(teamId: string, userId: string): Promise<TeamAdminGrantResponse>;
|
|
226
|
+
/**
|
|
227
|
+
* DELETE /v1/teams/:team_id/admins/:user_id — revoke a team_admin grant.
|
|
228
|
+
*
|
|
229
|
+
* Per ADR-046 §3: callable by org_owner / org_admin OR self-revoke (the
|
|
230
|
+
* team_admin revokes their own grant — the only self-mutation). Idempotent
|
|
231
|
+
* — revoking an absent or already-revoked grant returns 200 with
|
|
232
|
+
* `idempotent_noop: true` and no audit row.
|
|
233
|
+
*/
|
|
234
|
+
export declare function revokeTeamAdmin(teamId: string, userId: string): Promise<TeamAdminRevokeResponse>;
|
|
235
|
+
/**
|
|
236
|
+
* GET /v1/teams/:team_id/admins — list active team_admin grants on a team.
|
|
237
|
+
* Any member of the team's org can read.
|
|
238
|
+
*/
|
|
239
|
+
export declare function listTeamAdmins(teamId: string): Promise<TeamAdminListResponse>;
|
|
80
240
|
/**
|
|
81
241
|
* Look up an agent in the authenticated user's account by name.
|
|
82
242
|
* Tries exact match first, then single partial match.
|
|
@@ -253,3 +413,236 @@ export declare function putProtectionCard(agentId: string, body: string, content
|
|
|
253
413
|
* Otherwise resolves the name from the authenticated user's agent list.
|
|
254
414
|
*/
|
|
255
415
|
export declare function resolveAgentId(agentName?: string): Promise<string>;
|
|
416
|
+
export interface PostureBody {
|
|
417
|
+
posture_schema_version: "v1.0";
|
|
418
|
+
sideband: {
|
|
419
|
+
coherence: {
|
|
420
|
+
enabled: boolean;
|
|
421
|
+
cadence_seconds: number;
|
|
422
|
+
fire_on: {
|
|
423
|
+
pairwise_governance_floor_below: number | null;
|
|
424
|
+
conflict_edge_count_exceeds: number | null;
|
|
425
|
+
outlier_agents_count_exceeds: number | null;
|
|
426
|
+
};
|
|
427
|
+
severity_on_fire: "low" | "medium" | "high" | "critical";
|
|
428
|
+
};
|
|
429
|
+
fault_line: {
|
|
430
|
+
enabled: boolean;
|
|
431
|
+
cadence_seconds: number;
|
|
432
|
+
severity_floor: "low" | "medium" | "high" | "critical";
|
|
433
|
+
use_reputation_scores: boolean;
|
|
434
|
+
severity_on_fire: "low" | "medium" | "high" | "critical";
|
|
435
|
+
};
|
|
436
|
+
fleet: {
|
|
437
|
+
enabled: boolean;
|
|
438
|
+
cadence_seconds: number;
|
|
439
|
+
patterns: {
|
|
440
|
+
outliers: boolean;
|
|
441
|
+
min_pair_score_below: number | null;
|
|
442
|
+
cluster_partition: boolean;
|
|
443
|
+
};
|
|
444
|
+
severity_on_fire: "low" | "medium" | "high" | "critical";
|
|
445
|
+
};
|
|
446
|
+
};
|
|
447
|
+
fleet_identification: {
|
|
448
|
+
by: "team_membership";
|
|
449
|
+
};
|
|
450
|
+
fan_out: {
|
|
451
|
+
rule: "per_named_affected_agent";
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
export interface PostureSummary {
|
|
455
|
+
posture_id: string;
|
|
456
|
+
slug: string;
|
|
457
|
+
name: string;
|
|
458
|
+
description: string | null;
|
|
459
|
+
scope: "platform" | "org";
|
|
460
|
+
org_id: string | null;
|
|
461
|
+
is_default: boolean;
|
|
462
|
+
current_revision_id: string | null;
|
|
463
|
+
body: PostureBody | null;
|
|
464
|
+
created_at: string;
|
|
465
|
+
updated_at: string;
|
|
466
|
+
deleted_at: string | null;
|
|
467
|
+
}
|
|
468
|
+
export interface PostureRevision {
|
|
469
|
+
revision_id: string;
|
|
470
|
+
posture_id: string;
|
|
471
|
+
revision_no: number;
|
|
472
|
+
body: PostureBody;
|
|
473
|
+
change_summary: string | null;
|
|
474
|
+
authored_by: string | null;
|
|
475
|
+
authored_at: string;
|
|
476
|
+
}
|
|
477
|
+
export interface PostureDiffEntry {
|
|
478
|
+
path: string;
|
|
479
|
+
op: "added" | "removed" | "changed";
|
|
480
|
+
before: unknown;
|
|
481
|
+
after: unknown;
|
|
482
|
+
}
|
|
483
|
+
/** GET /v1/postures — list visible postures. */
|
|
484
|
+
export declare function listPostures(opts: {
|
|
485
|
+
orgId?: string;
|
|
486
|
+
includePlatform?: boolean;
|
|
487
|
+
includeDeleted?: boolean;
|
|
488
|
+
}): Promise<PostureSummary[]>;
|
|
489
|
+
/** GET /v1/postures/:id — read posture with current revision body. */
|
|
490
|
+
export declare function getPosture(postureId: string): Promise<PostureSummary>;
|
|
491
|
+
/** GET /v1/postures/:id/revisions — list revisions, newest first. */
|
|
492
|
+
export declare function listPostureRevisions(postureId: string): Promise<PostureRevision[]>;
|
|
493
|
+
/** GET /v1/postures/:id/diff?from=N&to=M — structural diff. */
|
|
494
|
+
export declare function diffPostureRevisions(postureId: string, fromNo: number, toNo: number): Promise<{
|
|
495
|
+
from: {
|
|
496
|
+
revision_no: number;
|
|
497
|
+
};
|
|
498
|
+
to: {
|
|
499
|
+
revision_no: number;
|
|
500
|
+
};
|
|
501
|
+
changes: PostureDiffEntry[];
|
|
502
|
+
}>;
|
|
503
|
+
interface CreatePostureInput {
|
|
504
|
+
scope: "org" | "platform";
|
|
505
|
+
org_id?: string;
|
|
506
|
+
slug: string;
|
|
507
|
+
name: string;
|
|
508
|
+
description?: string | null;
|
|
509
|
+
body: PostureBody;
|
|
510
|
+
change_summary?: string | null;
|
|
511
|
+
}
|
|
512
|
+
/** POST /v1/postures — create new posture (org-scope only via REST). */
|
|
513
|
+
export declare function createPosture(input: CreatePostureInput): Promise<PostureSummary>;
|
|
514
|
+
interface UpdatePostureInput {
|
|
515
|
+
body: PostureBody;
|
|
516
|
+
change_summary?: string | null;
|
|
517
|
+
name?: string;
|
|
518
|
+
description?: string | null;
|
|
519
|
+
}
|
|
520
|
+
/** PUT /v1/postures/:id — write a new revision (forward-only). */
|
|
521
|
+
export declare function updatePosture(postureId: string, input: UpdatePostureInput): Promise<PostureSummary>;
|
|
522
|
+
interface ClonePostureInput {
|
|
523
|
+
org_id: string;
|
|
524
|
+
slug?: string;
|
|
525
|
+
name?: string;
|
|
526
|
+
description?: string | null;
|
|
527
|
+
}
|
|
528
|
+
/** POST /v1/postures/:id/clone — clone source to org-scope. */
|
|
529
|
+
export declare function clonePosture(postureId: string, input: ClonePostureInput): Promise<PostureSummary>;
|
|
530
|
+
/** DELETE /v1/postures/:id — soft-delete (refuses if assigned). */
|
|
531
|
+
export declare function deletePosture(postureId: string): Promise<void>;
|
|
532
|
+
/** POST /v1/postures/:id/assign — assign to a team. */
|
|
533
|
+
export declare function assignPosture(postureId: string, teamId: string, pinRevisionNo?: number | null): Promise<{
|
|
534
|
+
posture_id: string;
|
|
535
|
+
team_id: string;
|
|
536
|
+
replaced_prior: boolean;
|
|
537
|
+
}>;
|
|
538
|
+
/** DELETE /v1/postures/:id/assignments/:team_id — remove an assignment. */
|
|
539
|
+
export declare function unassignPosture(postureId: string, teamId: string): Promise<void>;
|
|
540
|
+
/** POST /v1/postures/:id/preview-compose — preview effective for a team. */
|
|
541
|
+
export declare function previewComposePosture(postureId: string, teamId: string): Promise<{
|
|
542
|
+
team_id: string;
|
|
543
|
+
org_id: string;
|
|
544
|
+
composed: {
|
|
545
|
+
body: PostureBody;
|
|
546
|
+
scopes_applied: Array<{
|
|
547
|
+
scope: string;
|
|
548
|
+
posture_id: string;
|
|
549
|
+
revision_no: number;
|
|
550
|
+
}>;
|
|
551
|
+
};
|
|
552
|
+
}>;
|
|
553
|
+
export interface SidebandAdvisory {
|
|
554
|
+
id: string;
|
|
555
|
+
agent_id: string;
|
|
556
|
+
source: string;
|
|
557
|
+
source_ref: Record<string, unknown> | null;
|
|
558
|
+
nudge_content: string;
|
|
559
|
+
concerns_summary: string;
|
|
560
|
+
status: "pending" | "consumed" | "expired";
|
|
561
|
+
created_at: string;
|
|
562
|
+
consumed_at: string | null;
|
|
563
|
+
expires_at: string;
|
|
564
|
+
}
|
|
565
|
+
export interface SidebandCoverageSummary {
|
|
566
|
+
axis: "coherence" | "fault_line" | "fleet";
|
|
567
|
+
total_swept: number;
|
|
568
|
+
total_fired: number;
|
|
569
|
+
total_skipped: number;
|
|
570
|
+
last_swept_at: string | null;
|
|
571
|
+
last_outcome: string | null;
|
|
572
|
+
}
|
|
573
|
+
export interface SidebandCoverageRow {
|
|
574
|
+
team_id: string;
|
|
575
|
+
axis: string;
|
|
576
|
+
day: string;
|
|
577
|
+
swept_count: number;
|
|
578
|
+
fired_count: number;
|
|
579
|
+
skipped_count: number;
|
|
580
|
+
last_swept_at: string;
|
|
581
|
+
last_outcome: string;
|
|
582
|
+
last_duration_ms: number | null;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* GET /v1/agents/:id/sideband-advisories
|
|
586
|
+
*
|
|
587
|
+
* Lists pending_advisories rows where source LIKE 'sideband.%' for the
|
|
588
|
+
* given agent. Default page 50, max 200. Optional ?since=<ISO> filter.
|
|
589
|
+
*/
|
|
590
|
+
export declare function listSidebandAdvisoriesForAgent(agentId: string, opts?: {
|
|
591
|
+
limit?: number;
|
|
592
|
+
since?: string;
|
|
593
|
+
}): Promise<{
|
|
594
|
+
agent_id: string;
|
|
595
|
+
advisories: SidebandAdvisory[];
|
|
596
|
+
}>;
|
|
597
|
+
/**
|
|
598
|
+
* GET /v1/teams/:id/sideband-advisories
|
|
599
|
+
*
|
|
600
|
+
* Lists pending_advisories rows for any agent that is a current member of
|
|
601
|
+
* the team. Default page 100, max 500. Optional ?since=<ISO> filter.
|
|
602
|
+
*/
|
|
603
|
+
export declare function listSidebandAdvisoriesForTeam(teamId: string, opts?: {
|
|
604
|
+
limit?: number;
|
|
605
|
+
since?: string;
|
|
606
|
+
}): Promise<{
|
|
607
|
+
team_id: string;
|
|
608
|
+
advisories: SidebandAdvisory[];
|
|
609
|
+
}>;
|
|
610
|
+
/**
|
|
611
|
+
* GET /v1/teams/:id/sideband-coverage
|
|
612
|
+
*
|
|
613
|
+
* Compliance-grade proof-of-coverage for a team — last 30 days of
|
|
614
|
+
* per-axis sweep aggregates + heartbeat. Returns per-axis summary +
|
|
615
|
+
* raw rows.
|
|
616
|
+
*/
|
|
617
|
+
export declare function getTeamSidebandCoverage(teamId: string): Promise<{
|
|
618
|
+
team_id: string;
|
|
619
|
+
window_days: number;
|
|
620
|
+
summary: SidebandCoverageSummary[];
|
|
621
|
+
rows: SidebandCoverageRow[];
|
|
622
|
+
}>;
|
|
623
|
+
export interface HarnessRunSummary {
|
|
624
|
+
run_id: string;
|
|
625
|
+
started_at: string;
|
|
626
|
+
finished_at: string | null;
|
|
627
|
+
git_sha: string;
|
|
628
|
+
trigger: "nightly_cron" | "manual" | "pre_deploy";
|
|
629
|
+
lane: "full" | "fast";
|
|
630
|
+
total_pairs: number;
|
|
631
|
+
passed: number;
|
|
632
|
+
failed: number;
|
|
633
|
+
warned: number;
|
|
634
|
+
cac_violations: number;
|
|
635
|
+
i10_violations: number;
|
|
636
|
+
duration_ms: number | null;
|
|
637
|
+
is_complete: boolean;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* GET /v1/admin/safe-house/harness-state — fetch the most recent
|
|
641
|
+
* harness run per lane (full + fast). Powers `mnemom validate
|
|
642
|
+
* safe-house`. Admin-gated; returns 403 for non-mnemom-staff.
|
|
643
|
+
*/
|
|
644
|
+
export declare function getSafeHouseHarnessState(): Promise<{
|
|
645
|
+
full: HarnessRunSummary | null;
|
|
646
|
+
fast: HarnessRunSummary | null;
|
|
647
|
+
}>;
|
|
648
|
+
export {};
|