@dual-os/cli 0.0.0-stage → 0.11.0-next.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.
- package/LICENSE +4 -0
- package/README.md +15 -2
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/auth/credentials.d.ts +17 -0
- package/dist/auth/credentials.d.ts.map +1 -0
- package/dist/auth/credentials.js +57 -0
- package/dist/auth/credentials.js.map +1 -0
- package/dist/auth/destination.d.ts +22 -0
- package/dist/auth/destination.d.ts.map +1 -0
- package/dist/auth/destination.js +49 -0
- package/dist/auth/destination.js.map +1 -0
- package/dist/auth/http.d.ts +12 -0
- package/dist/auth/http.d.ts.map +1 -0
- package/dist/auth/http.js +34 -0
- package/dist/auth/http.js.map +1 -0
- package/dist/auth/login.d.ts +22 -0
- package/dist/auth/login.d.ts.map +1 -0
- package/dist/auth/login.js +98 -0
- package/dist/auth/login.js.map +1 -0
- package/dist/auth/protocol.d.ts +26 -0
- package/dist/auth/protocol.d.ts.map +1 -0
- package/dist/auth/protocol.js +31 -0
- package/dist/auth/protocol.js.map +1 -0
- package/dist/baseline.d.ts +18 -0
- package/dist/baseline.d.ts.map +1 -0
- package/dist/baseline.js +22 -0
- package/dist/baseline.js.map +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +7 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +19 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +492 -0
- package/dist/cli.js.map +1 -0
- package/dist/create/choices.d.ts +58 -0
- package/dist/create/choices.d.ts.map +1 -0
- package/dist/create/choices.js +121 -0
- package/dist/create/choices.js.map +1 -0
- package/dist/create/deployment.d.ts +48 -0
- package/dist/create/deployment.d.ts.map +1 -0
- package/dist/create/deployment.js +66 -0
- package/dist/create/deployment.js.map +1 -0
- package/dist/create/scaffold.d.ts +57 -0
- package/dist/create/scaffold.d.ts.map +1 -0
- package/dist/create/scaffold.js +198 -0
- package/dist/create/scaffold.js.map +1 -0
- package/dist/create/source-reference.d.ts +39 -0
- package/dist/create/source-reference.d.ts.map +1 -0
- package/dist/create/source-reference.js +185 -0
- package/dist/create/source-reference.js.map +1 -0
- package/dist/create/template.d.ts +116 -0
- package/dist/create/template.d.ts.map +1 -0
- package/dist/create/template.js +211 -0
- package/dist/create/template.js.map +1 -0
- package/dist/diagnostics.d.ts +6 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +18 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/help.d.ts +16 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +73 -0
- package/dist/help.js.map +1 -0
- package/dist/openapi/bundle.d.ts +18 -0
- package/dist/openapi/bundle.d.ts.map +1 -0
- package/dist/openapi/bundle.js +201 -0
- package/dist/openapi/bundle.js.map +1 -0
- package/dist/openapi/discovery.d.ts +30 -0
- package/dist/openapi/discovery.d.ts.map +1 -0
- package/dist/openapi/discovery.js +325 -0
- package/dist/openapi/discovery.js.map +1 -0
- package/dist/openapi/emit.d.ts +52 -0
- package/dist/openapi/emit.d.ts.map +1 -0
- package/dist/openapi/emit.js +596 -0
- package/dist/openapi/emit.js.map +1 -0
- package/dist/openapi/graphql.d.ts +102 -0
- package/dist/openapi/graphql.d.ts.map +1 -0
- package/dist/openapi/graphql.js +294 -0
- package/dist/openapi/graphql.js.map +1 -0
- package/dist/openapi/identity.d.ts +88 -0
- package/dist/openapi/identity.d.ts.map +1 -0
- package/dist/openapi/identity.js +98 -0
- package/dist/openapi/identity.js.map +1 -0
- package/dist/openapi/mcp.d.ts +21 -0
- package/dist/openapi/mcp.d.ts.map +1 -0
- package/dist/openapi/mcp.js +133 -0
- package/dist/openapi/mcp.js.map +1 -0
- package/dist/openapi/operations.d.ts +165 -0
- package/dist/openapi/operations.d.ts.map +1 -0
- package/dist/openapi/operations.js +361 -0
- package/dist/openapi/operations.js.map +1 -0
- package/dist/openapi/overlay.d.ts +23 -0
- package/dist/openapi/overlay.d.ts.map +1 -0
- package/dist/openapi/overlay.js +115 -0
- package/dist/openapi/overlay.js.map +1 -0
- package/dist/openapi/plugin.d.ts +83 -0
- package/dist/openapi/plugin.d.ts.map +1 -0
- package/dist/openapi/plugin.js +468 -0
- package/dist/openapi/plugin.js.map +1 -0
- package/dist/openapi/polymorphism.d.ts +21 -0
- package/dist/openapi/polymorphism.d.ts.map +1 -0
- package/dist/openapi/polymorphism.js +96 -0
- package/dist/openapi/polymorphism.js.map +1 -0
- package/dist/openapi/postman.d.ts +21 -0
- package/dist/openapi/postman.d.ts.map +1 -0
- package/dist/openapi/postman.js +286 -0
- package/dist/openapi/postman.js.map +1 -0
- package/dist/openapi/schema.d.ts +178 -0
- package/dist/openapi/schema.d.ts.map +1 -0
- package/dist/openapi/schema.js +1234 -0
- package/dist/openapi/schema.js.map +1 -0
- package/dist/openapi/select.d.ts +22 -0
- package/dist/openapi/select.d.ts.map +1 -0
- package/dist/openapi/select.js +79 -0
- package/dist/openapi/select.js.map +1 -0
- package/dist/openapi/spec.d.ts +147 -0
- package/dist/openapi/spec.d.ts.map +1 -0
- package/dist/openapi/spec.js +263 -0
- package/dist/openapi/spec.js.map +1 -0
- package/dist/openapi/swagger.d.ts +166 -0
- package/dist/openapi/swagger.d.ts.map +1 -0
- package/dist/openapi/swagger.js +298 -0
- package/dist/openapi/swagger.js.map +1 -0
- package/dist/openapi/versions.d.ts +52 -0
- package/dist/openapi/versions.d.ts.map +1 -0
- package/dist/openapi/versions.js +120 -0
- package/dist/openapi/versions.js.map +1 -0
- package/dist/plugin/archive.d.ts +27 -0
- package/dist/plugin/archive.d.ts.map +1 -0
- package/dist/plugin/archive.js +170 -0
- package/dist/plugin/archive.js.map +1 -0
- package/dist/plugin/bundle.d.ts +27 -0
- package/dist/plugin/bundle.d.ts.map +1 -0
- package/dist/plugin/bundle.js +328 -0
- package/dist/plugin/bundle.js.map +1 -0
- package/dist/plugin/init.d.ts +18 -0
- package/dist/plugin/init.d.ts.map +1 -0
- package/dist/plugin/init.js +121 -0
- package/dist/plugin/init.js.map +1 -0
- package/dist/plugin/inspection.d.ts +24 -0
- package/dist/plugin/inspection.d.ts.map +1 -0
- package/dist/plugin/inspection.js +24 -0
- package/dist/plugin/inspection.js.map +1 -0
- package/dist/plugin/package.d.ts +26 -0
- package/dist/plugin/package.d.ts.map +1 -0
- package/dist/plugin/package.js +73 -0
- package/dist/plugin/package.js.map +1 -0
- package/dist/plugin/publication.d.ts +29 -0
- package/dist/plugin/publication.d.ts.map +1 -0
- package/dist/plugin/publication.js +65 -0
- package/dist/plugin/publication.js.map +1 -0
- package/dist/plugin/validation.d.ts +15 -0
- package/dist/plugin/validation.d.ts.map +1 -0
- package/dist/plugin/validation.js +119 -0
- package/dist/plugin/validation.js.map +1 -0
- package/dist/release/archives.d.ts +33 -0
- package/dist/release/archives.d.ts.map +1 -0
- package/dist/release/archives.js +81 -0
- package/dist/release/archives.js.map +1 -0
- package/dist/release/release-manifest.d.ts +182 -0
- package/dist/release/release-manifest.d.ts.map +1 -0
- package/dist/release/release-manifest.js +79 -0
- package/dist/release/release-manifest.js.map +1 -0
- package/dist/release/releases.d.ts +36 -0
- package/dist/release/releases.d.ts.map +1 -0
- package/dist/release/releases.js +122 -0
- package/dist/release/releases.js.map +1 -0
- package/dist/skills.d.ts +35 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +257 -0
- package/dist/skills.js.map +1 -0
- package/package.json +73 -4
- package/skills/dual-fde/SKILL.md +38 -0
- package/skills/dual-fde/references/access.md +62 -0
- package/skills/dual-fde/references/author-plugins.md +54 -0
- package/skills/dual-fde/references/cli.md +97 -0
- package/skills/dual-fde/references/manage-plugins.md +78 -0
- package/skills/dual-fde/references/migrations-deployment.md +84 -0
- package/skills/dual-fde/references/openapi-plugins.md +47 -0
- package/skills/dual-fde/references/sdk-docs.md +56 -0
- package/skills/dual-fde/references/upgrades.md +115 -0
- package/skills/dual-fde/references/working-context.md +69 -0
- package/src/auth/credentials.ts +84 -0
- package/src/auth/destination.ts +83 -0
- package/src/auth/http.ts +39 -0
- package/src/auth/login.ts +177 -0
- package/src/auth/protocol.ts +37 -0
- package/src/baseline.ts +15 -0
- package/src/bin.ts +4 -0
- package/src/cli.ts +969 -0
- package/src/create/choices.ts +177 -0
- package/src/create/deployment.ts +96 -0
- package/src/create/scaffold.ts +334 -0
- package/src/create/source-reference.ts +212 -0
- package/src/create/template.ts +300 -0
- package/src/diagnostics.ts +8 -0
- package/src/help.ts +142 -0
- package/src/openapi/bundle.ts +290 -0
- package/src/openapi/discovery.ts +438 -0
- package/src/openapi/emit.ts +1031 -0
- package/src/openapi/graphql.ts +375 -0
- package/src/openapi/identity.ts +153 -0
- package/src/openapi/mcp.ts +165 -0
- package/src/openapi/operations.ts +781 -0
- package/src/openapi/overlay.ts +195 -0
- package/src/openapi/plugin.ts +856 -0
- package/src/openapi/polymorphism.ts +207 -0
- package/src/openapi/postman.ts +403 -0
- package/src/openapi/schema.ts +2138 -0
- package/src/openapi/select.ts +113 -0
- package/src/openapi/spec.ts +401 -0
- package/src/openapi/swagger.ts +422 -0
- package/src/openapi/versions.ts +174 -0
- package/src/plugin/archive.ts +244 -0
- package/src/plugin/bundle.ts +572 -0
- package/src/plugin/init.ts +178 -0
- package/src/plugin/inspection.ts +19 -0
- package/src/plugin/package.ts +140 -0
- package/src/plugin/publication.ts +128 -0
- package/src/plugin/validation.ts +213 -0
- package/src/release/archives.ts +133 -0
- package/src/release/release-manifest.ts +79 -0
- package/src/release/releases.ts +210 -0
- package/src/skills.ts +434 -0
- package/templates/compose/.env.compose.example.hbs +3 -0
- package/templates/compose/.env.host.example.hbs +4 -0
- package/templates/compose/Dockerfile.hbs +12 -0
- package/templates/compose/OPERATIONS.md.hbs +159 -0
- package/templates/compose/_dockerignore +14 -0
- package/templates/compose/compose.external.yaml +7 -0
- package/templates/compose/compose.host-linux.yaml +5 -0
- package/templates/compose/compose.host.yaml.hbs +15 -0
- package/templates/compose/compose.yaml.hbs +85 -0
- package/templates/compose/release.env.hbs +2 -0
- package/templates/default/.env.example.hbs +79 -0
- package/templates/default/README.md.hbs +150 -0
- package/templates/default/_gitignore +11 -0
- package/templates/default/packages/customer-plugin/src/Customer.ts.hbs +17 -0
- package/templates/default/packages/customer-plugin/tsconfig.json +15 -0
- package/templates/default/packages/execution-layer/src/App.ts.hbs +7 -0
- package/templates/default/packages/execution-layer/src/Host.ts.hbs +31 -0
- package/templates/default/packages/execution-layer/src/Telemetry.ts.hbs +23 -0
- package/templates/default/packages/execution-layer/src/api.ts.hbs +21 -0
- package/templates/default/packages/execution-layer/src/bootstrap.ts +22 -0
- package/templates/default/packages/execution-layer/src/migrate.ts +11 -0
- package/templates/default/packages/execution-layer/src/registry-check.ts +29 -0
- package/templates/default/packages/execution-layer/src/registry-sync.ts +14 -0
- package/templates/default/packages/execution-layer/src/worker.ts.hbs +16 -0
- package/templates/default/packages/execution-layer/test/app.host-test.ts.hbs +58 -0
- package/templates/default/packages/execution-layer/test/app.test.ts.hbs +16 -0
- package/templates/default/tsconfig.json +5 -0
- package/templates/default/vitest.config.ts +5 -0
- package/templates/default/vitest.host.config.ts +6 -0
- package/templates/opensandbox/OPEN-SANDBOX.md +25 -0
- package/templates/opensandbox/docker/agent-sandbox.Dockerfile +41 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { PackageError, Service as Service$1, fromCause } from "./package.js";
|
|
3
|
+
import "./inspection.js";
|
|
4
|
+
import "./validation.js";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
6
|
+
import { Context, Effect, Fiber, FileSystem, Layer, Path, Schema, Scope, Stream, pipe } from "effect";
|
|
7
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
8
|
+
import { ReleaseManifest } from "#release/release-manifest";
|
|
9
|
+
import { fork } from "node:child_process";
|
|
10
|
+
import { NodeStream } from "@effect/platform-node";
|
|
11
|
+
import { PluginRuntime } from "@dual-os/sdk/PluginRuntime";
|
|
12
|
+
import { RemoteRuntime } from "@dual-os/sdk/RemoteRuntime";
|
|
13
|
+
// src/plugin/validation.ts
|
|
14
|
+
var validation_exports = /* @__PURE__ */ __exportAll({
|
|
15
|
+
PluginValidation: () => validation_exports,
|
|
16
|
+
Service: () => Service,
|
|
17
|
+
layer: () => layer
|
|
18
|
+
});
|
|
19
|
+
var Service = class extends Context.Service()("@dual-os/cli/plugin/validation/Service") {};
|
|
20
|
+
const layer = Layer.effect(Service, Effect.gen(function* () {
|
|
21
|
+
const fs = yield* FileSystem.FileSystem;
|
|
22
|
+
const path = yield* Path.Path;
|
|
23
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
24
|
+
const packages = yield* Service$1;
|
|
25
|
+
return Service.of({ validate: Effect.fn("PluginValidation.validate")(function* (directory) {
|
|
26
|
+
const scope = yield* Scope.Scope;
|
|
27
|
+
const prepared = yield* packages.inspect(directory);
|
|
28
|
+
const require = createRequire(prepared.entrypoint);
|
|
29
|
+
const bundled = (yield* Schema.decodeEffect(Schema.fromJsonString(Schema.Struct({ dual: Schema.Struct({ plugin: Schema.Struct({
|
|
30
|
+
runner: Schema.optionalKey(Schema.String),
|
|
31
|
+
sdk_version: Schema.optionalKey(ReleaseManifest.ExactVersion)
|
|
32
|
+
}) }) })))(yield* fs.readFileString(path.join(prepared.directory, "package.json")))).dual.plugin;
|
|
33
|
+
const runner = bundled.runner === void 0 ? yield* Effect.try(() => require.resolve("@dual-os/sdk/Runner")) : yield* fs.realPath(path.join(prepared.directory, bundled.runner));
|
|
34
|
+
if (bundled.runner !== void 0 && !runner.startsWith(`${prepared.directory}${path.sep}`)) return yield* PackageError.make({ message: "Bundle runner escapes the artifact" });
|
|
35
|
+
const sdk = bundled.sdk_version === void 0 ? yield* Schema.decodeEffect(Schema.fromJsonString(Schema.Struct({ version: ReleaseManifest.ExactVersion })))(yield* fs.readFileString(yield* Effect.try(() => require.resolve("@dual-os/sdk/package.json")))) : { version: bundled.sdk_version };
|
|
36
|
+
const executable = bundled.runner === void 0 ? process.execPath : (yield* spawner.string(ChildProcess.make("which", ["bun"]))).trim();
|
|
37
|
+
const request = {
|
|
38
|
+
_tag: "extract",
|
|
39
|
+
identity: {
|
|
40
|
+
artifactDigest: "0".repeat(128),
|
|
41
|
+
invocationId: "inspection",
|
|
42
|
+
organizationId: "local",
|
|
43
|
+
pluginKey: "local-inspection",
|
|
44
|
+
pluginVersion: prepared.version
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const { child, exited } = yield* Effect.acquireRelease(Effect.gen(function* () {
|
|
48
|
+
const child = yield* Effect.try(() => fork(runner, [
|
|
49
|
+
prepared.entrypoint,
|
|
50
|
+
prepared.export,
|
|
51
|
+
"inspect",
|
|
52
|
+
prepared.version
|
|
53
|
+
], {
|
|
54
|
+
execPath: executable,
|
|
55
|
+
execArgv: bundled.runner === void 0 ? [] : ["--no-env-file", "--no-install"],
|
|
56
|
+
serialization: "json",
|
|
57
|
+
stdio: [
|
|
58
|
+
"ignore",
|
|
59
|
+
"pipe",
|
|
60
|
+
"pipe",
|
|
61
|
+
"ipc"
|
|
62
|
+
],
|
|
63
|
+
cwd: prepared.directory,
|
|
64
|
+
env: {}
|
|
65
|
+
}));
|
|
66
|
+
return {
|
|
67
|
+
child,
|
|
68
|
+
exited: Effect.callback((resume) => {
|
|
69
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
70
|
+
resume(Effect.succeed(child.exitCode));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const closed = (code) => resume(Effect.succeed(code));
|
|
74
|
+
child.once("close", closed);
|
|
75
|
+
return Effect.sync(() => {
|
|
76
|
+
child.removeListener("close", closed);
|
|
77
|
+
});
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
}), (owned) => pipe(Effect.sync(() => {
|
|
81
|
+
if (owned.child.exitCode === null && owned.child.signalCode === null) owned.child.kill("SIGKILL");
|
|
82
|
+
}), Effect.andThen(Effect.interruptible(owned.exited)), Effect.timeout("5 seconds"), Effect.orDie));
|
|
83
|
+
const stdout = yield* Effect.fromNullishOr(child.stdout);
|
|
84
|
+
const stderr = yield* Effect.fromNullishOr(child.stderr);
|
|
85
|
+
const diagnostic = yield* pipe(Effect.all({
|
|
86
|
+
stderr: PluginRuntime.readBounded(NodeStream.fromReadable({
|
|
87
|
+
evaluate: () => stderr,
|
|
88
|
+
onError: (cause) => fromCause(cause)
|
|
89
|
+
})),
|
|
90
|
+
stdout: PluginRuntime.readBounded(NodeStream.fromReadable({
|
|
91
|
+
evaluate: () => stdout,
|
|
92
|
+
onError: (cause) => fromCause(cause)
|
|
93
|
+
}))
|
|
94
|
+
}, { concurrency: "unbounded" }), Effect.forkIn(scope, { startImmediately: true }));
|
|
95
|
+
const output = yield* pipe(PluginRuntime.ipcMessages(child), Stream.mapEffect(PluginRuntime.decodeOutput), Stream.take(2), Stream.runCollect, Effect.forkIn(scope, { startImmediately: true }));
|
|
96
|
+
yield* PluginRuntime.sendIpc(child, yield* PluginRuntime.encodeInput(request));
|
|
97
|
+
const exitCode = yield* exited;
|
|
98
|
+
const diagnostics = yield* Fiber.join(diagnostic);
|
|
99
|
+
if (exitCode !== 0) return yield* PackageError.make({ message: `${diagnostics.stderr}\n${diagnostics.stdout}`.trim() || "Plugin inspection failed. Check the compiled module and its installed SDK." });
|
|
100
|
+
const messages = yield* Fiber.join(output);
|
|
101
|
+
if (messages.length !== 1) return yield* PackageError.make({ message: "Plugin inspection must return one IPC response" });
|
|
102
|
+
const result = yield* Schema.decodeUnknownEffect(RemoteRuntime.Response)(messages[0]);
|
|
103
|
+
yield* PluginRuntime.verifyResponse(request, result);
|
|
104
|
+
if (result._tag === "failure") return yield* PackageError.make({ message: result.error.message });
|
|
105
|
+
return {
|
|
106
|
+
plugin: (yield* Schema.decodeUnknownEffect(Schema.Struct({
|
|
107
|
+
pluginIdentifier: Schema.NonEmptyString,
|
|
108
|
+
pluginVersion: ReleaseManifest.ExactVersion,
|
|
109
|
+
providers: Schema.Array(Schema.Unknown)
|
|
110
|
+
}))(result.value)).pluginIdentifier,
|
|
111
|
+
registry: result.value,
|
|
112
|
+
sdkVersion: sdk.version,
|
|
113
|
+
version: prepared.version
|
|
114
|
+
};
|
|
115
|
+
}, Effect.timeout("30 seconds"), Effect.scoped, Effect.mapError((cause) => Schema.is(PackageError)(cause) ? cause : fromCause(cause, "Plugin validation failed or timed out. No publication occurred."))) });
|
|
116
|
+
}));
|
|
117
|
+
export { validation_exports as PluginValidation, Service, layer };
|
|
118
|
+
|
|
119
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","names":["PluginPackage.Service","PluginPackage.fromCause","PluginPackage.PackageError"],"sources":["../../src/plugin/validation.ts"],"sourcesContent":["import { fork } from \"node:child_process\";\nimport { createRequire } from \"node:module\";\n\nimport { NodeStream } from \"@effect/platform-node\";\n\nimport {\n Context,\n Effect,\n Fiber,\n FileSystem,\n Layer,\n Path,\n Schema,\n Scope,\n Stream,\n pipe,\n} from \"effect\";\n\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { PluginRuntime } from \"@dual-os/sdk/PluginRuntime\";\nimport { RemoteRuntime } from \"@dual-os/sdk/RemoteRuntime\";\n\nimport { ReleaseManifest } from \"#release/release-manifest\";\n\nimport { PluginInspection } from \"./inspection.ts\";\nimport { PluginPackage } from \"./package.ts\";\n\nexport class Service extends Context.Service<\n Service,\n {\n readonly validate: (\n directory: string,\n ) => Effect.Effect<PluginInspection.Result, PluginPackage.PackageError>;\n }\n>()(\"@dual-os/cli/plugin/validation/Service\") {}\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const packages = yield* PluginPackage.Service;\n return Service.of({\n validate: Effect.fn(\"PluginValidation.validate\")(\n function* (directory: string) {\n const scope = yield* Scope.Scope;\n const prepared = yield* packages.inspect(directory);\n const require = createRequire(prepared.entrypoint);\n const metadata = yield* Schema.decodeEffect(\n Schema.fromJsonString(\n Schema.Struct({\n dual: Schema.Struct({\n plugin: Schema.Struct({\n runner: Schema.optionalKey(Schema.String),\n sdk_version: Schema.optionalKey(ReleaseManifest.ExactVersion),\n }),\n }),\n }),\n ),\n )(yield* fs.readFileString(path.join(prepared.directory, \"package.json\")));\n const bundled = metadata.dual.plugin;\n const runner =\n bundled.runner === undefined\n ? yield* Effect.try(() => require.resolve(\"@dual-os/sdk/Runner\"))\n : yield* fs.realPath(path.join(prepared.directory, bundled.runner));\n if (\n bundled.runner !== undefined &&\n !runner.startsWith(`${prepared.directory}${path.sep}`)\n )\n return yield* PluginPackage.PackageError.make({\n message: \"Bundle runner escapes the artifact\",\n });\n const sdk =\n bundled.sdk_version === undefined\n ? yield* Schema.decodeEffect(\n Schema.fromJsonString(Schema.Struct({ version: ReleaseManifest.ExactVersion })),\n )(\n yield* fs.readFileString(\n yield* Effect.try(() => require.resolve(\"@dual-os/sdk/package.json\")),\n ),\n )\n : { version: bundled.sdk_version };\n const executable =\n bundled.runner === undefined\n ? process.execPath\n : (yield* spawner.string(ChildProcess.make(\"which\", [\"bun\"]))).trim();\n const request = {\n _tag: \"extract\" as const,\n identity: {\n artifactDigest: \"0\".repeat(128),\n invocationId: \"inspection\",\n organizationId: \"local\",\n pluginKey: \"local-inspection\",\n pluginVersion: prepared.version,\n },\n };\n const { child, exited } = yield* Effect.acquireRelease(\n Effect.gen(function* () {\n const child = yield* Effect.try(() =>\n fork(runner, [prepared.entrypoint, prepared.export, \"inspect\", prepared.version], {\n execPath: executable,\n execArgv: bundled.runner === undefined ? [] : [\"--no-env-file\", \"--no-install\"],\n serialization: \"json\",\n stdio: [\"ignore\", \"pipe\", \"pipe\", \"ipc\"],\n cwd: prepared.directory,\n env: {},\n }),\n );\n const exited = Effect.callback<number | null>(resume => {\n if (child.exitCode !== null || child.signalCode !== null) {\n resume(Effect.succeed(child.exitCode));\n return;\n }\n const closed = (code: number | null) => resume(Effect.succeed(code));\n child.once(\"close\", closed);\n return Effect.sync(() => {\n child.removeListener(\"close\", closed);\n });\n });\n return { child, exited };\n }),\n owned =>\n pipe(\n Effect.sync(() => {\n if (owned.child.exitCode === null && owned.child.signalCode === null)\n owned.child.kill(\"SIGKILL\");\n }),\n Effect.andThen(Effect.interruptible(owned.exited)),\n Effect.timeout(\"5 seconds\"),\n // oxlint-disable-next-line @deslop/coding-standards/no-discarded-failure -- Scope finalizers cannot fail; unconfirmed child termination must remain a defect.\n Effect.orDie,\n ),\n );\n const stdout = yield* Effect.fromNullishOr(child.stdout);\n const stderr = yield* Effect.fromNullishOr(child.stderr);\n const diagnostic = yield* pipe(\n Effect.all(\n {\n stderr: PluginRuntime.readBounded(\n NodeStream.fromReadable({\n evaluate: () => stderr,\n onError: cause => PluginPackage.fromCause(cause),\n }),\n ),\n stdout: PluginRuntime.readBounded(\n NodeStream.fromReadable({\n evaluate: () => stdout,\n onError: cause => PluginPackage.fromCause(cause),\n }),\n ),\n },\n { concurrency: \"unbounded\" },\n ),\n Effect.forkIn(scope, { startImmediately: true }),\n );\n const output = yield* pipe(\n PluginRuntime.ipcMessages(child),\n Stream.mapEffect(PluginRuntime.decodeOutput),\n Stream.take(2),\n Stream.runCollect,\n Effect.forkIn(scope, { startImmediately: true }),\n );\n yield* PluginRuntime.sendIpc(child, yield* PluginRuntime.encodeInput(request));\n const exitCode = yield* exited;\n const diagnostics = yield* Fiber.join(diagnostic);\n if (exitCode !== 0) {\n return yield* PluginPackage.PackageError.make({\n message:\n `${diagnostics.stderr}\\n${diagnostics.stdout}`.trim() ||\n \"Plugin inspection failed. Check the compiled module and its installed SDK.\",\n });\n }\n const messages = yield* Fiber.join(output);\n if (messages.length !== 1)\n return yield* PluginPackage.PackageError.make({\n message: \"Plugin inspection must return one IPC response\",\n });\n const result = yield* Schema.decodeUnknownEffect(RemoteRuntime.Response)(messages[0]);\n yield* PluginRuntime.verifyResponse(request, result);\n if (result._tag === \"failure\")\n return yield* PluginPackage.PackageError.make({ message: result.error.message });\n const registry = yield* Schema.decodeUnknownEffect(\n Schema.Struct({\n pluginIdentifier: Schema.NonEmptyString,\n pluginVersion: ReleaseManifest.ExactVersion,\n providers: Schema.Array(Schema.Unknown),\n }),\n )(result.value);\n return {\n plugin: registry.pluginIdentifier,\n registry: result.value,\n sdkVersion: sdk.version,\n version: prepared.version,\n };\n },\n Effect.timeout(\"30 seconds\"),\n Effect.scoped,\n Effect.mapError(cause =>\n Schema.is(PluginPackage.PackageError)(cause)\n ? cause\n : PluginPackage.fromCause(\n cause,\n \"Plugin validation failed or timed out. No publication occurred.\",\n ),\n ),\n ),\n });\n }),\n);\n\nexport * as PluginValidation from \"./validation.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,IAAa,UAAb,cAA6B,QAAQ,QAOnC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC;AAE/C,MAAa,QAAQ,MAAM,OACzB,SACA,OAAO,IAAI,aAAa;CACtB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,UAAU,OAAO,oBAAoB;CAC3C,MAAM,WAAW,OAAOA;CACxB,OAAO,QAAQ,GAAG,EAChB,UAAU,OAAO,GAAG,2BAA2B,CAAC,CAC9C,WAAW,WAAmB;EAC5B,MAAM,QAAQ,OAAO,MAAM;EAC3B,MAAM,WAAW,OAAO,SAAS,QAAQ,SAAS;EAClD,MAAM,UAAU,cAAc,SAAS,UAAU;EAajD,MAAM,WAAU,OAZQ,OAAO,aAC7B,OAAO,eACL,OAAO,OAAO,EACZ,MAAM,OAAO,OAAO,EAClB,QAAQ,OAAO,OAAO;GACpB,QAAQ,OAAO,YAAY,OAAO,MAAM;GACxC,aAAa,OAAO,YAAY,gBAAgB,YAAY;EAC9D,CAAC,EACH,CAAC,EACH,CAAC,CACH,CAC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,YAAY,OAAO,CAAC;EAC7E,MAAM,WAAW,OAAO;EACxB,MAAM,cAAc,OAAO,MAAM,KAAK,UAAU;EAChD,IAAI,aAAa,GACf,OAAO,OAAA,aAAkC,KAAK,EAC5C,SACE,GAAG,YAAY,OAAO,IAAI,YAAY,SAAS,KAAK,KACpD,6EACJ,CAAC;EAEH,MAAM,WAAW,OAAO,MAAM,KAAK,MAAM;EACzC,IAAI,SAAS,WAAW,GACtB,OAAO,OAAA,aAAkC,KAAK,EAC5C,SAAS,iDACX,CAAC;EACH,MAAM,SAAS,OAAO,OAAO,oBAAoB,cAAc,QAAQ,CAAC,CAAC,SAAS,EAAE;EACpF,OAAO,cAAc,eAAe,SAAS,MAAM;EACnD,IAAI,OAAO,SAAS,WAClB,OAAO,OAAA,aAAkC,KAAK,EAAE,SAAS,OAAO,MAAM,QAAQ,CAAC;EAQjF,OAAO;GACL,SAAQ,OARc,OAAO,oBAC7B,OAAO,OAAO;IACZ,kBAAkB,OAAO;IACzB,eAAe,gBAAgB;IAC/B,WAAW,OAAO,MAAM,OAAO,OAAO;GACxC,CAAC,CACH,CAAC,CAAC,OAAO,KAAK,EAAA,CAEK;GACjB,UAAU,OAAO;GACjB,YAAY,IAAI;GAChB,SAAS,SAAS;EACpB;CACF,GACA,OAAO,QAAQ,YAAY,GAC3B,OAAO,QACP,OAAO,UAAS,UACd,OAAO,GAAGC,YAA0B,CAAC,CAAC,KAAK,IACvC,QACAD,UACE,OACA,iEACF,CACN,CACF,EACF,CAAC;AACH,CAAC,CACH"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "./archives.js";
|
|
2
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
+
import { ChildProcessSpawner } from "effect/process";
|
|
4
|
+
declare namespace archives_d_exports {
|
|
5
|
+
export { ArchiveError, archives_d_exports as Archives, Interface, Service, layer, read };
|
|
6
|
+
}
|
|
7
|
+
declare const Archive: Schema.Struct<{
|
|
8
|
+
readonly filename: Schema.String;
|
|
9
|
+
readonly name: Schema.NonEmptyString;
|
|
10
|
+
readonly version: Schema.NonEmptyString;
|
|
11
|
+
}>;
|
|
12
|
+
declare const ArchiveError_base: Schema.Class<ArchiveError, Schema.TaggedStruct<"ArchiveError", {
|
|
13
|
+
readonly cause: Schema.Redacted<Schema.Defect>;
|
|
14
|
+
}>, import("effect/Cause").YieldableError>;
|
|
15
|
+
export declare class ArchiveError extends ArchiveError_base {}
|
|
16
|
+
export type Interface = {
|
|
17
|
+
/** The caller owns a fresh disposable directory for archives and cache. */
|
|
18
|
+
readonly pack: (specifier: string, cwd: string) => Effect.Effect<typeof Archive.Type, ArchiveError>;
|
|
19
|
+
};
|
|
20
|
+
declare const Service_base: Context.ServiceClass<Service, "@dual-os/cli/Archives", Interface>;
|
|
21
|
+
export declare class Service extends Service_base {}
|
|
22
|
+
export declare const layer: Layer.Layer<Service, never, ChildProcessSpawner.ChildProcessSpawner>;
|
|
23
|
+
/**
|
|
24
|
+
* Lists a gzipped npm archive's regular files and reads the named documents.
|
|
25
|
+
* Never extracts or evaluates package code; a duplicate path, or a named document
|
|
26
|
+
* that is not a regular file within 256 KiB, fails.
|
|
27
|
+
*/
|
|
28
|
+
export declare const read: (archive: Uint8Array<ArrayBufferLike>, documents: readonly string[]) => Effect.Effect<{
|
|
29
|
+
documents: Record<string, string>;
|
|
30
|
+
files: string[];
|
|
31
|
+
}, ArchiveError, never>;
|
|
32
|
+
export { archives_d_exports as Archives };
|
|
33
|
+
//# sourceMappingURL=archives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archives.d.ts","names":[],"sources":["../../src/release/archives.ts"],"mappings":";;;;;;cAOM,SAAO,OAAA;;;;;;;;qBAWA,qBAAqB;YAKtB;;WAED,OACP,mBACA,gBACG,OAAO,cAAc,QAAQ,MAAM;;;qBAE7B,gBAAgB;qBAChB,OAAK,MAAA,MAAA,gBAAA,oBAAA;;;;;;qBA+DL,OAAI,SAAA,WAAA,kBAAA,iCAAA,OAAA;;;GAoCW"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import "./archives.js";
|
|
3
|
+
import { Array, Context, Effect, Layer, Option, Record, Redacted, Schema, Stream } from "effect";
|
|
4
|
+
import { Tar } from "effect/encoding";
|
|
5
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
// src/release/archives.ts
|
|
8
|
+
var archives_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
+
ArchiveError: () => ArchiveError,
|
|
10
|
+
Archives: () => archives_exports,
|
|
11
|
+
Service: () => Service,
|
|
12
|
+
layer: () => layer,
|
|
13
|
+
read: () => read
|
|
14
|
+
});
|
|
15
|
+
const Archive = Schema.Struct({
|
|
16
|
+
filename: Schema.String.check(Schema.isPattern(/^[a-zA-Z0-9._-]+\.tgz$/)),
|
|
17
|
+
name: Schema.NonEmptyString,
|
|
18
|
+
version: Schema.NonEmptyString
|
|
19
|
+
});
|
|
20
|
+
const Packed = Schema.Union([Schema.Array(Archive).check(Schema.isBetweenLength(1, 1)), Schema.Record(Schema.String, Archive).check(Schema.isBetweenProperties(1, 1))]);
|
|
21
|
+
var ArchiveError = class extends Schema.TaggedError()("ArchiveError", { cause: Schema.Redacted(Schema.Defect()) }) {};
|
|
22
|
+
const failure = (cause) => new ArchiveError({ cause: Redacted.make(cause) });
|
|
23
|
+
var Service = class extends Context.Service()("@dual-os/cli/Archives") {};
|
|
24
|
+
const layer = Layer.effect(Service, Effect.gen(function* () {
|
|
25
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
26
|
+
const pack = Effect.fn("Archives.pack")(function* (specifier, cwd) {
|
|
27
|
+
const handle = yield* spawner.spawn(ChildProcess.make("npm", [
|
|
28
|
+
"pack",
|
|
29
|
+
specifier,
|
|
30
|
+
"--ignore-scripts",
|
|
31
|
+
"--json",
|
|
32
|
+
"--cache",
|
|
33
|
+
join(cwd, "cache"),
|
|
34
|
+
"--prefer-online",
|
|
35
|
+
"--fetch-retries=0"
|
|
36
|
+
], {
|
|
37
|
+
cwd,
|
|
38
|
+
stderr: "ignore",
|
|
39
|
+
stdin: "ignore",
|
|
40
|
+
stdout: "pipe"
|
|
41
|
+
}));
|
|
42
|
+
const output = yield* Stream.mkString(Stream.decodeText(handle.stdout));
|
|
43
|
+
if ((yield* handle.exitCode) !== 0) return yield* failure("Native package fetch failed");
|
|
44
|
+
const packed = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Packed))(output);
|
|
45
|
+
const archive = (Array.isArray(packed) ? packed : Record.values(packed))[0];
|
|
46
|
+
if (archive === void 0) return yield* failure("Missing archive");
|
|
47
|
+
if (specifier !== archive.name && specifier !== `${archive.name}@${archive.version}`) return yield* failure("Package identity mismatch");
|
|
48
|
+
return archive;
|
|
49
|
+
}, Effect.scoped, Effect.timeout("60 seconds"), Effect.mapError(failure));
|
|
50
|
+
return Service.of({ pack });
|
|
51
|
+
}));
|
|
52
|
+
const documentBytes = 262144;
|
|
53
|
+
const documentText = (entry, documents) => {
|
|
54
|
+
const { path, size, type } = entry.header;
|
|
55
|
+
if (!Array.contains(documents, path) || type !== "File" || size > documentBytes) return Effect.succeedNone;
|
|
56
|
+
return Effect.map(Stream.mkUint8Array(entry.body), (body) => Option.some(new TextDecoder("utf-8", { ignoreBOM: true }).decode(body)));
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Lists a gzipped npm archive's regular files and reads the named documents.
|
|
60
|
+
* Never extracts or evaluates package code; a duplicate path, or a named document
|
|
61
|
+
* that is not a regular file within 256 KiB, fails.
|
|
62
|
+
*/
|
|
63
|
+
const read = Effect.fn("Archives.read")(function* (archive, documents) {
|
|
64
|
+
const entries = yield* Stream.fromReadableStream({
|
|
65
|
+
evaluate: () => new Blob([Uint8Array.from(archive)]).stream().pipeThrough(new DecompressionStream("gzip")),
|
|
66
|
+
onError: failure
|
|
67
|
+
}).pipe(Stream.pipeThroughChannel(Tar.decode()), Stream.mapEffect((entry) => Effect.map(documentText(entry, documents), (text) => ({
|
|
68
|
+
header: entry.header,
|
|
69
|
+
text
|
|
70
|
+
}))), Stream.runCollect);
|
|
71
|
+
const paths = Array.map(entries, (entry) => entry.header.path);
|
|
72
|
+
const named = Array.filter(entries, (entry) => Array.contains(documents, entry.header.path));
|
|
73
|
+
if (Array.dedupe(paths).length !== paths.length || Array.some(named, (entry) => Option.isNone(entry.text))) return yield* failure("Duplicate or invalid metadata archive entries");
|
|
74
|
+
return {
|
|
75
|
+
documents: Record.fromEntries(Array.getSomes(Array.map(named, (entry) => Option.map(entry.text, (text) => [entry.header.path, text])))),
|
|
76
|
+
files: Array.map(Array.filter(entries, (entry) => entry.header.type === "File"), (entry) => entry.header.path)
|
|
77
|
+
};
|
|
78
|
+
}, Effect.mapError(failure));
|
|
79
|
+
export { ArchiveError, archives_exports as Archives, Service, layer, read };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=archives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archives.js","names":[],"sources":["../../src/release/archives.ts"],"sourcesContent":["import { join } from \"node:path\";\n\nimport { Array, Context, Effect, Layer, Option, Record, Redacted, Schema, Stream } from \"effect\";\n\nimport { Tar } from \"effect/encoding\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nconst Archive = Schema.Struct({\n filename: Schema.String.check(Schema.isPattern(/^[a-zA-Z0-9._-]+\\.tgz$/)),\n name: Schema.NonEmptyString,\n version: Schema.NonEmptyString,\n});\ntype Packed = typeof Packed.Type;\nconst Packed = Schema.Union([\n Schema.Array(Archive).check(Schema.isBetweenLength(1, 1)),\n Schema.Record(Schema.String, Archive).check(Schema.isBetweenProperties(1, 1)),\n]);\n\nexport class ArchiveError extends Schema.TaggedError<ArchiveError>()(\"ArchiveError\", {\n cause: Schema.Redacted(Schema.Defect()),\n}) {}\nconst failure = (cause: unknown) => new ArchiveError({ cause: Redacted.make(cause) });\n\nexport type Interface = {\n /** The caller owns a fresh disposable directory for archives and cache. */\n readonly pack: (\n specifier: string,\n cwd: string,\n ) => Effect.Effect<typeof Archive.Type, ArchiveError>;\n};\nexport class Service extends Context.Service<Service, Interface>()(\"@dual-os/cli/Archives\") {}\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const pack = Effect.fn(\"Archives.pack\")(\n function* (specifier: string, cwd: string) {\n // Fetch one archive, not a dependency tree or peer solver. A fresh cache\n // forbids stale offline fallback. Never run scripts or echo child output.\n const handle = yield* spawner.spawn(\n ChildProcess.make(\n \"npm\",\n [\n \"pack\",\n specifier,\n \"--ignore-scripts\",\n \"--json\",\n \"--cache\",\n join(cwd, \"cache\"),\n \"--prefer-online\",\n \"--fetch-retries=0\",\n ],\n { cwd, stderr: \"ignore\", stdin: \"ignore\", stdout: \"pipe\" },\n ),\n );\n const output = yield* Stream.mkString(Stream.decodeText(handle.stdout));\n if ((yield* handle.exitCode) !== 0) return yield* failure(\"Native package fetch failed\");\n const packed = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Packed))(output);\n const archive = (Array.isArray<Packed>(packed) ? packed : Record.values(packed))[0];\n if (archive === undefined) return yield* failure(\"Missing archive\");\n if (specifier !== archive.name && specifier !== `${archive.name}@${archive.version}`) {\n return yield* failure(\"Package identity mismatch\");\n }\n return archive;\n },\n Effect.scoped,\n Effect.timeout(\"60 seconds\"),\n Effect.mapError(failure),\n );\n return Service.of({ pack });\n }),\n);\n\nconst documentBytes = 262144;\n\n// The body of a named regular file, kept byte-exact (a BOM stays and fails JSON decoding).\nconst documentText = (\n entry: Tar.Entry<Tar.TarError | ArchiveError>,\n documents: ReadonlyArray<string>,\n) => {\n const { path, size, type } = entry.header;\n if (!Array.contains(documents, path) || type !== \"File\" || size > documentBytes) {\n return Effect.succeedNone;\n }\n return Effect.map(Stream.mkUint8Array(entry.body), body =>\n Option.some(new TextDecoder(\"utf-8\", { ignoreBOM: true }).decode(body)),\n );\n};\n\n/**\n * Lists a gzipped npm archive's regular files and reads the named documents.\n * Never extracts or evaluates package code; a duplicate path, or a named document\n * that is not a regular file within 256 KiB, fails.\n */\nexport const read = Effect.fn(\"Archives.read\")(function* (\n archive: Uint8Array,\n documents: ReadonlyArray<string>,\n) {\n const entries = yield* Stream.fromReadableStream({\n evaluate: () =>\n new Blob([Uint8Array.from(archive)]).stream().pipeThrough(new DecompressionStream(\"gzip\")),\n onError: failure,\n }).pipe(\n Stream.pipeThroughChannel(Tar.decode()),\n Stream.mapEffect(entry =>\n Effect.map(documentText(entry, documents), text => ({ header: entry.header, text })),\n ),\n Stream.runCollect,\n );\n const paths = Array.map(entries, entry => entry.header.path);\n const named = Array.filter(entries, entry => Array.contains(documents, entry.header.path));\n if (\n Array.dedupe(paths).length !== paths.length ||\n Array.some(named, entry => Option.isNone(entry.text))\n ) {\n return yield* failure(\"Duplicate or invalid metadata archive entries\");\n }\n return {\n documents: Record.fromEntries(\n Array.getSomes(\n Array.map(named, entry =>\n Option.map(entry.text, text => [entry.header.path, text] as const),\n ),\n ),\n ),\n files: Array.map(\n Array.filter(entries, entry => entry.header.type === \"File\"),\n entry => entry.header.path,\n ),\n };\n}, Effect.mapError(failure));\n\nexport * as Archives from \"./archives.ts\";\n"],"mappings":";;;;;;;;;;;;;;AAOA,MAAM,UAAU,OAAO,OAAO;CAC5B,UAAU,OAAO,OAAO,MAAM,OAAO,UAAU,wBAAwB,CAAC;CACxE,MAAM,OAAO;CACb,SAAS,OAAO;AAClB,CAAC;AAED,MAAM,SAAS,OAAO,MAAM,CAC1B,OAAO,MAAM,OAAO,CAAC,CAAC,MAAM,OAAO,gBAAgB,GAAG,CAAC,CAAC,GACxD,OAAO,OAAO,OAAO,QAAQ,OAAO,CAAC,CAAC,MAAM,OAAO,oBAAoB,GAAG,CAAC,CAAC,CAC9E,CAAC;AAED,IAAa,eAAb,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,MAAM,OAAO,SAAS,MAAM,IAC3D,UAAS,MAAM,OAAO,IACxB;CACF;AACF,GAAG,OAAO,SAAS,OAAO,CAAC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import "./release-manifest.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
declare namespace release_manifest_d_exports {
|
|
4
|
+
export { ExactVersion, Manifest, Packages, ReadableManifest, ReadableSelection, release_manifest_d_exports as ReleaseManifest, Selection, Version, packageName };
|
|
5
|
+
}
|
|
6
|
+
export declare const packageName = "@dual/release-manifest";
|
|
7
|
+
export declare const Version: Schema.String;
|
|
8
|
+
export declare const ExactVersion: Schema.String;
|
|
9
|
+
export declare const Packages: Schema.Struct<{
|
|
10
|
+
readonly "@dual/core": Schema.String;
|
|
11
|
+
readonly "@dual-os/sdk": Schema.String;
|
|
12
|
+
readonly "@dual/dualspec": Schema.String;
|
|
13
|
+
readonly "@dual/workspace-opensandbox": Schema.String;
|
|
14
|
+
readonly effect: Schema.String;
|
|
15
|
+
readonly "@effect/platform-node": Schema.String;
|
|
16
|
+
readonly "@effect/vitest": Schema.String;
|
|
17
|
+
readonly typescript: Schema.String;
|
|
18
|
+
readonly vitest: Schema.String;
|
|
19
|
+
readonly "bun-types": Schema.String;
|
|
20
|
+
readonly "@dual/ai-providers": Schema.optionalKey<Schema.String>;
|
|
21
|
+
readonly "@deslop/coding-standards": Schema.String;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const Manifest: Schema.Struct<{
|
|
24
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
25
|
+
readonly version: Schema.String;
|
|
26
|
+
readonly commit: Schema.String;
|
|
27
|
+
readonly compatibility: Schema.Struct<{
|
|
28
|
+
readonly cli: Schema.NonEmptyString;
|
|
29
|
+
readonly template: Schema.NonEmptyString;
|
|
30
|
+
}>;
|
|
31
|
+
readonly packageManager: Schema.String;
|
|
32
|
+
readonly pair: Schema.Struct<{
|
|
33
|
+
readonly commit: Schema.String;
|
|
34
|
+
readonly coreVersion: Schema.String;
|
|
35
|
+
readonly imageDigest: Schema.String;
|
|
36
|
+
readonly webImage: Schema.Union<readonly [Schema.String, Schema.TemplateLiteral<readonly [Schema.String, "@", Schema.String]>, Schema.TemplateLiteral<readonly [Schema.String, ":", Schema.String, "@", Schema.String]>]>;
|
|
37
|
+
}>;
|
|
38
|
+
readonly packages: Schema.Struct<{
|
|
39
|
+
readonly "@dual/core": Schema.String;
|
|
40
|
+
readonly "@dual-os/sdk": Schema.String;
|
|
41
|
+
readonly "@dual/dualspec": Schema.String;
|
|
42
|
+
readonly "@dual/workspace-opensandbox": Schema.String;
|
|
43
|
+
readonly effect: Schema.String;
|
|
44
|
+
readonly "@effect/platform-node": Schema.String;
|
|
45
|
+
readonly "@effect/vitest": Schema.String;
|
|
46
|
+
readonly typescript: Schema.String;
|
|
47
|
+
readonly vitest: Schema.String;
|
|
48
|
+
readonly "bun-types": Schema.String;
|
|
49
|
+
readonly "@dual/ai-providers": Schema.optionalKey<Schema.String>;
|
|
50
|
+
readonly "@deslop/coding-standards": Schema.String;
|
|
51
|
+
}>;
|
|
52
|
+
}>;
|
|
53
|
+
export type Manifest = typeof Manifest.Type;
|
|
54
|
+
/** A current manifest or one published before the move to @deslop/coding-standards or before
|
|
55
|
+
* plugins left the release. */
|
|
56
|
+
export declare const ReadableManifest: Schema.Struct<{
|
|
57
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
58
|
+
readonly version: Schema.String;
|
|
59
|
+
readonly commit: Schema.String;
|
|
60
|
+
readonly compatibility: Schema.Struct<{
|
|
61
|
+
readonly cli: Schema.NonEmptyString;
|
|
62
|
+
readonly template: Schema.NonEmptyString;
|
|
63
|
+
}>;
|
|
64
|
+
readonly packageManager: Schema.String;
|
|
65
|
+
readonly pair: Schema.Struct<{
|
|
66
|
+
readonly commit: Schema.String;
|
|
67
|
+
readonly coreVersion: Schema.String;
|
|
68
|
+
readonly imageDigest: Schema.String;
|
|
69
|
+
readonly webImage: Schema.Union<readonly [Schema.String, Schema.TemplateLiteral<readonly [Schema.String, "@", Schema.String]>, Schema.TemplateLiteral<readonly [Schema.String, ":", Schema.String, "@", Schema.String]>]>;
|
|
70
|
+
}>;
|
|
71
|
+
readonly packages: Schema.Union<readonly [Schema.Struct<{
|
|
72
|
+
readonly "@dual/core": Schema.String;
|
|
73
|
+
readonly "@dual-os/sdk": Schema.String;
|
|
74
|
+
readonly "@dual/dualspec": Schema.String;
|
|
75
|
+
readonly "@dual/workspace-opensandbox": Schema.String;
|
|
76
|
+
readonly effect: Schema.String;
|
|
77
|
+
readonly "@effect/platform-node": Schema.String;
|
|
78
|
+
readonly "@effect/vitest": Schema.String;
|
|
79
|
+
readonly typescript: Schema.String;
|
|
80
|
+
readonly vitest: Schema.String;
|
|
81
|
+
readonly "bun-types": Schema.String;
|
|
82
|
+
readonly "@dual/ai-providers": Schema.optionalKey<Schema.String>;
|
|
83
|
+
readonly "@deslop/coding-standards": Schema.String;
|
|
84
|
+
}>, Schema.Struct<{
|
|
85
|
+
readonly "@dual/core": Schema.String;
|
|
86
|
+
readonly "@dual-os/sdk": Schema.String;
|
|
87
|
+
readonly "@dual/dualspec": Schema.String;
|
|
88
|
+
readonly "@dual/workspace-opensandbox": Schema.String;
|
|
89
|
+
readonly effect: Schema.String;
|
|
90
|
+
readonly "@effect/platform-node": Schema.String;
|
|
91
|
+
readonly "@effect/vitest": Schema.String;
|
|
92
|
+
readonly typescript: Schema.String;
|
|
93
|
+
readonly vitest: Schema.String;
|
|
94
|
+
readonly "bun-types": Schema.String;
|
|
95
|
+
readonly "@deslop/workflow": Schema.String;
|
|
96
|
+
}>]>;
|
|
97
|
+
readonly plugins: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
98
|
+
}>;
|
|
99
|
+
export type ReadableManifest = typeof ReadableManifest.Type;
|
|
100
|
+
export declare const Selection: Schema.Struct<{
|
|
101
|
+
readonly integrity: Schema.String;
|
|
102
|
+
readonly manifest: Schema.Struct<{
|
|
103
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
104
|
+
readonly version: Schema.String;
|
|
105
|
+
readonly commit: Schema.String;
|
|
106
|
+
readonly compatibility: Schema.Struct<{
|
|
107
|
+
readonly cli: Schema.NonEmptyString;
|
|
108
|
+
readonly template: Schema.NonEmptyString;
|
|
109
|
+
}>;
|
|
110
|
+
readonly packageManager: Schema.String;
|
|
111
|
+
readonly pair: Schema.Struct<{
|
|
112
|
+
readonly commit: Schema.String;
|
|
113
|
+
readonly coreVersion: Schema.String;
|
|
114
|
+
readonly imageDigest: Schema.String;
|
|
115
|
+
readonly webImage: Schema.Union<readonly [Schema.String, Schema.TemplateLiteral<readonly [Schema.String, "@", Schema.String]>, Schema.TemplateLiteral<readonly [Schema.String, ":", Schema.String, "@", Schema.String]>]>;
|
|
116
|
+
}>;
|
|
117
|
+
readonly packages: Schema.Struct<{
|
|
118
|
+
readonly "@dual/core": Schema.String;
|
|
119
|
+
readonly "@dual-os/sdk": Schema.String;
|
|
120
|
+
readonly "@dual/dualspec": Schema.String;
|
|
121
|
+
readonly "@dual/workspace-opensandbox": Schema.String;
|
|
122
|
+
readonly effect: Schema.String;
|
|
123
|
+
readonly "@effect/platform-node": Schema.String;
|
|
124
|
+
readonly "@effect/vitest": Schema.String;
|
|
125
|
+
readonly typescript: Schema.String;
|
|
126
|
+
readonly vitest: Schema.String;
|
|
127
|
+
readonly "bun-types": Schema.String;
|
|
128
|
+
readonly "@dual/ai-providers": Schema.optionalKey<Schema.String>;
|
|
129
|
+
readonly "@deslop/coding-standards": Schema.String;
|
|
130
|
+
}>;
|
|
131
|
+
}>;
|
|
132
|
+
}>;
|
|
133
|
+
export type Selection = typeof Selection.Type;
|
|
134
|
+
export declare const ReadableSelection: Schema.Struct<{
|
|
135
|
+
readonly integrity: Schema.String;
|
|
136
|
+
readonly manifest: Schema.Struct<{
|
|
137
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
138
|
+
readonly version: Schema.String;
|
|
139
|
+
readonly commit: Schema.String;
|
|
140
|
+
readonly compatibility: Schema.Struct<{
|
|
141
|
+
readonly cli: Schema.NonEmptyString;
|
|
142
|
+
readonly template: Schema.NonEmptyString;
|
|
143
|
+
}>;
|
|
144
|
+
readonly packageManager: Schema.String;
|
|
145
|
+
readonly pair: Schema.Struct<{
|
|
146
|
+
readonly commit: Schema.String;
|
|
147
|
+
readonly coreVersion: Schema.String;
|
|
148
|
+
readonly imageDigest: Schema.String;
|
|
149
|
+
readonly webImage: Schema.Union<readonly [Schema.String, Schema.TemplateLiteral<readonly [Schema.String, "@", Schema.String]>, Schema.TemplateLiteral<readonly [Schema.String, ":", Schema.String, "@", Schema.String]>]>;
|
|
150
|
+
}>;
|
|
151
|
+
readonly packages: Schema.Union<readonly [Schema.Struct<{
|
|
152
|
+
readonly "@dual/core": Schema.String;
|
|
153
|
+
readonly "@dual-os/sdk": Schema.String;
|
|
154
|
+
readonly "@dual/dualspec": Schema.String;
|
|
155
|
+
readonly "@dual/workspace-opensandbox": Schema.String;
|
|
156
|
+
readonly effect: Schema.String;
|
|
157
|
+
readonly "@effect/platform-node": Schema.String;
|
|
158
|
+
readonly "@effect/vitest": Schema.String;
|
|
159
|
+
readonly typescript: Schema.String;
|
|
160
|
+
readonly vitest: Schema.String;
|
|
161
|
+
readonly "bun-types": Schema.String;
|
|
162
|
+
readonly "@dual/ai-providers": Schema.optionalKey<Schema.String>;
|
|
163
|
+
readonly "@deslop/coding-standards": Schema.String;
|
|
164
|
+
}>, Schema.Struct<{
|
|
165
|
+
readonly "@dual/core": Schema.String;
|
|
166
|
+
readonly "@dual-os/sdk": Schema.String;
|
|
167
|
+
readonly "@dual/dualspec": Schema.String;
|
|
168
|
+
readonly "@dual/workspace-opensandbox": Schema.String;
|
|
169
|
+
readonly effect: Schema.String;
|
|
170
|
+
readonly "@effect/platform-node": Schema.String;
|
|
171
|
+
readonly "@effect/vitest": Schema.String;
|
|
172
|
+
readonly typescript: Schema.String;
|
|
173
|
+
readonly vitest: Schema.String;
|
|
174
|
+
readonly "bun-types": Schema.String;
|
|
175
|
+
readonly "@deslop/workflow": Schema.String;
|
|
176
|
+
}>]>;
|
|
177
|
+
readonly plugins: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
178
|
+
}>;
|
|
179
|
+
}>;
|
|
180
|
+
export type ReadableSelection = typeof ReadableSelection.Type;
|
|
181
|
+
export { release_manifest_d_exports as ReleaseManifest };
|
|
182
|
+
//# sourceMappingURL=release-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-manifest.d.ts","names":[],"sources":["../../src/release/release-manifest.ts"],"mappings":";;;;;qBAMa;qBACA,SAAO,OAAA;qBACP,cAAY,OAAA;qBAwBZ,UAAQ,OAAA;;;;;;;;;;;;;;qBA4BR,UAAQ,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAGT,kBAAkB,SAAS;;;qBAG1B,kBAAgB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAKjB,0BAA0B,iBAAiB;qBAE1C,WAAS,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YACV,mBAAmB,UAAU;qBAC5B,mBAAiB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAClB,2BAA2B,kBAAkB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { CurrentPair } from "../create/deployment.js";
|
|
3
|
+
import "./release-manifest.js";
|
|
4
|
+
import { Array, Schema, String } from "effect";
|
|
5
|
+
import semver from "semver";
|
|
6
|
+
// src/release/release-manifest.ts
|
|
7
|
+
var release_manifest_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
ExactVersion: () => ExactVersion,
|
|
9
|
+
Manifest: () => Manifest,
|
|
10
|
+
Packages: () => Packages,
|
|
11
|
+
ReadableManifest: () => ReadableManifest,
|
|
12
|
+
ReadableSelection: () => ReadableSelection,
|
|
13
|
+
ReleaseManifest: () => release_manifest_exports,
|
|
14
|
+
Selection: () => Selection,
|
|
15
|
+
Version: () => Version,
|
|
16
|
+
packageName: () => packageName
|
|
17
|
+
});
|
|
18
|
+
const packageName = "@dual/release-manifest";
|
|
19
|
+
const Version = Schema.String.check(Schema.isPattern(/^0\.0\.[1-9][0-9]*$/));
|
|
20
|
+
const ExactVersion = Schema.String.check(Schema.makeFilter((value) => {
|
|
21
|
+
const parsed = semver.parse(value);
|
|
22
|
+
return parsed !== null && value === `${parsed.version}${Array.isReadonlyArrayEmpty(parsed.build) ? "" : `+${Array.join(parsed.build, ".")}`}`;
|
|
23
|
+
}));
|
|
24
|
+
const framework = {
|
|
25
|
+
"@dual/core": ExactVersion,
|
|
26
|
+
"@dual-os/sdk": ExactVersion,
|
|
27
|
+
"@dual/dualspec": ExactVersion,
|
|
28
|
+
"@dual/workspace-opensandbox": ExactVersion,
|
|
29
|
+
effect: ExactVersion,
|
|
30
|
+
"@effect/platform-node": ExactVersion,
|
|
31
|
+
"@effect/vitest": ExactVersion,
|
|
32
|
+
typescript: ExactVersion,
|
|
33
|
+
vitest: ExactVersion,
|
|
34
|
+
"bun-types": ExactVersion
|
|
35
|
+
};
|
|
36
|
+
const Packages = Schema.Struct({
|
|
37
|
+
...framework,
|
|
38
|
+
"@dual/ai-providers": Schema.optionalKey(ExactVersion),
|
|
39
|
+
"@deslop/coding-standards": ExactVersion
|
|
40
|
+
});
|
|
41
|
+
const PreviousPackages = Schema.Struct({
|
|
42
|
+
...framework,
|
|
43
|
+
"@deslop/workflow": ExactVersion
|
|
44
|
+
});
|
|
45
|
+
const manifestFields = {
|
|
46
|
+
schemaVersion: Schema.Literal(1),
|
|
47
|
+
version: Version,
|
|
48
|
+
commit: Schema.String.check(Schema.isPattern(/^[a-f0-9]{40}$/)),
|
|
49
|
+
compatibility: Schema.Struct({
|
|
50
|
+
cli: Schema.NonEmptyString.check(Schema.makeFilter((value) => semver.validRange(value) !== null)),
|
|
51
|
+
template: Schema.NonEmptyString
|
|
52
|
+
}),
|
|
53
|
+
packageManager: Schema.String.check(Schema.makeFilter((value) => String.startsWith("bun@")(value) && Schema.is(ExactVersion)(String.slice(4)(value)))),
|
|
54
|
+
pair: CurrentPair
|
|
55
|
+
};
|
|
56
|
+
const corePinMatchesPair = Schema.makeFilter((manifest) => manifest.packages["@dual/core"] === manifest.pair.coreVersion, { message: "Core pin must match the qualified image pair" });
|
|
57
|
+
const Manifest = Schema.Struct({
|
|
58
|
+
...manifestFields,
|
|
59
|
+
packages: Packages
|
|
60
|
+
}).check(corePinMatchesPair);
|
|
61
|
+
/** A current manifest or one published before the move to @deslop/coding-standards or before
|
|
62
|
+
* plugins left the release. */
|
|
63
|
+
const ReadableManifest = Schema.Struct({
|
|
64
|
+
...manifestFields,
|
|
65
|
+
packages: Schema.Union([Packages, PreviousPackages]),
|
|
66
|
+
plugins: Schema.optionalKey(Schema.Record(Schema.String, ExactVersion))
|
|
67
|
+
}).check(corePinMatchesPair);
|
|
68
|
+
const integrity = Schema.String.check(Schema.isPattern(/^sha512-[A-Za-z0-9+/]{85}[AQgw]==$/));
|
|
69
|
+
const Selection = Schema.Struct({
|
|
70
|
+
integrity,
|
|
71
|
+
manifest: Manifest
|
|
72
|
+
});
|
|
73
|
+
const ReadableSelection = Schema.Struct({
|
|
74
|
+
integrity,
|
|
75
|
+
manifest: ReadableManifest
|
|
76
|
+
});
|
|
77
|
+
export { ExactVersion, Manifest, Packages, ReadableManifest, ReadableSelection, release_manifest_exports as ReleaseManifest, Selection, Version, packageName };
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=release-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-manifest.js","names":["Deployment.CurrentPair"],"sources":["../../src/release/release-manifest.ts"],"sourcesContent":["import { Array, Schema, String } from \"effect\";\n\nimport semver from \"semver\";\n\nimport { Deployment } from \"../create/deployment.ts\";\n\nexport const packageName = \"@dual/release-manifest\";\nexport const Version = Schema.String.check(Schema.isPattern(/^0\\.0\\.[1-9][0-9]*$/));\nexport const ExactVersion = Schema.String.check(\n Schema.makeFilter(value => {\n const parsed = semver.parse(value);\n return (\n parsed !== null &&\n value ===\n `${parsed.version}${Array.isReadonlyArrayEmpty(parsed.build) ? \"\" : `+${Array.join(parsed.build, \".\")}`}`\n );\n }),\n);\n// Field order is the manifest's key order: candidates first, then the public toolchain in\n// download order.\nconst framework = {\n \"@dual/core\": ExactVersion,\n \"@dual-os/sdk\": ExactVersion,\n \"@dual/dualspec\": ExactVersion,\n \"@dual/workspace-opensandbox\": ExactVersion,\n effect: ExactVersion,\n \"@effect/platform-node\": ExactVersion,\n \"@effect/vitest\": ExactVersion,\n typescript: ExactVersion,\n vitest: ExactVersion,\n \"bun-types\": ExactVersion,\n};\nexport const Packages = Schema.Struct({\n ...framework,\n \"@dual/ai-providers\": Schema.optionalKey(ExactVersion),\n \"@deslop/coding-standards\": ExactVersion,\n});\n// Releases published before the scaffold moved to @deslop/coding-standards. The CLI still lists\n// them, but creates repositories only from current releases.\nconst PreviousPackages = Schema.Struct({ ...framework, \"@deslop/workflow\": ExactVersion });\nconst manifestFields = {\n schemaVersion: Schema.Literal(1),\n version: Version,\n commit: Schema.String.check(Schema.isPattern(/^[a-f0-9]{40}$/)),\n compatibility: Schema.Struct({\n cli: Schema.NonEmptyString.check(Schema.makeFilter(value => semver.validRange(value) !== null)),\n template: Schema.NonEmptyString,\n }),\n packageManager: Schema.String.check(\n Schema.makeFilter(\n value => String.startsWith(\"bun@\")(value) && Schema.is(ExactVersion)(String.slice(4)(value)),\n ),\n ),\n pair: Deployment.CurrentPair,\n};\nconst corePinMatchesPair = Schema.makeFilter(\n (manifest: { packages: { \"@dual/core\": string }; pair: { coreVersion: string } }) =>\n manifest.packages[\"@dual/core\"] === manifest.pair.coreVersion,\n { message: \"Core pin must match the qualified image pair\" },\n);\nexport const Manifest = Schema.Struct({ ...manifestFields, packages: Packages }).check(\n corePinMatchesPair,\n);\nexport type Manifest = typeof Manifest.Type;\n/** A current manifest or one published before the move to @deslop/coding-standards or before\n * plugins left the release. */\nexport const ReadableManifest = Schema.Struct({\n ...manifestFields,\n packages: Schema.Union([Packages, PreviousPackages]),\n plugins: Schema.optionalKey(Schema.Record(Schema.String, ExactVersion)),\n}).check(corePinMatchesPair);\nexport type ReadableManifest = typeof ReadableManifest.Type;\nconst integrity = Schema.String.check(Schema.isPattern(/^sha512-[A-Za-z0-9+/]{85}[AQgw]==$/));\nexport const Selection = Schema.Struct({ integrity, manifest: Manifest });\nexport type Selection = typeof Selection.Type;\nexport const ReadableSelection = Schema.Struct({ integrity, manifest: ReadableManifest });\nexport type ReadableSelection = typeof ReadableSelection.Type;\n\nexport * as ReleaseManifest from \"./release-manifest.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAMA,MAAa,cAAc;AAC3B,MAAa,UAAU,OAAO,OAAO,MAAM,OAAO,UAAU,qBAAqB,CAAC;AAClF,MAAa,eAAe,OAAO,OAAO,MACxC,OAAO,YAAW,UAAS;CACzB,MAAM,SAAS,OAAO,MAAM,KAAK;CACjC,OACE,WAAW,QACX,UACE,GAAG,OAAO,UAAU,MAAM,qBAAqB,OAAO,KAAK,IAAI,KAAK,IAAI,MAAM,KAAK,OAAO,OAAO,GAAG;AAE1G,CAAC,CACH;AAGA,MAAM,YAAY;CAChB,cAAc;CACd,gBAAgB;CAChB,kBAAkB;CAClB,+BAA+B;CAC/B,QAAQ;CACR,yBAAyB;CACzB,kBAAkB;CAClB,YAAY;CACZ,QAAQ;CACR,aAAa;AACf;AACA,MAAa,WAAW,OAAO,OAAO;CACpC,GAAG;CACH,sBAAsB,OAAO,YAAY,YAAY;CACrD,4BAA4B;AAC9B,CAAC;AAGD,MAAM,mBAAmB,OAAO,OAAO;CAAE,GAAG;CAAW,oBAAoB;AAAa,CAAC;AACzF,MAAM,iBAAiB;CACrB,eAAe,OAAO,QAAQ,CAAC;CAC/B,SAAS;CACT,QAAQ,OAAO,OAAO,MAAM,OAAO,UAAU,gBAAgB,CAAC;CAC9D,eAAe,OAAO,OAAO;EAC3B,KAAK,OAAO,eAAe,MAAM,OAAO,YAAW,UAAS,OAAO,WAAW,KAAK,MAAM,IAAI,CAAC;EAC9F,UAAU,OAAO;CACnB,CAAC;CACD,gBAAgB,OAAO,OAAO,MAC5B,OAAO,YACL,UAAS,OAAO,WAAW,MAAM,CAAC,CAAC,KAAK,KAAK,OAAO,GAAG,YAAY,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAC7F,CACF;CACA,MAAMA;AACR;AACA,MAAM,qBAAqB,OAAO,YAC/B,aACC,SAAS,SAAS,kBAAkB,SAAS,KAAK,aACpD,EAAE,SAAS,+CAA+C,CAC5D;AACA,MAAa,WAAW,OAAO,OAAO;CAAE,GAAG;CAAgB,UAAU;AAAS,CAAC,CAAC,CAAC,MAC/E,kBACF;;;AAIA,MAAa,mBAAmB,OAAO,OAAO;CAC5C,GAAG;CACH,UAAU,OAAO,MAAM,CAAC,UAAU,gBAAgB,CAAC;CACnD,SAAS,OAAO,YAAY,OAAO,OAAO,OAAO,QAAQ,YAAY,CAAC;AACxE,CAAC,CAAC,CAAC,MAAM,kBAAkB;AAE3B,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,UAAU,oCAAoC,CAAC;AAC5F,MAAa,YAAY,OAAO,OAAO;CAAE;CAAW,UAAU;AAAS,CAAC;AAExE,MAAa,oBAAoB,OAAO,OAAO;CAAE;CAAW,UAAU;AAAiB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReadableSelection, Selection } from "./release-manifest.js";
|
|
2
|
+
import "./releases.js";
|
|
3
|
+
import { Context, Effect, FileSystem, Layer, Schema } from "effect";
|
|
4
|
+
import { ChildProcessSpawner } from "effect/process";
|
|
5
|
+
declare namespace releases_d_exports {
|
|
6
|
+
export { CoreSelector, Interface, ReleaseError, releases_d_exports as Releases, Request, Selector, Service, Version, layer, packageName };
|
|
7
|
+
}
|
|
8
|
+
export declare const packageName = "@dual/release-manifest";
|
|
9
|
+
export declare const Version: Schema.String;
|
|
10
|
+
export declare const CoreSelector: Schema.Union<readonly [Schema.Literal<"latest">, Schema.String]>;
|
|
11
|
+
export declare const Selector: Schema.Union<readonly [Schema.Literal<"latest">, Schema.String]>;
|
|
12
|
+
export declare const Request: Schema.Union<readonly [Schema.Struct<{
|
|
13
|
+
readonly core: Schema.Union<readonly [Schema.Literal<"latest">, Schema.String]>;
|
|
14
|
+
readonly manifest: Schema.optionalKey<Schema.Never>;
|
|
15
|
+
}>, Schema.Struct<{
|
|
16
|
+
readonly core: Schema.optionalKey<Schema.Never>;
|
|
17
|
+
readonly manifest: Schema.String;
|
|
18
|
+
}>]>;
|
|
19
|
+
export type Request = typeof Request.Type;
|
|
20
|
+
declare const ReleaseError_base: Schema.Class<ReleaseError, Schema.TaggedStruct<"ReleaseError", {
|
|
21
|
+
readonly cause: Schema.Redacted<Schema.Defect>;
|
|
22
|
+
}>, import("effect/Cause").YieldableError>;
|
|
23
|
+
export declare class ReleaseError extends ReleaseError_base {}
|
|
24
|
+
export type Interface = {
|
|
25
|
+
readonly resolve: (request: Request) => Effect.Effect<ReadableSelection, ReleaseError>;
|
|
26
|
+
readonly resolveForCreate: (request: Request, compatibility: {
|
|
27
|
+
readonly cli: string;
|
|
28
|
+
readonly template: string;
|
|
29
|
+
}) => Effect.Effect<Selection, ReleaseError>;
|
|
30
|
+
readonly verify: (selection: Selection) => Effect.Effect<Selection, ReleaseError>;
|
|
31
|
+
};
|
|
32
|
+
declare const Service_base: Context.ServiceClass<Service, "@dual-os/cli/Releases", Interface>;
|
|
33
|
+
export declare class Service extends Service_base {}
|
|
34
|
+
export declare const layer: Layer.Layer<Service, never, ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem>;
|
|
35
|
+
export { releases_d_exports as Releases };
|
|
36
|
+
//# sourceMappingURL=releases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"releases.d.ts","names":["ReleaseManifest.ReadableSelection","ReleaseManifest.Selection"],"sources":["../../src/release/releases.ts"],"mappings":";;;;;;;qBAwBa;qBACA,SAAO,OAAA;qBACP,cAAY,OAAA,gBAAA,OAAA,mBAAA,OAAA;qBACZ,UAAQ,OAAA,gBAAA,OAAA,mBAAA,OAAA;qBACR,SAAO,OAAA,gBAAA,OAAA;;;;;;;YAIR,iBAAiB,QAAQ;;;;qBAexB,qBAAqB;YAItB;WACD,UACP,SAAS,YACN,OAAO,OAAOA,mBAAmC;WAC7C,mBACP,SAAS,SACT;aAA0B;aAAsB;QAC7C,OAAO,OAAOC,WAA2B;WACrC,SACP,WAAWA,cACR,OAAO,OAAOA,WAA2B;;;qBAEnC,gBAAgB;qBAChB,OAAK,MAAA,MAAA,gBAAA,oBAAA,sBAAA,WAAA"}
|