gestalt-mobile 0.43.0 → 0.44.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 +8 -0
- package/dist/client/assets/{index-BLgr7z1T.js → index-6WgZCe9g.js} +44 -44
- package/dist/client/assets/{index-5-CmBBPG.css → index-BKls66uM.css} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/server/composition.contracts.js +80 -0
- package/dist/server/server/composition.js +35 -8
- package/dist/server/server/platform/plans/filesystem-plan-status-source.js +42 -1
- package/package.json +1 -1
|
@@ -25,6 +25,8 @@ export class FilesystemPlanStatusSource {
|
|
|
25
25
|
}
|
|
26
26
|
async open(session, listener) {
|
|
27
27
|
this.leases.get(session.id)?.close();
|
|
28
|
+
if (!(await stat(session.workspacePath)).isDirectory())
|
|
29
|
+
throw new Error('WORKSPACE_NOT_DIRECTORY');
|
|
28
30
|
const statusDirectory = planStatusDirectoryPath(session.workspacePath, session.id);
|
|
29
31
|
await mkdir(this.dismissalDirectory, { recursive: true, mode: 0o700 });
|
|
30
32
|
await mkdir(statusDirectory, { recursive: true, mode: 0o700 });
|
|
@@ -39,6 +41,42 @@ export class FilesystemPlanStatusSource {
|
|
|
39
41
|
await lease.start();
|
|
40
42
|
return lease;
|
|
41
43
|
}
|
|
44
|
+
/** Explicit attachments use the same durable publication and watchers as helper updates. */
|
|
45
|
+
async attach(session, requestedPath, listener, reason = 'supervision-start') {
|
|
46
|
+
const [planPath, workspacePath] = await Promise.all([
|
|
47
|
+
this.planReadFilesystem.realpath(requestedPath),
|
|
48
|
+
this.planReadFilesystem.realpath(session.workspacePath),
|
|
49
|
+
]);
|
|
50
|
+
if (!isPlanPathWithinWorkspace(planPath, workspacePath))
|
|
51
|
+
throw new Error('PATH_OUTSIDE_WORKSPACE');
|
|
52
|
+
const parsed = parseSupervisedPlan({
|
|
53
|
+
source: await this.planReadFilesystem.readFile(planPath, 'utf8'),
|
|
54
|
+
planPath,
|
|
55
|
+
workspacePath,
|
|
56
|
+
});
|
|
57
|
+
if (parsed.kind !== 'available')
|
|
58
|
+
throw new Error('PLAN_UNAVAILABLE');
|
|
59
|
+
const directory = planStatusDirectoryPath(workspacePath, session.id);
|
|
60
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
61
|
+
const statusPath = planStatusFilePath(directory, planPath);
|
|
62
|
+
const candidate = join(directory, `.${randomUUID()}.status.tmp`);
|
|
63
|
+
try {
|
|
64
|
+
await writeFile(candidate, JSON.stringify({ schemaVersion: 1, planPath, reason, updatedAt: new Date().toISOString() }), { mode: 0o600 });
|
|
65
|
+
await rename(candidate, statusPath);
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
await rm(candidate, { force: true }).catch(() => { });
|
|
69
|
+
}
|
|
70
|
+
const identity = createHash('sha256').update(planPath).digest('hex');
|
|
71
|
+
const dismissed = new Set(await this.dismissed(session.id));
|
|
72
|
+
if (dismissed.delete(identity))
|
|
73
|
+
await this.saveDismissals(session.id, dismissed);
|
|
74
|
+
const lease = this.leases.get(session.id);
|
|
75
|
+
if (lease)
|
|
76
|
+
await lease.refreshLatest();
|
|
77
|
+
else
|
|
78
|
+
await this.open(session, listener);
|
|
79
|
+
}
|
|
42
80
|
closeAll() {
|
|
43
81
|
for (const lease of this.leases.values())
|
|
44
82
|
lease.close();
|
|
@@ -92,9 +130,12 @@ export class FilesystemPlanStatusSource {
|
|
|
92
130
|
}
|
|
93
131
|
}
|
|
94
132
|
async dismiss(sessionId, identity) {
|
|
95
|
-
const path = this.dismissalPath(sessionId);
|
|
96
133
|
const dismissed = await this.dismissed(sessionId);
|
|
97
134
|
const next = new Set(dismissed).add(identity);
|
|
135
|
+
await this.saveDismissals(sessionId, next);
|
|
136
|
+
}
|
|
137
|
+
async saveDismissals(sessionId, next) {
|
|
138
|
+
const path = this.dismissalPath(sessionId);
|
|
98
139
|
const candidate = join(this.dismissalDirectory, `.${randomUUID()}.dismissals.tmp`);
|
|
99
140
|
try {
|
|
100
141
|
await this.dismissalFilesystem.writeFile(candidate, JSON.stringify([...next]), {
|