@jamesaphoenix/tx-test-utils 0.5.3 → 0.5.5
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
CHANGED
|
@@ -17,6 +17,14 @@ tx init --codex # AGENTS.md + .codex/agents
|
|
|
17
17
|
tx init --claude --codex # scaffold both
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
Watchdog onboarding (optional, default off):
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
tx init --watchdog # scaffold watchdog assets with runtime auto-detect
|
|
24
|
+
tx init --watchdog --watchdog-runtime codex
|
|
25
|
+
tx init --watchdog --watchdog-runtime both
|
|
26
|
+
```
|
|
27
|
+
|
|
20
28
|
---
|
|
21
29
|
|
|
22
30
|
## The Problem
|
|
@@ -172,6 +180,30 @@ tx done $task
|
|
|
172
180
|
|
|
173
181
|
---
|
|
174
182
|
|
|
183
|
+
## Watchdog (Opt-In)
|
|
184
|
+
|
|
185
|
+
Use watchdog when you want detached, self-healing RALPH loops that can survive terminal closes and reconcile stale runs/tasks automatically.
|
|
186
|
+
|
|
187
|
+
Use it for:
|
|
188
|
+
- Long-running unattended execution
|
|
189
|
+
- Automatic stalled-run reaping and orphan task reset
|
|
190
|
+
- Background supervision through launchd/systemd
|
|
191
|
+
|
|
192
|
+
Skip it for:
|
|
193
|
+
- Short interactive sessions
|
|
194
|
+
- One-off local runs you supervise manually
|
|
195
|
+
|
|
196
|
+
Quick start:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
tx init --watchdog --watchdog-runtime auto
|
|
200
|
+
./scripts/watchdog-launcher.sh start
|
|
201
|
+
./scripts/watchdog-launcher.sh status
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Detailed rollout, detached service setup, rollback, and troubleshooting:
|
|
205
|
+
- [Watchdog Runbook](apps/docs/content/docs/watchdog-runbook.mdx)
|
|
206
|
+
|
|
175
207
|
## Why tx?
|
|
176
208
|
|
|
177
209
|
| | Native Tasks | CLAUDE.md | tx |
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module @tx/test-utils/factories/task
|
|
5
5
|
*/
|
|
6
|
-
import type { Task, TaskStatus } from "@jamesaphoenix/tx-types";
|
|
6
|
+
import type { Task, TaskAssigneeType, TaskStatus } from "@jamesaphoenix/tx-types";
|
|
7
7
|
import type { TestDatabase } from "../database/index.js";
|
|
8
8
|
/**
|
|
9
9
|
* Options for creating a test task.
|
|
@@ -27,6 +27,14 @@ export interface CreateTaskOptions {
|
|
|
27
27
|
createdAt?: Date;
|
|
28
28
|
/** Completion timestamp (only if status is 'done') */
|
|
29
29
|
completedAt?: Date | null;
|
|
30
|
+
/** Task assignee type */
|
|
31
|
+
assigneeType?: TaskAssigneeType | null;
|
|
32
|
+
/** Task assignee identifier */
|
|
33
|
+
assigneeId?: string | null;
|
|
34
|
+
/** Task assigned timestamp */
|
|
35
|
+
assignedAt?: Date | null;
|
|
36
|
+
/** Assignment source */
|
|
37
|
+
assignedBy?: string | null;
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
40
|
* Factory class for creating test tasks.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.factory.d.ts","sourceRoot":"","sources":["../../src/factories/task.factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,IAAI,
|
|
1
|
+
{"version":3,"file":"task.factory.d.ts","sourceRoot":"","sources":["../../src/factories/task.factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,IAAI,EACJ,gBAAgB,EAEhB,UAAU,EACX,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGxD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,iBAAiB;IACjB,KAAK,CAAC,EAAE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YAAY,CACV,aAAa,EAAE,iBAAiB,EAChC,UAAU,EAAE,MAAM,EAClB,YAAY,GAAE,iBAAsB,GACnC;QAAE,MAAM,EAAE,IAAI,CAAC;QAAC,QAAQ,EAAE,IAAI,EAAE,CAAA;KAAE;IASrC;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GACzB,IAAI,YAAY,EAChB,UAAS,iBAAsB,KAC9B,IAGF,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAC1B,IAAI,YAAY,EAChB,OAAO,MAAM,EACb,UAAS,iBAAsB,KAC9B,IAAI,EAGN,CAAA"}
|
|
@@ -49,6 +49,10 @@ export class TaskFactory {
|
|
|
49
49
|
const metadata = options.metadata ?? {};
|
|
50
50
|
const createdAt = options.createdAt ?? now;
|
|
51
51
|
const completedAt = options.completedAt ?? (status === "done" ? now : null);
|
|
52
|
+
const assigneeType = options.assigneeType ?? null;
|
|
53
|
+
const assigneeId = options.assigneeId ?? null;
|
|
54
|
+
const assignedAt = options.assignedAt ?? null;
|
|
55
|
+
const assignedBy = options.assignedBy ?? null;
|
|
52
56
|
this.db.run(`INSERT INTO tasks (id, title, description, status, parent_id, score, metadata, created_at, updated_at, completed_at)
|
|
53
57
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
54
58
|
id,
|
|
@@ -72,7 +76,11 @@ export class TaskFactory {
|
|
|
72
76
|
metadata,
|
|
73
77
|
createdAt,
|
|
74
78
|
updatedAt: now,
|
|
75
|
-
completedAt
|
|
79
|
+
completedAt,
|
|
80
|
+
assigneeType,
|
|
81
|
+
assigneeId,
|
|
82
|
+
assignedAt,
|
|
83
|
+
assignedBy
|
|
76
84
|
};
|
|
77
85
|
}
|
|
78
86
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.factory.js","sourceRoot":"","sources":["../../src/factories/task.factory.ts"],"names":[],"mappings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;IACnC,OAAO,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AAC3C,CAAC,CAAA"}
|
|
@@ -56,7 +56,7 @@ export interface SharedTestLayer<L> {
|
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
export declare const createSharedTestLayer: () => Promise<{
|
|
59
|
-
layer: Layer.Layer<import("@jamesaphoenix/tx-core").MigrationService | import("@jamesaphoenix/tx-core").SqliteClient | import("@jamesaphoenix/tx-core").TaskRepository | import("@jamesaphoenix/tx-core").DependencyRepository | import("@jamesaphoenix/tx-core").LearningRepository | import("@jamesaphoenix/tx-core").FileLearningRepository | import("@jamesaphoenix/tx-core").AttemptRepository | import("@jamesaphoenix/tx-core").RunRepository | import("@jamesaphoenix/tx-core").AnchorRepository | import("@jamesaphoenix/tx-core").EdgeRepository | import("@jamesaphoenix/tx-core").DeduplicationRepository | import("@jamesaphoenix/tx-core").CandidateRepository | import("@jamesaphoenix/tx-core").TrackedProjectRepository | import("@jamesaphoenix/tx-core").WorkerRepository | import("@jamesaphoenix/tx-core").ClaimRepository | import("@jamesaphoenix/tx-core").OrchestratorStateRepository | import("@jamesaphoenix/tx-core").TaskService | import("@jamesaphoenix/tx-core").DependencyService | import("@jamesaphoenix/tx-core").ReadyService | import("@jamesaphoenix/tx-core").HierarchyService | import("@jamesaphoenix/tx-core").EdgeService | import("@jamesaphoenix/tx-core").GraphExpansionService | import("@jamesaphoenix/tx-core").FeedbackTrackerService | import("@jamesaphoenix/tx-core").DiversifierService | import("@jamesaphoenix/tx-core").RetrieverService | import("@jamesaphoenix/tx-core").LearningService | import("@jamesaphoenix/tx-core").FileLearningService | import("@jamesaphoenix/tx-core").AttemptService | import("@jamesaphoenix/tx-core").AnchorVerificationService | import("@jamesaphoenix/tx-core").AnchorService | import("@jamesaphoenix/tx-core").DeduplicationService | import("@jamesaphoenix/tx-core").SyncService | import("@jamesaphoenix/tx-core").SwarmVerificationService | import("@jamesaphoenix/tx-core").PromotionService | import("@jamesaphoenix/tx-core").WorkerService | import("@jamesaphoenix/tx-core").ClaimService | import("@jamesaphoenix/tx-core").OrchestratorService | import("@jamesaphoenix/tx-core").DaemonService | import("@jamesaphoenix/tx-core").TracingService | import("@jamesaphoenix/tx-core").CompactionRepository | import("@jamesaphoenix/tx-core").CompactionService | import("@jamesaphoenix/tx-core").ValidationService | import("@jamesaphoenix/tx-core").MessageRepository | import("@jamesaphoenix/tx-core").MessageService | import("@jamesaphoenix/tx-core").DocRepository | import("@jamesaphoenix/tx-core").DocService, import("@jamesaphoenix/tx-core").DatabaseError, never>;
|
|
59
|
+
layer: Layer.Layer<import("@jamesaphoenix/tx-core").MigrationService | import("@jamesaphoenix/tx-core").SqliteClient | import("@jamesaphoenix/tx-core").TaskRepository | import("@jamesaphoenix/tx-core").DependencyRepository | import("@jamesaphoenix/tx-core").LearningRepository | import("@jamesaphoenix/tx-core").FileLearningRepository | import("@jamesaphoenix/tx-core").AttemptRepository | import("@jamesaphoenix/tx-core").RunRepository | import("@jamesaphoenix/tx-core").AnchorRepository | import("@jamesaphoenix/tx-core").EdgeRepository | import("@jamesaphoenix/tx-core").DeduplicationRepository | import("@jamesaphoenix/tx-core").CandidateRepository | import("@jamesaphoenix/tx-core").TrackedProjectRepository | import("@jamesaphoenix/tx-core").WorkerRepository | import("@jamesaphoenix/tx-core").ClaimRepository | import("@jamesaphoenix/tx-core").OrchestratorStateRepository | import("@jamesaphoenix/tx-core").TaskService | import("@jamesaphoenix/tx-core").DependencyService | import("@jamesaphoenix/tx-core").ReadyService | import("@jamesaphoenix/tx-core").HierarchyService | import("@jamesaphoenix/tx-core").EdgeService | import("@jamesaphoenix/tx-core").GraphExpansionService | import("@jamesaphoenix/tx-core").FeedbackTrackerService | import("@jamesaphoenix/tx-core").DiversifierService | import("@jamesaphoenix/tx-core").RetrieverService | import("@jamesaphoenix/tx-core").LearningService | import("@jamesaphoenix/tx-core").FileLearningService | import("@jamesaphoenix/tx-core").AttemptService | import("@jamesaphoenix/tx-core").AnchorVerificationService | import("@jamesaphoenix/tx-core").AnchorService | import("@jamesaphoenix/tx-core").DeduplicationService | import("@jamesaphoenix/tx-core").SyncService | import("@jamesaphoenix/tx-core").SwarmVerificationService | import("@jamesaphoenix/tx-core").PromotionService | import("@jamesaphoenix/tx-core").WorkerService | import("@jamesaphoenix/tx-core").RunHeartbeatService | import("@jamesaphoenix/tx-core").ClaimService | import("@jamesaphoenix/tx-core").OrchestratorService | import("@jamesaphoenix/tx-core").DaemonService | import("@jamesaphoenix/tx-core").TracingService | import("@jamesaphoenix/tx-core").CompactionRepository | import("@jamesaphoenix/tx-core").CompactionService | import("@jamesaphoenix/tx-core").ValidationService | import("@jamesaphoenix/tx-core").MessageRepository | import("@jamesaphoenix/tx-core").MessageService | import("@jamesaphoenix/tx-core").DocRepository | import("@jamesaphoenix/tx-core").DocService, import("@jamesaphoenix/tx-core").DatabaseError, never>;
|
|
60
60
|
reset: () => Promise<void>;
|
|
61
61
|
close: () => Promise<void>;
|
|
62
62
|
getDb: () => Database;
|