@hasna/loops 0.2.0 → 0.3.1
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/README.md +25 -4
- package/dist/cli/index.js +686 -88
- package/dist/daemon/daemon.d.ts +1 -0
- package/dist/daemon/index.js +474 -71
- package/dist/daemon/install.d.ts +8 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +644 -79
- package/dist/lib/doctor.d.ts +13 -0
- package/dist/lib/env.d.ts +4 -0
- package/dist/lib/executor.d.ts +8 -0
- package/dist/lib/format.d.ts +3 -0
- package/dist/lib/scheduler.d.ts +12 -0
- package/dist/lib/store.d.ts +10 -0
- package/dist/lib/store.js +157 -20
- package/dist/lib/workflow-runner.d.ts +4 -1
- package/dist/sdk/index.js +440 -79
- package/dist/types.d.ts +3 -2
- package/docs/USAGE.md +25 -4
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -58,8 +58,8 @@ export interface WorkflowTarget {
|
|
|
58
58
|
export type ExecutableTarget = CommandTarget | AgentTarget;
|
|
59
59
|
export type LoopTarget = ExecutableTarget | WorkflowTarget;
|
|
60
60
|
export type WorkflowStatus = "active" | "archived";
|
|
61
|
-
export type WorkflowRunStatus = "running" | "succeeded" | "failed" | "timed_out";
|
|
62
|
-
export type WorkflowStepRunStatus = "pending" | "running" | "succeeded" | "failed" | "timed_out" | "skipped";
|
|
61
|
+
export type WorkflowRunStatus = "running" | "succeeded" | "failed" | "timed_out" | "cancelled";
|
|
62
|
+
export type WorkflowStepRunStatus = "pending" | "running" | "succeeded" | "failed" | "timed_out" | "skipped" | "cancelled";
|
|
63
63
|
export interface WorkflowStep {
|
|
64
64
|
id: string;
|
|
65
65
|
name?: string;
|
|
@@ -111,6 +111,7 @@ export interface WorkflowStepRun {
|
|
|
111
111
|
startedAt?: string;
|
|
112
112
|
finishedAt?: string;
|
|
113
113
|
exitCode?: number;
|
|
114
|
+
pid?: number;
|
|
114
115
|
durationMs?: number;
|
|
115
116
|
stdout?: string;
|
|
116
117
|
stderr?: string;
|
package/docs/USAGE.md
CHANGED
|
@@ -95,7 +95,8 @@ Create a workflow JSON file:
|
|
|
95
95
|
"id": "status",
|
|
96
96
|
"target": {
|
|
97
97
|
"type": "command",
|
|
98
|
-
"command": "git
|
|
98
|
+
"command": "git",
|
|
99
|
+
"args": ["status", "--short"],
|
|
99
100
|
"cwd": "/path/to/repo"
|
|
100
101
|
}
|
|
101
102
|
},
|
|
@@ -117,15 +118,32 @@ Create a workflow JSON file:
|
|
|
117
118
|
Save, run, inspect, and schedule it:
|
|
118
119
|
|
|
119
120
|
```bash
|
|
121
|
+
loops workflows validate repo-morning.json
|
|
122
|
+
loops workflows validate repo-morning.json --preflight
|
|
120
123
|
loops workflows create repo-morning.json
|
|
121
124
|
loops workflows run repo-morning --show-output
|
|
122
125
|
loops workflows runs repo-morning
|
|
126
|
+
loops workflows inspect <workflow-run-id>
|
|
123
127
|
loops workflows events <workflow-run-id>
|
|
128
|
+
loops workflows cancel <workflow-run-id> --reason "no longer needed"
|
|
129
|
+
loops workflows recover <workflow-run-id>
|
|
124
130
|
loops create workflow repo-morning-loop --workflow repo-morning --cron "0 8 * * *"
|
|
125
131
|
```
|
|
126
132
|
|
|
127
133
|
Workflow specs are stored separately from loops. A loop can schedule a workflow, but workflow runs and step runs have their own durable rows and events. Steps run in dependency order and a scheduled workflow run is idempotent per loop slot.
|
|
128
134
|
|
|
135
|
+
For command steps, `command` is the executable when `shell` is not true. Put flags in `args`:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{ "type": "command", "command": "git", "args": ["status", "--short"] }
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Use `shell: true` only when you intentionally want shell parsing:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{ "type": "command", "command": "git status --short", "shell": true }
|
|
145
|
+
```
|
|
146
|
+
|
|
129
147
|
## Manage
|
|
130
148
|
|
|
131
149
|
```bash
|
|
@@ -148,6 +166,7 @@ loops daemon start
|
|
|
148
166
|
loops daemon status
|
|
149
167
|
loops daemon logs
|
|
150
168
|
loops daemon stop
|
|
169
|
+
loops doctor
|
|
151
170
|
```
|
|
152
171
|
|
|
153
172
|
Run in the foreground for supervised environments:
|
|
@@ -160,9 +179,10 @@ Install startup integration:
|
|
|
160
179
|
|
|
161
180
|
```bash
|
|
162
181
|
loops daemon install
|
|
182
|
+
loops daemon install --enable
|
|
163
183
|
```
|
|
164
184
|
|
|
165
|
-
On Linux this writes a user systemd service. On macOS it writes a LaunchAgent plist. The command prints the exact enable/load commands to run.
|
|
185
|
+
On Linux this writes a user systemd service. On macOS it writes a LaunchAgent plist. The command prints the exact enable/load commands to run. `--enable` runs the user-service enable/start command when supported.
|
|
166
186
|
|
|
167
187
|
## Scheduling Contract
|
|
168
188
|
|
|
@@ -183,10 +203,11 @@ On Linux this writes a user systemd service. On macOS it writes a LaunchAgent pl
|
|
|
183
203
|
The adapters intentionally use provider command surfaces instead of pretending every agent has one SDK:
|
|
184
204
|
|
|
185
205
|
- Claude uses `claude -p --output-format json` and safe-mode/local setting sources by default.
|
|
186
|
-
- Codewith uses `codewith exec --json --ephemeral --
|
|
206
|
+
- Codewith uses `codewith --ask-for-approval never exec --json --ephemeral --skip-git-repo-check`.
|
|
187
207
|
- AI Copilot and OpenCode use `run --format json --pure`.
|
|
188
208
|
- Cursor is CLI-first for now via `cursor-agent -p`; treat output as less stable until a stronger public SDK contract is selected.
|
|
189
209
|
- Codex uses `codex exec --json --ephemeral --ask-for-approval never`.
|
|
190
|
-
- When `--account` or a step `account` is set, OpenLoops resolves `accounts env <profile> --tool <tool>` before spawning the target, strips inherited tool home/API-key variables, and applies the selected profile only to that process.
|
|
210
|
+
- When `--account` or a step `account` is set, OpenLoops resolves `accounts env <profile> --tool <tool>` before spawning the target, strips inherited tool home/API-key variables, and applies the selected profile only to that process. Missing account profiles fail before the provider binary receives the prompt.
|
|
211
|
+
- Daemon and scheduled runs prepend common user executable directories such as `~/.local/bin` and `~/.bun/bin` before resolving provider CLIs.
|
|
191
212
|
|
|
192
213
|
For production loops that can mutate repos, prefer disposable worktrees and explicit prompts that name allowed write scope.
|