@hasna/loops 0.4.28 → 0.4.29

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +84 -1
  2. package/README.md +226 -49
  3. package/dist/api/index.d.ts +20 -19
  4. package/dist/api/index.js +6846 -1087
  5. package/dist/cli/index.js +2471 -885
  6. package/dist/cli/safe-error-context.d.ts +1 -0
  7. package/dist/daemon/daemon.d.ts +1 -0
  8. package/dist/daemon/index.js +1786 -493
  9. package/dist/generated/storage-kit/index.d.ts +1 -1
  10. package/dist/generated/storage-kit/mode.d.ts +6 -12
  11. package/dist/index.d.ts +3 -3
  12. package/dist/index.js +4778 -1016
  13. package/dist/lib/advancement.d.ts +52 -0
  14. package/dist/lib/agent-adapter.d.ts +20 -2
  15. package/dist/lib/auth/route-policy.d.ts +14 -0
  16. package/dist/lib/auth/tenant-auth.d.ts +38 -0
  17. package/dist/lib/cloud/mode.d.ts +2 -8
  18. package/dist/lib/cloud/storage.d.ts +1 -2
  19. package/dist/lib/cloud/transport.d.ts +4 -18
  20. package/dist/lib/errors.d.ts +43 -1
  21. package/dist/lib/format.d.ts +2 -2
  22. package/dist/lib/goal/runner.d.ts +36 -3
  23. package/dist/lib/health.d.ts +1 -1
  24. package/dist/lib/labels.d.ts +4 -0
  25. package/dist/lib/loop-status.d.ts +4 -0
  26. package/dist/lib/migration.d.ts +4 -17
  27. package/dist/lib/mode.d.ts +2 -5
  28. package/dist/lib/mode.js +27 -36
  29. package/dist/lib/route/index.d.ts +2 -2
  30. package/dist/lib/route/throttle.d.ts +7 -0
  31. package/dist/lib/route/types.d.ts +3 -0
  32. package/dist/lib/run-completion.d.ts +18 -0
  33. package/dist/lib/scheduler.d.ts +5 -11
  34. package/dist/lib/storage/contract.d.ts +15 -1
  35. package/dist/lib/storage/index.d.ts +1 -1
  36. package/dist/lib/storage/index.js +3864 -457
  37. package/dist/lib/storage/pg-executor.d.ts +10 -5
  38. package/dist/lib/storage/postgres-loop-storage.d.ts +50 -24
  39. package/dist/lib/storage/postgres-schema.d.ts +8 -0
  40. package/dist/lib/storage/postgres-schema.js +1323 -1
  41. package/dist/lib/storage/postgres.d.ts +3 -1
  42. package/dist/lib/storage/postgres.js +1353 -27
  43. package/dist/lib/storage/provider-credentials.d.ts +84 -0
  44. package/dist/lib/storage/shared-database-transfer.d.ts +136 -0
  45. package/dist/lib/storage/sqlite.d.ts +15 -2
  46. package/dist/lib/storage/sqlite.js +1299 -217
  47. package/dist/lib/storage/tenant-backfill-s3.d.ts +53 -0
  48. package/dist/lib/storage/tenant-backfill.d.ts +40 -0
  49. package/dist/lib/store/index.d.ts +11 -8
  50. package/dist/lib/store.d.ts +52 -7
  51. package/dist/lib/store.js +1266 -217
  52. package/dist/lib/templates.d.ts +11 -0
  53. package/dist/lib/workflow-events.d.ts +6 -0
  54. package/dist/lib/workflow-provenance.d.ts +8 -0
  55. package/dist/lib/workflow-runner.d.ts +52 -4
  56. package/dist/mcp/index.js +1961 -651
  57. package/dist/runner/index.d.ts +20 -2
  58. package/dist/runner/index.js +2113 -177
  59. package/dist/sdk/http.d.ts +211 -3
  60. package/dist/sdk/http.js +301 -0
  61. package/dist/sdk/index.d.ts +7 -2
  62. package/dist/sdk/index.js +1959 -711
  63. package/dist/serve/index.d.ts +14 -0
  64. package/dist/serve/index.js +12323 -1743
  65. package/dist/types.d.ts +64 -3
  66. package/docs/AUTOMATION_RUNTIME_DESIGN.md +32 -32
  67. package/docs/CUTOVER-RUNBOOK.md +158 -31
  68. package/docs/DEPLOYMENT_MODES.md +78 -56
  69. package/docs/RUNTIME_BOUNDARY.md +26 -26
  70. package/docs/SHARED-DATABASE-TRANSFER.md +95 -0
  71. package/docs/SHARED_KIT_EXTRACTION_INVENTORY.md +631 -0
  72. package/docs/TRANSCRIPT_LOOP_PATTERNS.md +3 -3
  73. package/docs/UNIFIED_PRODUCT_CONTRACT.md +365 -0
  74. package/docs/USAGE.md +143 -52
  75. package/docs/workflows/transcript-feedback-to-loops.json +2 -2
  76. package/package.json +7 -3
  77. package/dist/lib/storage/pg-runner-claim.d.ts +0 -40
