novyx 2.12.0 → 3.1.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/index.d.mts +89 -3
- package/dist/index.d.ts +89 -3
- package/dist/index.js +134 -4
- package/dist/index.mjs +134 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -623,7 +623,93 @@ declare class Novyx {
|
|
|
623
623
|
reason?: string;
|
|
624
624
|
approver_id?: string;
|
|
625
625
|
}): Promise<Record<string, any>>;
|
|
626
|
-
listPolicies(
|
|
626
|
+
listPolicies(opts?: {
|
|
627
|
+
agent_id?: string;
|
|
628
|
+
}): Promise<PoliciesResult>;
|
|
629
|
+
/**
|
|
630
|
+
* Create or update a custom Control policy.
|
|
631
|
+
*
|
|
632
|
+
* Tier requirements:
|
|
633
|
+
* - draft_policies (Starter+) for any custom policy
|
|
634
|
+
* - agent_scoped_policies (Pro+) when agent_id is set
|
|
635
|
+
*
|
|
636
|
+
* @example
|
|
637
|
+
* await nx.createPolicy({
|
|
638
|
+
* name: "pii_protection",
|
|
639
|
+
* description: "Block PII exposure",
|
|
640
|
+
* rules: [
|
|
641
|
+
* {
|
|
642
|
+
* match: "(ssn|social.security|passport)",
|
|
643
|
+
* severity: "critical",
|
|
644
|
+
* reason: "PII detected: {match}",
|
|
645
|
+
* },
|
|
646
|
+
* ],
|
|
647
|
+
* whitelisted_domains: ["internal.company.com"],
|
|
648
|
+
* });
|
|
649
|
+
*/
|
|
650
|
+
createPolicy(params: {
|
|
651
|
+
name: string;
|
|
652
|
+
rules: Array<Record<string, any>>;
|
|
653
|
+
description?: string;
|
|
654
|
+
step_types?: string[];
|
|
655
|
+
whitelisted_domains?: string[];
|
|
656
|
+
enabled?: boolean;
|
|
657
|
+
agent_id?: string;
|
|
658
|
+
}): Promise<Record<string, any>>;
|
|
659
|
+
/**
|
|
660
|
+
* Get a single policy by name and scope.
|
|
661
|
+
*
|
|
662
|
+
* The same policy name can exist at both tenant-wide (no agent_id) and
|
|
663
|
+
* agent-scoped levels independently. Specify which one you want.
|
|
664
|
+
*/
|
|
665
|
+
getPolicy(policyName: string, opts?: {
|
|
666
|
+
agent_id?: string;
|
|
667
|
+
}): Promise<Record<string, any>>;
|
|
668
|
+
/**
|
|
669
|
+
* Update an existing custom policy. Increments version.
|
|
670
|
+
* agent_id targets the agent-scoped version; omit to update tenant-wide.
|
|
671
|
+
*/
|
|
672
|
+
updatePolicy(policyName: string, params: {
|
|
673
|
+
rules: Array<Record<string, any>>;
|
|
674
|
+
description?: string;
|
|
675
|
+
step_types?: string[];
|
|
676
|
+
whitelisted_domains?: string[];
|
|
677
|
+
enabled?: boolean;
|
|
678
|
+
agent_id?: string;
|
|
679
|
+
}): Promise<Record<string, any>>;
|
|
680
|
+
/**
|
|
681
|
+
* Disable a custom policy (soft delete).
|
|
682
|
+
* Built-in policies cannot be deleted.
|
|
683
|
+
*/
|
|
684
|
+
deletePolicy(policyName: string, opts?: {
|
|
685
|
+
agent_id?: string;
|
|
686
|
+
}): Promise<Record<string, any>>;
|
|
687
|
+
/**
|
|
688
|
+
* Aggregated governance stats over the audit chain.
|
|
689
|
+
*
|
|
690
|
+
* Returns totals (evaluations, executed, pending_review, approved, denied),
|
|
691
|
+
* violations broken down by policy and agent, and a time-series of activity.
|
|
692
|
+
*
|
|
693
|
+
* Tier: governance_dashboard feature (Starter+).
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* const dash = await nx.governanceDashboard({ window: "7d" });
|
|
697
|
+
* console.log(dash.totals);
|
|
698
|
+
*/
|
|
699
|
+
governanceDashboard(opts?: {
|
|
700
|
+
window?: "24h" | "7d" | "30d";
|
|
701
|
+
bucket?: "hour" | "day";
|
|
702
|
+
}): Promise<Record<string, any>>;
|
|
703
|
+
/**
|
|
704
|
+
* Per-agent violation history from the audit chain.
|
|
705
|
+
*
|
|
706
|
+
* Tier: governance_dashboard feature (Starter+).
|
|
707
|
+
*/
|
|
708
|
+
agentViolations(agentId: string, opts?: {
|
|
709
|
+
limit?: number;
|
|
710
|
+
since?: string;
|
|
711
|
+
until?: string;
|
|
712
|
+
}): Promise<Record<string, any>>;
|
|
627
713
|
explainAction(actionId: string): Promise<Record<string, any>>;
|
|
628
714
|
streamStatus(): Promise<StreamStatusResult>;
|
|
629
715
|
memoryHealth(): Promise<Record<string, any>>;
|
|
@@ -640,10 +726,10 @@ declare class Novyx {
|
|
|
640
726
|
policyCheck(): Promise<any>;
|
|
641
727
|
createAgent(params: {
|
|
642
728
|
name: string;
|
|
729
|
+
provider: "openai" | "anthropic" | "litellm";
|
|
730
|
+
model: string;
|
|
643
731
|
agent_id?: string;
|
|
644
732
|
description?: string;
|
|
645
|
-
model?: string;
|
|
646
|
-
provider?: string;
|
|
647
733
|
instructions?: string;
|
|
648
734
|
capabilities?: string[];
|
|
649
735
|
memory_scope?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -623,7 +623,93 @@ declare class Novyx {
|
|
|
623
623
|
reason?: string;
|
|
624
624
|
approver_id?: string;
|
|
625
625
|
}): Promise<Record<string, any>>;
|
|
626
|
-
listPolicies(
|
|
626
|
+
listPolicies(opts?: {
|
|
627
|
+
agent_id?: string;
|
|
628
|
+
}): Promise<PoliciesResult>;
|
|
629
|
+
/**
|
|
630
|
+
* Create or update a custom Control policy.
|
|
631
|
+
*
|
|
632
|
+
* Tier requirements:
|
|
633
|
+
* - draft_policies (Starter+) for any custom policy
|
|
634
|
+
* - agent_scoped_policies (Pro+) when agent_id is set
|
|
635
|
+
*
|
|
636
|
+
* @example
|
|
637
|
+
* await nx.createPolicy({
|
|
638
|
+
* name: "pii_protection",
|
|
639
|
+
* description: "Block PII exposure",
|
|
640
|
+
* rules: [
|
|
641
|
+
* {
|
|
642
|
+
* match: "(ssn|social.security|passport)",
|
|
643
|
+
* severity: "critical",
|
|
644
|
+
* reason: "PII detected: {match}",
|
|
645
|
+
* },
|
|
646
|
+
* ],
|
|
647
|
+
* whitelisted_domains: ["internal.company.com"],
|
|
648
|
+
* });
|
|
649
|
+
*/
|
|
650
|
+
createPolicy(params: {
|
|
651
|
+
name: string;
|
|
652
|
+
rules: Array<Record<string, any>>;
|
|
653
|
+
description?: string;
|
|
654
|
+
step_types?: string[];
|
|
655
|
+
whitelisted_domains?: string[];
|
|
656
|
+
enabled?: boolean;
|
|
657
|
+
agent_id?: string;
|
|
658
|
+
}): Promise<Record<string, any>>;
|
|
659
|
+
/**
|
|
660
|
+
* Get a single policy by name and scope.
|
|
661
|
+
*
|
|
662
|
+
* The same policy name can exist at both tenant-wide (no agent_id) and
|
|
663
|
+
* agent-scoped levels independently. Specify which one you want.
|
|
664
|
+
*/
|
|
665
|
+
getPolicy(policyName: string, opts?: {
|
|
666
|
+
agent_id?: string;
|
|
667
|
+
}): Promise<Record<string, any>>;
|
|
668
|
+
/**
|
|
669
|
+
* Update an existing custom policy. Increments version.
|
|
670
|
+
* agent_id targets the agent-scoped version; omit to update tenant-wide.
|
|
671
|
+
*/
|
|
672
|
+
updatePolicy(policyName: string, params: {
|
|
673
|
+
rules: Array<Record<string, any>>;
|
|
674
|
+
description?: string;
|
|
675
|
+
step_types?: string[];
|
|
676
|
+
whitelisted_domains?: string[];
|
|
677
|
+
enabled?: boolean;
|
|
678
|
+
agent_id?: string;
|
|
679
|
+
}): Promise<Record<string, any>>;
|
|
680
|
+
/**
|
|
681
|
+
* Disable a custom policy (soft delete).
|
|
682
|
+
* Built-in policies cannot be deleted.
|
|
683
|
+
*/
|
|
684
|
+
deletePolicy(policyName: string, opts?: {
|
|
685
|
+
agent_id?: string;
|
|
686
|
+
}): Promise<Record<string, any>>;
|
|
687
|
+
/**
|
|
688
|
+
* Aggregated governance stats over the audit chain.
|
|
689
|
+
*
|
|
690
|
+
* Returns totals (evaluations, executed, pending_review, approved, denied),
|
|
691
|
+
* violations broken down by policy and agent, and a time-series of activity.
|
|
692
|
+
*
|
|
693
|
+
* Tier: governance_dashboard feature (Starter+).
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* const dash = await nx.governanceDashboard({ window: "7d" });
|
|
697
|
+
* console.log(dash.totals);
|
|
698
|
+
*/
|
|
699
|
+
governanceDashboard(opts?: {
|
|
700
|
+
window?: "24h" | "7d" | "30d";
|
|
701
|
+
bucket?: "hour" | "day";
|
|
702
|
+
}): Promise<Record<string, any>>;
|
|
703
|
+
/**
|
|
704
|
+
* Per-agent violation history from the audit chain.
|
|
705
|
+
*
|
|
706
|
+
* Tier: governance_dashboard feature (Starter+).
|
|
707
|
+
*/
|
|
708
|
+
agentViolations(agentId: string, opts?: {
|
|
709
|
+
limit?: number;
|
|
710
|
+
since?: string;
|
|
711
|
+
until?: string;
|
|
712
|
+
}): Promise<Record<string, any>>;
|
|
627
713
|
explainAction(actionId: string): Promise<Record<string, any>>;
|
|
628
714
|
streamStatus(): Promise<StreamStatusResult>;
|
|
629
715
|
memoryHealth(): Promise<Record<string, any>>;
|
|
@@ -640,10 +726,10 @@ declare class Novyx {
|
|
|
640
726
|
policyCheck(): Promise<any>;
|
|
641
727
|
createAgent(params: {
|
|
642
728
|
name: string;
|
|
729
|
+
provider: "openai" | "anthropic" | "litellm";
|
|
730
|
+
model: string;
|
|
643
731
|
agent_id?: string;
|
|
644
732
|
description?: string;
|
|
645
|
-
model?: string;
|
|
646
|
-
provider?: string;
|
|
647
733
|
instructions?: string;
|
|
648
734
|
capabilities?: string[];
|
|
649
735
|
memory_scope?: string;
|
package/dist/index.js
CHANGED
|
@@ -673,8 +673,129 @@ var Novyx = class {
|
|
|
673
673
|
if (opts?.approver_id) params.approver_id = opts.approver_id;
|
|
674
674
|
return this._request("POST", `/v1/approvals/${approvalId}/decision`, { params });
|
|
675
675
|
}
|
|
676
|
-
|
|
677
|
-
|
|
676
|
+
// ========================================================================
|
|
677
|
+
// Novyx Control — Policy CRUD (Phase 1 + Phase 5)
|
|
678
|
+
// ========================================================================
|
|
679
|
+
async listPolicies(opts) {
|
|
680
|
+
const params = {};
|
|
681
|
+
if (opts?.agent_id) params.agent_id = opts.agent_id;
|
|
682
|
+
return this._request(
|
|
683
|
+
"GET",
|
|
684
|
+
"/v1/control/policies",
|
|
685
|
+
Object.keys(params).length > 0 ? { params } : void 0
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Create or update a custom Control policy.
|
|
690
|
+
*
|
|
691
|
+
* Tier requirements:
|
|
692
|
+
* - draft_policies (Starter+) for any custom policy
|
|
693
|
+
* - agent_scoped_policies (Pro+) when agent_id is set
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* await nx.createPolicy({
|
|
697
|
+
* name: "pii_protection",
|
|
698
|
+
* description: "Block PII exposure",
|
|
699
|
+
* rules: [
|
|
700
|
+
* {
|
|
701
|
+
* match: "(ssn|social.security|passport)",
|
|
702
|
+
* severity: "critical",
|
|
703
|
+
* reason: "PII detected: {match}",
|
|
704
|
+
* },
|
|
705
|
+
* ],
|
|
706
|
+
* whitelisted_domains: ["internal.company.com"],
|
|
707
|
+
* });
|
|
708
|
+
*/
|
|
709
|
+
async createPolicy(params) {
|
|
710
|
+
const body = {
|
|
711
|
+
name: params.name,
|
|
712
|
+
description: params.description ?? "",
|
|
713
|
+
rules: params.rules,
|
|
714
|
+
enabled: params.enabled ?? true
|
|
715
|
+
};
|
|
716
|
+
if (params.step_types !== void 0) body.step_types = params.step_types;
|
|
717
|
+
if (params.whitelisted_domains !== void 0) body.whitelisted_domains = params.whitelisted_domains;
|
|
718
|
+
if (params.agent_id !== void 0) body.agent_id = params.agent_id;
|
|
719
|
+
return this._request("POST", "/v1/control/policies", { body });
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Get a single policy by name and scope.
|
|
723
|
+
*
|
|
724
|
+
* The same policy name can exist at both tenant-wide (no agent_id) and
|
|
725
|
+
* agent-scoped levels independently. Specify which one you want.
|
|
726
|
+
*/
|
|
727
|
+
async getPolicy(policyName, opts) {
|
|
728
|
+
const params = {};
|
|
729
|
+
if (opts?.agent_id) params.agent_id = opts.agent_id;
|
|
730
|
+
return this._request(
|
|
731
|
+
"GET",
|
|
732
|
+
`/v1/control/policies/${policyName}`,
|
|
733
|
+
Object.keys(params).length > 0 ? { params } : void 0
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Update an existing custom policy. Increments version.
|
|
738
|
+
* agent_id targets the agent-scoped version; omit to update tenant-wide.
|
|
739
|
+
*/
|
|
740
|
+
async updatePolicy(policyName, params) {
|
|
741
|
+
const body = {
|
|
742
|
+
name: policyName,
|
|
743
|
+
description: params.description ?? "",
|
|
744
|
+
rules: params.rules,
|
|
745
|
+
enabled: params.enabled ?? true
|
|
746
|
+
};
|
|
747
|
+
if (params.step_types !== void 0) body.step_types = params.step_types;
|
|
748
|
+
if (params.whitelisted_domains !== void 0) body.whitelisted_domains = params.whitelisted_domains;
|
|
749
|
+
if (params.agent_id !== void 0) body.agent_id = params.agent_id;
|
|
750
|
+
return this._request("PUT", `/v1/control/policies/${policyName}`, { body });
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Disable a custom policy (soft delete).
|
|
754
|
+
* Built-in policies cannot be deleted.
|
|
755
|
+
*/
|
|
756
|
+
async deletePolicy(policyName, opts) {
|
|
757
|
+
const params = {};
|
|
758
|
+
if (opts?.agent_id) params.agent_id = opts.agent_id;
|
|
759
|
+
return this._request(
|
|
760
|
+
"DELETE",
|
|
761
|
+
`/v1/control/policies/${policyName}`,
|
|
762
|
+
Object.keys(params).length > 0 ? { params } : void 0
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
// ========================================================================
|
|
766
|
+
// Novyx Control — Governance Dashboard (Phase 4)
|
|
767
|
+
// ========================================================================
|
|
768
|
+
/**
|
|
769
|
+
* Aggregated governance stats over the audit chain.
|
|
770
|
+
*
|
|
771
|
+
* Returns totals (evaluations, executed, pending_review, approved, denied),
|
|
772
|
+
* violations broken down by policy and agent, and a time-series of activity.
|
|
773
|
+
*
|
|
774
|
+
* Tier: governance_dashboard feature (Starter+).
|
|
775
|
+
*
|
|
776
|
+
* @example
|
|
777
|
+
* const dash = await nx.governanceDashboard({ window: "7d" });
|
|
778
|
+
* console.log(dash.totals);
|
|
779
|
+
*/
|
|
780
|
+
async governanceDashboard(opts) {
|
|
781
|
+
const params = { window: opts?.window ?? "7d" };
|
|
782
|
+
if (opts?.bucket !== void 0) params.bucket = opts.bucket;
|
|
783
|
+
return this._request("GET", "/v1/control/dashboard", { params });
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Per-agent violation history from the audit chain.
|
|
787
|
+
*
|
|
788
|
+
* Tier: governance_dashboard feature (Starter+).
|
|
789
|
+
*/
|
|
790
|
+
async agentViolations(agentId, opts) {
|
|
791
|
+
const params = { limit: opts?.limit ?? 50 };
|
|
792
|
+
if (opts?.since !== void 0) params.since = opts.since;
|
|
793
|
+
if (opts?.until !== void 0) params.until = opts.until;
|
|
794
|
+
return this._request(
|
|
795
|
+
"GET",
|
|
796
|
+
`/v1/control/agents/${agentId}/violations`,
|
|
797
|
+
{ params }
|
|
798
|
+
);
|
|
678
799
|
}
|
|
679
800
|
// ========================================================================
|
|
680
801
|
// Explain Action
|
|
@@ -749,10 +870,19 @@ var Novyx = class {
|
|
|
749
870
|
// Agents (Runtime v2)
|
|
750
871
|
// ========================================================================
|
|
751
872
|
async createAgent(params) {
|
|
873
|
+
const validProviders = ["openai", "anthropic", "litellm"];
|
|
874
|
+
if (!validProviders.includes(params.provider)) {
|
|
875
|
+
throw new Error(
|
|
876
|
+
`Unknown provider '${params.provider}'. Choose 'openai', 'anthropic', or 'litellm' (use litellm for Gemini, Mistral, Cohere, etc.).`
|
|
877
|
+
);
|
|
878
|
+
}
|
|
879
|
+
if (!params.model) {
|
|
880
|
+
throw new Error("model is required");
|
|
881
|
+
}
|
|
752
882
|
const body = {
|
|
753
883
|
name: params.name,
|
|
754
|
-
model: params.model
|
|
755
|
-
provider: params.provider
|
|
884
|
+
model: params.model,
|
|
885
|
+
provider: params.provider
|
|
756
886
|
};
|
|
757
887
|
if (params.agent_id) body.agent_id = params.agent_id;
|
|
758
888
|
if (params.description) body.description = params.description;
|
package/dist/index.mjs
CHANGED
|
@@ -640,8 +640,129 @@ var Novyx = class {
|
|
|
640
640
|
if (opts?.approver_id) params.approver_id = opts.approver_id;
|
|
641
641
|
return this._request("POST", `/v1/approvals/${approvalId}/decision`, { params });
|
|
642
642
|
}
|
|
643
|
-
|
|
644
|
-
|
|
643
|
+
// ========================================================================
|
|
644
|
+
// Novyx Control — Policy CRUD (Phase 1 + Phase 5)
|
|
645
|
+
// ========================================================================
|
|
646
|
+
async listPolicies(opts) {
|
|
647
|
+
const params = {};
|
|
648
|
+
if (opts?.agent_id) params.agent_id = opts.agent_id;
|
|
649
|
+
return this._request(
|
|
650
|
+
"GET",
|
|
651
|
+
"/v1/control/policies",
|
|
652
|
+
Object.keys(params).length > 0 ? { params } : void 0
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Create or update a custom Control policy.
|
|
657
|
+
*
|
|
658
|
+
* Tier requirements:
|
|
659
|
+
* - draft_policies (Starter+) for any custom policy
|
|
660
|
+
* - agent_scoped_policies (Pro+) when agent_id is set
|
|
661
|
+
*
|
|
662
|
+
* @example
|
|
663
|
+
* await nx.createPolicy({
|
|
664
|
+
* name: "pii_protection",
|
|
665
|
+
* description: "Block PII exposure",
|
|
666
|
+
* rules: [
|
|
667
|
+
* {
|
|
668
|
+
* match: "(ssn|social.security|passport)",
|
|
669
|
+
* severity: "critical",
|
|
670
|
+
* reason: "PII detected: {match}",
|
|
671
|
+
* },
|
|
672
|
+
* ],
|
|
673
|
+
* whitelisted_domains: ["internal.company.com"],
|
|
674
|
+
* });
|
|
675
|
+
*/
|
|
676
|
+
async createPolicy(params) {
|
|
677
|
+
const body = {
|
|
678
|
+
name: params.name,
|
|
679
|
+
description: params.description ?? "",
|
|
680
|
+
rules: params.rules,
|
|
681
|
+
enabled: params.enabled ?? true
|
|
682
|
+
};
|
|
683
|
+
if (params.step_types !== void 0) body.step_types = params.step_types;
|
|
684
|
+
if (params.whitelisted_domains !== void 0) body.whitelisted_domains = params.whitelisted_domains;
|
|
685
|
+
if (params.agent_id !== void 0) body.agent_id = params.agent_id;
|
|
686
|
+
return this._request("POST", "/v1/control/policies", { body });
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Get a single policy by name and scope.
|
|
690
|
+
*
|
|
691
|
+
* The same policy name can exist at both tenant-wide (no agent_id) and
|
|
692
|
+
* agent-scoped levels independently. Specify which one you want.
|
|
693
|
+
*/
|
|
694
|
+
async getPolicy(policyName, opts) {
|
|
695
|
+
const params = {};
|
|
696
|
+
if (opts?.agent_id) params.agent_id = opts.agent_id;
|
|
697
|
+
return this._request(
|
|
698
|
+
"GET",
|
|
699
|
+
`/v1/control/policies/${policyName}`,
|
|
700
|
+
Object.keys(params).length > 0 ? { params } : void 0
|
|
701
|
+
);
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Update an existing custom policy. Increments version.
|
|
705
|
+
* agent_id targets the agent-scoped version; omit to update tenant-wide.
|
|
706
|
+
*/
|
|
707
|
+
async updatePolicy(policyName, params) {
|
|
708
|
+
const body = {
|
|
709
|
+
name: policyName,
|
|
710
|
+
description: params.description ?? "",
|
|
711
|
+
rules: params.rules,
|
|
712
|
+
enabled: params.enabled ?? true
|
|
713
|
+
};
|
|
714
|
+
if (params.step_types !== void 0) body.step_types = params.step_types;
|
|
715
|
+
if (params.whitelisted_domains !== void 0) body.whitelisted_domains = params.whitelisted_domains;
|
|
716
|
+
if (params.agent_id !== void 0) body.agent_id = params.agent_id;
|
|
717
|
+
return this._request("PUT", `/v1/control/policies/${policyName}`, { body });
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Disable a custom policy (soft delete).
|
|
721
|
+
* Built-in policies cannot be deleted.
|
|
722
|
+
*/
|
|
723
|
+
async deletePolicy(policyName, opts) {
|
|
724
|
+
const params = {};
|
|
725
|
+
if (opts?.agent_id) params.agent_id = opts.agent_id;
|
|
726
|
+
return this._request(
|
|
727
|
+
"DELETE",
|
|
728
|
+
`/v1/control/policies/${policyName}`,
|
|
729
|
+
Object.keys(params).length > 0 ? { params } : void 0
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
// ========================================================================
|
|
733
|
+
// Novyx Control — Governance Dashboard (Phase 4)
|
|
734
|
+
// ========================================================================
|
|
735
|
+
/**
|
|
736
|
+
* Aggregated governance stats over the audit chain.
|
|
737
|
+
*
|
|
738
|
+
* Returns totals (evaluations, executed, pending_review, approved, denied),
|
|
739
|
+
* violations broken down by policy and agent, and a time-series of activity.
|
|
740
|
+
*
|
|
741
|
+
* Tier: governance_dashboard feature (Starter+).
|
|
742
|
+
*
|
|
743
|
+
* @example
|
|
744
|
+
* const dash = await nx.governanceDashboard({ window: "7d" });
|
|
745
|
+
* console.log(dash.totals);
|
|
746
|
+
*/
|
|
747
|
+
async governanceDashboard(opts) {
|
|
748
|
+
const params = { window: opts?.window ?? "7d" };
|
|
749
|
+
if (opts?.bucket !== void 0) params.bucket = opts.bucket;
|
|
750
|
+
return this._request("GET", "/v1/control/dashboard", { params });
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Per-agent violation history from the audit chain.
|
|
754
|
+
*
|
|
755
|
+
* Tier: governance_dashboard feature (Starter+).
|
|
756
|
+
*/
|
|
757
|
+
async agentViolations(agentId, opts) {
|
|
758
|
+
const params = { limit: opts?.limit ?? 50 };
|
|
759
|
+
if (opts?.since !== void 0) params.since = opts.since;
|
|
760
|
+
if (opts?.until !== void 0) params.until = opts.until;
|
|
761
|
+
return this._request(
|
|
762
|
+
"GET",
|
|
763
|
+
`/v1/control/agents/${agentId}/violations`,
|
|
764
|
+
{ params }
|
|
765
|
+
);
|
|
645
766
|
}
|
|
646
767
|
// ========================================================================
|
|
647
768
|
// Explain Action
|
|
@@ -716,10 +837,19 @@ var Novyx = class {
|
|
|
716
837
|
// Agents (Runtime v2)
|
|
717
838
|
// ========================================================================
|
|
718
839
|
async createAgent(params) {
|
|
840
|
+
const validProviders = ["openai", "anthropic", "litellm"];
|
|
841
|
+
if (!validProviders.includes(params.provider)) {
|
|
842
|
+
throw new Error(
|
|
843
|
+
`Unknown provider '${params.provider}'. Choose 'openai', 'anthropic', or 'litellm' (use litellm for Gemini, Mistral, Cohere, etc.).`
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
if (!params.model) {
|
|
847
|
+
throw new Error("model is required");
|
|
848
|
+
}
|
|
719
849
|
const body = {
|
|
720
850
|
name: params.name,
|
|
721
|
-
model: params.model
|
|
722
|
-
provider: params.provider
|
|
851
|
+
model: params.model,
|
|
852
|
+
provider: params.provider
|
|
723
853
|
};
|
|
724
854
|
if (params.agent_id) body.agent_id = params.agent_id;
|
|
725
855
|
if (params.description) body.description = params.description;
|