@swarm-agent/sdk 0.1.56 → 0.1.57

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.
@@ -181,6 +181,11 @@ export interface JobAutomation {
181
181
  revision: number;
182
182
  created_at: number;
183
183
  updated_at: number;
184
+ history_count?: number;
185
+ last_change?: {
186
+ time: number;
187
+ who: string;
188
+ };
184
189
  latest_deliveries?: JobDelivery[];
185
190
  }
186
191
  export interface SetJobAutomationParams {
@@ -307,6 +312,32 @@ export interface ListJobDeliveriesParams {
307
312
  /** Default 50, at most 200. */
308
313
  limit?: number;
309
314
  }
315
+ export type WorkflowDefinition = Omit<SetJobAutomationParams, 'scope'> & {
316
+ swarm_workflow: 1;
317
+ scope: Omit<JobAutomationScope, 'folder'> & {
318
+ folder?: string;
319
+ };
320
+ };
321
+ export type WorkflowImportResult = {
322
+ automation: JobAutomation;
323
+ created: boolean;
324
+ unchanged?: boolean;
325
+ } | {
326
+ files: {
327
+ path: string;
328
+ status: 'created' | 'updated' | 'unchanged' | 'refused';
329
+ error?: string;
330
+ }[];
331
+ };
332
+ export interface WorkflowHistoryRecord {
333
+ revision: number;
334
+ time: number;
335
+ kind: 'created' | 'updated' | 'deleted' | 'restored';
336
+ source: 'set' | 'import' | 'restore' | 'delete';
337
+ who: string;
338
+ changed_fields: string[];
339
+ deleted?: boolean;
340
+ }
310
341
  /** Workflows and their deliveries (`/v3/workflows`, `/v3/job-deliveries`). */
311
342
  export declare class SwarmJobAutomationsNamespace {
312
343
  private readonly transport;
@@ -322,6 +353,40 @@ export declare class SwarmJobAutomationsNamespace {
322
353
  automation: JobAutomation;
323
354
  created: boolean;
324
355
  }>;
356
+ /** Export to .swarm/workflows, commit, and import on another machine. Empty path selects the default filename. */
357
+ exportWorkflow(params: {
358
+ name?: string;
359
+ id?: string;
360
+ path?: string;
361
+ overwrite?: boolean;
362
+ }): Promise<WorkflowDefinition>;
363
+ /** Import one definition/file or every *.json in a directory; run steps require a full key. */
364
+ importWorkflow(params: {
365
+ definition?: WorkflowDefinition;
366
+ path?: string;
367
+ project?: string;
368
+ workspace?: string;
369
+ }): Promise<WorkflowImportResult>;
370
+ /** Retained changes newest first, also for deleted workflows; a revision returns portable JSON. */
371
+ history(params: {
372
+ name?: string;
373
+ id?: string;
374
+ revision?: number;
375
+ }): Promise<{
376
+ history: WorkflowHistoryRecord[];
377
+ } | WorkflowDefinition | {
378
+ revision: number;
379
+ deleted: true;
380
+ }>;
381
+ /** Save an old definition as a new revision. Run steps require the owner's full key. */
382
+ restore(params: {
383
+ name?: string;
384
+ id?: string;
385
+ revision: number;
386
+ }): Promise<{
387
+ automation: JobAutomation;
388
+ created: boolean;
389
+ }>;
325
390
  delete(id: string): Promise<void>;
326
391
  /** The machine-wide stop switch. */
327
392
  stopState(): Promise<JobAutomationStop>;
@@ -23,6 +23,29 @@ export class SwarmJobAutomationsNamespace {
23
23
  });
24
24
  return { automation: res.data.automation, created: Boolean(res.data.created) };
25
25
  }
26
+ /** Export to .swarm/workflows, commit, and import on another machine. Empty path selects the default filename. */
27
+ async exportWorkflow(params) {
28
+ return (await this.transport.request('/v3/workflows/export', { method: 'POST', body: params })).data;
29
+ }
30
+ /** Import one definition/file or every *.json in a directory; run steps require a full key. */
31
+ async importWorkflow(params) {
32
+ return (await this.transport.request('/v3/workflows/import', { method: 'POST', body: params })).data;
33
+ }
34
+ /** Retained changes newest first, also for deleted workflows; a revision returns portable JSON. */
35
+ async history(params) {
36
+ const q = new URLSearchParams();
37
+ if (params.name)
38
+ q.set('name', params.name);
39
+ if (params.id)
40
+ q.set('id', params.id);
41
+ if (params.revision !== undefined)
42
+ q.set('revision', String(params.revision));
43
+ return (await this.transport.request(`/v3/workflows/history?${q}`, { method: 'GET' })).data;
44
+ }
45
+ /** Save an old definition as a new revision. Run steps require the owner's full key. */
46
+ async restore(params) {
47
+ return (await this.transport.request('/v3/workflows/restore', { method: 'POST', body: params })).data;
48
+ }
26
49
  async delete(id) {
27
50
  await this.transport.request(`/v3/workflows/${encodeURIComponent(id)}`, { method: 'DELETE' });
28
51
  }
@@ -1,5 +1,6 @@
1
1
  import type { SwarmTransport } from './transport.js';
2
2
  export interface ProviderStatus {
3
+ runs_agents: boolean;
3
4
  id: string;
4
5
  ready: boolean;
5
6
  runnable: boolean;
package/dist/types.d.ts CHANGED
@@ -632,6 +632,7 @@ export interface ProjectTaskAttempt {
632
632
  [key: string]: unknown;
633
633
  }
634
634
  export interface ProjectTaskRecord {
635
+ speech?: SpeechSettings;
635
636
  id: string;
636
637
  project_id: string;
637
638
  account_id?: string;
@@ -774,7 +775,16 @@ export interface CancelDesignJobResult {
774
775
  task_id: string;
775
776
  status: string;
776
777
  }
778
+ export interface SpeechSettings {
779
+ text: string;
780
+ voice: string;
781
+ style?: string;
782
+ language?: string;
783
+ format?: 'wav';
784
+ }
777
785
  export interface CreateProjectTaskParams {
786
+ operation?: 'create' | 'edit' | 'extend' | 'speech';
787
+ speech?: SpeechSettings;
778
788
  id?: string;
779
789
  title: string;
780
790
  description?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarm-agent/sdk",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "description": "Official TypeScript SDK for Swarm local AI coding workspace",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",