@hasna/loops 0.3.59 → 0.4.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +247 -0
  2. package/LICENSE +197 -13
  3. package/README.md +28 -60
  4. package/dist/cli/index.js +7269 -5776
  5. package/dist/daemon/control.d.ts +21 -1
  6. package/dist/daemon/daemon.d.ts +5 -0
  7. package/dist/daemon/index.js +2985 -1072
  8. package/dist/daemon/install.d.ts +1 -1
  9. package/dist/index.d.ts +21 -8
  10. package/dist/index.js +5906 -4580
  11. package/dist/lib/accounts.d.ts +6 -1
  12. package/dist/lib/agent-adapter.d.ts +74 -0
  13. package/dist/lib/backup.d.ts +25 -0
  14. package/dist/lib/errors.d.ts +21 -0
  15. package/dist/lib/executor.d.ts +10 -1
  16. package/dist/lib/goal/metadata.d.ts +16 -0
  17. package/dist/lib/goal/model-factory.d.ts +1 -0
  18. package/dist/lib/goal/prompts.d.ts +3 -1
  19. package/dist/lib/goal/types.d.ts +3 -0
  20. package/dist/lib/health.d.ts +1 -1
  21. package/dist/lib/ids.d.ts +8 -1
  22. package/dist/lib/machines.d.ts +6 -0
  23. package/dist/lib/process-identity.d.ts +16 -0
  24. package/dist/lib/{schedule.d.ts → recurrence.d.ts} +1 -0
  25. package/dist/lib/redact.d.ts +21 -0
  26. package/dist/lib/route/cursors.d.ts +18 -0
  27. package/dist/lib/route/drain.d.ts +6 -0
  28. package/dist/lib/route/fields.d.ts +27 -0
  29. package/dist/lib/route/gates.d.ts +26 -0
  30. package/dist/lib/route/index.d.ts +18 -0
  31. package/dist/lib/route/options.d.ts +31 -0
  32. package/dist/lib/route/parse.d.ts +8 -0
  33. package/dist/lib/route/pr-review.d.ts +11 -0
  34. package/dist/lib/route/provider.d.ts +41 -0
  35. package/dist/lib/route/route-event.d.ts +23 -0
  36. package/dist/lib/route/route-tasks.d.ts +75 -0
  37. package/dist/lib/route/throttle.d.ts +47 -0
  38. package/dist/lib/route/todos-cli.d.ts +21 -0
  39. package/dist/lib/route/types.d.ts +88 -0
  40. package/dist/lib/run-artifacts.d.ts +17 -2
  41. package/dist/lib/run-envelope.d.ts +41 -0
  42. package/dist/lib/scheduler.d.ts +78 -2
  43. package/dist/lib/store.d.ts +63 -0
  44. package/dist/lib/store.js +1011 -266
  45. package/dist/lib/template-kit.d.ts +70 -0
  46. package/dist/lib/templates-custom.d.ts +34 -0
  47. package/dist/lib/templates.d.ts +13 -81
  48. package/dist/lib/workflow-runner.d.ts +2 -0
  49. package/dist/mcp/index.d.ts +3 -0
  50. package/dist/mcp/index.js +3313 -1165
  51. package/dist/sdk/index.d.ts +29 -3
  52. package/dist/sdk/index.js +2910 -897
  53. package/dist/test-helpers.d.ts +37 -0
  54. package/dist/types.d.ts +2 -0
  55. package/docs/USAGE.md +40 -18
  56. package/package.json +6 -3
@@ -1,18 +1,38 @@
1
- import type { CreateLoopInput, Goal, GoalRun, Loop, LoopRun, OpenAutomationsRuntimeBinding } from "../types.js";
1
+ import type { CreateLoopInput, Goal, GoalRun, Loop, LoopRun, LoopStatus, OpenAutomationsRuntimeBinding, RunStatus } from "../types.js";
2
+ import { type DoctorReport } from "../lib/doctor.js";
3
+ import { type LoopsHealthReport } from "../lib/health.js";
2
4
  import { tick } from "../lib/scheduler.js";
3
5
  import { Store } from "../lib/store.js";
4
6
  export { runGoal } from "../lib/goal/runner.js";
5
7
  export interface LoopsClientOptions {
6
8
  store?: Store;
9
+ /**
10
+ * Claim owner id for inline runs. Keep the `<surface>:<pid>` shape (see
11
+ * INLINE_RUNNER_ID_PATTERN in lib/scheduler.ts; default `sdk:<pid>`) so a
12
+ * starting daemon can see the owner process is still alive and will not
13
+ * reap the run's process group out from under it.
14
+ */
7
15
  runnerId?: string;
8
16
  }
17
+ export interface ListLoopsFilters {
18
+ status?: LoopStatus;
19
+ limit?: number;
20
+ /** include archived loops alongside live ones */
21
+ includeArchived?: boolean;
22
+ /** return only archived loops */
23
+ archivedOnly?: boolean;
24
+ }
25
+ export interface ListRunsFilters {
26
+ status?: RunStatus;
27
+ limit?: number;
28
+ }
9
29
  export declare class LoopsClient {
10
30
  readonly store: Store;
11
31
  private readonly ownStore;
12
32
  private readonly runnerId;
13
33
  constructor(opts?: LoopsClientOptions);
14
34
  create(input: CreateLoopInput): Loop;
15
- list(): Loop[];
35
+ list(filters?: ListLoopsFilters): Loop[];
16
36
  get(idOrName: string): Loop;
17
37
  pause(idOrName: string): Loop;
18
38
  resume(idOrName: string): Loop;
@@ -20,7 +40,13 @@ export declare class LoopsClient {
20
40
  archive(idOrName: string): Loop;
21
41
  unarchive(idOrName: string): Loop;
22
42
  delete(idOrName: string): boolean;
23
- runs(loopId?: string): LoopRun[];
43
+ runs(idOrName?: string, filters?: ListRunsFilters): LoopRun[];
44
+ doctor(): DoctorReport;
45
+ health(opts?: {
46
+ includeArchived?: boolean;
47
+ includeInactive?: boolean;
48
+ limit?: number;
49
+ }): LoopsHealthReport;
24
50
  goal(idOrName: string): {
25
51
  goal?: Goal;
26
52
  runs: GoalRun[];