@@ -1,3 +1,43 @@
1
+ export interface PublicValidationDetails {
2
+ "code": string;
3
+ "reason": "not_array" | "invalid_array" | "invalid_item" | "option_not_allowed";
4
+ "path": string;
5
+ "index"?: number;
6
+ "option"?: string;
7
+ }
8
+ export interface ValidationFailureResponse {
9
+ "ok": boolean;
10
+ "error": string;
11
+ "details"?: PublicValidationDetails;
12
+ }
13
+ export interface InvalidLoopStatusResponse {
14
+ "ok": boolean;
15
+ "error": string;
16
+ }
17
+ export interface AmbiguousNameResponse {
18
+ "ok": boolean;
19
+ "error": string;
20
+ }
21
+ export interface InvalidJsonResponse {
22
+ "ok": boolean;
23
+ "error": string;
24
+ }
25
+ export interface UnsupportedMediaTypeResponse {
26
+ "ok": boolean;
27
+ "error": string;
28
+ }
29
+ export interface InvalidWorkflowRecoveryBodyResponse {
30
+ "ok": boolean;
31
+ "error": string;
32
+ }
33
+ export interface WorkflowRecoveryConflictResponse {
34
+ "ok": boolean;
35
+ "error": "workflow_run_has_live_steps" | "workflow_run_step_ownership_unverifiable" | "workflow_run_not_running";
36
+ }
37
+ export interface RunFinalizeConflictResponse {
38
+ "ok": boolean;
39
+ "error": "stale_claim" | "run_not_running" | "loop_advancement_conflict";
40
+ }
1
41
  export interface Foundation {
2
42
  "status": string;
3
43
  "version": string;
@@ -9,7 +49,8 @@ export interface Loop {
9
49
  "id": string;
10
50
  "name": string;
11
51
  "description"?: string | null;
12
- "status": string;
52
+ "labels": Array<string>;
53
+ "status": "active" | "paused" | "stopped" | "expired";
13
54
  "schedule"?: Record<string, unknown>;
14
55
  "target"?: Record<string, unknown>;
15
56
  "nextRunAt"?: string | null;
@@ -19,6 +60,7 @@ export interface Loop {
19
60
  export interface CreateLoopInput {
20
61
  "name": string;
21
62
  "description"?: string;
63
+ "labels"?: Array<string>;
22
64
  "schedule": Record<string, unknown>;
23
65
  "target": Record<string, unknown>;
24
66
  }
@@ -27,6 +69,7 @@ export interface UpdateLoopInput {
27
69
  "nextRunAt"?: string | null;
28
70
  "retryScheduledFor"?: string | null;
29
71
  "expiresAt"?: string | null;
72
+ "labels"?: Array<string>;
30
73
  }
31
74
  export interface Run {
32
75
  "id": string;
@@ -214,6 +257,75 @@ export interface ImportResponse {
214
257
  };
215
258
  "skippedRunning": number;
216
259
  }
260
+ export interface AgentSessionContract {
261
+ "version": 1;
262
+ "provider": "claude" | "cursor" | "codewith" | "codex" | "aicopilot" | "opencode";
263
+ "model"?: string;
264
+ "cwd"?: string;
265
+ "permissionMode": "default" | "plan" | "auto" | "bypass";
266
+ "sandbox": "read-only" | "workspace-write" | "danger-full-access" | "enabled" | "disabled" | "provider-default";
267
+ "manualBreakGlass": boolean;
268
+ "routing"?: {
269
+ "projectPath"?: string;
270
+ "projectGroup"?: string;
271
+ "taskId"?: string;
272
+ "eventId"?: string;
273
+ "eventType"?: string;
274
+ "eventSource"?: string;
275
+ "role"?: "triage" | "planner" | "worker" | "verifier";
276
+ };
277
+ "timeoutMs": number | null;
278
+ "restrictions": {
279
+ "tools"?: Array<string>;
280
+ "commands"?: Array<string>;
281
+ "enforcement": "metadata_only";
282
+ "providerEnforced": false;
283
+ };
284
+ "safetyReason"?: string;
285
+ }
286
+ export interface AgentSessionContractEventInput {
287
+ "claimToken": string;
288
+ "eventType": "agent_session_contract";
289
+ "stepId": string;
290
+ "payload": AgentSessionContract;
291
+ }
292
+ export interface GenericWorkflowEvent {
293
+ "id": string;
294
+ "workflowRunId": string;
295
+ "sequence": number;
296
+ "eventType": "created" | "workflow_archived" | "todos_workflow_pointers_synced" | "todos_workflow_pointers_sync_failed" | "step_started" | "step_progress" | "recovered" | "step_pending" | "step_running" | "step_succeeded" | "step_failed" | "step_timed_out" | "step_skipped" | "step_cancelled" | "succeeded" | "failed" | "timed_out" | "cancelled";
297
+ "stepId"?: string;
298
+ "payload"?: Record<string, unknown>;
299
+ "createdAt": string;
300
+ }
301
+ export interface AgentSessionContractWorkflowEvent {
302
+ "id": string;
303
+ "workflowRunId": string;
304
+ "sequence": number;
305
+ "eventType": "agent_session_contract";
306
+ "stepId": string;
307
+ "payload": AgentSessionContract;
308
+ "createdAt": string;
309
+ }
310
+ export interface CustomWorkflowEvent {
311
+ "id": string;
312
+ "workflowRunId": string;
313
+ "sequence": number;
314
+ "eventKind": "custom";
315
+ "eventType": string;
316
+ "stepId"?: string;
317
+ "payload"?: Record<string, unknown>;
318
+ "createdAt": string;
319
+ }
320
+ export type WorkflowEvent = AgentSessionContractWorkflowEvent | GenericWorkflowEvent | CustomWorkflowEvent;
321
+ export interface WorkflowEventResponse {
322
+ "ok": boolean;
323
+ "event": WorkflowEvent;
324
+ }
325
+ export interface WorkflowEventListResponse {
326
+ "ok": boolean;
327
+ "events": Array<WorkflowEvent>;
328
+ }
217
329
  export interface CountResponse {
218
330
  "ok": boolean;
219
331
  "count": number;
@@ -242,8 +354,25 @@ export declare class LoopsClient {
242
354
  private request;
243
355
  /** Liveness probe */
244
356
  healthCheck(init?: RequestInit): Promise<Foundation>;
357
+ healthzProbe(init?: RequestInit): Promise<Record<string, unknown>>;
358
+ openapiJsonProbe(init?: RequestInit): Promise<Record<string, unknown>>;
245
359
  /** Readiness probe (storage reachable + migrated) */
246
360
  readyCheck(init?: RequestInit): Promise<Foundation>;
361
+ readyzProbe(init?: RequestInit): Promise<Record<string, unknown>>;
362
+ /** status.read */
363
+ statusRead(init?: RequestInit): Promise<Record<string, unknown>>;
364
+ /** api.read */
365
+ apiRead(init?: RequestInit): Promise<Record<string, unknown>>;
366
+ /** goalRuns.list */
367
+ goalRunsList(init?: RequestInit): Promise<Record<string, unknown>>;
368
+ /** goals.list */
369
+ goalsList(init?: RequestInit): Promise<Record<string, unknown>>;
370
+ /** goals.get */
371
+ goalsGet(id: string, init?: RequestInit): Promise<Record<string, unknown>>;
372
+ /** goals.planNodes */
373
+ goalsPlanNodes(id: string, init?: RequestInit): Promise<Record<string, unknown>>;
374
+ /** history.prune */
375
+ historyPrune(init?: RequestInit): Promise<Record<string, unknown>>;
247
376
  /** Bulk id-preserving import (self-hosted backfill) */
248
377
  importRows(body: ImportInput, init?: RequestInit): Promise<ImportResponse>;
249
378
  /** List workflow route invocations */
@@ -252,6 +381,10 @@ export declare class LoopsClient {
252
381
  }, init?: RequestInit): Promise<WorkflowInvocationListResponse>;
253
382
  /** Create an id-preserving workflow route invocation */
254
383
  createWorkflowInvocation(body: CreateWorkflowInvocationInput, init?: RequestInit): Promise<WorkflowInvocationResponse>;
384
+ /** invocations.get */
385
+ invocationsGet(id: string, init?: RequestInit): Promise<Record<string, unknown>>;
386
+ /** leases.recover */
387
+ leasesRecover(init?: RequestInit): Promise<Record<string, unknown>>;
255
388
  /** List loops */
256
389
  listLoops(query?: {
257
390
  "status"?: "active" | "paused" | "stopped" | "expired";
@@ -259,6 +392,7 @@ export declare class LoopsClient {
259
392
  "offset"?: number;
260
393
  "includeArchived"?: boolean;
261
394
  "archived"?: boolean;
395
+ "labels"?: Array<string>;
262
396
  }, init?: RequestInit): Promise<LoopListResponse>;
263
397
  /** Create a loop */
264
398
  createLoop(body: CreateLoopInput, init?: RequestInit): Promise<LoopResponse>;
@@ -274,9 +408,11 @@ export declare class LoopsClient {
274
408
  deleteLoop(id: string, init?: RequestInit): Promise<DeleteResponse>;
275
409
  /** Update a loop (status / schedule fields) */
276
410
  updateLoop(id: string, body: UpdateLoopInput, init?: RequestInit): Promise<LoopResponse>;
277
- /** Archive a loop */
411
+ /** Archive a loop by id or name */
278
412
  archiveLoop(id: string, init?: RequestInit): Promise<LoopResponse>;
279
- /** Unarchive a loop */
413
+ /** loops.rename */
414
+ loopsRename(id: string, init?: RequestInit): Promise<Record<string, unknown>>;
415
+ /** Unarchive a loop by id or name */
280
416
  unarchiveLoop(id: string, init?: RequestInit): Promise<LoopResponse>;
281
417
  /** List run receipts */
282
418
  listRunReceipts(query?: {
@@ -291,10 +427,15 @@ export declare class LoopsClient {
291
427
  writeRunReceipt(body: WriteRunReceiptInput, init?: RequestInit): Promise<RunReceiptResponse>;
292
428
  /** Get a run receipt by run id */
293
429
  getRunReceipt(runId: string, init?: RequestInit): Promise<RunReceiptResponse>;
430
+ /** runners.claim */
431
+ runnersClaim(body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
432
+ /** runners.poll */
433
+ runnersPoll(body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
294
434
  /** List runs */
295
435
  listRuns(query?: {
296
436
  "loopId"?: string;
297
437
  "status"?: string;
438
+ "labels"?: Array<string>;
298
439
  "limit"?: number;
299
440
  "offset"?: number;
300
441
  "showOutput"?: boolean;
@@ -307,6 +448,57 @@ export declare class LoopsClient {
307
448
  getRun(id: string, query?: {
308
449
  "showOutput"?: boolean;
309
450
  }, init?: RequestInit): Promise<RunResponse>;
451
+ /** runs.evidence */
452
+ runsEvidence(id: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
453
+ /** runs.finalize */
454
+ runsFinalize(id: string, body: {
455
+ "claimToken": string;
456
+ "status": "succeeded" | "failed" | "timed_out";
457
+ "finishedAt"?: string;
458
+ "durationMs"?: number;
459
+ "stdout"?: string;
460
+ "stderr"?: string;
461
+ "error"?: string;
462
+ "exitCode"?: number;
463
+ "pid"?: number;
464
+ }, init?: RequestInit): Promise<Record<string, unknown>>;
465
+ /** runs.Goals.Create */
466
+ runsGoalsCreate(id: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
467
+ /** runs.Goals.Find */
468
+ runsGoalsFind(id: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
469
+ /** runs.Goals.Events */
470
+ runsGoalsEvents(id: string, goalId: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
471
+ /** runs.Goals.Get */
472
+ runsGoalsGet(id: string, goalId: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
473
+ /** runs.Goals.Plan.Nodes.Create */
474
+ runsGoalsPlanNodesCreate(id: string, goalId: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
475
+ /** runs.Goals.Plan.Nodes.List */
476
+ runsGoalsPlanNodesList(id: string, goalId: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
477
+ /** runs.Goals.Plan.Nodes.Update */
478
+ runsGoalsPlanNodesUpdate(id: string, goalId: string, key: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
479
+ /** runs.Goals.Status */
480
+ runsGoalsStatus(id: string, goalId: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
481
+ /** runs.heartbeat */
482
+ runsHeartbeat(id: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
483
+ /** runs.recover */
484
+ runsRecover(id: string, init?: RequestInit): Promise<Record<string, unknown>>;
485
+ /** runs.workflowRuns.create */
486
+ runsWorkflowRunsCreate(id: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
487
+ /** Validate a legacy runner-authored agent session contract */
488
+ runsWorkflowRunsEvents(id: string, workflowRunId: string, body: AgentSessionContractEventInput, init?: RequestInit): Promise<WorkflowEventResponse>;
489
+ /** runs.workflowRuns.finalize */
490
+ runsWorkflowRunsFinalize(id: string, workflowRunId: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
491
+ /** runs.workflowRuns.get */
492
+ runsWorkflowRunsGet(id: string, workflowRunId: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
493
+ /** runs.workflowRuns.recover */
494
+ runsWorkflowRunsRecover(id: string, workflowRunId: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
495
+ /** runs.workflowRuns.steps */
496
+ runsWorkflowRunsSteps(id: string, workflowRunId: string, body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
497
+ /** runs.workflowRuns.stepAction */
498
+ runsWorkflowRunsStepAction(id: string, workflowRunId: string, stepId: string, action: "get" | "start" | "pid" | "progress" | "skip" | "finalize", body: Record<string, unknown>, init?: RequestInit): Promise<Record<string, unknown>>;
499
+ /** api.status */
500
+ apiStatus(init?: RequestInit): Promise<Record<string, unknown>>;
501
+ v1VersionProbe(init?: RequestInit): Promise<Record<string, unknown>>;
310
502
  /** List workflow route work items */
311
503
  listWorkflowWorkItems(query?: {
312
504
  "status"?: string;
@@ -315,6 +507,20 @@ export declare class LoopsClient {
315
507
  }, init?: RequestInit): Promise<WorkflowWorkItemListResponse>;
316
508
  /** Upsert an id-preserving workflow route work item */
317
509
  upsertWorkflowWorkItem(body: UpsertWorkflowWorkItemInput, init?: RequestInit): Promise<WorkflowWorkItemResponse>;
510
+ /** workItems.get */
511
+ workItemsGet(id: string, init?: RequestInit): Promise<Record<string, unknown>>;
512
+ /** workflowRuns.list */
513
+ workflowRunsList(init?: RequestInit): Promise<Record<string, unknown>>;
514
+ /** workflowRuns.get */
515
+ workflowRunsGet(id: string, init?: RequestInit): Promise<Record<string, unknown>>;
516
+ /** workflowRuns.events */
517
+ workflowRunsEvents(id: string, init?: RequestInit): Promise<WorkflowEventListResponse>;
518
+ /** workflowRuns.recover */
519
+ workflowRunsRecover(id: string, body?: {
520
+ "reason"?: string;
521
+ }, init?: RequestInit): Promise<Record<string, unknown>>;
522
+ /** workflowRuns.steps */
523
+ workflowRunsSteps(id: string, init?: RequestInit): Promise<Record<string, unknown>>;
318
524
  /** List workflow specs */
319
525
  listWorkflows(query?: {
320
526
  "status"?: "active" | "archived";
@@ -329,6 +535,8 @@ export declare class LoopsClient {
329
535
  }, init?: RequestInit): Promise<CountResponse>;
330
536
  /** Get a workflow spec by id */
331
537
  getWorkflow(id: string, init?: RequestInit): Promise<WorkflowResponse>;
538
+ /** workflows.archive */
539
+ workflowsArchive(id: string, init?: RequestInit): Promise<Record<string, unknown>>;
332
540
  /** Service version */
333
541
  getVersion(init?: RequestInit): Promise<Foundation>;
334
542
  }
package/dist/sdk/http.js CHANGED
@@ -61,6 +61,20 @@ class LoopsClient {
61
61
  init
62
62
  });
63
63
  }
64
+ async healthzProbe(init) {
65
+ return this.request("GET", `/healthz`, {
66
+ body: undefined,
67
+ query: undefined,
68
+ init
69
+ });
70
+ }
71
+ async openapiJsonProbe(init) {
72
+ return this.request("GET", `/openapi.json`, {
73
+ body: undefined,
74
+ query: undefined,
75
+ init
76
+ });
77
+ }
64
78
  async readyCheck(init) {
65
79
  return this.request("GET", `/ready`, {
66
80
  body: undefined,
@@ -68,6 +82,62 @@ class LoopsClient {
68
82
  init
69
83
  });
70
84
  }
85
+ async readyzProbe(init) {
86
+ return this.request("GET", `/readyz`, {
87
+ body: undefined,
88
+ query: undefined,
89
+ init
90
+ });
91
+ }
92
+ async statusRead(init) {
93
+ return this.request("GET", `/status`, {
94
+ body: undefined,
95
+ query: undefined,
96
+ init
97
+ });
98
+ }
99
+ async apiRead(init) {
100
+ return this.request("GET", `/v1`, {
101
+ body: undefined,
102
+ query: undefined,
103
+ init
104
+ });
105
+ }
106
+ async goalRunsList(init) {
107
+ return this.request("GET", `/v1/goal-runs`, {
108
+ body: undefined,
109
+ query: undefined,
110
+ init
111
+ });
112
+ }
113
+ async goalsList(init) {
114
+ return this.request("GET", `/v1/goals`, {
115
+ body: undefined,
116
+ query: undefined,
117
+ init
118
+ });
119
+ }
120
+ async goalsGet(id, init) {
121
+ return this.request("GET", `/v1/goals/${encodeURIComponent(String(id))}`, {
122
+ body: undefined,
123
+ query: undefined,
124
+ init
125
+ });
126
+ }
127
+ async goalsPlanNodes(id, init) {
128
+ return this.request("GET", `/v1/goals/${encodeURIComponent(String(id))}/plan-nodes`, {
129
+ body: undefined,
130
+ query: undefined,
131
+ init
132
+ });
133
+ }
134
+ async historyPrune(init) {
135
+ return this.request("POST", `/v1/history/prune`, {
136
+ body: undefined,
137
+ query: undefined,
138
+ init
139
+ });
140
+ }
71
141
  async importRows(body, init) {
72
142
  return this.request("POST", `/v1/import`, {
73
143
  body,
@@ -89,6 +159,20 @@ class LoopsClient {
89
159
  init
90
160
  });
91
161
  }
162
+ async invocationsGet(id, init) {
163
+ return this.request("GET", `/v1/invocations/${encodeURIComponent(String(id))}`, {
164
+ body: undefined,
165
+ query: undefined,
166
+ init
167
+ });
168
+ }
169
+ async leasesRecover(init) {
170
+ return this.request("POST", `/v1/leases/recover`, {
171
+ body: undefined,
172
+ query: undefined,
173
+ init
174
+ });
175
+ }
92
176
  async listLoops(query, init) {
93
177
  return this.request("GET", `/v1/loops`, {
94
178
  body: undefined,
@@ -138,6 +222,13 @@ class LoopsClient {
138
222
  init
139
223
  });
140
224
  }
225
+ async loopsRename(id, init) {
226
+ return this.request("POST", `/v1/loops/${encodeURIComponent(String(id))}/rename`, {
227
+ body: undefined,
228
+ query: undefined,
229
+ init
230
+ });
231
+ }
141
232
  async unarchiveLoop(id, init) {
142
233
  return this.request("POST", `/v1/loops/${encodeURIComponent(String(id))}/unarchive`, {
143
234
  body: undefined,
@@ -166,6 +257,20 @@ class LoopsClient {
166
257
  init
167
258
  });
168
259
  }
260
+ async runnersClaim(body, init) {
261
+ return this.request("POST", `/v1/runners/claim`, {
262
+ body,
263
+ query: undefined,
264
+ init
265
+ });
266
+ }
267
+ async runnersPoll(body, init) {
268
+ return this.request("POST", `/v1/runners/poll`, {
269
+ body,
270
+ query: undefined,
271
+ init
272
+ });
273
+ }
169
274
  async listRuns(query, init) {
170
275
  return this.request("GET", `/v1/runs`, {
171
276
  body: undefined,
@@ -187,6 +292,153 @@ class LoopsClient {
187
292
  init
188
293
  });
189
294
  }
295
+ async runsEvidence(id, body, init) {
296
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/evidence`, {
297
+ body,
298
+ query: undefined,
299
+ init
300
+ });
301
+ }
302
+ async runsFinalize(id, body, init) {
303
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/finalize`, {
304
+ body,
305
+ query: undefined,
306
+ init
307
+ });
308
+ }
309
+ async runsGoalsCreate(id, body, init) {
310
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/goals`, {
311
+ body,
312
+ query: undefined,
313
+ init
314
+ });
315
+ }
316
+ async runsGoalsFind(id, body, init) {
317
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/goals/find`, {
318
+ body,
319
+ query: undefined,
320
+ init
321
+ });
322
+ }
323
+ async runsGoalsEvents(id, goalId, body, init) {
324
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/goals/${encodeURIComponent(String(goalId))}/events`, {
325
+ body,
326
+ query: undefined,
327
+ init
328
+ });
329
+ }
330
+ async runsGoalsGet(id, goalId, body, init) {
331
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/goals/${encodeURIComponent(String(goalId))}/get`, {
332
+ body,
333
+ query: undefined,
334
+ init
335
+ });
336
+ }
337
+ async runsGoalsPlanNodesCreate(id, goalId, body, init) {
338
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/goals/${encodeURIComponent(String(goalId))}/plan-nodes`, {
339
+ body,
340
+ query: undefined,
341
+ init
342
+ });
343
+ }
344
+ async runsGoalsPlanNodesList(id, goalId, body, init) {
345
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/goals/${encodeURIComponent(String(goalId))}/plan-nodes/list`, {
346
+ body,
347
+ query: undefined,
348
+ init
349
+ });
350
+ }
351
+ async runsGoalsPlanNodesUpdate(id, goalId, key, body, init) {
352
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/goals/${encodeURIComponent(String(goalId))}/plan-nodes/${encodeURIComponent(String(key))}`, {
353
+ body,
354
+ query: undefined,
355
+ init
356
+ });
357
+ }
358
+ async runsGoalsStatus(id, goalId, body, init) {
359
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/goals/${encodeURIComponent(String(goalId))}/status`, {
360
+ body,
361
+ query: undefined,
362
+ init
363
+ });
364
+ }
365
+ async runsHeartbeat(id, body, init) {
366
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/heartbeat`, {
367
+ body,
368
+ query: undefined,
369
+ init
370
+ });
371
+ }
372
+ async runsRecover(id, init) {
373
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/recover`, {
374
+ body: undefined,
375
+ query: undefined,
376
+ init
377
+ });
378
+ }
379
+ async runsWorkflowRunsCreate(id, body, init) {
380
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/workflow-runs`, {
381
+ body,
382
+ query: undefined,
383
+ init
384
+ });
385
+ }
386
+ async runsWorkflowRunsEvents(id, workflowRunId, body, init) {
387
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/workflow-runs/${encodeURIComponent(String(workflowRunId))}/events`, {
388
+ body,
389
+ query: undefined,
390
+ init
391
+ });
392
+ }
393
+ async runsWorkflowRunsFinalize(id, workflowRunId, body, init) {
394
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/workflow-runs/${encodeURIComponent(String(workflowRunId))}/finalize`, {
395
+ body,
396
+ query: undefined,
397
+ init
398
+ });
399
+ }
400
+ async runsWorkflowRunsGet(id, workflowRunId, body, init) {
401
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/workflow-runs/${encodeURIComponent(String(workflowRunId))}/get`, {
402
+ body,
403
+ query: undefined,
404
+ init
405
+ });
406
+ }
407
+ async runsWorkflowRunsRecover(id, workflowRunId, body, init) {
408
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/workflow-runs/${encodeURIComponent(String(workflowRunId))}/recover`, {
409
+ body,
410
+ query: undefined,
411
+ init
412
+ });
413
+ }
414
+ async runsWorkflowRunsSteps(id, workflowRunId, body, init) {
415
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/workflow-runs/${encodeURIComponent(String(workflowRunId))}/steps`, {
416
+ body,
417
+ query: undefined,
418
+ init
419
+ });
420
+ }
421
+ async runsWorkflowRunsStepAction(id, workflowRunId, stepId, action, body, init) {
422
+ return this.request("POST", `/v1/runs/${encodeURIComponent(String(id))}/workflow-runs/${encodeURIComponent(String(workflowRunId))}/steps/${encodeURIComponent(String(stepId))}/${encodeURIComponent(String(action))}`, {
423
+ body,
424
+ query: undefined,
425
+ init
426
+ });
427
+ }
428
+ async apiStatus(init) {
429
+ return this.request("GET", `/v1/status`, {
430
+ body: undefined,
431
+ query: undefined,
432
+ init
433
+ });
434
+ }
435
+ async v1VersionProbe(init) {
436
+ return this.request("GET", `/v1/version`, {
437
+ body: undefined,
438
+ query: undefined,
439
+ init
440
+ });
441
+ }
190
442
  async listWorkflowWorkItems(query, init) {
191
443
  return this.request("GET", `/v1/work-items`, {
192
444
  body: undefined,
@@ -201,6 +453,48 @@ class LoopsClient {
201
453
  init
202
454
  });
203
455
  }
456
+ async workItemsGet(id, init) {
457
+ return this.request("GET", `/v1/work-items/${encodeURIComponent(String(id))}`, {
458
+ body: undefined,
459
+ query: undefined,
460
+ init
461
+ });
462
+ }
463
+ async workflowRunsList(init) {
464
+ return this.request("GET", `/v1/workflow-runs`, {
465
+ body: undefined,
466
+ query: undefined,
467
+ init
468
+ });
469
+ }
470
+ async workflowRunsGet(id, init) {
471
+ return this.request("GET", `/v1/workflow-runs/${encodeURIComponent(String(id))}`, {
472
+ body: undefined,
473
+ query: undefined,
474
+ init
475
+ });
476
+ }
477
+ async workflowRunsEvents(id, init) {
478
+ return this.request("GET", `/v1/workflow-runs/${encodeURIComponent(String(id))}/events`, {
479
+ body: undefined,
480
+ query: undefined,
481
+ init
482
+ });
483
+ }
484
+ async workflowRunsRecover(id, body, init) {
485
+ return this.request("POST", `/v1/workflow-runs/${encodeURIComponent(String(id))}/recover`, {
486
+ body,
487
+ query: undefined,
488
+ init
489
+ });
490
+ }
491
+ async workflowRunsSteps(id, init) {
492
+ return this.request("GET", `/v1/workflow-runs/${encodeURIComponent(String(id))}/steps`, {
493
+ body: undefined,
494
+ query: undefined,
495
+ init
496
+ });
497
+ }
204
498
  async listWorkflows(query, init) {
205
499
  return this.request("GET", `/v1/workflows`, {
206
500
  body: undefined,
@@ -229,6 +523,13 @@ class LoopsClient {
229
523
  init
230
524
  });
231
525
  }
526
+ async workflowsArchive(id, init) {
527
+ return this.request("POST", `/v1/workflows/${encodeURIComponent(String(id))}/archive`, {
528
+ body: undefined,
529
+ query: undefined,
530
+ init
531
+ });
532
+ }
232
533
  async getVersion(init) {
233
534
  return this.request("GET", `/version`, {
234
535
  body: undefined,
@@ -6,8 +6,8 @@ import { tick } from "../lib/scheduler.js";
6
6
  import { Store } from "../lib/store.js";
7
7
  import { type LoopStore } from "../lib/store/index.js";
8
8
  export { runGoal } from "../lib/goal/runner.js";
9
- export { LOOPS_MIGRATION_SCHEMA, applyImportMigrationBundle, buildImportMigrationPlan, buildSelfHostedMigrationPlan, exportLoopsMigrationBundle, migrationHash, registerSelfHostedRunner, validateLoopsMigrationBundle, } from "../lib/migration.js";
10
- export type { ApplyLoopsMigrationResult, ExportLoopsMigrationOptions, ImportLoopsMigrationOptions, LoopsMigrationAction, LoopsMigrationBundle, LoopsMigrationPlan, LoopsMigrationPlanRow, LoopsMigrationPlanSummary, LoopsMigrationResource, RunnerRegistrationOptions, RunnerRegistrationResult, SelfHostedPlanOptions, } from "../lib/migration.js";
9
+ export { LOOPS_MIGRATION_SCHEMA, applyImportMigrationBundle, buildImportMigrationPlan, buildSelfHostedMigrationPlan, exportLoopsMigrationBundle, migrationHash, validateLoopsMigrationBundle, } from "../lib/migration.js";
10
+ export type { ApplyLoopsMigrationResult, ExportLoopsMigrationOptions, ImportLoopsMigrationOptions, LoopsMigrationAction, LoopsMigrationBundle, LoopsMigrationPlan, LoopsMigrationPlanRow, LoopsMigrationPlanSummary, LoopsMigrationResource, SelfHostedPlanOptions, } from "../lib/migration.js";
11
11
  export interface LoopsClientOptions {
12
12
  /**
13
13
  * Inject an on-box sqlite {@link Store} (mainly for tests and in-process local
@@ -28,6 +28,7 @@ export interface LoopsClientOptions {
28
28
  }
29
29
  export interface ListLoopsFilters {
30
30
  status?: LoopStatus;
31
+ labels?: string[];
31
32
  limit?: number;
32
33
  /** include archived loops alongside live ones */
33
34
  includeArchived?: boolean;
@@ -36,6 +37,7 @@ export interface ListLoopsFilters {
36
37
  }
37
38
  export interface ListRunsFilters {
38
39
  status?: RunStatus;
40
+ labels?: string[];
39
41
  limit?: number;
40
42
  }
41
43
  export interface ListRunReceiptsFilters {
@@ -70,6 +72,9 @@ export declare class LoopsClient {
70
72
  pause(idOrName: string): Promise<Loop>;
71
73
  resume(idOrName: string): Promise<Loop>;
72
74
  stop(idOrName: string): Promise<Loop>;
75
+ setLabels(idOrName: string, labels: string[]): Promise<Loop>;
76
+ addLabels(idOrName: string, labels: string[]): Promise<Loop>;
77
+ removeLabels(idOrName: string, labels: string[]): Promise<Loop>;
73
78
  archive(idOrName: string): Promise<Loop>;
74
79
  unarchive(idOrName: string): Promise<Loop>;
75
80
  delete(idOrName: string): Promise<boolean>;