@nowcrew/daemon 0.6.60 → 0.6.63

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.
Files changed (46) hide show
  1. package/dist/agent-ability/materializer.js +1 -20
  2. package/dist/automatic-install-target.js +10 -15
  3. package/dist/computer-cli.js +1 -10
  4. package/dist/computer-service.js +1 -41
  5. package/dist/config.js +0 -35
  6. package/dist/daemon-migration-controller.js +18 -16
  7. package/dist/execution-runner.js +0 -1
  8. package/dist/local-executor.js +1 -44
  9. package/dist/machine-info.js +2 -3
  10. package/dist/main.js +0 -83
  11. package/dist/managed-service-lifecycle.js +2 -47
  12. package/dist/managed-service-startup.js +0 -2
  13. package/dist/profile-layout.js +4 -10
  14. package/dist/runner.js +0 -1
  15. package/dist/serve.js +3 -64
  16. package/dist/workspace.js +1 -24
  17. package/package.json +10 -9
  18. package/dist/local-memory/index-budget.js +0 -74
  19. package/dist/local-memory/pending.js +0 -111
  20. package/dist/local-memory/runtime.js +0 -87
  21. package/dist/local-memory/types.js +0 -1
  22. package/dist/local-memory/write.js +0 -448
  23. package/dist/storage-config.js +0 -175
  24. package/dist/storage-control.js +0 -131
  25. package/dist/storage-copy.js +0 -444
  26. package/dist/storage-credential-guard.js +0 -21
  27. package/dist/storage-doctor.js +0 -175
  28. package/dist/storage-identity.js +0 -29
  29. package/dist/storage-layout.js +0 -143
  30. package/dist/storage-manifest.js +0 -440
  31. package/dist/storage-migration-controller.js +0 -417
  32. package/dist/storage-migration-manifest.js +0 -105
  33. package/dist/storage-migration-policy.js +0 -100
  34. package/dist/storage-runtime-controller.js +0 -313
  35. package/dist/storage-runtime-readiness.js +0 -184
  36. package/dist/storage-runtime.js +0 -39
  37. package/dist/storage-safe-fs.js +0 -293
  38. package/dist/storage-serve-adapter.js +0 -65
  39. package/dist/storage-status-delivery.js +0 -201
  40. package/dist/storage-status-replay.js +0 -125
  41. package/dist/storage-target-confirmation.js +0 -129
  42. package/dist/storage-worker-command.js +0 -27
  43. package/dist/storage-worker-executor.js +0 -383
  44. package/dist/storage-worker-handoff.js +0 -151
  45. package/dist/storage-worker-operation.js +0 -283
  46. package/dist/storage-worker-status.js +0 -105
