@mnemom/mnemom 0.9.1 → 0.11.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/api-key.d.ts +37 -0
- package/dist/commands/api-key.js +181 -0
- package/dist/commands/governance.d.ts +85 -0
- package/dist/commands/governance.js +331 -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 +713 -14
- package/dist/lib/api.d.ts +576 -0
- package/dist/lib/api.js +884 -5
- package/dist/lib/format.d.ts +4 -0
- package/dist/lib/format.js +6 -0
- 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,419 @@ 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 type GovernanceSignalScope = "platform" | "org" | "team" | "agent";
|
|
649
|
+
export type GovernanceSignalSource = "sideband.drift" | "sideband.coherence" | "sideband.fault_line" | "sideband.fleet";
|
|
650
|
+
export type GovernanceSignalSeverity = "info" | "warn" | "high" | "critical";
|
|
651
|
+
export type GovernanceSignalStatus = "open" | "acknowledged" | "resolved" | "dismissed" | "expired";
|
|
652
|
+
export type GovernanceResolutionStatus = "action_taken" | "wont_fix" | "duplicate" | "false_positive" | "self_resolved";
|
|
653
|
+
export type GovernanceNotificationChannel = "webhook" | "slack" | "email" | "pagerduty";
|
|
654
|
+
export interface GovernanceSignal {
|
|
655
|
+
id: string;
|
|
656
|
+
scope: GovernanceSignalScope;
|
|
657
|
+
scope_id: string;
|
|
658
|
+
source: GovernanceSignalSource;
|
|
659
|
+
pattern_type: string;
|
|
660
|
+
severity: GovernanceSignalSeverity;
|
|
661
|
+
detected_at: string;
|
|
662
|
+
detected_by: string;
|
|
663
|
+
org_id: string;
|
|
664
|
+
team_id: string | null;
|
|
665
|
+
agent_ids: string[];
|
|
666
|
+
detail: Record<string, unknown>;
|
|
667
|
+
source_ref: Record<string, unknown>;
|
|
668
|
+
status: GovernanceSignalStatus;
|
|
669
|
+
acknowledged_by: string | null;
|
|
670
|
+
acknowledged_at: string | null;
|
|
671
|
+
acknowledged_actor_role: string | null;
|
|
672
|
+
resolution_status: GovernanceResolutionStatus | null;
|
|
673
|
+
action_taken: string | null;
|
|
674
|
+
resolved_by: string | null;
|
|
675
|
+
resolved_at: string | null;
|
|
676
|
+
expires_at: string | null;
|
|
677
|
+
notification_state: Record<string, unknown>;
|
|
678
|
+
created_at: string;
|
|
679
|
+
updated_at: string;
|
|
680
|
+
}
|
|
681
|
+
export interface GovernanceDestination {
|
|
682
|
+
id: string;
|
|
683
|
+
org_id: string;
|
|
684
|
+
channel: GovernanceNotificationChannel;
|
|
685
|
+
config: Record<string, unknown>;
|
|
686
|
+
filter: Record<string, unknown>;
|
|
687
|
+
enabled: boolean;
|
|
688
|
+
display_name: string | null;
|
|
689
|
+
last_tested_at: string | null;
|
|
690
|
+
last_test_status: "ok" | "failed" | null;
|
|
691
|
+
last_test_error: string | null;
|
|
692
|
+
created_at: string;
|
|
693
|
+
updated_at: string;
|
|
694
|
+
}
|
|
695
|
+
export interface GovernanceRule {
|
|
696
|
+
id: string;
|
|
697
|
+
org_id: string;
|
|
698
|
+
name: string;
|
|
699
|
+
predicate: Record<string, unknown>;
|
|
700
|
+
destination_ids: string[];
|
|
701
|
+
enabled: boolean;
|
|
702
|
+
last_fired_at: string | null;
|
|
703
|
+
fire_count: number;
|
|
704
|
+
created_at: string;
|
|
705
|
+
updated_at: string;
|
|
706
|
+
}
|
|
707
|
+
interface SignalListFilters {
|
|
708
|
+
source?: string;
|
|
709
|
+
severity?: string;
|
|
710
|
+
status?: string;
|
|
711
|
+
scope?: string;
|
|
712
|
+
pattern_type?: string;
|
|
713
|
+
since?: string;
|
|
714
|
+
limit?: number;
|
|
715
|
+
}
|
|
716
|
+
export declare function listGovernanceSignalsForOrg(orgId: string, opts?: SignalListFilters): Promise<{
|
|
717
|
+
org_id: string;
|
|
718
|
+
signals: GovernanceSignal[];
|
|
719
|
+
}>;
|
|
720
|
+
export declare function listGovernanceSignalsForTeam(teamId: string, opts?: SignalListFilters): Promise<{
|
|
721
|
+
team_id: string;
|
|
722
|
+
signals: GovernanceSignal[];
|
|
723
|
+
}>;
|
|
724
|
+
export declare function listGovernanceSignalsForAgent(agentId: string, opts?: SignalListFilters): Promise<{
|
|
725
|
+
agent_id: string;
|
|
726
|
+
signals: GovernanceSignal[];
|
|
727
|
+
}>;
|
|
728
|
+
export declare function getGovernanceSignal(id: string): Promise<GovernanceSignal>;
|
|
729
|
+
export declare function acknowledgeGovernanceSignal(id: string, body?: {
|
|
730
|
+
action_taken?: string;
|
|
731
|
+
}): Promise<GovernanceSignal>;
|
|
732
|
+
export declare function resolveGovernanceSignal(id: string, body: {
|
|
733
|
+
resolution_status: GovernanceResolutionStatus;
|
|
734
|
+
action_taken?: string;
|
|
735
|
+
}): Promise<GovernanceSignal>;
|
|
736
|
+
export declare function dismissGovernanceSignal(id: string, body?: {
|
|
737
|
+
reason?: string;
|
|
738
|
+
}): Promise<GovernanceSignal>;
|
|
739
|
+
export declare function listGovernanceDestinations(orgId: string): Promise<{
|
|
740
|
+
org_id: string;
|
|
741
|
+
destinations: GovernanceDestination[];
|
|
742
|
+
}>;
|
|
743
|
+
export declare function createGovernanceDestination(orgId: string, body: {
|
|
744
|
+
channel: GovernanceNotificationChannel;
|
|
745
|
+
config: Record<string, unknown>;
|
|
746
|
+
filter?: Record<string, unknown>;
|
|
747
|
+
display_name?: string;
|
|
748
|
+
enabled?: boolean;
|
|
749
|
+
}): Promise<GovernanceDestination>;
|
|
750
|
+
export declare function deleteGovernanceDestination(orgId: string, destinationId: string): Promise<{
|
|
751
|
+
ok: true;
|
|
752
|
+
}>;
|
|
753
|
+
export declare function testGovernanceDestination(orgId: string, destinationId: string): Promise<{
|
|
754
|
+
destination_id: string;
|
|
755
|
+
channel: GovernanceNotificationChannel;
|
|
756
|
+
result: {
|
|
757
|
+
ok: boolean;
|
|
758
|
+
attempts: number;
|
|
759
|
+
delivered_at?: string;
|
|
760
|
+
last_error?: string;
|
|
761
|
+
};
|
|
762
|
+
}>;
|
|
763
|
+
export declare function listGovernanceRules(orgId: string): Promise<{
|
|
764
|
+
org_id: string;
|
|
765
|
+
rules: GovernanceRule[];
|
|
766
|
+
}>;
|
|
767
|
+
export declare function createGovernanceRule(orgId: string, body: {
|
|
768
|
+
name: string;
|
|
769
|
+
predicate: Record<string, unknown>;
|
|
770
|
+
destination_ids: string[];
|
|
771
|
+
enabled?: boolean;
|
|
772
|
+
}): Promise<GovernanceRule>;
|
|
773
|
+
export declare function deleteGovernanceRule(orgId: string, ruleId: string): Promise<{
|
|
774
|
+
ok: true;
|
|
775
|
+
}>;
|
|
776
|
+
/**
|
|
777
|
+
* Capability-based scope vocabulary (ADR-049). Mirrors the API's
|
|
778
|
+
* VALID_SCOPES exactly. Update both surfaces together when the
|
|
779
|
+
* vocabulary changes.
|
|
780
|
+
*/
|
|
781
|
+
export declare const API_KEY_SCOPES: readonly ["gateway", "api:read", "api:write", "admin:org", "admin:platform"];
|
|
782
|
+
export type ApiKeyScope = (typeof API_KEY_SCOPES)[number];
|
|
783
|
+
export declare const DEFAULT_API_KEY_SCOPES: ApiKeyScope[];
|
|
784
|
+
/**
|
|
785
|
+
* Recognize legacy two-scope sets so the CLI can annotate pre-ADR-049
|
|
786
|
+
* keys appropriately. Mirror of mnemom-api `expandLegacyScopes` logic
|
|
787
|
+
* for display purposes; the auth gate handles the actual aliasing.
|
|
788
|
+
*/
|
|
789
|
+
export declare function isLegacyScopeSet(scopes: string[] | undefined): boolean;
|
|
790
|
+
export interface ApiKeyListItem {
|
|
791
|
+
key_id: string;
|
|
792
|
+
key_prefix: string;
|
|
793
|
+
name: string;
|
|
794
|
+
scopes: string[];
|
|
795
|
+
created_at: string;
|
|
796
|
+
last_used_at: string | null;
|
|
797
|
+
org_id?: string | null;
|
|
798
|
+
}
|
|
799
|
+
export interface ApiKeyCreated {
|
|
800
|
+
key_id: string;
|
|
801
|
+
key: string;
|
|
802
|
+
key_prefix: string;
|
|
803
|
+
name: string;
|
|
804
|
+
scopes: string[];
|
|
805
|
+
created_at: string;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* GET /v1/api-keys — list the caller's active personal API keys.
|
|
809
|
+
*/
|
|
810
|
+
export declare function listApiKeys(): Promise<ApiKeyListItem[]>;
|
|
811
|
+
/**
|
|
812
|
+
* POST /v1/api-keys — mint a new personal API key with explicit scopes.
|
|
813
|
+
*
|
|
814
|
+
* Returns the full secret only on this call. The mint-time ceiling
|
|
815
|
+
* rejects admin scopes the caller is not eligible for (admin:platform
|
|
816
|
+
* for non-staff, admin:org for users not in any org-admin role).
|
|
817
|
+
*/
|
|
818
|
+
export declare function createApiKey(name: string, scopes: ApiKeyScope[]): Promise<ApiKeyCreated>;
|
|
819
|
+
/**
|
|
820
|
+
* POST /v1/api-keys/{key_id}/rotate — atomic mint-new + revoke-old.
|
|
821
|
+
* Returns the full new secret only on this call. The new key inherits
|
|
822
|
+
* the old key's name and scopes verbatim; the old key is revoked the
|
|
823
|
+
* moment this returns.
|
|
824
|
+
*/
|
|
825
|
+
export declare function rotateApiKey(keyId: string): Promise<ApiKeyCreated>;
|
|
826
|
+
/**
|
|
827
|
+
* DELETE /v1/api-keys/{key_id} — soft-revoke. The key row stays for
|
|
828
|
+
* audit; `is_active` flips to false and `revoked_at` is timestamped.
|
|
829
|
+
*/
|
|
830
|
+
export declare function revokeApiKey(keyId: string): Promise<void>;
|
|
831
|
+
export {};
|