novyx 2.11.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 +238 -1
- package/dist/index.d.ts +238 -1
- package/dist/index.js +293 -2
- package/dist/index.mjs +293 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -301,6 +301,68 @@ interface StreamStatusResult {
|
|
|
301
301
|
connections: number;
|
|
302
302
|
event_bus: Record<string, any>;
|
|
303
303
|
}
|
|
304
|
+
interface Agent {
|
|
305
|
+
agent_id: string;
|
|
306
|
+
name: string;
|
|
307
|
+
model: string;
|
|
308
|
+
provider: string;
|
|
309
|
+
description?: string;
|
|
310
|
+
instructions?: string;
|
|
311
|
+
memory_scope?: string;
|
|
312
|
+
capabilities: string[];
|
|
313
|
+
policy_profile?: Record<string, any>;
|
|
314
|
+
config?: Record<string, any>;
|
|
315
|
+
status: string;
|
|
316
|
+
created_at: string;
|
|
317
|
+
updated_at?: string;
|
|
318
|
+
}
|
|
319
|
+
interface Mission {
|
|
320
|
+
mission_id: string;
|
|
321
|
+
agent_id: string;
|
|
322
|
+
goal: string;
|
|
323
|
+
constraints?: string[];
|
|
324
|
+
success_criteria?: string[];
|
|
325
|
+
allowed_capabilities?: string[];
|
|
326
|
+
escalation_rules?: Record<string, any>[];
|
|
327
|
+
stop_conditions?: string[];
|
|
328
|
+
config?: Record<string, any>;
|
|
329
|
+
status: string;
|
|
330
|
+
created_at: string;
|
|
331
|
+
updated_at?: string;
|
|
332
|
+
}
|
|
333
|
+
interface Capability {
|
|
334
|
+
capability_id: string;
|
|
335
|
+
name: string;
|
|
336
|
+
description?: string;
|
|
337
|
+
tools?: Record<string, any>[];
|
|
338
|
+
risk_levels?: Record<string, any>;
|
|
339
|
+
approval_requirements?: Record<string, any>;
|
|
340
|
+
memory_behavior?: Record<string, any>;
|
|
341
|
+
eval_rules?: Record<string, any>;
|
|
342
|
+
config?: Record<string, any>;
|
|
343
|
+
status: string;
|
|
344
|
+
created_at: string;
|
|
345
|
+
updated_at?: string;
|
|
346
|
+
}
|
|
347
|
+
interface Checkpoint {
|
|
348
|
+
checkpoint_id: string;
|
|
349
|
+
mission_id: string;
|
|
350
|
+
label?: string;
|
|
351
|
+
metadata?: Record<string, any>;
|
|
352
|
+
mission_status?: string;
|
|
353
|
+
created_at: string;
|
|
354
|
+
}
|
|
355
|
+
interface Intervention {
|
|
356
|
+
intervention_id: string;
|
|
357
|
+
intervention_type: string;
|
|
358
|
+
mission_id?: string;
|
|
359
|
+
action_id?: string;
|
|
360
|
+
agent_id?: string;
|
|
361
|
+
rationale?: string;
|
|
362
|
+
metadata?: Record<string, any>;
|
|
363
|
+
actor?: string;
|
|
364
|
+
created_at: string;
|
|
365
|
+
}
|
|
304
366
|
|
|
305
367
|
declare class NovyxSession {
|
|
306
368
|
private client;
|
|
@@ -561,7 +623,93 @@ declare class Novyx {
|
|
|
561
623
|
reason?: string;
|
|
562
624
|
approver_id?: string;
|
|
563
625
|
}): Promise<Record<string, any>>;
|
|
564
|
-
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>>;
|
|
565
713
|
explainAction(actionId: string): Promise<Record<string, any>>;
|
|
566
714
|
streamStatus(): Promise<StreamStatusResult>;
|
|
567
715
|
memoryHealth(): Promise<Record<string, any>>;
|
|
@@ -576,6 +724,95 @@ declare class Novyx {
|
|
|
576
724
|
}): Promise<any>;
|
|
577
725
|
/** Check the current Control policy profile. */
|
|
578
726
|
policyCheck(): Promise<any>;
|
|
727
|
+
createAgent(params: {
|
|
728
|
+
name: string;
|
|
729
|
+
provider: "openai" | "anthropic" | "litellm";
|
|
730
|
+
model: string;
|
|
731
|
+
agent_id?: string;
|
|
732
|
+
description?: string;
|
|
733
|
+
instructions?: string;
|
|
734
|
+
capabilities?: string[];
|
|
735
|
+
memory_scope?: string;
|
|
736
|
+
policy_profile?: Record<string, any>;
|
|
737
|
+
config?: Record<string, any>;
|
|
738
|
+
}): Promise<Agent>;
|
|
739
|
+
getAgent(agentId: string): Promise<Agent>;
|
|
740
|
+
listAgents(opts?: {
|
|
741
|
+
status?: string;
|
|
742
|
+
limit?: number;
|
|
743
|
+
offset?: number;
|
|
744
|
+
}): Promise<Record<string, any>>;
|
|
745
|
+
updateAgent(agentId: string, updates: Record<string, any>): Promise<Agent>;
|
|
746
|
+
deleteAgent(agentId: string): Promise<Record<string, any>>;
|
|
747
|
+
createMission(params: {
|
|
748
|
+
agent_id: string;
|
|
749
|
+
goal: string;
|
|
750
|
+
constraints?: string[];
|
|
751
|
+
success_criteria?: string[];
|
|
752
|
+
allowed_capabilities?: string[];
|
|
753
|
+
escalation_rules?: Record<string, any>[];
|
|
754
|
+
stop_conditions?: string[];
|
|
755
|
+
config?: Record<string, any>;
|
|
756
|
+
}): Promise<Mission>;
|
|
757
|
+
getMission(missionId: string): Promise<Mission>;
|
|
758
|
+
listMissions(opts?: {
|
|
759
|
+
agent_id?: string;
|
|
760
|
+
status?: string;
|
|
761
|
+
limit?: number;
|
|
762
|
+
offset?: number;
|
|
763
|
+
}): Promise<Record<string, any>>;
|
|
764
|
+
updateMission(missionId: string, updates: Record<string, any>): Promise<Mission>;
|
|
765
|
+
deleteMission(missionId: string): Promise<Record<string, any>>;
|
|
766
|
+
pauseMission(missionId: string): Promise<Mission>;
|
|
767
|
+
resumeMission(missionId: string): Promise<Mission>;
|
|
768
|
+
cancelMission(missionId: string): Promise<Mission>;
|
|
769
|
+
createCapability(params: {
|
|
770
|
+
name: string;
|
|
771
|
+
capability_id?: string;
|
|
772
|
+
description?: string;
|
|
773
|
+
tools?: Record<string, any>[];
|
|
774
|
+
risk_levels?: Record<string, any>;
|
|
775
|
+
approval_requirements?: Record<string, any>;
|
|
776
|
+
memory_behavior?: Record<string, any>;
|
|
777
|
+
eval_rules?: Record<string, any>;
|
|
778
|
+
config?: Record<string, any>;
|
|
779
|
+
}): Promise<Capability>;
|
|
780
|
+
getCapability(capabilityId: string): Promise<Capability>;
|
|
781
|
+
listCapabilities(opts?: {
|
|
782
|
+
status?: string;
|
|
783
|
+
limit?: number;
|
|
784
|
+
offset?: number;
|
|
785
|
+
}): Promise<Record<string, any>>;
|
|
786
|
+
updateCapability(capabilityId: string, updates: Record<string, any>): Promise<Capability>;
|
|
787
|
+
deleteCapability(capabilityId: string): Promise<Record<string, any>>;
|
|
788
|
+
createCheckpoint(missionId: string, opts?: {
|
|
789
|
+
label?: string;
|
|
790
|
+
metadata?: Record<string, any>;
|
|
791
|
+
}): Promise<Checkpoint>;
|
|
792
|
+
getCheckpoint(checkpointId: string): Promise<Checkpoint>;
|
|
793
|
+
listCheckpoints(missionId: string, opts?: {
|
|
794
|
+
limit?: number;
|
|
795
|
+
offset?: number;
|
|
796
|
+
}): Promise<Record<string, any>>;
|
|
797
|
+
rollbackToCheckpoint(missionId: string, checkpointId: string, opts?: {
|
|
798
|
+
reason?: string;
|
|
799
|
+
}): Promise<Record<string, any>>;
|
|
800
|
+
createIntervention(params: {
|
|
801
|
+
intervention_type: string;
|
|
802
|
+
mission_id?: string;
|
|
803
|
+
action_id?: string;
|
|
804
|
+
agent_id?: string;
|
|
805
|
+
rationale?: string;
|
|
806
|
+
metadata?: Record<string, any>;
|
|
807
|
+
}): Promise<Intervention>;
|
|
808
|
+
getIntervention(interventionId: string): Promise<Intervention>;
|
|
809
|
+
listInterventions(opts?: {
|
|
810
|
+
mission_id?: string;
|
|
811
|
+
agent_id?: string;
|
|
812
|
+
intervention_type?: string;
|
|
813
|
+
limit?: number;
|
|
814
|
+
offset?: number;
|
|
815
|
+
}): Promise<Record<string, any>>;
|
|
579
816
|
}
|
|
580
817
|
|
|
581
818
|
declare class NovyxError extends Error {
|
package/dist/index.d.ts
CHANGED
|
@@ -301,6 +301,68 @@ interface StreamStatusResult {
|
|
|
301
301
|
connections: number;
|
|
302
302
|
event_bus: Record<string, any>;
|
|
303
303
|
}
|
|
304
|
+
interface Agent {
|
|
305
|
+
agent_id: string;
|
|
306
|
+
name: string;
|
|
307
|
+
model: string;
|
|
308
|
+
provider: string;
|
|
309
|
+
description?: string;
|
|
310
|
+
instructions?: string;
|
|
311
|
+
memory_scope?: string;
|
|
312
|
+
capabilities: string[];
|
|
313
|
+
policy_profile?: Record<string, any>;
|
|
314
|
+
config?: Record<string, any>;
|
|
315
|
+
status: string;
|
|
316
|
+
created_at: string;
|
|
317
|
+
updated_at?: string;
|
|
318
|
+
}
|
|
319
|
+
interface Mission {
|
|
320
|
+
mission_id: string;
|
|
321
|
+
agent_id: string;
|
|
322
|
+
goal: string;
|
|
323
|
+
constraints?: string[];
|
|
324
|
+
success_criteria?: string[];
|
|
325
|
+
allowed_capabilities?: string[];
|
|
326
|
+
escalation_rules?: Record<string, any>[];
|
|
327
|
+
stop_conditions?: string[];
|
|
328
|
+
config?: Record<string, any>;
|
|
329
|
+
status: string;
|
|
330
|
+
created_at: string;
|
|
331
|
+
updated_at?: string;
|
|
332
|
+
}
|
|
333
|
+
interface Capability {
|
|
334
|
+
capability_id: string;
|
|
335
|
+
name: string;
|
|
336
|
+
description?: string;
|
|
337
|
+
tools?: Record<string, any>[];
|
|
338
|
+
risk_levels?: Record<string, any>;
|
|
339
|
+
approval_requirements?: Record<string, any>;
|
|
340
|
+
memory_behavior?: Record<string, any>;
|
|
341
|
+
eval_rules?: Record<string, any>;
|
|
342
|
+
config?: Record<string, any>;
|
|
343
|
+
status: string;
|
|
344
|
+
created_at: string;
|
|
345
|
+
updated_at?: string;
|
|
346
|
+
}
|
|
347
|
+
interface Checkpoint {
|
|
348
|
+
checkpoint_id: string;
|
|
349
|
+
mission_id: string;
|
|
350
|
+
label?: string;
|
|
351
|
+
metadata?: Record<string, any>;
|
|
352
|
+
mission_status?: string;
|
|
353
|
+
created_at: string;
|
|
354
|
+
}
|
|
355
|
+
interface Intervention {
|
|
356
|
+
intervention_id: string;
|
|
357
|
+
intervention_type: string;
|
|
358
|
+
mission_id?: string;
|
|
359
|
+
action_id?: string;
|
|
360
|
+
agent_id?: string;
|
|
361
|
+
rationale?: string;
|
|
362
|
+
metadata?: Record<string, any>;
|
|
363
|
+
actor?: string;
|
|
364
|
+
created_at: string;
|
|
365
|
+
}
|
|
304
366
|
|
|
305
367
|
declare class NovyxSession {
|
|
306
368
|
private client;
|
|
@@ -561,7 +623,93 @@ declare class Novyx {
|
|
|
561
623
|
reason?: string;
|
|
562
624
|
approver_id?: string;
|
|
563
625
|
}): Promise<Record<string, any>>;
|
|
564
|
-
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>>;
|
|
565
713
|
explainAction(actionId: string): Promise<Record<string, any>>;
|
|
566
714
|
streamStatus(): Promise<StreamStatusResult>;
|
|
567
715
|
memoryHealth(): Promise<Record<string, any>>;
|
|
@@ -576,6 +724,95 @@ declare class Novyx {
|
|
|
576
724
|
}): Promise<any>;
|
|
577
725
|
/** Check the current Control policy profile. */
|
|
578
726
|
policyCheck(): Promise<any>;
|
|
727
|
+
createAgent(params: {
|
|
728
|
+
name: string;
|
|
729
|
+
provider: "openai" | "anthropic" | "litellm";
|
|
730
|
+
model: string;
|
|
731
|
+
agent_id?: string;
|
|
732
|
+
description?: string;
|
|
733
|
+
instructions?: string;
|
|
734
|
+
capabilities?: string[];
|
|
735
|
+
memory_scope?: string;
|
|
736
|
+
policy_profile?: Record<string, any>;
|
|
737
|
+
config?: Record<string, any>;
|
|
738
|
+
}): Promise<Agent>;
|
|
739
|
+
getAgent(agentId: string): Promise<Agent>;
|
|
740
|
+
listAgents(opts?: {
|
|
741
|
+
status?: string;
|
|
742
|
+
limit?: number;
|
|
743
|
+
offset?: number;
|
|
744
|
+
}): Promise<Record<string, any>>;
|
|
745
|
+
updateAgent(agentId: string, updates: Record<string, any>): Promise<Agent>;
|
|
746
|
+
deleteAgent(agentId: string): Promise<Record<string, any>>;
|
|
747
|
+
createMission(params: {
|
|
748
|
+
agent_id: string;
|
|
749
|
+
goal: string;
|
|
750
|
+
constraints?: string[];
|
|
751
|
+
success_criteria?: string[];
|
|
752
|
+
allowed_capabilities?: string[];
|
|
753
|
+
escalation_rules?: Record<string, any>[];
|
|
754
|
+
stop_conditions?: string[];
|
|
755
|
+
config?: Record<string, any>;
|
|
756
|
+
}): Promise<Mission>;
|
|
757
|
+
getMission(missionId: string): Promise<Mission>;
|
|
758
|
+
listMissions(opts?: {
|
|
759
|
+
agent_id?: string;
|
|
760
|
+
status?: string;
|
|
761
|
+
limit?: number;
|
|
762
|
+
offset?: number;
|
|
763
|
+
}): Promise<Record<string, any>>;
|
|
764
|
+
updateMission(missionId: string, updates: Record<string, any>): Promise<Mission>;
|
|
765
|
+
deleteMission(missionId: string): Promise<Record<string, any>>;
|
|
766
|
+
pauseMission(missionId: string): Promise<Mission>;
|
|
767
|
+
resumeMission(missionId: string): Promise<Mission>;
|
|
768
|
+
cancelMission(missionId: string): Promise<Mission>;
|
|
769
|
+
createCapability(params: {
|
|
770
|
+
name: string;
|
|
771
|
+
capability_id?: string;
|
|
772
|
+
description?: string;
|
|
773
|
+
tools?: Record<string, any>[];
|
|
774
|
+
risk_levels?: Record<string, any>;
|
|
775
|
+
approval_requirements?: Record<string, any>;
|
|
776
|
+
memory_behavior?: Record<string, any>;
|
|
777
|
+
eval_rules?: Record<string, any>;
|
|
778
|
+
config?: Record<string, any>;
|
|
779
|
+
}): Promise<Capability>;
|
|
780
|
+
getCapability(capabilityId: string): Promise<Capability>;
|
|
781
|
+
listCapabilities(opts?: {
|
|
782
|
+
status?: string;
|
|
783
|
+
limit?: number;
|
|
784
|
+
offset?: number;
|
|
785
|
+
}): Promise<Record<string, any>>;
|
|
786
|
+
updateCapability(capabilityId: string, updates: Record<string, any>): Promise<Capability>;
|
|
787
|
+
deleteCapability(capabilityId: string): Promise<Record<string, any>>;
|
|
788
|
+
createCheckpoint(missionId: string, opts?: {
|
|
789
|
+
label?: string;
|
|
790
|
+
metadata?: Record<string, any>;
|
|
791
|
+
}): Promise<Checkpoint>;
|
|
792
|
+
getCheckpoint(checkpointId: string): Promise<Checkpoint>;
|
|
793
|
+
listCheckpoints(missionId: string, opts?: {
|
|
794
|
+
limit?: number;
|
|
795
|
+
offset?: number;
|
|
796
|
+
}): Promise<Record<string, any>>;
|
|
797
|
+
rollbackToCheckpoint(missionId: string, checkpointId: string, opts?: {
|
|
798
|
+
reason?: string;
|
|
799
|
+
}): Promise<Record<string, any>>;
|
|
800
|
+
createIntervention(params: {
|
|
801
|
+
intervention_type: string;
|
|
802
|
+
mission_id?: string;
|
|
803
|
+
action_id?: string;
|
|
804
|
+
agent_id?: string;
|
|
805
|
+
rationale?: string;
|
|
806
|
+
metadata?: Record<string, any>;
|
|
807
|
+
}): Promise<Intervention>;
|
|
808
|
+
getIntervention(interventionId: string): Promise<Intervention>;
|
|
809
|
+
listInterventions(opts?: {
|
|
810
|
+
mission_id?: string;
|
|
811
|
+
agent_id?: string;
|
|
812
|
+
intervention_type?: string;
|
|
813
|
+
limit?: number;
|
|
814
|
+
offset?: number;
|
|
815
|
+
}): Promise<Record<string, any>>;
|
|
579
816
|
}
|
|
580
817
|
|
|
581
818
|
declare class NovyxError extends Error {
|
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
|
|
@@ -745,6 +866,176 @@ var Novyx = class {
|
|
|
745
866
|
async policyCheck() {
|
|
746
867
|
return this._controlRequest("GET", "/v1/control/policies");
|
|
747
868
|
}
|
|
869
|
+
// ========================================================================
|
|
870
|
+
// Agents (Runtime v2)
|
|
871
|
+
// ========================================================================
|
|
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
|
+
}
|
|
882
|
+
const body = {
|
|
883
|
+
name: params.name,
|
|
884
|
+
model: params.model,
|
|
885
|
+
provider: params.provider
|
|
886
|
+
};
|
|
887
|
+
if (params.agent_id) body.agent_id = params.agent_id;
|
|
888
|
+
if (params.description) body.description = params.description;
|
|
889
|
+
if (params.instructions) body.instructions = params.instructions;
|
|
890
|
+
if (params.capabilities) body.capabilities = params.capabilities;
|
|
891
|
+
if (params.memory_scope) body.memory_scope = params.memory_scope;
|
|
892
|
+
if (params.policy_profile) body.policy_profile = params.policy_profile;
|
|
893
|
+
if (params.config) body.config = params.config;
|
|
894
|
+
return this._request("POST", "/v1/agents", { body });
|
|
895
|
+
}
|
|
896
|
+
async getAgent(agentId) {
|
|
897
|
+
return this._request("GET", `/v1/agents/${agentId}`);
|
|
898
|
+
}
|
|
899
|
+
async listAgents(opts) {
|
|
900
|
+
const params = {
|
|
901
|
+
limit: opts?.limit ?? 100,
|
|
902
|
+
offset: opts?.offset ?? 0
|
|
903
|
+
};
|
|
904
|
+
if (opts?.status) params.status = opts.status;
|
|
905
|
+
return this._request("GET", "/v1/agents", { params });
|
|
906
|
+
}
|
|
907
|
+
async updateAgent(agentId, updates) {
|
|
908
|
+
return this._request("PATCH", `/v1/agents/${agentId}`, { body: updates });
|
|
909
|
+
}
|
|
910
|
+
async deleteAgent(agentId) {
|
|
911
|
+
return this._request("DELETE", `/v1/agents/${agentId}`);
|
|
912
|
+
}
|
|
913
|
+
// ========================================================================
|
|
914
|
+
// Missions (Runtime v2)
|
|
915
|
+
// ========================================================================
|
|
916
|
+
async createMission(params) {
|
|
917
|
+
const body = {
|
|
918
|
+
agent_id: params.agent_id,
|
|
919
|
+
goal: params.goal
|
|
920
|
+
};
|
|
921
|
+
if (params.constraints !== void 0) body.constraints = params.constraints;
|
|
922
|
+
if (params.success_criteria !== void 0) body.success_criteria = params.success_criteria;
|
|
923
|
+
if (params.allowed_capabilities !== void 0) body.allowed_capabilities = params.allowed_capabilities;
|
|
924
|
+
if (params.escalation_rules !== void 0) body.escalation_rules = params.escalation_rules;
|
|
925
|
+
if (params.stop_conditions !== void 0) body.stop_conditions = params.stop_conditions;
|
|
926
|
+
if (params.config !== void 0) body.config = params.config;
|
|
927
|
+
return this._request("POST", "/v1/missions", { body });
|
|
928
|
+
}
|
|
929
|
+
async getMission(missionId) {
|
|
930
|
+
return this._request("GET", `/v1/missions/${missionId}`);
|
|
931
|
+
}
|
|
932
|
+
async listMissions(opts) {
|
|
933
|
+
const params = {
|
|
934
|
+
limit: opts?.limit ?? 100,
|
|
935
|
+
offset: opts?.offset ?? 0
|
|
936
|
+
};
|
|
937
|
+
if (opts?.agent_id) params.agent_id = opts.agent_id;
|
|
938
|
+
if (opts?.status) params.status = opts.status;
|
|
939
|
+
return this._request("GET", "/v1/missions", { params });
|
|
940
|
+
}
|
|
941
|
+
async updateMission(missionId, updates) {
|
|
942
|
+
return this._request("PATCH", `/v1/missions/${missionId}`, { body: updates });
|
|
943
|
+
}
|
|
944
|
+
async deleteMission(missionId) {
|
|
945
|
+
return this._request("DELETE", `/v1/missions/${missionId}`);
|
|
946
|
+
}
|
|
947
|
+
async pauseMission(missionId) {
|
|
948
|
+
return this._request("POST", `/v1/missions/${missionId}/pause`);
|
|
949
|
+
}
|
|
950
|
+
async resumeMission(missionId) {
|
|
951
|
+
return this._request("POST", `/v1/missions/${missionId}/resume`);
|
|
952
|
+
}
|
|
953
|
+
async cancelMission(missionId) {
|
|
954
|
+
return this._request("POST", `/v1/missions/${missionId}/cancel`);
|
|
955
|
+
}
|
|
956
|
+
// ========================================================================
|
|
957
|
+
// Capabilities (Runtime v2)
|
|
958
|
+
// ========================================================================
|
|
959
|
+
async createCapability(params) {
|
|
960
|
+
const body = { name: params.name };
|
|
961
|
+
if (params.capability_id !== void 0) body.capability_id = params.capability_id;
|
|
962
|
+
if (params.description !== void 0) body.description = params.description;
|
|
963
|
+
if (params.tools !== void 0) body.tools = params.tools;
|
|
964
|
+
if (params.risk_levels !== void 0) body.risk_levels = params.risk_levels;
|
|
965
|
+
if (params.approval_requirements !== void 0) body.approval_requirements = params.approval_requirements;
|
|
966
|
+
if (params.memory_behavior !== void 0) body.memory_behavior = params.memory_behavior;
|
|
967
|
+
if (params.eval_rules !== void 0) body.eval_rules = params.eval_rules;
|
|
968
|
+
if (params.config !== void 0) body.config = params.config;
|
|
969
|
+
return this._request("POST", "/v1/capabilities", { body });
|
|
970
|
+
}
|
|
971
|
+
async getCapability(capabilityId) {
|
|
972
|
+
return this._request("GET", `/v1/capabilities/${capabilityId}`);
|
|
973
|
+
}
|
|
974
|
+
async listCapabilities(opts) {
|
|
975
|
+
const params = {
|
|
976
|
+
limit: opts?.limit ?? 100,
|
|
977
|
+
offset: opts?.offset ?? 0
|
|
978
|
+
};
|
|
979
|
+
if (opts?.status) params.status = opts.status;
|
|
980
|
+
return this._request("GET", "/v1/capabilities", { params });
|
|
981
|
+
}
|
|
982
|
+
async updateCapability(capabilityId, updates) {
|
|
983
|
+
return this._request("PATCH", `/v1/capabilities/${capabilityId}`, { body: updates });
|
|
984
|
+
}
|
|
985
|
+
async deleteCapability(capabilityId) {
|
|
986
|
+
return this._request("DELETE", `/v1/capabilities/${capabilityId}`);
|
|
987
|
+
}
|
|
988
|
+
// ========================================================================
|
|
989
|
+
// Checkpoints (Runtime v2)
|
|
990
|
+
// ========================================================================
|
|
991
|
+
async createCheckpoint(missionId, opts) {
|
|
992
|
+
const body = {};
|
|
993
|
+
if (opts?.label !== void 0) body.label = opts.label;
|
|
994
|
+
if (opts?.metadata !== void 0) body.metadata = opts.metadata;
|
|
995
|
+
return this._request("POST", `/v1/missions/${missionId}/checkpoints`, { body });
|
|
996
|
+
}
|
|
997
|
+
async getCheckpoint(checkpointId) {
|
|
998
|
+
return this._request("GET", `/v1/checkpoints/${checkpointId}`);
|
|
999
|
+
}
|
|
1000
|
+
async listCheckpoints(missionId, opts) {
|
|
1001
|
+
const params = {
|
|
1002
|
+
limit: opts?.limit ?? 100,
|
|
1003
|
+
offset: opts?.offset ?? 0
|
|
1004
|
+
};
|
|
1005
|
+
return this._request("GET", `/v1/missions/${missionId}/checkpoints`, { params });
|
|
1006
|
+
}
|
|
1007
|
+
async rollbackToCheckpoint(missionId, checkpointId, opts) {
|
|
1008
|
+
const body = { checkpoint_id: checkpointId };
|
|
1009
|
+
if (opts?.reason !== void 0) body.reason = opts.reason;
|
|
1010
|
+
return this._request("POST", `/v1/missions/${missionId}/rollback`, { body });
|
|
1011
|
+
}
|
|
1012
|
+
// ========================================================================
|
|
1013
|
+
// Interventions (Runtime v2)
|
|
1014
|
+
// ========================================================================
|
|
1015
|
+
async createIntervention(params) {
|
|
1016
|
+
const body = {
|
|
1017
|
+
intervention_type: params.intervention_type
|
|
1018
|
+
};
|
|
1019
|
+
if (params.mission_id !== void 0) body.mission_id = params.mission_id;
|
|
1020
|
+
if (params.action_id !== void 0) body.action_id = params.action_id;
|
|
1021
|
+
if (params.agent_id !== void 0) body.agent_id = params.agent_id;
|
|
1022
|
+
if (params.rationale !== void 0) body.rationale = params.rationale;
|
|
1023
|
+
if (params.metadata !== void 0) body.metadata = params.metadata;
|
|
1024
|
+
return this._request("POST", "/v1/interventions", { body });
|
|
1025
|
+
}
|
|
1026
|
+
async getIntervention(interventionId) {
|
|
1027
|
+
return this._request("GET", `/v1/interventions/${interventionId}`);
|
|
1028
|
+
}
|
|
1029
|
+
async listInterventions(opts) {
|
|
1030
|
+
const params = {
|
|
1031
|
+
limit: opts?.limit ?? 100,
|
|
1032
|
+
offset: opts?.offset ?? 0
|
|
1033
|
+
};
|
|
1034
|
+
if (opts?.mission_id) params.mission_id = opts.mission_id;
|
|
1035
|
+
if (opts?.agent_id) params.agent_id = opts.agent_id;
|
|
1036
|
+
if (opts?.intervention_type) params.type = opts.intervention_type;
|
|
1037
|
+
return this._request("GET", "/v1/interventions", { params });
|
|
1038
|
+
}
|
|
748
1039
|
};
|
|
749
1040
|
// Annotate the CommonJS export names for ESM import in node:
|
|
750
1041
|
0 && (module.exports = {
|
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
|
|
@@ -712,6 +833,176 @@ var Novyx = class {
|
|
|
712
833
|
async policyCheck() {
|
|
713
834
|
return this._controlRequest("GET", "/v1/control/policies");
|
|
714
835
|
}
|
|
836
|
+
// ========================================================================
|
|
837
|
+
// Agents (Runtime v2)
|
|
838
|
+
// ========================================================================
|
|
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
|
+
}
|
|
849
|
+
const body = {
|
|
850
|
+
name: params.name,
|
|
851
|
+
model: params.model,
|
|
852
|
+
provider: params.provider
|
|
853
|
+
};
|
|
854
|
+
if (params.agent_id) body.agent_id = params.agent_id;
|
|
855
|
+
if (params.description) body.description = params.description;
|
|
856
|
+
if (params.instructions) body.instructions = params.instructions;
|
|
857
|
+
if (params.capabilities) body.capabilities = params.capabilities;
|
|
858
|
+
if (params.memory_scope) body.memory_scope = params.memory_scope;
|
|
859
|
+
if (params.policy_profile) body.policy_profile = params.policy_profile;
|
|
860
|
+
if (params.config) body.config = params.config;
|
|
861
|
+
return this._request("POST", "/v1/agents", { body });
|
|
862
|
+
}
|
|
863
|
+
async getAgent(agentId) {
|
|
864
|
+
return this._request("GET", `/v1/agents/${agentId}`);
|
|
865
|
+
}
|
|
866
|
+
async listAgents(opts) {
|
|
867
|
+
const params = {
|
|
868
|
+
limit: opts?.limit ?? 100,
|
|
869
|
+
offset: opts?.offset ?? 0
|
|
870
|
+
};
|
|
871
|
+
if (opts?.status) params.status = opts.status;
|
|
872
|
+
return this._request("GET", "/v1/agents", { params });
|
|
873
|
+
}
|
|
874
|
+
async updateAgent(agentId, updates) {
|
|
875
|
+
return this._request("PATCH", `/v1/agents/${agentId}`, { body: updates });
|
|
876
|
+
}
|
|
877
|
+
async deleteAgent(agentId) {
|
|
878
|
+
return this._request("DELETE", `/v1/agents/${agentId}`);
|
|
879
|
+
}
|
|
880
|
+
// ========================================================================
|
|
881
|
+
// Missions (Runtime v2)
|
|
882
|
+
// ========================================================================
|
|
883
|
+
async createMission(params) {
|
|
884
|
+
const body = {
|
|
885
|
+
agent_id: params.agent_id,
|
|
886
|
+
goal: params.goal
|
|
887
|
+
};
|
|
888
|
+
if (params.constraints !== void 0) body.constraints = params.constraints;
|
|
889
|
+
if (params.success_criteria !== void 0) body.success_criteria = params.success_criteria;
|
|
890
|
+
if (params.allowed_capabilities !== void 0) body.allowed_capabilities = params.allowed_capabilities;
|
|
891
|
+
if (params.escalation_rules !== void 0) body.escalation_rules = params.escalation_rules;
|
|
892
|
+
if (params.stop_conditions !== void 0) body.stop_conditions = params.stop_conditions;
|
|
893
|
+
if (params.config !== void 0) body.config = params.config;
|
|
894
|
+
return this._request("POST", "/v1/missions", { body });
|
|
895
|
+
}
|
|
896
|
+
async getMission(missionId) {
|
|
897
|
+
return this._request("GET", `/v1/missions/${missionId}`);
|
|
898
|
+
}
|
|
899
|
+
async listMissions(opts) {
|
|
900
|
+
const params = {
|
|
901
|
+
limit: opts?.limit ?? 100,
|
|
902
|
+
offset: opts?.offset ?? 0
|
|
903
|
+
};
|
|
904
|
+
if (opts?.agent_id) params.agent_id = opts.agent_id;
|
|
905
|
+
if (opts?.status) params.status = opts.status;
|
|
906
|
+
return this._request("GET", "/v1/missions", { params });
|
|
907
|
+
}
|
|
908
|
+
async updateMission(missionId, updates) {
|
|
909
|
+
return this._request("PATCH", `/v1/missions/${missionId}`, { body: updates });
|
|
910
|
+
}
|
|
911
|
+
async deleteMission(missionId) {
|
|
912
|
+
return this._request("DELETE", `/v1/missions/${missionId}`);
|
|
913
|
+
}
|
|
914
|
+
async pauseMission(missionId) {
|
|
915
|
+
return this._request("POST", `/v1/missions/${missionId}/pause`);
|
|
916
|
+
}
|
|
917
|
+
async resumeMission(missionId) {
|
|
918
|
+
return this._request("POST", `/v1/missions/${missionId}/resume`);
|
|
919
|
+
}
|
|
920
|
+
async cancelMission(missionId) {
|
|
921
|
+
return this._request("POST", `/v1/missions/${missionId}/cancel`);
|
|
922
|
+
}
|
|
923
|
+
// ========================================================================
|
|
924
|
+
// Capabilities (Runtime v2)
|
|
925
|
+
// ========================================================================
|
|
926
|
+
async createCapability(params) {
|
|
927
|
+
const body = { name: params.name };
|
|
928
|
+
if (params.capability_id !== void 0) body.capability_id = params.capability_id;
|
|
929
|
+
if (params.description !== void 0) body.description = params.description;
|
|
930
|
+
if (params.tools !== void 0) body.tools = params.tools;
|
|
931
|
+
if (params.risk_levels !== void 0) body.risk_levels = params.risk_levels;
|
|
932
|
+
if (params.approval_requirements !== void 0) body.approval_requirements = params.approval_requirements;
|
|
933
|
+
if (params.memory_behavior !== void 0) body.memory_behavior = params.memory_behavior;
|
|
934
|
+
if (params.eval_rules !== void 0) body.eval_rules = params.eval_rules;
|
|
935
|
+
if (params.config !== void 0) body.config = params.config;
|
|
936
|
+
return this._request("POST", "/v1/capabilities", { body });
|
|
937
|
+
}
|
|
938
|
+
async getCapability(capabilityId) {
|
|
939
|
+
return this._request("GET", `/v1/capabilities/${capabilityId}`);
|
|
940
|
+
}
|
|
941
|
+
async listCapabilities(opts) {
|
|
942
|
+
const params = {
|
|
943
|
+
limit: opts?.limit ?? 100,
|
|
944
|
+
offset: opts?.offset ?? 0
|
|
945
|
+
};
|
|
946
|
+
if (opts?.status) params.status = opts.status;
|
|
947
|
+
return this._request("GET", "/v1/capabilities", { params });
|
|
948
|
+
}
|
|
949
|
+
async updateCapability(capabilityId, updates) {
|
|
950
|
+
return this._request("PATCH", `/v1/capabilities/${capabilityId}`, { body: updates });
|
|
951
|
+
}
|
|
952
|
+
async deleteCapability(capabilityId) {
|
|
953
|
+
return this._request("DELETE", `/v1/capabilities/${capabilityId}`);
|
|
954
|
+
}
|
|
955
|
+
// ========================================================================
|
|
956
|
+
// Checkpoints (Runtime v2)
|
|
957
|
+
// ========================================================================
|
|
958
|
+
async createCheckpoint(missionId, opts) {
|
|
959
|
+
const body = {};
|
|
960
|
+
if (opts?.label !== void 0) body.label = opts.label;
|
|
961
|
+
if (opts?.metadata !== void 0) body.metadata = opts.metadata;
|
|
962
|
+
return this._request("POST", `/v1/missions/${missionId}/checkpoints`, { body });
|
|
963
|
+
}
|
|
964
|
+
async getCheckpoint(checkpointId) {
|
|
965
|
+
return this._request("GET", `/v1/checkpoints/${checkpointId}`);
|
|
966
|
+
}
|
|
967
|
+
async listCheckpoints(missionId, opts) {
|
|
968
|
+
const params = {
|
|
969
|
+
limit: opts?.limit ?? 100,
|
|
970
|
+
offset: opts?.offset ?? 0
|
|
971
|
+
};
|
|
972
|
+
return this._request("GET", `/v1/missions/${missionId}/checkpoints`, { params });
|
|
973
|
+
}
|
|
974
|
+
async rollbackToCheckpoint(missionId, checkpointId, opts) {
|
|
975
|
+
const body = { checkpoint_id: checkpointId };
|
|
976
|
+
if (opts?.reason !== void 0) body.reason = opts.reason;
|
|
977
|
+
return this._request("POST", `/v1/missions/${missionId}/rollback`, { body });
|
|
978
|
+
}
|
|
979
|
+
// ========================================================================
|
|
980
|
+
// Interventions (Runtime v2)
|
|
981
|
+
// ========================================================================
|
|
982
|
+
async createIntervention(params) {
|
|
983
|
+
const body = {
|
|
984
|
+
intervention_type: params.intervention_type
|
|
985
|
+
};
|
|
986
|
+
if (params.mission_id !== void 0) body.mission_id = params.mission_id;
|
|
987
|
+
if (params.action_id !== void 0) body.action_id = params.action_id;
|
|
988
|
+
if (params.agent_id !== void 0) body.agent_id = params.agent_id;
|
|
989
|
+
if (params.rationale !== void 0) body.rationale = params.rationale;
|
|
990
|
+
if (params.metadata !== void 0) body.metadata = params.metadata;
|
|
991
|
+
return this._request("POST", "/v1/interventions", { body });
|
|
992
|
+
}
|
|
993
|
+
async getIntervention(interventionId) {
|
|
994
|
+
return this._request("GET", `/v1/interventions/${interventionId}`);
|
|
995
|
+
}
|
|
996
|
+
async listInterventions(opts) {
|
|
997
|
+
const params = {
|
|
998
|
+
limit: opts?.limit ?? 100,
|
|
999
|
+
offset: opts?.offset ?? 0
|
|
1000
|
+
};
|
|
1001
|
+
if (opts?.mission_id) params.mission_id = opts.mission_id;
|
|
1002
|
+
if (opts?.agent_id) params.agent_id = opts.agent_id;
|
|
1003
|
+
if (opts?.intervention_type) params.type = opts.intervention_type;
|
|
1004
|
+
return this._request("GET", "/v1/interventions", { params });
|
|
1005
|
+
}
|
|
715
1006
|
};
|
|
716
1007
|
export {
|
|
717
1008
|
Novyx,
|