@llmsafespaces/sdk 0.8.13 → 0.9.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.cjs +52 -0
- package/dist/index.d.cts +78 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +52 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -97,6 +97,8 @@ var LLMSafeSpaces = class {
|
|
|
97
97
|
probe;
|
|
98
98
|
prompts;
|
|
99
99
|
agentRoles;
|
|
100
|
+
workflows;
|
|
101
|
+
triggers;
|
|
100
102
|
constructor(options) {
|
|
101
103
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
102
104
|
this.timeout = options.timeout ?? DEFAULT_TIMEOUT;
|
|
@@ -117,6 +119,8 @@ var LLMSafeSpaces = class {
|
|
|
117
119
|
this.probe = new ProbeAPI(this);
|
|
118
120
|
this.prompts = new PromptsAPI(this);
|
|
119
121
|
this.agentRoles = new AgentRolesAPI(this);
|
|
122
|
+
this.workflows = new WorkflowsAPI(this);
|
|
123
|
+
this.triggers = new TriggersAPI(this);
|
|
120
124
|
}
|
|
121
125
|
/** Internal: make an authenticated request. */
|
|
122
126
|
async request(method, path, body, timeout) {
|
|
@@ -577,6 +581,54 @@ var AgentRolesAPI = class {
|
|
|
577
581
|
return this.client.request("GET", `/workspaces/${workspaceId}/effective-agent-role`);
|
|
578
582
|
}
|
|
579
583
|
};
|
|
584
|
+
var WorkflowsAPI = class {
|
|
585
|
+
constructor(client) {
|
|
586
|
+
this.client = client;
|
|
587
|
+
}
|
|
588
|
+
client;
|
|
589
|
+
list() {
|
|
590
|
+
return this.client.request("GET", "/me/workflows");
|
|
591
|
+
}
|
|
592
|
+
get(id) {
|
|
593
|
+
return this.client.request("GET", `/me/workflows/${id}`);
|
|
594
|
+
}
|
|
595
|
+
create(req) {
|
|
596
|
+
return this.client.request("POST", "/me/workflows", req);
|
|
597
|
+
}
|
|
598
|
+
update(id, req) {
|
|
599
|
+
return this.client.request("PUT", `/me/workflows/${id}`, req);
|
|
600
|
+
}
|
|
601
|
+
delete(id) {
|
|
602
|
+
return this.client.request("DELETE", `/me/workflows/${id}`);
|
|
603
|
+
}
|
|
604
|
+
run(id, input, workspaceId) {
|
|
605
|
+
return this.client.request("POST", `/me/workflows/${id}/runs`, { input, workspaceId });
|
|
606
|
+
}
|
|
607
|
+
getRun(runId) {
|
|
608
|
+
return this.client.request("GET", `/me/runs/${runId}`);
|
|
609
|
+
}
|
|
610
|
+
cancelRun(runId) {
|
|
611
|
+
return this.client.request("POST", `/me/runs/${runId}/cancel`);
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
var TriggersAPI = class {
|
|
615
|
+
constructor(client) {
|
|
616
|
+
this.client = client;
|
|
617
|
+
}
|
|
618
|
+
client;
|
|
619
|
+
list() {
|
|
620
|
+
return this.client.request("GET", "/me/triggers");
|
|
621
|
+
}
|
|
622
|
+
create(req) {
|
|
623
|
+
return this.client.request("POST", "/me/triggers", req);
|
|
624
|
+
}
|
|
625
|
+
update(id, req) {
|
|
626
|
+
return this.client.request("PUT", `/me/triggers/${id}`, req);
|
|
627
|
+
}
|
|
628
|
+
delete(id) {
|
|
629
|
+
return this.client.request("DELETE", `/me/triggers/${id}`);
|
|
630
|
+
}
|
|
631
|
+
};
|
|
580
632
|
|
|
581
633
|
// src/types.ts
|
|
582
634
|
var SECRET_NAME_PATTERN = /^[a-z0-9._-]+$/;
|
package/dist/index.d.cts
CHANGED
|
@@ -213,6 +213,8 @@ declare class LLMSafeSpaces {
|
|
|
213
213
|
readonly probe: ProbeAPI;
|
|
214
214
|
readonly prompts: PromptsAPI;
|
|
215
215
|
readonly agentRoles: AgentRolesAPI;
|
|
216
|
+
readonly workflows: WorkflowsAPI;
|
|
217
|
+
readonly triggers: TriggersAPI;
|
|
216
218
|
constructor(options: ClientOptions);
|
|
217
219
|
/** Internal: make an authenticated request. */
|
|
218
220
|
request<T>(method: string, path: string, body?: unknown, timeout?: number): Promise<T>;
|
|
@@ -421,6 +423,82 @@ declare class AgentRolesAPI {
|
|
|
421
423
|
clearWorkspaceRole(workspaceId: string): Promise<void>;
|
|
422
424
|
getEffectiveWorkspaceRole(workspaceId: string): Promise<unknown>;
|
|
423
425
|
}
|
|
426
|
+
interface WorkflowResponse {
|
|
427
|
+
id: string;
|
|
428
|
+
ownerType: string;
|
|
429
|
+
name: string;
|
|
430
|
+
slug: string;
|
|
431
|
+
description: string;
|
|
432
|
+
specYaml: string;
|
|
433
|
+
status: string;
|
|
434
|
+
createdAt: string;
|
|
435
|
+
updatedAt: string;
|
|
436
|
+
}
|
|
437
|
+
interface WorkflowRunResponse {
|
|
438
|
+
id: string;
|
|
439
|
+
workflowId: string;
|
|
440
|
+
status: string;
|
|
441
|
+
errorCode?: string;
|
|
442
|
+
input?: unknown;
|
|
443
|
+
output?: unknown;
|
|
444
|
+
startedAt?: string;
|
|
445
|
+
finishedAt?: string;
|
|
446
|
+
createdAt: string;
|
|
447
|
+
}
|
|
448
|
+
interface TriggerResponse {
|
|
449
|
+
id: string;
|
|
450
|
+
name: string;
|
|
451
|
+
enabled: boolean;
|
|
452
|
+
sourceType: string;
|
|
453
|
+
sourceConfig: unknown;
|
|
454
|
+
targetType: string;
|
|
455
|
+
targetConfig: unknown;
|
|
456
|
+
consecutiveFailures: number;
|
|
457
|
+
autoDisableAfter: number;
|
|
458
|
+
lastFiredAt?: string;
|
|
459
|
+
nextFireAt?: string;
|
|
460
|
+
}
|
|
461
|
+
declare class WorkflowsAPI {
|
|
462
|
+
private readonly client;
|
|
463
|
+
constructor(client: LLMSafeSpaces);
|
|
464
|
+
list(): Promise<{
|
|
465
|
+
workflows: WorkflowResponse[];
|
|
466
|
+
}>;
|
|
467
|
+
get(id: string): Promise<WorkflowResponse>;
|
|
468
|
+
create(req: {
|
|
469
|
+
name: string;
|
|
470
|
+
specYaml: string;
|
|
471
|
+
status?: string;
|
|
472
|
+
}): Promise<WorkflowResponse>;
|
|
473
|
+
update(id: string, req: {
|
|
474
|
+
name?: string;
|
|
475
|
+
status?: string;
|
|
476
|
+
specYaml?: string;
|
|
477
|
+
}): Promise<WorkflowResponse>;
|
|
478
|
+
delete(id: string): Promise<void>;
|
|
479
|
+
run(id: string, input?: unknown, workspaceId?: string): Promise<WorkflowRunResponse>;
|
|
480
|
+
getRun(runId: string): Promise<WorkflowRunResponse>;
|
|
481
|
+
cancelRun(runId: string): Promise<void>;
|
|
482
|
+
}
|
|
483
|
+
declare class TriggersAPI {
|
|
484
|
+
private readonly client;
|
|
485
|
+
constructor(client: LLMSafeSpaces);
|
|
486
|
+
list(): Promise<{
|
|
487
|
+
triggers: TriggerResponse[];
|
|
488
|
+
}>;
|
|
489
|
+
create(req: {
|
|
490
|
+
name: string;
|
|
491
|
+
sourceType: string;
|
|
492
|
+
targetType: string;
|
|
493
|
+
sourceConfig: unknown;
|
|
494
|
+
targetConfig: unknown;
|
|
495
|
+
}): Promise<TriggerResponse>;
|
|
496
|
+
update(id: string, req: {
|
|
497
|
+
enabled?: boolean;
|
|
498
|
+
autoDisableAfter?: number;
|
|
499
|
+
}): Promise<TriggerResponse>;
|
|
500
|
+
delete(id: string): Promise<void>;
|
|
501
|
+
}
|
|
424
502
|
|
|
425
503
|
/** Base error for all LLMSafeSpaces API errors. */
|
|
426
504
|
declare class LLMSafeSpacesError extends Error {
|
package/dist/index.d.ts
CHANGED
|
@@ -213,6 +213,8 @@ declare class LLMSafeSpaces {
|
|
|
213
213
|
readonly probe: ProbeAPI;
|
|
214
214
|
readonly prompts: PromptsAPI;
|
|
215
215
|
readonly agentRoles: AgentRolesAPI;
|
|
216
|
+
readonly workflows: WorkflowsAPI;
|
|
217
|
+
readonly triggers: TriggersAPI;
|
|
216
218
|
constructor(options: ClientOptions);
|
|
217
219
|
/** Internal: make an authenticated request. */
|
|
218
220
|
request<T>(method: string, path: string, body?: unknown, timeout?: number): Promise<T>;
|
|
@@ -421,6 +423,82 @@ declare class AgentRolesAPI {
|
|
|
421
423
|
clearWorkspaceRole(workspaceId: string): Promise<void>;
|
|
422
424
|
getEffectiveWorkspaceRole(workspaceId: string): Promise<unknown>;
|
|
423
425
|
}
|
|
426
|
+
interface WorkflowResponse {
|
|
427
|
+
id: string;
|
|
428
|
+
ownerType: string;
|
|
429
|
+
name: string;
|
|
430
|
+
slug: string;
|
|
431
|
+
description: string;
|
|
432
|
+
specYaml: string;
|
|
433
|
+
status: string;
|
|
434
|
+
createdAt: string;
|
|
435
|
+
updatedAt: string;
|
|
436
|
+
}
|
|
437
|
+
interface WorkflowRunResponse {
|
|
438
|
+
id: string;
|
|
439
|
+
workflowId: string;
|
|
440
|
+
status: string;
|
|
441
|
+
errorCode?: string;
|
|
442
|
+
input?: unknown;
|
|
443
|
+
output?: unknown;
|
|
444
|
+
startedAt?: string;
|
|
445
|
+
finishedAt?: string;
|
|
446
|
+
createdAt: string;
|
|
447
|
+
}
|
|
448
|
+
interface TriggerResponse {
|
|
449
|
+
id: string;
|
|
450
|
+
name: string;
|
|
451
|
+
enabled: boolean;
|
|
452
|
+
sourceType: string;
|
|
453
|
+
sourceConfig: unknown;
|
|
454
|
+
targetType: string;
|
|
455
|
+
targetConfig: unknown;
|
|
456
|
+
consecutiveFailures: number;
|
|
457
|
+
autoDisableAfter: number;
|
|
458
|
+
lastFiredAt?: string;
|
|
459
|
+
nextFireAt?: string;
|
|
460
|
+
}
|
|
461
|
+
declare class WorkflowsAPI {
|
|
462
|
+
private readonly client;
|
|
463
|
+
constructor(client: LLMSafeSpaces);
|
|
464
|
+
list(): Promise<{
|
|
465
|
+
workflows: WorkflowResponse[];
|
|
466
|
+
}>;
|
|
467
|
+
get(id: string): Promise<WorkflowResponse>;
|
|
468
|
+
create(req: {
|
|
469
|
+
name: string;
|
|
470
|
+
specYaml: string;
|
|
471
|
+
status?: string;
|
|
472
|
+
}): Promise<WorkflowResponse>;
|
|
473
|
+
update(id: string, req: {
|
|
474
|
+
name?: string;
|
|
475
|
+
status?: string;
|
|
476
|
+
specYaml?: string;
|
|
477
|
+
}): Promise<WorkflowResponse>;
|
|
478
|
+
delete(id: string): Promise<void>;
|
|
479
|
+
run(id: string, input?: unknown, workspaceId?: string): Promise<WorkflowRunResponse>;
|
|
480
|
+
getRun(runId: string): Promise<WorkflowRunResponse>;
|
|
481
|
+
cancelRun(runId: string): Promise<void>;
|
|
482
|
+
}
|
|
483
|
+
declare class TriggersAPI {
|
|
484
|
+
private readonly client;
|
|
485
|
+
constructor(client: LLMSafeSpaces);
|
|
486
|
+
list(): Promise<{
|
|
487
|
+
triggers: TriggerResponse[];
|
|
488
|
+
}>;
|
|
489
|
+
create(req: {
|
|
490
|
+
name: string;
|
|
491
|
+
sourceType: string;
|
|
492
|
+
targetType: string;
|
|
493
|
+
sourceConfig: unknown;
|
|
494
|
+
targetConfig: unknown;
|
|
495
|
+
}): Promise<TriggerResponse>;
|
|
496
|
+
update(id: string, req: {
|
|
497
|
+
enabled?: boolean;
|
|
498
|
+
autoDisableAfter?: number;
|
|
499
|
+
}): Promise<TriggerResponse>;
|
|
500
|
+
delete(id: string): Promise<void>;
|
|
501
|
+
}
|
|
424
502
|
|
|
425
503
|
/** Base error for all LLMSafeSpaces API errors. */
|
|
426
504
|
declare class LLMSafeSpacesError extends Error {
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,8 @@ var LLMSafeSpaces = class {
|
|
|
64
64
|
probe;
|
|
65
65
|
prompts;
|
|
66
66
|
agentRoles;
|
|
67
|
+
workflows;
|
|
68
|
+
triggers;
|
|
67
69
|
constructor(options) {
|
|
68
70
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
69
71
|
this.timeout = options.timeout ?? DEFAULT_TIMEOUT;
|
|
@@ -84,6 +86,8 @@ var LLMSafeSpaces = class {
|
|
|
84
86
|
this.probe = new ProbeAPI(this);
|
|
85
87
|
this.prompts = new PromptsAPI(this);
|
|
86
88
|
this.agentRoles = new AgentRolesAPI(this);
|
|
89
|
+
this.workflows = new WorkflowsAPI(this);
|
|
90
|
+
this.triggers = new TriggersAPI(this);
|
|
87
91
|
}
|
|
88
92
|
/** Internal: make an authenticated request. */
|
|
89
93
|
async request(method, path, body, timeout) {
|
|
@@ -544,6 +548,54 @@ var AgentRolesAPI = class {
|
|
|
544
548
|
return this.client.request("GET", `/workspaces/${workspaceId}/effective-agent-role`);
|
|
545
549
|
}
|
|
546
550
|
};
|
|
551
|
+
var WorkflowsAPI = class {
|
|
552
|
+
constructor(client) {
|
|
553
|
+
this.client = client;
|
|
554
|
+
}
|
|
555
|
+
client;
|
|
556
|
+
list() {
|
|
557
|
+
return this.client.request("GET", "/me/workflows");
|
|
558
|
+
}
|
|
559
|
+
get(id) {
|
|
560
|
+
return this.client.request("GET", `/me/workflows/${id}`);
|
|
561
|
+
}
|
|
562
|
+
create(req) {
|
|
563
|
+
return this.client.request("POST", "/me/workflows", req);
|
|
564
|
+
}
|
|
565
|
+
update(id, req) {
|
|
566
|
+
return this.client.request("PUT", `/me/workflows/${id}`, req);
|
|
567
|
+
}
|
|
568
|
+
delete(id) {
|
|
569
|
+
return this.client.request("DELETE", `/me/workflows/${id}`);
|
|
570
|
+
}
|
|
571
|
+
run(id, input, workspaceId) {
|
|
572
|
+
return this.client.request("POST", `/me/workflows/${id}/runs`, { input, workspaceId });
|
|
573
|
+
}
|
|
574
|
+
getRun(runId) {
|
|
575
|
+
return this.client.request("GET", `/me/runs/${runId}`);
|
|
576
|
+
}
|
|
577
|
+
cancelRun(runId) {
|
|
578
|
+
return this.client.request("POST", `/me/runs/${runId}/cancel`);
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
var TriggersAPI = class {
|
|
582
|
+
constructor(client) {
|
|
583
|
+
this.client = client;
|
|
584
|
+
}
|
|
585
|
+
client;
|
|
586
|
+
list() {
|
|
587
|
+
return this.client.request("GET", "/me/triggers");
|
|
588
|
+
}
|
|
589
|
+
create(req) {
|
|
590
|
+
return this.client.request("POST", "/me/triggers", req);
|
|
591
|
+
}
|
|
592
|
+
update(id, req) {
|
|
593
|
+
return this.client.request("PUT", `/me/triggers/${id}`, req);
|
|
594
|
+
}
|
|
595
|
+
delete(id) {
|
|
596
|
+
return this.client.request("DELETE", `/me/triggers/${id}`);
|
|
597
|
+
}
|
|
598
|
+
};
|
|
547
599
|
|
|
548
600
|
// src/types.ts
|
|
549
601
|
var SECRET_NAME_PATTERN = /^[a-z0-9._-]+$/;
|