@yourrealm/sdk 0.0.0-alpha.1378.ce03c8dc
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-EXCEPTION +26 -0
- package/README.md +34 -0
- package/dist/chunk-3R6KEFOI.js +22 -0
- package/dist/chunk-67BDAMYX.js +376 -0
- package/dist/chunk-AITGS27R.js +139 -0
- package/dist/chunk-CMAEHQ4F.js +6 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/chunk-O3UIK34B.js +1430 -0
- package/dist/chunk-VHTUSZUX.js +176 -0
- package/dist/cli.js +9006 -0
- package/dist/docker.js +54 -0
- package/dist/index.js +1053 -0
- package/dist/ingress.js +436 -0
- package/dist/jsx-runtime.js +2 -0
- package/dist/preact.js +22 -0
- package/dist/service-url.js +11 -0
- package/dist/services.js +213 -0
- package/dist/test.js +5069 -0
- package/dist/ui.js +254 -0
- package/dist/worker-protocol.js +89 -0
- package/package.json +112 -0
- package/src/app-icon.ts +74 -0
- package/src/apply.ts +52 -0
- package/src/bundle-ui.ts +211 -0
- package/src/bundle.ts +546 -0
- package/src/cli/build-dev-landing.ts +84 -0
- package/src/cli/build-install-panel.ts +90 -0
- package/src/cli/build-runtime.ts +133 -0
- package/src/cli/build.ts +63 -0
- package/src/cli/dev.ts +107 -0
- package/src/cli/down.ts +60 -0
- package/src/cli/main.ts +56 -0
- package/src/cli/test.ts +61 -0
- package/src/cli/validate.ts +37 -0
- package/src/compile.ts +100 -0
- package/src/create-app.ts +982 -0
- package/src/deep-merge.ts +33 -0
- package/src/dev/fixture.ts +48 -0
- package/src/dev/install-handler.ts +383 -0
- package/src/dev/server.ts +968 -0
- package/src/dev/stack.ts +108 -0
- package/src/dev/state.ts +159 -0
- package/src/docker.ts +96 -0
- package/src/errors.ts +61 -0
- package/src/factory.ts +481 -0
- package/src/garage.ts +56 -0
- package/src/generator/hash.ts +6 -0
- package/src/generator/resolve-refs.ts +207 -0
- package/src/grants-builder.ts +100 -0
- package/src/grants.ts +260 -0
- package/src/home-api.ts +172 -0
- package/src/home-cookie.ts +10 -0
- package/src/home-registry.ts +120 -0
- package/src/home.ts +187 -0
- package/src/host-registry.ts +143 -0
- package/src/http-header.ts +20 -0
- package/src/identifiers.ts +49 -0
- package/src/index.ts +66 -0
- package/src/info.ts +64 -0
- package/src/ini.ts +50 -0
- package/src/json.ts +14 -0
- package/src/jsx-runtime/index.ts +5 -0
- package/src/keys.ts +29 -0
- package/src/mysql.ts +56 -0
- package/src/pack-build.ts +108 -0
- package/src/pack.ts +115 -0
- package/src/peer-registry.ts +121 -0
- package/src/peer-world.ts +117 -0
- package/src/permission-meta.ts +116 -0
- package/src/permissions.ts +108 -0
- package/src/pkg-root.ts +34 -0
- package/src/postgres.ts +79 -0
- package/src/preact/index.ts +27 -0
- package/src/redis.ts +43 -0
- package/src/ref.ts +271 -0
- package/src/remote-registry.ts +33 -0
- package/src/required-host-kinds.ts +110 -0
- package/src/resolve-context.ts +111 -0
- package/src/resolve.ts +471 -0
- package/src/runtime/docker/compose/compose-schema.ts +118 -0
- package/src/runtime/docker/compose/convert-to-docker-compose.ts +278 -0
- package/src/runtime/docker/compose/default-hardening.ts +21 -0
- package/src/runtime/docker/compose/effects.ts +107 -0
- package/src/runtime/docker/compose/index.ts +17 -0
- package/src/runtime/docker/compose/labels.ts +39 -0
- package/src/runtime/docker/compose/types.ts +78 -0
- package/src/runtime/docker/home-proxy-server/index.ts +177 -0
- package/src/runtime/docker/home-proxy-server/protocol.ts +53 -0
- package/src/runtime/docker/ingress/build-config.ts +819 -0
- package/src/runtime/docker/ingress/index.ts +16 -0
- package/src/runtime/docker/ingress/types.ts +182 -0
- package/src/runtime/docker/log-frames.ts +121 -0
- package/src/runtime/docker/logs-server/index.ts +366 -0
- package/src/runtime/docker/spawn-server/context-key.ts +82 -0
- package/src/runtime/docker/spawn-server/index.ts +492 -0
- package/src/runtime/docker/spawn-server/protocol.ts +70 -0
- package/src/runtime/docker/spawn-server/spec.ts +122 -0
- package/src/runtime/docker/stats-server/disks.ts +161 -0
- package/src/runtime/docker/stats-server/index.ts +322 -0
- package/src/runtime/home-client/index.ts +71 -0
- package/src/runtime/log-line.ts +24 -0
- package/src/runtime/logs-client/index.ts +175 -0
- package/src/runtime/spawn-client/index.ts +93 -0
- package/src/runtime/spawn-client/kaniko.ts +79 -0
- package/src/runtime/stats-client/index.ts +65 -0
- package/src/runtime/stats-sample.ts +95 -0
- package/src/safe-json.ts +37 -0
- package/src/sandbox.ts +1209 -0
- package/src/schema/build-apps.ts +38 -0
- package/src/schema/home.ts +217 -0
- package/src/schema/host.ts +792 -0
- package/src/schema/inputs.ts +26 -0
- package/src/schema/nodes.ts +75 -0
- package/src/schema/peer.ts +400 -0
- package/src/schema/public-domain.ts +116 -0
- package/src/schema/remote.ts +74 -0
- package/src/security.ts +594 -0
- package/src/serialize.ts +21 -0
- package/src/service-definition.ts +284 -0
- package/src/service-url.ts +64 -0
- package/src/service.ts +39 -0
- package/src/services/index.ts +5 -0
- package/src/shared.ts +65 -0
- package/src/speculative-silo.ts +96 -0
- package/src/stable-secret.ts +14 -0
- package/src/surfaces.ts +264 -0
- package/src/tailwind-bin.ts +56 -0
- package/src/test/boot.ts +192 -0
- package/src/test/compile.ts +501 -0
- package/src/test/describe.ts +117 -0
- package/src/test/index.ts +11 -0
- package/src/test/ingress-fixture.ts +37 -0
- package/src/test/types.ts +318 -0
- package/src/trusted-headers.ts +79 -0
- package/src/types.ts +126 -0
- package/src/ui/components/aside.tsx +96 -0
- package/src/ui/components/badge.tsx +42 -0
- package/src/ui/components/button.tsx +59 -0
- package/src/ui/components/card.tsx +106 -0
- package/src/ui/components/checkbox.tsx +37 -0
- package/src/ui/components/code-block.tsx +29 -0
- package/src/ui/components/combobox.tsx +119 -0
- package/src/ui/components/config-field.tsx +284 -0
- package/src/ui/components/dialog.tsx +137 -0
- package/src/ui/components/domain-editor.tsx +317 -0
- package/src/ui/components/domain-list.ts +205 -0
- package/src/ui/components/dropdown-menu.tsx +73 -0
- package/src/ui/components/empty-state.tsx +51 -0
- package/src/ui/components/highlight.ts +59 -0
- package/src/ui/components/icons.tsx +101 -0
- package/src/ui/components/image-posture.tsx +85 -0
- package/src/ui/components/input.tsx +28 -0
- package/src/ui/components/label.tsx +16 -0
- package/src/ui/components/line-chart.tsx +113 -0
- package/src/ui/components/page.tsx +39 -0
- package/src/ui/components/permission-row.tsx +262 -0
- package/src/ui/components/permission-section.tsx +51 -0
- package/src/ui/components/pie-chart.tsx +245 -0
- package/src/ui/components/schema-block.tsx +60 -0
- package/src/ui/components/separator.tsx +42 -0
- package/src/ui/components/sheet.tsx +130 -0
- package/src/ui/components/sidebar.tsx +650 -0
- package/src/ui/components/silo-picker.tsx +510 -0
- package/src/ui/components/skeleton.tsx +13 -0
- package/src/ui/components/sonner.tsx +33 -0
- package/src/ui/components/switch.tsx +58 -0
- package/src/ui/components/table-view.ts +219 -0
- package/src/ui/components/table.tsx +506 -0
- package/src/ui/components/tabs.tsx +59 -0
- package/src/ui/components/timeago.tsx +84 -0
- package/src/ui/components/tooltip.tsx +56 -0
- package/src/ui/components.json +21 -0
- package/src/ui/dev/dev-shell.tsx +145 -0
- package/src/ui/home/home-grid.tsx +177 -0
- package/src/ui/hooks/use-mobile.ts +19 -0
- package/src/ui/index.ts +189 -0
- package/src/ui/install/adapter.ts +193 -0
- package/src/ui/install/deploy-targets-picker.tsx +185 -0
- package/src/ui/install/install-app-panel.tsx +912 -0
- package/src/ui/install/install-error.tsx +62 -0
- package/src/ui/install/perms-inactive.ts +50 -0
- package/src/ui/install/required-fields.ts +37 -0
- package/src/ui/install/tabs-form.tsx +557 -0
- package/src/ui/tokens.css +279 -0
- package/src/ui/utils.ts +78 -0
- package/src/ui-error.ts +139 -0
- package/src/ui-runtime/dev-landing-entry.tsx +258 -0
- package/src/ui-runtime/index.ts +83 -0
- package/src/ui-runtime/install-entry.tsx +119 -0
- package/src/ui-runtime/mount.ts +367 -0
- package/src/ui-runtime/runtime.css +56 -0
- package/src/ui-surface.ts +451 -0
- package/src/valkey.ts +43 -0
- package/src/worker/extract-tar.ts +125 -0
- package/src/worker/identity.ts +183 -0
- package/src/worker/index.ts +16 -0
- package/src/worker/public-ip.ts +92 -0
- package/src/worker/queue.ts +54 -0
- package/src/worker/reconcile.ts +127 -0
- package/src/worker/start-worker.ts +227 -0
- package/src/worker/ui-proxy.ts +335 -0
- package/src/worker/uplink.ts +523 -0
- package/src/worker/validate.ts +34 -0
- package/src/worker/verify-relay.ts +102 -0
- package/src/worker-protocol/app-dirs.ts +94 -0
- package/src/worker-protocol/home-proxy-paths.ts +76 -0
- package/src/worker-protocol/index.ts +55 -0
- package/src/worker-protocol/ingress.ts +166 -0
- package/src/worker-protocol/logs-socket-path.ts +50 -0
- package/src/worker-protocol/networks.ts +39 -0
- package/src/worker-protocol/node-version.ts +70 -0
- package/src/worker-protocol/silo-paths.ts +114 -0
- package/src/worker-protocol/spawn-paths.ts +165 -0
- package/src/worker-protocol/stats-socket-path.ts +40 -0
- package/src/worker-protocol/update-files.ts +77 -0
- package/src/worker-protocol/uplink/constants.ts +86 -0
- package/src/worker-protocol/uplink/errors.ts +61 -0
- package/src/worker-protocol/uplink/frame.ts +114 -0
- package/src/worker-protocol/uplink/identity.ts +40 -0
- package/src/worker-protocol/uplink/index.ts +63 -0
- package/src/worker-protocol/uplink/methods.ts +462 -0
- package/src/worker-protocol/uplink/mux.ts +646 -0
- package/src/worker-protocol/uplink/protocol.ts +11 -0
- package/src/worker-protocol/uplink/rpc.ts +309 -0
- package/src/worker-protocol/uplink/session.ts +540 -0
- package/src/worker-protocol/uplink/test-support.ts +188 -0
- package/src/worker-protocol/worker-mount.ts +27 -0
- package/src/worker-protocol/worker-state.ts +190 -0
- package/src/xml.ts +49 -0
- package/src/yaml.ts +15 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Violation } from "../../home.ts";
|
|
2
|
+
import type { InstallErrorShape } from "./adapter.ts";
|
|
3
|
+
|
|
4
|
+
export type { InstallErrorShape };
|
|
5
|
+
|
|
6
|
+
export function parseInstallError(status: number, body: unknown): InstallErrorShape {
|
|
7
|
+
const b = body as { error?: string; violations?: Violation[] } | null;
|
|
8
|
+
if (b && b.error === "grant violations" && Array.isArray(b.violations)) {
|
|
9
|
+
return { kind: "violations", violations: b.violations };
|
|
10
|
+
}
|
|
11
|
+
if (b && typeof b.error === "string") return { kind: "message", message: b.error };
|
|
12
|
+
return { kind: "network", message: `Request failed (${status})` };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function InstallError({ error }: { error: InstallErrorShape }) {
|
|
16
|
+
if (error.kind === "violations") {
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
class="rounded-2xl border border-destructive/40 bg-destructive/5 p-4 flex flex-col gap-2"
|
|
20
|
+
data-testid="install-violations"
|
|
21
|
+
>
|
|
22
|
+
<h4 class="text-sm font-bold text-destructive">Permission violations</h4>
|
|
23
|
+
<ul class="flex flex-col gap-1.5">
|
|
24
|
+
{error.violations.map((v, i) => (
|
|
25
|
+
<li key={i} class="text-xs text-destructive/90">
|
|
26
|
+
{v.kind === "grant" ? (
|
|
27
|
+
<>
|
|
28
|
+
<span class="font-mono font-semibold">{v.permissionKind}</span>
|
|
29
|
+
{v.serviceName ? (
|
|
30
|
+
<>
|
|
31
|
+
{" in service "}
|
|
32
|
+
<span class="font-mono font-semibold">{v.serviceName}</span>
|
|
33
|
+
</>
|
|
34
|
+
) : null}
|
|
35
|
+
: {v.description} (<span class="font-mono">{JSON.stringify(v.use)}</span>)
|
|
36
|
+
</>
|
|
37
|
+
) : v.kind === "worker-capability" ? (
|
|
38
|
+
<>
|
|
39
|
+
Worker <span class="font-mono font-semibold">{v.workerId}</span> can't satisfy:{" "}
|
|
40
|
+
<span class="font-mono font-semibold">{v.missing.join(", ")}</span>
|
|
41
|
+
</>
|
|
42
|
+
) : v.kind === "app-kind" || v.kind === "routing" ? (
|
|
43
|
+
<>{v.description}</>
|
|
44
|
+
) : (
|
|
45
|
+
<>{v.message}</>
|
|
46
|
+
)}
|
|
47
|
+
</li>
|
|
48
|
+
))}
|
|
49
|
+
</ul>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div
|
|
56
|
+
class="rounded-2xl border border-destructive/40 bg-destructive/5 text-destructive text-sm px-4 py-3"
|
|
57
|
+
data-testid="install-error"
|
|
58
|
+
>
|
|
59
|
+
{error.message}
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Pure walker shared between InstallAppPanel and EditAppPanel. An
|
|
2
|
+
// optional section whose value is `undefined` means the feature is off;
|
|
3
|
+
// any permission nested under that section's path is inactive and
|
|
4
|
+
// shouldn't count toward "required but missing" checks.
|
|
5
|
+
|
|
6
|
+
import type { SerializablePermission } from "../../sandbox.ts";
|
|
7
|
+
import type { ConfigFieldTree } from "./tabs-form.tsx";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Dotted paths of permissions that live inside an optional-section
|
|
11
|
+
* subtree whose toggle is currently off. Those permissions must not be
|
|
12
|
+
* treated as required, since the feature they power is disabled.
|
|
13
|
+
*/
|
|
14
|
+
export function permsInInactiveSections(
|
|
15
|
+
schema: ConfigFieldTree,
|
|
16
|
+
values: Record<string, unknown>,
|
|
17
|
+
permissionsFlat: Record<string, SerializablePermission>,
|
|
18
|
+
): Set<string> {
|
|
19
|
+
const inactivePrefixes: string[] = [];
|
|
20
|
+
function walk(fields: ConfigFieldTree, vals: Record<string, unknown>, prefix: string) {
|
|
21
|
+
for (const [name, field] of Object.entries(fields)) {
|
|
22
|
+
const path = prefix ? `${prefix}.${name}` : name;
|
|
23
|
+
if (field.type === "section") {
|
|
24
|
+
const current = vals[name];
|
|
25
|
+
if (field.optional && current === undefined) {
|
|
26
|
+
inactivePrefixes.push(path);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const nested = (current as Record<string, unknown> | undefined) ?? {};
|
|
30
|
+
walk(field.fields, nested, path);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (field.type === "tab") {
|
|
34
|
+
const nested = (vals[name] as Record<string, unknown> | undefined) ?? {};
|
|
35
|
+
walk(field.fields, nested, path);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
walk(schema, values, "");
|
|
40
|
+
const out = new Set<string>();
|
|
41
|
+
for (const p of Object.keys(permissionsFlat)) {
|
|
42
|
+
for (const prefix of inactivePrefixes) {
|
|
43
|
+
if (p === prefix || p.startsWith(prefix + ".")) {
|
|
44
|
+
out.add(p);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Pure walker shared between InstallAppPanel and EditAppPanel's update mode:
|
|
2
|
+
// which required config fields still hold nothing.
|
|
3
|
+
|
|
4
|
+
import type { ConfigFieldTree } from "./tabs-form.tsx";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Dotted paths of required fields that are unset. Skips subtrees of optional
|
|
8
|
+
* sections whose toggle is off (those sections must report `undefined`, not
|
|
9
|
+
* a missing-field error).
|
|
10
|
+
*/
|
|
11
|
+
export function findMissingRequired(
|
|
12
|
+
schema: ConfigFieldTree,
|
|
13
|
+
values: Record<string, unknown>,
|
|
14
|
+
prefix = "",
|
|
15
|
+
): string[] {
|
|
16
|
+
const missing: string[] = [];
|
|
17
|
+
for (const [name, field] of Object.entries(schema)) {
|
|
18
|
+
const path = prefix ? `${prefix}.${name}` : name;
|
|
19
|
+
if (field.type === "permission") continue;
|
|
20
|
+
if (field.type === "tab") {
|
|
21
|
+
const nested = (values[name] as Record<string, unknown> | undefined) ?? {};
|
|
22
|
+
missing.push(...findMissingRequired(field.fields, nested, path));
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (field.type === "section") {
|
|
26
|
+
const current = values[name];
|
|
27
|
+
if (field.optional && current === undefined) continue;
|
|
28
|
+
const nested = (current as Record<string, unknown> | undefined) ?? {};
|
|
29
|
+
missing.push(...findMissingRequired(field.fields, nested, path));
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (field.optional) continue;
|
|
33
|
+
const v = values[name];
|
|
34
|
+
if (v === undefined || v === null || v === "") missing.push(path);
|
|
35
|
+
}
|
|
36
|
+
return missing;
|
|
37
|
+
}
|