@hasna/loops 0.3.1 → 0.3.3
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 +21 -1
- package/dist/cli/index.js +510 -159
- package/dist/daemon/index.js +447 -146
- package/dist/index.js +446 -146
- package/dist/lib/executor.d.ts +2 -2
- package/dist/lib/format.d.ts +2 -1
- package/dist/lib/scheduler.d.ts +10 -1
- package/dist/lib/store.d.ts +21 -12
- package/dist/lib/store.js +304 -107
- package/dist/sdk/index.js +446 -146
- package/dist/types.d.ts +5 -0
- package/docs/USAGE.md +21 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface AgentTarget {
|
|
|
44
44
|
cwd?: string;
|
|
45
45
|
model?: string;
|
|
46
46
|
agent?: string;
|
|
47
|
+
authProfile?: string;
|
|
47
48
|
extraArgs?: string[];
|
|
48
49
|
timeoutMs?: number;
|
|
49
50
|
configIsolation?: AgentConfigIsolation;
|
|
@@ -193,3 +194,7 @@ export interface ExecutorResult {
|
|
|
193
194
|
finishedAt: string;
|
|
194
195
|
durationMs: number;
|
|
195
196
|
}
|
|
197
|
+
export interface PersistGuardOptions {
|
|
198
|
+
beforePersist?: () => void;
|
|
199
|
+
daemonLeaseId?: string;
|
|
200
|
+
}
|
package/docs/USAGE.md
CHANGED
|
@@ -76,6 +76,17 @@ loops create agent supply-chain-watch \
|
|
|
76
76
|
--prompt "Check for suspicious dependency or supply-chain changes. Report only concrete findings."
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
Run a Codewith loop with a Codewith-native auth profile:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
loops create agent supply-chain-watch \
|
|
83
|
+
--provider codewith \
|
|
84
|
+
--auth-profile account001 \
|
|
85
|
+
--every 15m \
|
|
86
|
+
--cwd /path/to/repo \
|
|
87
|
+
--prompt "Check for suspicious dependency or supply-chain changes. Report only concrete findings."
|
|
88
|
+
```
|
|
89
|
+
|
|
79
90
|
For `codewith` and `aicopilot` account isolation, register matching OpenAccounts tools first if they are not built in on the machine:
|
|
80
91
|
|
|
81
92
|
```bash
|
|
@@ -157,7 +168,13 @@ loops remove <id-or-name>
|
|
|
157
168
|
loops run-now <id-or-name>
|
|
158
169
|
```
|
|
159
170
|
|
|
160
|
-
Use `--json` for machine-readable output. Prompt bodies and run stdout/stderr are redacted by default in status output.
|
|
171
|
+
Use `--json` for machine-readable output. Prompt bodies and run stdout/stderr are redacted by default in status output. `loops run-now` exits non-zero when the recorded run fails or times out.
|
|
172
|
+
|
|
173
|
+
`loops run-now` reports the manual run source:
|
|
174
|
+
|
|
175
|
+
- `source=ad_hoc`: the loop was not due yet, so OpenLoops created a one-off manual slot. This is a single immediate attempt and does not schedule retries or consume the future scheduled slot.
|
|
176
|
+
- `source=due_slot`: the persisted scheduled slot was already due, so the manual run claims that slot and advances or retries the loop using normal scheduler rules.
|
|
177
|
+
- `source=retry_slot`: the loop was waiting on a failed slot retry, so the manual run claims that retry slot and advances the loop using normal retry rules.
|
|
161
178
|
|
|
162
179
|
## Daemon
|
|
163
180
|
|
|
@@ -196,6 +213,7 @@ On Linux this writes a user systemd service. On macOS it writes a LaunchAgent pl
|
|
|
196
213
|
- `overlap=skip` by default: a due slot records a skipped run if a previous run is still active.
|
|
197
214
|
- Each run is keyed by `(loop_id, scheduled_for)` so a slot is claimed once.
|
|
198
215
|
- Failed slots retry only when `--attempts` is greater than `1`; retries keep the original `scheduled_for` value.
|
|
216
|
+
- Failed ad-hoc manual `run-now` slots are single attempts and do not schedule retries. Due-slot and retry-slot manual runs use normal retry behavior.
|
|
199
217
|
- Running rows have leases. If a daemon dies, a later daemon marks expired running rows as `abandoned`.
|
|
200
218
|
|
|
201
219
|
## Agent Adapter Notes
|
|
@@ -207,7 +225,9 @@ The adapters intentionally use provider command surfaces instead of pretending e
|
|
|
207
225
|
- AI Copilot and OpenCode use `run --format json --pure`.
|
|
208
226
|
- Cursor is CLI-first for now via `cursor-agent -p`; treat output as less stable until a stronger public SDK contract is selected.
|
|
209
227
|
- Codex uses `codex exec --json --ephemeral --ask-for-approval never`.
|
|
228
|
+
- Agent prompts are sent through child stdin instead of argv so prompt bodies do not appear in process listings.
|
|
210
229
|
- 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.
|
|
230
|
+
- `--auth-profile` and step `authProfile` are provider-native auth selectors. They currently apply to Codewith and are passed to Codewith as `--auth-profile <name>` before `exec`; they do not call OpenAccounts.
|
|
211
231
|
- Daemon and scheduled runs prepend common user executable directories such as `~/.local/bin` and `~/.bun/bin` before resolving provider CLIs.
|
|
212
232
|
|
|
213
233
|
For production loops that can mutate repos, prefer disposable worktrees and explicit prompts that name allowed write scope.
|