@@ -1,313 +0,0 @@
1
- import { createHash } from "node:crypto";
2
- import { dirname, join } from "node:path";
3
- import { z } from "zod";
4
- import { buildServiceSpec } from "./computer-service.js";
5
- import { buildManagedServiceRecord } from "./managed-service-lifecycle.js";
6
- import { createStorageControlController } from "./storage-control.js";
7
- import { runStorageDoctor } from "./storage-doctor.js";
8
- import { storageHelloIdentity } from "./storage-identity.js";
9
- import { storageLayout, validateStorageEnvironment } from "./storage-layout.js";
10
- import { StorageMigrationFailure } from "./storage-migration-controller.js";
11
- import { launchStorageMigrationWorker, writeStorageWorkerHandoff } from "./storage-worker-handoff.js";
12
- import { writeStorageWorkerOperation } from "./storage-worker-operation.js";
13
- import { latestSourceStorageMigrationReceipt, monitorStorageMigrationStatus, storageMigrationStatusReplay, } from "./storage-status-replay.js";
14
- const UUID = z.string().uuid();
15
- function fingerprint(value) {
16
- return `sha256:${createHash("sha256").update(value).digest("hex")}`;
17
- }
18
- function deterministicUuid(value) {
19
- const chars = createHash("sha256").update(value).digest("hex").slice(0, 32).split("");
20
- chars[12] = "4";
21
- chars[16] = ((Number.parseInt(chars[16], 16) & 0x3) | 0x8).toString(16);
22
- const hex = chars.join("");
23
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
24
- }
25
- function storageId(input, workspaceId) {
26
- return `storage_${createHash("sha256").update([
27
- input.serverUrl.replace(/\/+$/u, ""), input.profile, workspaceId, input.nowworkHome,
28
- ].join("\0")).digest("hex").slice(0, 32)}`;
29
- }
30
- function installationBase(input, workspaceId, migrationId, createdAt) {
31
- const layout = storageLayout({
32
- nowworkHome: input.nowworkHome,
33
- environment: input.environment,
34
- workspaceId,
35
- runtimeBase: input.local.runtimeBase,
36
- platform: input.platform,
37
- });
38
- return {
39
- version: 1,
40
- installationId: deterministicUuid(`installation\0${input.serverUrl}\0${input.profile}\0${workspaceId}\0${input.nowworkHome}`),
41
- profile: input.profile,
42
- serverUrl: input.serverUrl,
43
- environment: input.environment,
44
- workspaceId,
45
- storageId: storageId(input, workspaceId),
46
- nowworkHome: input.nowworkHome,
47
- runtimeRoot: layout.runtimeRoot,
48
- credentialRef: `profile:${input.profile}`,
49
- ...(migrationId === undefined ? {} : { storageMigrationId: migrationId }),
50
- createdAt,
51
- updatedAt: createdAt,
52
- };
53
- }
54
- function targetRecord(input, workspaceId, createdAt) {
55
- const layout = storageLayout({
56
- nowworkHome: input.nowworkHome,
57
- environment: input.environment,
58
- workspaceId,
59
- runtimeBase: input.local.runtimeBase,
60
- platform: input.platform,
61
- });
62
- const spec = buildServiceSpec({
63
- platform: input.platform,
64
- profile: input.profile,
65
- userHome: input.userHome,
66
- uid: input.uid,
67
- nodePath: input.sourceRecord.nodePath,
68
- entryPath: input.sourceRecord.entryPath,
69
- profileHome: input.local.configRoot,
70
- ...(input.serviceEnvironment === undefined ? {} : { environment: input.serviceEnvironment }),
71
- });
72
- return buildManagedServiceRecord({
73
- spec,
74
- daemonHome: input.local.configRoot,
75
- agentsRoot: layout.agentItemsRoot,
76
- nodePath: input.sourceRecord.nodePath,
77
- entryPath: input.sourceRecord.entryPath,
78
- packageRoot: input.sourceRecord.packageRoot,
79
- npmPrefix: input.sourceRecord.npmPrefix,
80
- generation: () => deterministicUuid(`service\0${spec.id}\0${workspaceId}`),
81
- now: () => new Date(createdAt),
82
- });
83
- }
84
- export function createStorageMigrationRuntimeController(rawInput, injected = {}) {
85
- const input = {
86
- ...rawInput,
87
- profile: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/u).parse(rawInput.profile),
88
- serverUrl: z.string().url().parse(rawInput.serverUrl),
89
- environment: validateStorageEnvironment(rawInput.environment),
90
- };
91
- if (input.sourceRecord.profile !== input.profile || input.sourceRecord.platform !== input.platform) {
92
- throw new Error("Storage runtime source service identity does not match profile");
93
- }
94
- const dependencies = {
95
- assertSourceIdentity: async () => undefined,
96
- runDoctor: (doctorInput) => runStorageDoctor(doctorInput),
97
- writeOperation: writeStorageWorkerOperation,
98
- writeHandoff: writeStorageWorkerHandoff,
99
- launchWorker: launchStorageMigrationWorker,
100
- monitorWorker: monitorStorageMigrationStatus,
101
- now: () => new Date(),
102
- ...injected,
103
- };
104
- let workspaceId = null;
105
- let identity;
106
- let gate = null;
107
- let sendStatus = null;
108
- let control = null;
109
- const doctorInput = async (migrationId) => {
110
- if (workspaceId === null || gate === null)
111
- throw new Error("Storage migration runtime is not attached");
112
- let profileIdentityExact = true;
113
- await dependencies.assertSourceIdentity().catch(() => { profileIdentityExact = false; });
114
- const target = storageLayout({
115
- nowworkHome: input.nowworkHome,
116
- environment: input.environment,
117
- workspaceId,
118
- runtimeBase: input.local.runtimeBase,
119
- platform: input.platform,
120
- });
121
- return {
122
- migrationId,
123
- generatedAt: dependencies.now().toISOString(),
124
- environment: input.environment,
125
- workspaceId,
126
- profile: input.profile,
127
- targetWorkspaceRoot: target.workspaceRoot,
128
- sources: [
129
- { kind: "daemon-home", root: input.sourceRecord.daemonHome, logicalPrefix: "daemon" },
130
- { kind: "agents-root", root: input.sourceRecord.agentsRoot, logicalPrefix: "agent-items" },
131
- ],
132
- policy: input.policy,
133
- state: {
134
- profileIdentityExact,
135
- duplicateWorkspaceMappings: input.duplicateWorkspaceMappings ?? 0,
136
- activeAgentExecutions: gate.isBusy() ? 1 : 0,
137
- activeScheduledRuns: 0,
138
- },
139
- freeSpaceMultiplier: 1.2,
140
- };
141
- };
142
- const buildOperation = (doctor, freshInput) => {
143
- if (workspaceId === null)
144
- throw new Error("Storage migration workspace identity is missing");
145
- const createdAt = freshInput.generatedAt;
146
- const target = storageLayout({
147
- nowworkHome: input.nowworkHome,
148
- environment: input.environment,
149
- workspaceId,
150
- runtimeBase: input.local.runtimeBase,
151
- platform: input.platform,
152
- });
153
- const { freeSpaceMultiplier, ...doctorBase } = freshInput;
154
- const operationDoctorInput = {
155
- ...doctorBase,
156
- sources: freshInput.sources.map((source) => ({ ...source })),
157
- policy: {
158
- exclusions: freshInput.policy.exclusions.map((exclusion) => ({ ...exclusion })),
159
- transformations: freshInput.policy.transformations.map((transformation) => ({ ...transformation })),
160
- },
161
- ...(freeSpaceMultiplier === undefined ? {} : { freeSpaceMultiplier }),
162
- };
163
- return {
164
- version: 1,
165
- migrationId: doctor.manifest.migrationId,
166
- createdAt,
167
- environment: input.environment,
168
- workspaceId,
169
- profile: input.profile,
170
- expectedManifestDigest: doctor.manifestDigest,
171
- doctorInput: operationDoctorInput,
172
- migration: {
173
- sourceRoots: {
174
- "daemon-home": input.sourceRecord.daemonHome,
175
- "agents-root": input.sourceRecord.agentsRoot,
176
- },
177
- stagingWorkspaceRoot: join(dirname(target.workspaceRoot), `.nowwork-staging-${doctor.manifest.migrationId}`),
178
- targetWorkspaceRoot: target.workspaceRoot,
179
- backupsRoot: input.local.backupsRoot,
180
- backupArtifacts: input.backupArtifacts.map((artifact) => ({ ...artifact })),
181
- acceptedWarnings: [...input.policy.acceptedWarnings],
182
- },
183
- service: {
184
- platform: input.platform,
185
- userHome: input.userHome,
186
- ...(input.uid === undefined ? {} : { uid: input.uid }),
187
- ...(input.serviceEnvironment === undefined ? {} : { serviceEnvironment: input.serviceEnvironment }),
188
- sourceWasRunning: true,
189
- sourceRecord: input.sourceRecord,
190
- targetRecord: targetRecord(input, workspaceId, createdAt),
191
- },
192
- installation: {
193
- configRoot: input.local.configRoot,
194
- target: {
195
- ...installationBase(input, workspaceId, doctor.manifest.migrationId, createdAt),
196
- storageMigrationId: doctor.manifest.migrationId,
197
- },
198
- },
199
- };
200
- };
201
- const ensureControl = () => {
202
- if (control !== null || workspaceId === null || gate === null || sendStatus === null || identity === undefined)
203
- return;
204
- const sourceStorageFingerprint = fingerprint(JSON.stringify({
205
- profile: input.profile,
206
- daemonHome: input.sourceRecord.daemonHome,
207
- agentsRoot: input.sourceRecord.agentsRoot,
208
- serviceId: input.sourceRecord.serviceId,
209
- }));
210
- control = createStorageControlController({
211
- environment: input.environment,
212
- workspaceId,
213
- profile: input.profile,
214
- sourceStorageFingerprint,
215
- targetStorageFingerprint: identity.storageIdFingerprint,
216
- runDoctor: async (migrationId) => dependencies.runDoctor(await doctorInput(migrationId)),
217
- runMigration: async (doctor) => {
218
- await gate.closeAndFlush();
219
- let workerLaunched = false;
220
- try {
221
- const freshInput = await doctorInput(doctor.manifest.migrationId);
222
- const freshDoctor = await dependencies.runDoctor(freshInput);
223
- if (!freshDoctor.applyAllowed || freshDoctor.manifestDigest !== doctor.manifestDigest) {
224
- throw new StorageMigrationFailure("source_changed_after_preflight", "source data or doctor gates changed after server preflight");
225
- }
226
- const operation = buildOperation(freshDoctor, freshInput);
227
- const written = await dependencies.writeOperation(operation, { stateRoot: input.local.stateRoot });
228
- const handoffPath = await dependencies.writeHandoff({
229
- version: 1,
230
- migrationId: operation.migrationId,
231
- profile: operation.profile,
232
- operationPath: written.path,
233
- operationSha256: written.sha256,
234
- }, { stateRoot: input.local.stateRoot });
235
- await dependencies.launchWorker({
236
- entryPath: input.sourceRecord.entryPath,
237
- handoffPath,
238
- migrationId: operation.migrationId,
239
- platform: input.platform,
240
- userHome: input.userHome,
241
- ...(input.uid === undefined ? {} : { uid: input.uid }),
242
- });
243
- workerLaunched = true;
244
- const outcome = await dependencies.monitorWorker({
245
- stateRoot: input.local.stateRoot,
246
- backupsRoot: input.local.backupsRoot,
247
- migrationId: operation.migrationId,
248
- environment: operation.environment,
249
- workspaceId: operation.workspaceId,
250
- profile: operation.profile,
251
- }, sendStatus);
252
- if (outcome.reopenAdmission)
253
- gate.reopen();
254
- }
255
- catch (error) {
256
- if (!workerLaunched) {
257
- gate.reopen();
258
- const failure = error instanceof Error ? error : new Error(String(error));
259
- throw Object.assign(new Error(failure.message, { cause: failure }), {
260
- code: error.code,
261
- reopenAdmission: true,
262
- });
263
- }
264
- throw error;
265
- }
266
- },
267
- sendStatus,
268
- });
269
- };
270
- const bindServerIdentity = (server) => {
271
- const nextWorkspaceId = UUID.parse(server.workspaceId).toLowerCase();
272
- if (workspaceId !== null && workspaceId !== nextWorkspaceId) {
273
- throw new Error("Storage migration server workspace identity changed");
274
- }
275
- workspaceId = nextWorkspaceId;
276
- const createdAt = dependencies.now().toISOString();
277
- const installation = installationBase(input, workspaceId, undefined, createdAt);
278
- const layout = storageLayout({
279
- nowworkHome: input.nowworkHome,
280
- environment: input.environment,
281
- workspaceId,
282
- runtimeBase: input.local.runtimeBase,
283
- platform: input.platform,
284
- });
285
- identity = storageHelloIdentity({ installation, layout });
286
- ensureControl();
287
- };
288
- const attach = (runtime) => {
289
- gate = runtime.gate;
290
- sendStatus = runtime.sendStatus;
291
- ensureControl();
292
- };
293
- const replayStatus = async (send) => {
294
- const receipt = await latestSourceStorageMigrationReceipt(input.local.backupsRoot, {
295
- environment: input.environment,
296
- profile: input.profile,
297
- });
298
- if (receipt === null)
299
- return;
300
- for (const frame of storageMigrationStatusReplay(receipt))
301
- send(frame);
302
- };
303
- return Object.freeze({
304
- statusOutboxPath: join(input.local.stateRoot, "storage-status-outbox.json"),
305
- identity: () => identity,
306
- bindServerIdentity,
307
- attach,
308
- replayStatus,
309
- controller: Object.freeze({
310
- handle: (raw) => control?.handle(raw) ?? Promise.resolve(false),
311
- }),
312
- });
313
- }
@@ -1,184 +0,0 @@
1
- import { realpathSync } from "node:fs";
2
- import { isAbsolute, resolve } from "node:path";
3
- import { z } from "zod";
4
- import { buildServiceSpec } from "./computer-service.js";
5
- import { profilePath } from "./computer-profile.js";
6
- import { assertManagedServiceIdentity } from "./managed-service-lifecycle.js";
7
- import { managedServiceRegistryPath, readManagedServiceRegistry, } from "./managed-service-registry.js";
8
- import { resolveLocalStorageRoots } from "./storage-config.js";
9
- import { readStorageMigrationPolicy } from "./storage-migration-policy.js";
10
- import { createStorageMigrationRuntimeController, } from "./storage-runtime-controller.js";
11
- import { resolveEnvTag, resolveNowworkHome } from "./storage-layout.js";
12
- const notReady = (reason) => Object.freeze({ ready: false, reason });
13
- function canonicalPath(value) {
14
- const absolute = resolve(value);
15
- try {
16
- return realpathSync.native(absolute);
17
- }
18
- catch (error) {
19
- const code = error.code;
20
- if (code === "ENOTDIR")
21
- return absolute;
22
- if (code !== "ENOENT")
23
- throw error;
24
- }
25
- const missing = [];
26
- let ancestor = absolute;
27
- for (;;) {
28
- const parent = resolve(ancestor, "..");
29
- if (parent === ancestor)
30
- return absolute;
31
- missing.unshift(ancestor.slice(parent.length + (parent.endsWith("/") ? 0 : 1)));
32
- ancestor = parent;
33
- try {
34
- return resolve(realpathSync.native(ancestor), ...missing);
35
- }
36
- catch (error) {
37
- const code = error.code;
38
- if (code === "ENOTDIR")
39
- return absolute;
40
- if (code !== "ENOENT")
41
- throw error;
42
- }
43
- }
44
- }
45
- const samePath = (left, right) => canonicalPath(left) === canonicalPath(right);
46
- function environmentMatchesServer(serverUrl, environment) {
47
- const hostname = new URL(serverUrl).hostname.toLowerCase();
48
- if (hostname === "nowwork-dev.nowcoder.com")
49
- return environment === "dev";
50
- if (hostname === "nowwork-in.nowcoder.com")
51
- return environment === "production";
52
- return true;
53
- }
54
- function findSourceRecord(records, input) {
55
- const matches = records.filter((record) => record.profile === input.profile
56
- && samePath(record.daemonHome, input.currentDaemonHome)
57
- && samePath(record.agentsRoot, input.currentAgentsRoot));
58
- return matches.length === 1 ? matches[0] : null;
59
- }
60
- export async function probeStorageMigrationRuntime(rawInput, injected = {}) {
61
- if (rawInput.platform !== "darwin" && rawInput.platform !== "linux") {
62
- return notReady("platform_not_supported");
63
- }
64
- if (rawInput.platform === "darwin" && rawInput.uid === undefined) {
65
- return notReady("platform_identity_missing");
66
- }
67
- const configuredNowworkHome = rawInput.environment.NOWWORK_HOME;
68
- if (configuredNowworkHome === undefined)
69
- return notReady("nowwork_home_missing");
70
- const input = {
71
- ...rawInput,
72
- profile: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/u).parse(rawInput.profile),
73
- serverUrl: z.string().url().parse(rawInput.serverUrl),
74
- platform: rawInput.platform,
75
- };
76
- let nowworkHome;
77
- let environment;
78
- try {
79
- const home = resolveNowworkHome({
80
- environment: configuredNowworkHome,
81
- userHome: input.userHome,
82
- platform: input.platform,
83
- });
84
- if (home.mode !== "standard")
85
- return notReady("nowwork_home_missing");
86
- nowworkHome = home.root;
87
- environment = resolveEnvTag({
88
- ...(input.environment.NOWWORK_ENV_TAG === undefined
89
- ? {}
90
- : { environment: input.environment.NOWWORK_ENV_TAG }),
91
- }).environment;
92
- }
93
- catch {
94
- return notReady("storage_environment_invalid");
95
- }
96
- if (!environmentMatchesServer(input.serverUrl, environment)) {
97
- return notReady("environment_server_mismatch");
98
- }
99
- const policyPath = input.environment.NOWWORK_STORAGE_POLICY_PATH;
100
- if (policyPath === undefined)
101
- return notReady("migration_policy_missing");
102
- if (!isAbsolute(policyPath) || /[\0\r\n]/u.test(policyPath))
103
- return notReady("migration_policy_invalid");
104
- const dependencies = {
105
- readManagedServices: readManagedServiceRegistry,
106
- assertManagedServiceIdentity,
107
- readPolicy: readStorageMigrationPolicy,
108
- createController: createStorageMigrationRuntimeController,
109
- ...injected,
110
- };
111
- let sourceRecord;
112
- try {
113
- const records = await dependencies.readManagedServices({ userHome: input.userHome });
114
- const found = findSourceRecord(records, input);
115
- if (found === null)
116
- return notReady("source_service_record_missing");
117
- sourceRecord = found;
118
- }
119
- catch {
120
- return notReady("source_service_registry_invalid");
121
- }
122
- const sourceSpec = buildServiceSpec({
123
- platform: input.platform,
124
- profile: input.profile,
125
- userHome: input.userHome,
126
- uid: input.uid,
127
- nodePath: sourceRecord.nodePath,
128
- entryPath: sourceRecord.entryPath,
129
- profileHome: input.currentDaemonHome,
130
- environment: input.environment,
131
- });
132
- const assertSourceIdentity = () => dependencies.assertManagedServiceIdentity({
133
- spec: sourceSpec,
134
- record: sourceRecord,
135
- registry: { userHome: input.userHome },
136
- });
137
- try {
138
- await assertSourceIdentity();
139
- }
140
- catch {
141
- return notReady("source_service_identity_drift");
142
- }
143
- let policy;
144
- try {
145
- policy = await dependencies.readPolicy(policyPath, {
146
- profile: input.profile,
147
- environment,
148
- nowworkHome,
149
- sourceDaemonHome: sourceRecord.daemonHome,
150
- sourceAgentsRoot: sourceRecord.agentsRoot,
151
- });
152
- }
153
- catch {
154
- return notReady("migration_policy_invalid");
155
- }
156
- const local = resolveLocalStorageRoots({
157
- platform: input.platform,
158
- userHome: input.userHome,
159
- environment: input.environment,
160
- });
161
- const runtime = dependencies.createController({
162
- profile: input.profile,
163
- serverUrl: input.serverUrl,
164
- environment,
165
- nowworkHome,
166
- userHome: input.userHome,
167
- platform: input.platform,
168
- ...(input.uid === undefined ? {} : { uid: input.uid }),
169
- sourceRecord,
170
- local,
171
- policy,
172
- serviceEnvironment: {
173
- NOWWORK_HOME: nowworkHome,
174
- NOWWORK_ENV_TAG: environment,
175
- NOWWORK_STORAGE_POLICY_PATH: policyPath,
176
- },
177
- backupArtifacts: [
178
- { name: "profile.json", path: profilePath(input.profile, input.currentDaemonHome) },
179
- { name: "service-descriptor", path: sourceRecord.descriptorPath },
180
- { name: "managed-service-registry.json", path: managedServiceRegistryPath(input.userHome) },
181
- ],
182
- }, { assertSourceIdentity });
183
- return Object.freeze({ ready: true, runtime });
184
- }
@@ -1,39 +0,0 @@
1
- import { findInstallationForProfile, readInstallations, resolveLocalStorageRoots, } from "./storage-config.js";
2
- import { storageHelloIdentity } from "./storage-identity.js";
3
- import { storageLayout } from "./storage-layout.js";
4
- const canonicalServerUrl = (value) => value.replace(/\/+$/u, "");
5
- export function resolveStorageRuntime(input) {
6
- const installation = findInstallationForProfile(input.records, input.profile);
7
- if (installation === null)
8
- return null;
9
- if (canonicalServerUrl(installation.serverUrl) !== canonicalServerUrl(input.serverUrl)) {
10
- throw new Error("installation server identity does not match the active profile");
11
- }
12
- const local = resolveLocalStorageRoots({
13
- platform: input.platform,
14
- userHome: input.userHome,
15
- environment: input.environment,
16
- });
17
- const layout = storageLayout({
18
- nowworkHome: installation.nowworkHome,
19
- environment: installation.environment,
20
- workspaceId: installation.workspaceId,
21
- runtimeBase: local.runtimeBase,
22
- platform: input.platform,
23
- });
24
- return Object.freeze({
25
- installation,
26
- layout,
27
- identity: storageHelloIdentity({ installation, layout }),
28
- local,
29
- });
30
- }
31
- export async function loadStorageRuntime(input) {
32
- const local = resolveLocalStorageRoots({
33
- platform: input.platform,
34
- userHome: input.userHome,
35
- environment: input.environment,
36
- });
37
- const records = await readInstallations({ configRoot: local.configRoot });
38
- return resolveStorageRuntime({ ...input, records });
39
- }