@ue-shed/project-custodian 0.2.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,eAAO,MAAM,iBAAiB,0DAAgE,CAAC;AAC/F,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAE9D,eAAO,MAAM,mBAAmB,4DAAkE,CAAC;AACnG,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAC;AAElE,eAAO,MAAM,sBAAsB,kDAA0C,CAAC;AAC9E,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC,IAAI,CAAC;AAExE,eAAO,MAAM,gBAAgB,sLAa3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAC;AAE5D,eAAO,MAAM,eAAe,qHAM1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;AAE1D,eAAO,MAAM,eAAe;;;;;;;EAO1B,CAAC;AACH,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC;CAAG;AAEtF,eAAO,MAAM,kBAAkB;;;;;;EAM7B,CAAC;AACH,MAAM,WAAW,kBAAmB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC;CAAG;AAE5F,eAAO,MAAM,eAAe;;;;;;;;;EAS1B,CAAC;AACH,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC;CAAG;AAEtF,eAAO,MAAM,gBAAgB;;;;;EAW3B,CAAC;AAC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;AAEJ,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;EAe3B,CAAC;AACH,MAAM,WAAW,gBAAiB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC;CAAG;AAExF,eAAO,MAAM,0BAA0B;;;6BAAmD,CAAC;AAC3F,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAA8C,CAAC;AACjF,eAAO,MAAM,6BAA6B;;;;;;6BAAsD,CAAC;AACjG,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAAgD,CAAC;AACrF,eAAO,MAAM,6BAA6B;;;sCAAsD,CAAC;AACjG,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;6BAA+C,CAAC"}
package/dist/schema.js ADDED
@@ -0,0 +1,217 @@
1
+ import { Schema } from "effect";
2
+ const Bytes = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
3
+ const NonNegativeNumber = Schema.Number.check(Schema.isGreaterThanOrEqualTo(0));
4
+ export const CustodianTargetId = Schema.NonEmptyString.pipe(Schema.brand("CustodianTargetId"));
5
+ export const CustodianProposalId = Schema.NonEmptyString.pipe(Schema.brand("CustodianProposalId"));
6
+ export const CustodianExecutionMode = Schema.Literals(["trash", "permanent"]);
7
+ export const ProjectTargetKey = Schema.Literals([
8
+ "intermediate",
9
+ "plugin_intermediate",
10
+ "binaries",
11
+ "plugin_binaries",
12
+ "build",
13
+ "ddc",
14
+ "cooked",
15
+ "staged",
16
+ "logs",
17
+ "crashes",
18
+ "autosaves",
19
+ "saved_config"
20
+ ]);
21
+ export const EngineTargetKey = Schema.Literals([
22
+ "engine_ddc",
23
+ "engine_logs",
24
+ "engine_crashes",
25
+ "engine_intermediate",
26
+ "engine_binaries"
27
+ ]);
28
+ export const CustodianPolicy = Schema.Struct({
29
+ enabled: Schema.Boolean,
30
+ minAgeDays: NonNegativeNumber,
31
+ minFreeGb: NonNegativeNumber,
32
+ keepBinariesForCpp: Schema.Boolean,
33
+ targets: Schema.Array(ProjectTargetKey),
34
+ source: Schema.Literals(["default", "project"])
35
+ });
36
+ export const CustodianFreshness = Schema.Struct({
37
+ authoredAt: Schema.optionalKey(Schema.String),
38
+ lastSessionAt: Schema.optionalKey(Schema.String),
39
+ effectiveAt: Schema.optionalKey(Schema.String),
40
+ ageDays: Schema.optionalKey(NonNegativeNumber),
41
+ mtimesLookRewritten: Schema.Boolean
42
+ });
43
+ export const CustodianTarget = Schema.Struct({
44
+ id: CustodianTargetId,
45
+ key: Schema.Union([ProjectTargetKey, EngineTargetKey]),
46
+ path: Schema.NonEmptyString,
47
+ relativePath: Schema.NonEmptyString,
48
+ bytes: Bytes,
49
+ description: Schema.NonEmptyString,
50
+ rebuildCost: Schema.NonEmptyString,
51
+ risk: Schema.Literals(["low", "medium", "high", "critical"])
52
+ });
53
+ export const CustodianRefusal = Schema.Struct({
54
+ path: Schema.NonEmptyString,
55
+ relativePath: Schema.NonEmptyString,
56
+ code: Schema.Literals([
57
+ "protected_path",
58
+ "outside_root",
59
+ "different_volume",
60
+ "installed_engine",
61
+ "unreadable"
62
+ ]),
63
+ reason: Schema.NonEmptyString
64
+ });
65
+ export const CustodianDiagnostic = Schema.Struct({
66
+ code: Schema.Literals([
67
+ "invalid_policy",
68
+ "descriptor_unreadable",
69
+ "target_unreadable",
70
+ "discovery_incomplete",
71
+ "cross_volume_skipped",
72
+ "hardlink_excluded"
73
+ ]),
74
+ message: Schema.NonEmptyString,
75
+ path: Schema.optionalKey(Schema.NonEmptyString)
76
+ });
77
+ export const ProjectEligibility = Schema.Union([
78
+ Schema.Struct({ kind: Schema.Literal("candidate") }),
79
+ Schema.Struct({ kind: Schema.Literal("opted_out") }),
80
+ Schema.Struct({ kind: Schema.Literal("recent"), eligibleAfterDays: NonNegativeNumber }),
81
+ Schema.Struct({ kind: Schema.Literal("unknown_age") }),
82
+ Schema.Struct({ kind: Schema.Literal("empty") }),
83
+ Schema.Struct({ kind: Schema.Literal("invalid_policy") })
84
+ ]);
85
+ export const CustodianProjectReport = Schema.Struct({
86
+ kind: Schema.Literal("project"),
87
+ name: Schema.NonEmptyString,
88
+ root: Schema.NonEmptyString,
89
+ descriptor: Schema.NonEmptyString,
90
+ engineAssociation: Schema.NonEmptyString,
91
+ isCpp: Schema.Boolean,
92
+ policy: CustodianPolicy,
93
+ freshness: CustodianFreshness,
94
+ eligibility: ProjectEligibility,
95
+ targets: Schema.Array(CustodianTarget),
96
+ refusals: Schema.Array(CustodianRefusal),
97
+ diagnostics: Schema.Array(CustodianDiagnostic),
98
+ reclaimableBytes: Bytes
99
+ });
100
+ export const CustodianEngineReport = Schema.Struct({
101
+ kind: Schema.Literal("engine"),
102
+ name: Schema.NonEmptyString,
103
+ root: Schema.NonEmptyString,
104
+ version: Schema.NonEmptyString,
105
+ buildKind: Schema.Literals(["installed", "source"]),
106
+ targets: Schema.Array(CustodianTarget),
107
+ refusals: Schema.Array(CustodianRefusal),
108
+ diagnostics: Schema.Array(CustodianDiagnostic),
109
+ reclaimableBytes: Bytes
110
+ });
111
+ export const CustodianPlanItem = Schema.Struct({
112
+ kind: Schema.Literals(["project", "engine"]),
113
+ name: Schema.NonEmptyString,
114
+ root: Schema.NonEmptyString,
115
+ bytes: Bytes,
116
+ targets: Schema.Array(CustodianTarget)
117
+ });
118
+ export const CustodianPlan = Schema.Struct({
119
+ status: Schema.Literals(["ready", "pressure_satisfied", "nothing_eligible"]),
120
+ freeBytes: Bytes,
121
+ thresholdBytes: Bytes,
122
+ projectedFreeBytes: Bytes,
123
+ reclaimableBytes: Bytes,
124
+ items: Schema.Array(CustodianPlanItem)
125
+ });
126
+ export const CustodianScanRequest = Schema.Struct({
127
+ root: Schema.NonEmptyString,
128
+ ignorePressure: Schema.optionalKey(Schema.Boolean)
129
+ });
130
+ export const CustodianReport = Schema.Struct({
131
+ schemaVersion: Schema.Literal(2),
132
+ root: Schema.NonEmptyString,
133
+ measuredAt: Schema.String,
134
+ freeBytes: Bytes,
135
+ totalReclaimableBytes: Bytes,
136
+ projects: Schema.Array(CustodianProjectReport),
137
+ engines: Schema.Array(CustodianEngineReport),
138
+ diagnostics: Schema.Array(CustodianDiagnostic),
139
+ plan: CustodianPlan,
140
+ destructiveOperationsAvailable: Schema.Literal(true)
141
+ });
142
+ export const CustodianProposalTarget = Schema.Struct({
143
+ kind: Schema.Literals(["project", "engine"]),
144
+ name: Schema.NonEmptyString,
145
+ root: Schema.NonEmptyString,
146
+ target: CustodianTarget
147
+ });
148
+ export const CustodianPrepareRequest = Schema.Struct({
149
+ root: Schema.NonEmptyString,
150
+ ignorePressure: Schema.optionalKey(Schema.Boolean),
151
+ mode: CustodianExecutionMode,
152
+ proposalDirectory: Schema.NonEmptyString,
153
+ targetIds: Schema.Array(CustodianTargetId).check(Schema.isMinLength(1))
154
+ });
155
+ export const CustodianProposal = Schema.Struct({
156
+ schemaVersion: Schema.Literal(1),
157
+ id: CustodianProposalId,
158
+ createdAt: Schema.String,
159
+ root: Schema.NonEmptyString,
160
+ ignorePressure: Schema.Boolean,
161
+ mode: CustodianExecutionMode,
162
+ proposalPath: Schema.NonEmptyString,
163
+ receiptPath: Schema.NonEmptyString,
164
+ logPath: Schema.NonEmptyString,
165
+ approvalPhrase: Schema.NonEmptyString,
166
+ bytes: Bytes,
167
+ targets: Schema.Array(CustodianProposalTarget).check(Schema.isMinLength(1))
168
+ });
169
+ export const CustodianExecuteRequest = Schema.Struct({
170
+ proposalPath: Schema.NonEmptyString,
171
+ approvalPhrase: Schema.NonEmptyString
172
+ });
173
+ export const CustodianCancelResult = Schema.Struct({
174
+ proposalId: CustodianProposalId,
175
+ status: Schema.Literals(["cancelled", "not_running"])
176
+ });
177
+ export const CustodianExecutionRefusal = Schema.Struct({
178
+ code: Schema.Literals([
179
+ "approval_mismatch",
180
+ "editor_running",
181
+ "proposal_stale",
182
+ "target_invalid"
183
+ ]),
184
+ message: Schema.NonEmptyString,
185
+ recovery: Schema.NonEmptyString
186
+ });
187
+ export const CustodianExecutionEntry = Schema.Struct({
188
+ targetId: CustodianTargetId,
189
+ path: Schema.NonEmptyString,
190
+ relativePath: Schema.NonEmptyString,
191
+ bytes: Bytes,
192
+ status: Schema.Literals(["trashed", "deleted", "failed", "cancelled"]),
193
+ message: Schema.optionalKey(Schema.NonEmptyString)
194
+ });
195
+ export const CustodianReceipt = Schema.Struct({
196
+ schemaVersion: Schema.Literal(1),
197
+ proposalId: CustodianProposalId,
198
+ proposalPath: Schema.NonEmptyString,
199
+ receiptPath: Schema.NonEmptyString,
200
+ logPath: Schema.NonEmptyString,
201
+ root: Schema.NonEmptyString,
202
+ mode: CustodianExecutionMode,
203
+ startedAt: Schema.String,
204
+ finishedAt: Schema.String,
205
+ status: Schema.Literals(["completed", "partial", "cancelled", "refused"]),
206
+ plannedBytes: Bytes,
207
+ processedBytes: Bytes,
208
+ entries: Schema.Array(CustodianExecutionEntry),
209
+ refusal: Schema.optionalKey(CustodianExecutionRefusal)
210
+ });
211
+ export const decodeCustodianScanRequest = Schema.decodeUnknownEffect(CustodianScanRequest);
212
+ export const decodeCustodianReport = Schema.decodeUnknownEffect(CustodianReport);
213
+ export const decodeCustodianPrepareRequest = Schema.decodeUnknownEffect(CustodianPrepareRequest);
214
+ export const decodeCustodianProposal = Schema.decodeUnknownEffect(CustodianProposal);
215
+ export const decodeCustodianExecuteRequest = Schema.decodeUnknownEffect(CustodianExecuteRequest);
216
+ export const decodeCustodianReceipt = Schema.decodeUnknownEffect(CustodianReceipt);
217
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC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E,SAAS,CAAC,CAAC;IACzE,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC;IAC9C,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,yBAAyB,CAAC;CACtD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;AAC3F,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC;AACjF,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;AACjG,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AACrF,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;AACjG,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Context, Effect, Layer, Schema } from "effect";
2
+ import { CustodianExecuteRequest, CustodianPrepareRequest, CustodianProposal, CustodianProposalId, CustodianScanRequest, type CustodianCancelResult, type CustodianReceipt, type CustodianReport } from "./schema.js";
3
+ declare const CustodianError_base: Schema.Class<CustodianError, Schema.TaggedStruct<"ProjectCustodian.Error", {
4
+ readonly code: Schema.Literals<readonly ["invalid_request", "scan_failed", "prepare_failed", "invalid_proposal", "execution_in_progress", "execution_failed"]>;
5
+ readonly message: Schema.String;
6
+ readonly recovery: Schema.String;
7
+ readonly retrySafe: Schema.Boolean;
8
+ readonly cause: Schema.Defect;
9
+ }>, import("effect/Cause").YieldableError>;
10
+ export declare class CustodianError extends CustodianError_base {
11
+ }
12
+ export interface CustodianApi {
13
+ readonly scan: (request: CustodianScanRequest) => Effect.Effect<CustodianReport, CustodianError>;
14
+ readonly prepare: (request: CustodianPrepareRequest) => Effect.Effect<CustodianProposal, CustodianError>;
15
+ readonly execute: (request: CustodianExecuteRequest) => Effect.Effect<CustodianReceipt, CustodianError>;
16
+ readonly cancel: (proposalId: CustodianProposalId) => Effect.Effect<CustodianCancelResult, CustodianError>;
17
+ }
18
+ declare const Custodian_base: Context.ServiceClass<Custodian, "@ue-shed/project-custodian/Custodian", CustodianApi>;
19
+ export declare class Custodian extends Custodian_base {
20
+ }
21
+ export declare const CustodianNodeLive: Layer.Layer<Custodian, never, never>;
22
+ export declare function makeCustodianTestLayer(service: CustodianApi): Layer.Layer<Custodian>;
23
+ export {};
24
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAO,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQ7D,OAAO,EACN,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EAGpB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,MAAM,aAAa,CAAC;;;;;;;;AAErB,qBAAa,cAAe,SAAQ,mBAgBnC;CAAG;AAEJ,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,CACd,OAAO,EAAE,oBAAoB,KACzB,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,CACjB,OAAO,EAAE,uBAAuB,KAC5B,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;IACtD,QAAQ,CAAC,OAAO,EAAE,CACjB,OAAO,EAAE,uBAAuB,KAC5B,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,CAChB,UAAU,EAAE,mBAAmB,KAC3B,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,cAAc,CAAC,CAAC;CAC1D;;AAED,qBAAa,SAAU,SAAQ,cAE9B;CAAG;AAeJ,eAAO,MAAM,iBAAiB,sCA8K7B,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAEpF"}
@@ -0,0 +1,151 @@
1
+ import { Context, Effect, Layer, Ref, Schema } from "effect";
2
+ import { custodianProposalStorageIsValid, executeCustodianProposal, prepareCustodianProposal, readCustodianProposalDocument } from "./node-executor.js";
3
+ import { scanCustodian } from "./node-scanner.js";
4
+ import { CustodianExecuteRequest, CustodianPrepareRequest, CustodianProposal, CustodianProposalId, CustodianScanRequest, decodeCustodianReceipt, decodeCustodianReport } from "./schema.js";
5
+ export class CustodianError extends Schema.TaggedErrorClass()("ProjectCustodian.Error", {
6
+ code: Schema.Literals([
7
+ "invalid_request",
8
+ "scan_failed",
9
+ "prepare_failed",
10
+ "invalid_proposal",
11
+ "execution_in_progress",
12
+ "execution_failed"
13
+ ]),
14
+ message: Schema.String,
15
+ recovery: Schema.String,
16
+ retrySafe: Schema.Boolean,
17
+ cause: Schema.Defect()
18
+ }) {
19
+ }
20
+ export class Custodian extends Context.Service()("@ue-shed/project-custodian/Custodian") {
21
+ }
22
+ function invalidRequest(operation, cause) {
23
+ return new CustodianError({
24
+ code: "invalid_request",
25
+ message: `The Project Custodian ${operation} request is invalid.`,
26
+ recovery: operation === "scan"
27
+ ? "Provide one readable directory as the explicit scan root."
28
+ : "Review the schema-owned request and retry without changing any target paths.",
29
+ retrySafe: false,
30
+ cause
31
+ });
32
+ }
33
+ export const CustodianNodeLive = Layer.effect(Custodian, Effect.gen(function* () {
34
+ const activeExecutions = yield* Ref.make(new Map());
35
+ const scan = Effect.fn("ProjectCustodian.scan")(function* (input) {
36
+ const request = yield* Schema.decodeUnknownEffect(CustodianScanRequest)(input).pipe(Effect.mapError((cause) => invalidRequest("scan", cause)));
37
+ const report = yield* Effect.tryPromise({
38
+ try: (signal) => scanCustodian(request, signal),
39
+ catch: (cause) => new CustodianError({
40
+ code: "scan_failed",
41
+ message: `Project Custodian could not scan ${request.root}.`,
42
+ recovery: "Choose a readable directory and retry. No files were changed.",
43
+ retrySafe: true,
44
+ cause
45
+ })
46
+ });
47
+ return yield* decodeCustodianReport(report).pipe(Effect.mapError((cause) => new CustodianError({
48
+ code: "scan_failed",
49
+ message: "Project Custodian produced an invalid report.",
50
+ recovery: "Update UE Shed and retry the scan. No files were changed.",
51
+ retrySafe: false,
52
+ cause
53
+ })));
54
+ });
55
+ const prepare = Effect.fn("ProjectCustodian.prepare")(function* (input) {
56
+ const request = yield* Schema.decodeUnknownEffect(CustodianPrepareRequest)(input).pipe(Effect.mapError((cause) => invalidRequest("prepare", cause)));
57
+ return yield* Effect.tryPromise({
58
+ try: (signal) => prepareCustodianProposal(request, signal),
59
+ catch: (cause) => new CustodianError({
60
+ code: "prepare_failed",
61
+ message: "Project Custodian could not create a cleanup proposal.",
62
+ recovery: "Rescan the root, select only targets in the current plan, and retry. No files were changed.",
63
+ retrySafe: true,
64
+ cause
65
+ })
66
+ });
67
+ });
68
+ const execute = Effect.fn("ProjectCustodian.execute")(function* (input) {
69
+ const request = yield* Schema.decodeUnknownEffect(CustodianExecuteRequest)(input).pipe(Effect.mapError((cause) => invalidRequest("execute", cause)));
70
+ const document = yield* Effect.tryPromise({
71
+ try: () => readCustodianProposalDocument(request.proposalPath),
72
+ catch: (cause) => new CustodianError({
73
+ code: "invalid_proposal",
74
+ message: "Project Custodian could not read the cleanup proposal.",
75
+ recovery: "Prepare a fresh proposal and review it before approving cleanup.",
76
+ retrySafe: false,
77
+ cause
78
+ })
79
+ });
80
+ const proposal = yield* Schema.decodeUnknownEffect(CustodianProposal)(document).pipe(Effect.mapError((cause) => new CustodianError({
81
+ code: "invalid_proposal",
82
+ message: "Project Custodian rejected a malformed cleanup proposal.",
83
+ recovery: "Prepare a fresh proposal and do not edit its JSON document.",
84
+ retrySafe: false,
85
+ cause
86
+ })));
87
+ if (!custodianProposalStorageIsValid(proposal, request.proposalPath)) {
88
+ return yield* Effect.fail(new CustodianError({
89
+ code: "invalid_proposal",
90
+ message: "Project Custodian rejected unsafe proposal storage paths.",
91
+ recovery: "Prepare a fresh proposal and do not move or edit its JSON document.",
92
+ retrySafe: false,
93
+ cause: proposal
94
+ }));
95
+ }
96
+ const controller = new AbortController();
97
+ const acquired = yield* Ref.modify(activeExecutions, (current) => {
98
+ if (current.has(proposal.id))
99
+ return [false, current];
100
+ const next = new Map(current);
101
+ next.set(proposal.id, controller);
102
+ return [true, next];
103
+ });
104
+ if (!acquired) {
105
+ return yield* Effect.fail(new CustodianError({
106
+ code: "execution_in_progress",
107
+ message: "This cleanup proposal is already executing.",
108
+ recovery: "Wait for the active run or cancel its remaining targets.",
109
+ retrySafe: true,
110
+ cause: proposal.id
111
+ }));
112
+ }
113
+ const cleanup = Effect.tryPromise({
114
+ try: (signal) => executeCustodianProposal(proposal, request.approvalPhrase, AbortSignal.any([signal, controller.signal])),
115
+ catch: (cause) => new CustodianError({
116
+ code: "execution_failed",
117
+ message: "Project Custodian could not finish the cleanup operation.",
118
+ recovery: "Inspect the proposal event log and receipt, then rescan before retrying any remaining targets.",
119
+ retrySafe: false,
120
+ cause
121
+ })
122
+ }).pipe(Effect.flatMap(decodeCustodianReceipt), Effect.mapError((cause) => cause instanceof CustodianError
123
+ ? cause
124
+ : new CustodianError({
125
+ code: "execution_failed",
126
+ message: "Project Custodian produced an invalid cleanup receipt.",
127
+ recovery: "Inspect the event log and rescan before retrying any remaining targets.",
128
+ retrySafe: false,
129
+ cause
130
+ })), Effect.ensuring(Ref.update(activeExecutions, (current) => {
131
+ const next = new Map(current);
132
+ next.delete(proposal.id);
133
+ return next;
134
+ })));
135
+ return yield* cleanup;
136
+ });
137
+ const cancel = Effect.fn("ProjectCustodian.cancel")(function* (proposalId) {
138
+ const decodedId = yield* Schema.decodeUnknownEffect(CustodianProposalId)(proposalId).pipe(Effect.mapError((cause) => invalidRequest("execute", cause)));
139
+ const active = (yield* Ref.get(activeExecutions)).get(decodedId);
140
+ if (active === undefined) {
141
+ return { proposalId: decodedId, status: "not_running" };
142
+ }
143
+ active.abort(new Error("Cleanup cancelled by the user."));
144
+ return { proposalId: decodedId, status: "cancelled" };
145
+ });
146
+ return Custodian.of({ scan, prepare, execute, cancel });
147
+ }));
148
+ export function makeCustodianTestLayer(service) {
149
+ return Layer.succeed(Custodian, Custodian.of(service));
150
+ }
151
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EACN,+BAA+B,EAC/B,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACN,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EAIrB,MAAM,aAAa,CAAC;AAErB,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,gBAAgB,EAAkB,CAC5E,wBAAwB,EACxB;IACC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC;QACrB,iBAAiB;QACjB,aAAa;QACb,gBAAgB;QAChB,kBAAkB;QAClB,uBAAuB;QACvB,kBAAkB;KAClB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,QAAQ,EAAE,MAAM,CAAC,MAAM;IACvB,SAAS,EAAE,MAAM,CAAC,OAAO;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AAC;QACD,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAC;QAC1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,WAAoB,EAAE,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;AACzD,CAAC,CAAC,CACF,CAAC;AAEF,MAAM,UAAU,sBAAsB,CAAC,OAAqB;IAC3D,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AACxD,CAAC"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@ue-shed/project-custodian",
3
+ "version": "0.2.0",
4
+ "description": "Guarded cleanup planning and execution for regeneratable Unreal storage.",
5
+ "homepage": "https://github.com/ue-shed/ue-shed#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/ue-shed/ue-shed/issues"
8
+ },
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/ue-shed/ue-shed.git",
13
+ "directory": "packages/project-custodian"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "type": "module",
21
+ "sideEffects": false,
22
+ "main": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ },
29
+ "./browser": {
30
+ "types": "./dist/browser.d.ts",
31
+ "import": "./dist/browser.js"
32
+ }
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "dependencies": {
38
+ "effect": "4.0.0-beta.98",
39
+ "trash": "10.1.1"
40
+ },
41
+ "devDependencies": {
42
+ "@effect/vitest": "4.0.0-beta.98"
43
+ },
44
+ "engines": {
45
+ "node": ">=22.14.0"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc -p tsconfig.build.json",
49
+ "typecheck": "tsc --noEmit"
50
+ }
51
+ }