@llmsafespaces/sdk 0.8.13 → 0.12.2

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 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) {
@@ -298,9 +302,21 @@ var SessionsAPI = class {
298
302
  enqueue(workspaceId, sessionId, text) {
299
303
  return this.client.request("POST", `/workspaces/${workspaceId}/sessions/${sessionId}/queue`, { text });
300
304
  }
305
+ /**
306
+ * @deprecated Under the V2 session-queue model (Epic 63), the queue is
307
+ * inboard in opencode and this endpoint returns a best-effort shadow
308
+ * derived from SSE events. Subscribe to the workspace SSE stream and
309
+ * track `queue.update` events instead. Removed in next major.
310
+ */
301
311
  listQueue(workspaceId, sessionId) {
302
312
  return this.client.request("GET", `/workspaces/${workspaceId}/sessions/${sessionId}/queue`);
303
313
  }
314
+ /**
315
+ * @deprecated Under the V2 session-queue model (Epic 63), abort is
316
+ * non-destructive and queued messages survive. This removes from the
317
+ * best-effort shadow only; it does not revoke the durable input.
318
+ * Removed in next major.
319
+ */
304
320
  dismissQueued(workspaceId, sessionId, messageId) {
305
321
  return this.client.request("DELETE", `/workspaces/${workspaceId}/sessions/${sessionId}/queue/${messageId}`);
306
322
  }
@@ -577,6 +593,54 @@ var AgentRolesAPI = class {
577
593
  return this.client.request("GET", `/workspaces/${workspaceId}/effective-agent-role`);
578
594
  }
579
595
  };
596
+ var WorkflowsAPI = class {
597
+ constructor(client) {
598
+ this.client = client;
599
+ }
600
+ client;
601
+ list() {
602
+ return this.client.request("GET", "/me/workflows");
603
+ }
604
+ get(id) {
605
+ return this.client.request("GET", `/me/workflows/${id}`);
606
+ }
607
+ create(req) {
608
+ return this.client.request("POST", "/me/workflows", req);
609
+ }
610
+ update(id, req) {
611
+ return this.client.request("PUT", `/me/workflows/${id}`, req);
612
+ }
613
+ delete(id) {
614
+ return this.client.request("DELETE", `/me/workflows/${id}`);
615
+ }
616
+ run(id, input, workspaceId) {
617
+ return this.client.request("POST", `/me/workflows/${id}/runs`, { input, workspaceId });
618
+ }
619
+ getRun(runId) {
620
+ return this.client.request("GET", `/me/runs/${runId}`);
621
+ }
622
+ cancelRun(runId) {
623
+ return this.client.request("POST", `/me/runs/${runId}/cancel`);
624
+ }
625
+ };
626
+ var TriggersAPI = class {
627
+ constructor(client) {
628
+ this.client = client;
629
+ }
630
+ client;
631
+ list() {
632
+ return this.client.request("GET", "/me/triggers");
633
+ }
634
+ create(req) {
635
+ return this.client.request("POST", "/me/triggers", req);
636
+ }
637
+ update(id, req) {
638
+ return this.client.request("PUT", `/me/triggers/${id}`, req);
639
+ }
640
+ delete(id) {
641
+ return this.client.request("DELETE", `/me/triggers/${id}`);
642
+ }
643
+ };
580
644
 
581
645
  // src/types.ts
582
646
  var SECRET_NAME_PATTERN = /^[a-z0-9._-]+$/;
package/dist/index.d.cts CHANGED
@@ -182,6 +182,13 @@ interface UpdateProviderCredentialRequest {
182
182
  modelContextLimits?: Record<string, number>;
183
183
  modelOutputLimits?: Record<string, number>;
184
184
  }
185
+ /**
186
+ * A message waiting in the session queue.
187
+ *
188
+ * Under the V2 session-queue model (Epic 63), this is a best-effort shadow
189
+ * derived from SSE events. `retry_count` is vestigial (V2 has no retry —
190
+ * opencode handles durability internally).
191
+ */
185
192
  interface QueuedMessage {
186
193
  id: string;
187
194
  text: string;
@@ -213,6 +220,8 @@ declare class LLMSafeSpaces {
213
220
  readonly probe: ProbeAPI;
214
221
  readonly prompts: PromptsAPI;
215
222
  readonly agentRoles: AgentRolesAPI;
223
+ readonly workflows: WorkflowsAPI;
224
+ readonly triggers: TriggersAPI;
216
225
  constructor(options: ClientOptions);
217
226
  /** Internal: make an authenticated request. */
218
227
  request<T>(method: string, path: string, body?: unknown, timeout?: number): Promise<T>;
@@ -270,9 +279,21 @@ declare class SessionsAPI {
270
279
  enqueue(workspaceId: string, sessionId: string, text: string): Promise<{
271
280
  messageID: string;
272
281
  }>;
282
+ /**
283
+ * @deprecated Under the V2 session-queue model (Epic 63), the queue is
284
+ * inboard in opencode and this endpoint returns a best-effort shadow
285
+ * derived from SSE events. Subscribe to the workspace SSE stream and
286
+ * track `queue.update` events instead. Removed in next major.
287
+ */
273
288
  listQueue(workspaceId: string, sessionId: string): Promise<{
274
289
  messages: QueuedMessage[];
275
290
  }>;
291
+ /**
292
+ * @deprecated Under the V2 session-queue model (Epic 63), abort is
293
+ * non-destructive and queued messages survive. This removes from the
294
+ * best-effort shadow only; it does not revoke the durable input.
295
+ * Removed in next major.
296
+ */
276
297
  dismissQueued(workspaceId: string, sessionId: string, messageId: string): Promise<void>;
277
298
  markSeen(workspaceId: string, sessionId: string): Promise<void>;
278
299
  }
@@ -421,6 +442,98 @@ declare class AgentRolesAPI {
421
442
  clearWorkspaceRole(workspaceId: string): Promise<void>;
422
443
  getEffectiveWorkspaceRole(workspaceId: string): Promise<unknown>;
423
444
  }
445
+ interface WorkflowResponse {
446
+ id: string;
447
+ ownerType: string;
448
+ name: string;
449
+ slug: string;
450
+ description: string;
451
+ specYaml: string;
452
+ status: string;
453
+ createdAt: string;
454
+ updatedAt: string;
455
+ }
456
+ interface WorkflowRunResponse {
457
+ id: string;
458
+ workflowId: string;
459
+ status: string;
460
+ errorCode?: string;
461
+ input?: unknown;
462
+ output?: unknown;
463
+ startedAt?: string;
464
+ finishedAt?: string;
465
+ createdAt: string;
466
+ }
467
+ interface TriggerResponse {
468
+ id: string;
469
+ name: string;
470
+ enabled: boolean;
471
+ sourceType: string;
472
+ sourceConfig: unknown;
473
+ workspaceId?: string;
474
+ workflowId?: string;
475
+ prompt?: string;
476
+ agent?: string;
477
+ scriptPath?: string;
478
+ scriptArgs?: string[];
479
+ scriptEnv?: unknown;
480
+ memoryMode?: string;
481
+ captureMode?: string;
482
+ preserveSession?: string;
483
+ consecutiveFailures: number;
484
+ autoDisableAfter: number;
485
+ lastFiredAt?: string;
486
+ nextFireAt?: string;
487
+ }
488
+ declare class WorkflowsAPI {
489
+ private readonly client;
490
+ constructor(client: LLMSafeSpaces);
491
+ list(): Promise<{
492
+ workflows: WorkflowResponse[];
493
+ }>;
494
+ get(id: string): Promise<WorkflowResponse>;
495
+ create(req: {
496
+ name: string;
497
+ specYaml: string;
498
+ status?: string;
499
+ }): Promise<WorkflowResponse>;
500
+ update(id: string, req: {
501
+ name?: string;
502
+ status?: string;
503
+ specYaml?: string;
504
+ }): Promise<WorkflowResponse>;
505
+ delete(id: string): Promise<void>;
506
+ run(id: string, input?: unknown, workspaceId?: string): Promise<WorkflowRunResponse>;
507
+ getRun(runId: string): Promise<WorkflowRunResponse>;
508
+ cancelRun(runId: string): Promise<void>;
509
+ }
510
+ declare class TriggersAPI {
511
+ private readonly client;
512
+ constructor(client: LLMSafeSpaces);
513
+ list(): Promise<{
514
+ triggers: TriggerResponse[];
515
+ }>;
516
+ create(req: {
517
+ name: string;
518
+ sourceType: string;
519
+ sourceConfig: unknown;
520
+ workspaceId?: string;
521
+ workflowId?: string;
522
+ prompt?: string;
523
+ agent?: string;
524
+ scriptPath?: string;
525
+ scriptArgs?: string[];
526
+ scriptEnv?: unknown;
527
+ memoryMode?: string;
528
+ captureMode?: string;
529
+ preserveSession?: string;
530
+ }): Promise<TriggerResponse>;
531
+ update(id: string, req: {
532
+ enabled?: boolean;
533
+ autoDisableAfter?: number;
534
+ }): Promise<TriggerResponse>;
535
+ delete(id: string): Promise<void>;
536
+ }
424
537
 
425
538
  /** Base error for all LLMSafeSpaces API errors. */
426
539
  declare class LLMSafeSpacesError extends Error {
package/dist/index.d.ts CHANGED
@@ -182,6 +182,13 @@ interface UpdateProviderCredentialRequest {
182
182
  modelContextLimits?: Record<string, number>;
183
183
  modelOutputLimits?: Record<string, number>;
184
184
  }
185
+ /**
186
+ * A message waiting in the session queue.
187
+ *
188
+ * Under the V2 session-queue model (Epic 63), this is a best-effort shadow
189
+ * derived from SSE events. `retry_count` is vestigial (V2 has no retry —
190
+ * opencode handles durability internally).
191
+ */
185
192
  interface QueuedMessage {
186
193
  id: string;
187
194
  text: string;
@@ -213,6 +220,8 @@ declare class LLMSafeSpaces {
213
220
  readonly probe: ProbeAPI;
214
221
  readonly prompts: PromptsAPI;
215
222
  readonly agentRoles: AgentRolesAPI;
223
+ readonly workflows: WorkflowsAPI;
224
+ readonly triggers: TriggersAPI;
216
225
  constructor(options: ClientOptions);
217
226
  /** Internal: make an authenticated request. */
218
227
  request<T>(method: string, path: string, body?: unknown, timeout?: number): Promise<T>;
@@ -270,9 +279,21 @@ declare class SessionsAPI {
270
279
  enqueue(workspaceId: string, sessionId: string, text: string): Promise<{
271
280
  messageID: string;
272
281
  }>;
282
+ /**
283
+ * @deprecated Under the V2 session-queue model (Epic 63), the queue is
284
+ * inboard in opencode and this endpoint returns a best-effort shadow
285
+ * derived from SSE events. Subscribe to the workspace SSE stream and
286
+ * track `queue.update` events instead. Removed in next major.
287
+ */
273
288
  listQueue(workspaceId: string, sessionId: string): Promise<{
274
289
  messages: QueuedMessage[];
275
290
  }>;
291
+ /**
292
+ * @deprecated Under the V2 session-queue model (Epic 63), abort is
293
+ * non-destructive and queued messages survive. This removes from the
294
+ * best-effort shadow only; it does not revoke the durable input.
295
+ * Removed in next major.
296
+ */
276
297
  dismissQueued(workspaceId: string, sessionId: string, messageId: string): Promise<void>;
277
298
  markSeen(workspaceId: string, sessionId: string): Promise<void>;
278
299
  }
@@ -421,6 +442,98 @@ declare class AgentRolesAPI {
421
442
  clearWorkspaceRole(workspaceId: string): Promise<void>;
422
443
  getEffectiveWorkspaceRole(workspaceId: string): Promise<unknown>;
423
444
  }
445
+ interface WorkflowResponse {
446
+ id: string;
447
+ ownerType: string;
448
+ name: string;
449
+ slug: string;
450
+ description: string;
451
+ specYaml: string;
452
+ status: string;
453
+ createdAt: string;
454
+ updatedAt: string;
455
+ }
456
+ interface WorkflowRunResponse {
457
+ id: string;
458
+ workflowId: string;
459
+ status: string;
460
+ errorCode?: string;
461
+ input?: unknown;
462
+ output?: unknown;
463
+ startedAt?: string;
464
+ finishedAt?: string;
465
+ createdAt: string;
466
+ }
467
+ interface TriggerResponse {
468
+ id: string;
469
+ name: string;
470
+ enabled: boolean;
471
+ sourceType: string;
472
+ sourceConfig: unknown;
473
+ workspaceId?: string;
474
+ workflowId?: string;
475
+ prompt?: string;
476
+ agent?: string;
477
+ scriptPath?: string;
478
+ scriptArgs?: string[];
479
+ scriptEnv?: unknown;
480
+ memoryMode?: string;
481
+ captureMode?: string;
482
+ preserveSession?: string;
483
+ consecutiveFailures: number;
484
+ autoDisableAfter: number;
485
+ lastFiredAt?: string;
486
+ nextFireAt?: string;
487
+ }
488
+ declare class WorkflowsAPI {
489
+ private readonly client;
490
+ constructor(client: LLMSafeSpaces);
491
+ list(): Promise<{
492
+ workflows: WorkflowResponse[];
493
+ }>;
494
+ get(id: string): Promise<WorkflowResponse>;
495
+ create(req: {
496
+ name: string;
497
+ specYaml: string;
498
+ status?: string;
499
+ }): Promise<WorkflowResponse>;
500
+ update(id: string, req: {
501
+ name?: string;
502
+ status?: string;
503
+ specYaml?: string;
504
+ }): Promise<WorkflowResponse>;
505
+ delete(id: string): Promise<void>;
506
+ run(id: string, input?: unknown, workspaceId?: string): Promise<WorkflowRunResponse>;
507
+ getRun(runId: string): Promise<WorkflowRunResponse>;
508
+ cancelRun(runId: string): Promise<void>;
509
+ }
510
+ declare class TriggersAPI {
511
+ private readonly client;
512
+ constructor(client: LLMSafeSpaces);
513
+ list(): Promise<{
514
+ triggers: TriggerResponse[];
515
+ }>;
516
+ create(req: {
517
+ name: string;
518
+ sourceType: string;
519
+ sourceConfig: unknown;
520
+ workspaceId?: string;
521
+ workflowId?: string;
522
+ prompt?: string;
523
+ agent?: string;
524
+ scriptPath?: string;
525
+ scriptArgs?: string[];
526
+ scriptEnv?: unknown;
527
+ memoryMode?: string;
528
+ captureMode?: string;
529
+ preserveSession?: string;
530
+ }): Promise<TriggerResponse>;
531
+ update(id: string, req: {
532
+ enabled?: boolean;
533
+ autoDisableAfter?: number;
534
+ }): Promise<TriggerResponse>;
535
+ delete(id: string): Promise<void>;
536
+ }
424
537
 
425
538
  /** Base error for all LLMSafeSpaces API errors. */
426
539
  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) {
@@ -265,9 +269,21 @@ var SessionsAPI = class {
265
269
  enqueue(workspaceId, sessionId, text) {
266
270
  return this.client.request("POST", `/workspaces/${workspaceId}/sessions/${sessionId}/queue`, { text });
267
271
  }
272
+ /**
273
+ * @deprecated Under the V2 session-queue model (Epic 63), the queue is
274
+ * inboard in opencode and this endpoint returns a best-effort shadow
275
+ * derived from SSE events. Subscribe to the workspace SSE stream and
276
+ * track `queue.update` events instead. Removed in next major.
277
+ */
268
278
  listQueue(workspaceId, sessionId) {
269
279
  return this.client.request("GET", `/workspaces/${workspaceId}/sessions/${sessionId}/queue`);
270
280
  }
281
+ /**
282
+ * @deprecated Under the V2 session-queue model (Epic 63), abort is
283
+ * non-destructive and queued messages survive. This removes from the
284
+ * best-effort shadow only; it does not revoke the durable input.
285
+ * Removed in next major.
286
+ */
271
287
  dismissQueued(workspaceId, sessionId, messageId) {
272
288
  return this.client.request("DELETE", `/workspaces/${workspaceId}/sessions/${sessionId}/queue/${messageId}`);
273
289
  }
@@ -544,6 +560,54 @@ var AgentRolesAPI = class {
544
560
  return this.client.request("GET", `/workspaces/${workspaceId}/effective-agent-role`);
545
561
  }
546
562
  };
563
+ var WorkflowsAPI = class {
564
+ constructor(client) {
565
+ this.client = client;
566
+ }
567
+ client;
568
+ list() {
569
+ return this.client.request("GET", "/me/workflows");
570
+ }
571
+ get(id) {
572
+ return this.client.request("GET", `/me/workflows/${id}`);
573
+ }
574
+ create(req) {
575
+ return this.client.request("POST", "/me/workflows", req);
576
+ }
577
+ update(id, req) {
578
+ return this.client.request("PUT", `/me/workflows/${id}`, req);
579
+ }
580
+ delete(id) {
581
+ return this.client.request("DELETE", `/me/workflows/${id}`);
582
+ }
583
+ run(id, input, workspaceId) {
584
+ return this.client.request("POST", `/me/workflows/${id}/runs`, { input, workspaceId });
585
+ }
586
+ getRun(runId) {
587
+ return this.client.request("GET", `/me/runs/${runId}`);
588
+ }
589
+ cancelRun(runId) {
590
+ return this.client.request("POST", `/me/runs/${runId}/cancel`);
591
+ }
592
+ };
593
+ var TriggersAPI = class {
594
+ constructor(client) {
595
+ this.client = client;
596
+ }
597
+ client;
598
+ list() {
599
+ return this.client.request("GET", "/me/triggers");
600
+ }
601
+ create(req) {
602
+ return this.client.request("POST", "/me/triggers", req);
603
+ }
604
+ update(id, req) {
605
+ return this.client.request("PUT", `/me/triggers/${id}`, req);
606
+ }
607
+ delete(id) {
608
+ return this.client.request("DELETE", `/me/triggers/${id}`);
609
+ }
610
+ };
547
611
 
548
612
  // src/types.ts
549
613
  var SECRET_NAME_PATTERN = /^[a-z0-9._-]+$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmsafespaces/sdk",
3
- "version": "0.8.13",
3
+ "version": "0.12.2",
4
4
  "description": "TypeScript SDK for LLMSafeSpaces API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",