alasio 8.0.0 → 9.0.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/dist/cli/src/api-server.js +18 -0
- package/dist/cli/src/api-server.js.map +1 -0
- package/dist/cli/src/branches.js +61 -20
- package/dist/cli/src/branches.js.map +1 -1
- package/dist/cli/src/cluster/docker.js +25 -10
- package/dist/cli/src/cluster/docker.js.map +1 -1
- package/dist/cli/src/cluster/host.js +33 -7
- package/dist/cli/src/cluster/host.js.map +1 -1
- package/dist/cli/src/cluster/k3s.js +43 -11
- package/dist/cli/src/cluster/k3s.js.map +1 -1
- package/dist/cli/src/cluster/node.js +107 -32
- package/dist/cli/src/cluster/node.js.map +1 -1
- package/dist/cli/src/cluster/stargz.js +55 -0
- package/dist/cli/src/cluster/stargz.js.map +1 -0
- package/dist/cli/src/commands/branch.js +5 -4
- package/dist/cli/src/commands/branch.js.map +1 -1
- package/dist/cli/src/commands/common.js +9 -3
- package/dist/cli/src/commands/common.js.map +1 -1
- package/dist/cli/src/commands/folder.js +14 -0
- package/dist/cli/src/commands/folder.js.map +1 -0
- package/dist/cli/src/commands/status.js +64 -12
- package/dist/cli/src/commands/status.js.map +1 -1
- package/dist/cli/src/commands/uninstall.js +8 -9
- package/dist/cli/src/commands/uninstall.js.map +1 -1
- package/dist/cli/src/commands/up.js +11 -3
- package/dist/cli/src/commands/up.js.map +1 -1
- package/dist/cli/src/commands/upgrade.js +1 -1
- package/dist/cli/src/commands/upgrade.js.map +1 -1
- package/dist/cli/src/commands.js +2 -1
- package/dist/cli/src/commands.js.map +1 -1
- package/dist/cli/src/config.js +4 -1
- package/dist/cli/src/config.js.map +1 -1
- package/dist/cli/src/cpu-baseline.js +8 -4
- package/dist/cli/src/cpu-baseline.js.map +1 -1
- package/dist/cli/src/folders.js +67 -0
- package/dist/cli/src/folders.js.map +1 -0
- package/dist/cli/src/gateway-calls.js +58 -0
- package/dist/cli/src/gateway-calls.js.map +1 -0
- package/dist/cli/src/install.js +77 -29
- package/dist/cli/src/install.js.map +1 -1
- package/dist/cli/src/kept-releases.js +27 -20
- package/dist/cli/src/kept-releases.js.map +1 -1
- package/dist/cli/src/kube/api.js +2 -3
- package/dist/cli/src/kube/api.js.map +1 -1
- package/dist/cli/src/kube/apply.js +15 -72
- package/dist/cli/src/kube/apply.js.map +1 -1
- package/dist/cli/src/kube/rollout.js +28 -16
- package/dist/cli/src/kube/rollout.js.map +1 -1
- package/dist/cli/src/manifests/admission.js +342 -223
- package/dist/cli/src/manifests/admission.js.map +1 -1
- package/dist/cli/src/manifests/alasio.js +58 -394
- package/dist/cli/src/manifests/alasio.js.map +1 -1
- package/dist/cli/src/manifests/branch.js +10 -26
- package/dist/cli/src/manifests/branch.js.map +1 -1
- package/dist/cli/src/manifests/collector.js +60 -44
- package/dist/cli/src/manifests/collector.js.map +1 -1
- package/dist/cli/src/manifests/common.js +32 -2
- package/dist/cli/src/manifests/common.js.map +1 -1
- package/dist/cli/src/manifests/config.js +64 -81
- package/dist/cli/src/manifests/config.js.map +1 -1
- package/dist/cli/src/manifests/disruption.js +10 -0
- package/dist/cli/src/manifests/disruption.js.map +1 -1
- package/dist/cli/src/manifests/folders.js +128 -0
- package/dist/cli/src/manifests/folders.js.map +1 -0
- package/dist/cli/src/manifests/grafana.js +4 -2
- package/dist/cli/src/manifests/grafana.js.map +1 -1
- package/dist/cli/src/manifests/index.js +10 -7
- package/dist/cli/src/manifests/index.js.map +1 -1
- package/dist/cli/src/manifests/lake.js +18 -4
- package/dist/cli/src/manifests/lake.js.map +1 -1
- package/dist/cli/src/manifests/log.js +32 -14
- package/dist/cli/src/manifests/log.js.map +1 -1
- package/dist/cli/src/manifests/neon.js +3 -3
- package/dist/cli/src/manifests/neon.js.map +1 -1
- package/dist/cli/src/manifests/network-policies.js +140 -74
- package/dist/cli/src/manifests/network-policies.js.map +1 -1
- package/dist/cli/src/manifests/node-agent.js +11 -4
- package/dist/cli/src/manifests/node-agent.js.map +1 -1
- package/dist/cli/src/manifests/object-store.js +4 -2
- package/dist/cli/src/manifests/object-store.js.map +1 -1
- package/dist/cli/src/manifests/sandbox-gateway.js +663 -0
- package/dist/cli/src/manifests/sandbox-gateway.js.map +1 -0
- package/dist/cli/src/manifests/scalers.js +16 -5
- package/dist/cli/src/manifests/scalers.js.map +1 -1
- package/dist/cli/src/manifests/sizing.js +16 -8
- package/dist/cli/src/manifests/sizing.js.map +1 -1
- package/dist/cli/src/manifests/valkey.js +11 -5
- package/dist/cli/src/manifests/valkey.js.map +1 -1
- package/dist/cli/src/manifests/vpa.js +3 -1
- package/dist/cli/src/manifests/vpa.js.map +1 -1
- package/dist/cli/src/manifests/workspace-storage.js +174 -89
- package/dist/cli/src/manifests/workspace-storage.js.map +1 -1
- package/dist/cli/src/neon-storage.js +54 -14
- package/dist/cli/src/neon-storage.js.map +1 -1
- package/dist/cli/src/release.js +9 -9
- package/dist/cluster/node/pins.json +9 -4
- package/dist/neon/control/branches.js +6 -6
- package/dist/neon/control/branches.js.map +1 -1
- package/dist/neon/control/secrets.js +14 -3
- package/dist/neon/control/secrets.js.map +1 -1
- package/dist/src/binder/names.js +33 -0
- package/dist/src/binder/names.js.map +1 -0
- package/dist/src/binder/tokens.js +58 -0
- package/dist/src/binder/tokens.js.map +1 -0
- package/dist/src/branch/names.js +12 -2
- package/dist/src/branch/names.js.map +1 -1
- package/dist/src/events/names.js +7 -0
- package/dist/src/events/names.js.map +1 -0
- package/dist/src/gateway/names.js +201 -0
- package/dist/src/gateway/names.js.map +1 -0
- package/dist/src/harness/names.js +49 -0
- package/dist/src/harness/names.js.map +1 -0
- package/dist/src/kube/sandbox-shape.js +8 -68
- package/dist/src/kube/sandbox-shape.js.map +1 -1
- package/dist/src/node-agent/names.js +52 -2
- package/dist/src/node-agent/names.js.map +1 -1
- package/dist/src/sandbox/names.js +12 -20
- package/dist/src/sandbox/names.js.map +1 -1
- package/dist/src/sandbox/otlp-resource.js +173 -0
- package/dist/src/sandbox/otlp-resource.js.map +1 -0
- package/dist/src/sandbox/telemetry.js +43 -0
- package/dist/src/sandbox/telemetry.js.map +1 -0
- package/dist/src/telemetry/config.js +131 -0
- package/dist/src/telemetry/config.js.map +1 -0
- package/dist/src/telemetry/forward.js +154 -0
- package/dist/src/telemetry/forward.js.map +1 -0
- package/package.json +1 -1
- package/dist/cli/src/manifests/agent-sandbox.js +0 -92
- package/dist/cli/src/manifests/agent-sandbox.js.map +0 -1
- package/dist/cli/src/manifests/juicefs-csi.js +0 -320
- package/dist/cli/src/manifests/juicefs-csi.js.map +0 -1
- package/dist/cli/src/manifests/sandboxes.agents.x-k8s.io.json +0 -6295
- package/dist/src/kube/config.js +0 -145
- package/dist/src/kube/config.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../../../src/gateway/names.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,wFAAwF;AACxF,MAAM,CAAC,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AAC/D,kIAAkI;AAClI,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC;AAChD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAChE,MAAM,CAAC,MAAM,mCAAmC,GAAG,4BAA4B,CAAC;AA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AAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;IAClE,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;IACrG,2IAA2I;IAC3I,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACpF;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;CACtJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Harness identifiers shared by persistence, operator controls, and runtime selection.
|
|
3
|
+
*
|
|
4
|
+
* A harness is the agent runtime alasio drives for a Telegram conversation. Each
|
|
5
|
+
* conversation has at most one active harness at a time; the other harness keeps
|
|
6
|
+
* its own parked session pointer so switching never mounts a foreign session.
|
|
7
|
+
*
|
|
8
|
+
* A conversation starts with no harness mounted. Until the operator chooses one
|
|
9
|
+
* through /service, alasio only ever answers with the service picker. The
|
|
10
|
+
* `null` harness is therefore a real state, not a fallback, and callers must
|
|
11
|
+
* not coerce it to a default.
|
|
12
|
+
*/
|
|
13
|
+
export const CODEX_HARNESS = "codex";
|
|
14
|
+
export const CLAUDE_HARNESS = "claude";
|
|
15
|
+
export const HARNESS_NAMES = Object.freeze([CODEX_HARNESS, CLAUDE_HARNESS]);
|
|
16
|
+
const DISPLAY_NAMES = Object.freeze({
|
|
17
|
+
[CODEX_HARNESS]: "Codex",
|
|
18
|
+
[CLAUDE_HARNESS]: "Claude",
|
|
19
|
+
});
|
|
20
|
+
export function isHarnessName(candidate) {
|
|
21
|
+
const names = HARNESS_NAMES;
|
|
22
|
+
return typeof candidate === "string" && names.includes(candidate);
|
|
23
|
+
}
|
|
24
|
+
export function normalizeHarnessName(candidate, fallback = CODEX_HARNESS) {
|
|
25
|
+
if (typeof candidate !== "string") {
|
|
26
|
+
return fallback;
|
|
27
|
+
}
|
|
28
|
+
const lowered = candidate.trim().toLowerCase();
|
|
29
|
+
if (lowered === "claude" || lowered === "claude-code" || lowered === "claude_code" || lowered === "claudecode" || lowered === "claude code") {
|
|
30
|
+
return CLAUDE_HARNESS;
|
|
31
|
+
}
|
|
32
|
+
if (lowered === "codex") {
|
|
33
|
+
return CODEX_HARNESS;
|
|
34
|
+
}
|
|
35
|
+
return fallback;
|
|
36
|
+
}
|
|
37
|
+
export function harnessDisplayName(harness) {
|
|
38
|
+
return (harness && DISPLAY_NAMES[harness]) ?? DISPLAY_NAMES[CODEX_HARNESS];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Harness pre-mounted on newly created conversations.
|
|
42
|
+
*
|
|
43
|
+
* Neutral by default: returns null unless ALASIO_DEFAULT_HARNESS opts into a
|
|
44
|
+
* harness, in which case new conversations skip the picker.
|
|
45
|
+
*/
|
|
46
|
+
export function getDefaultHarness(env = process.env) {
|
|
47
|
+
return normalizeHarnessName(env["ALASIO_DEFAULT_HARNESS"], null);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../../../src/harness/names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AACr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C,GAAG,CAAC,wBAAwB,CAAC,EAAE,IAAI,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1,42 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What alasio
|
|
3
|
-
* (../
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* that holds alasio to its templates (cli/src/manifests/admission.ts) knows it as they do.
|
|
2
|
+
* What alasio's pods of bayma carry, beyond their templates, that more than one of its
|
|
3
|
+
* parts knows: the gateway that binds them (../gateway/), the node agents that snapshot and
|
|
4
|
+
* restore them (../node-agent/), and the admission policies that hold them to what alasio
|
|
5
|
+
* up renders (cli/src/manifests/admission.ts). In one place, with no dependency, so the
|
|
6
|
+
* command line takes it as it is.
|
|
8
7
|
*/
|
|
9
|
-
/** The container
|
|
8
|
+
/** The container of a session's or a folder instance's pod that runs bayma. */
|
|
10
9
|
export const BAYMA_CONTAINER = "bayma";
|
|
11
|
-
/** Where a Sandbox's token Secret is mounted in its bayma container, its key, and its volume. */
|
|
12
|
-
export const TOKEN_DIR = "/run/alasio/bayma";
|
|
13
|
-
export const TOKEN_KEY = "token";
|
|
14
|
-
export const TOKEN_VOLUME = "alasio-bayma-token";
|
|
15
|
-
/** The token volume's files' mode: readable by the pod's group, which is how a non-root bayma reads it. */
|
|
16
|
-
export const TOKEN_MODE = 0o440;
|
|
17
|
-
/** The file bayma reads its token from, which a restored Sandbox's new token replaces. */
|
|
18
|
-
export const TOKEN_FILE = `${TOKEN_DIR}/${TOKEN_KEY}`;
|
|
19
|
-
/** The arguments bayma is given after its template's: where its token is. */
|
|
20
|
-
export const TOKEN_FILE_ARGS = ["--token-file", TOKEN_FILE];
|
|
21
|
-
/** The arguments a session's bayma is given after those when it exports telemetry: the token it exports with, read from the same file for each export. */
|
|
22
|
-
export const TELEMETRY_TOKEN_FILE_ARGS = ["--telemetry-token-file", TOKEN_FILE];
|
|
23
|
-
/** The name of a Sandbox's token Secret. */
|
|
24
|
-
export function tokenSecretName(name) {
|
|
25
|
-
return `${name}-bayma-token`;
|
|
26
|
-
}
|
|
27
|
-
/** The label every object alasio makes carries, and the one that names its Sandbox. */
|
|
28
|
-
export const MANAGED_BY = { "app.kubernetes.io/managed-by": "alasio" };
|
|
29
|
-
export const SANDBOX_LABEL = "alasio.dev/sandbox";
|
|
30
|
-
/** What a Sandbox's pod is to alasio: a session's, or a folder's bayma's. */
|
|
31
|
-
export const WORKLOAD_LABEL = "alasio.dev/workload";
|
|
32
10
|
/** A session's internet, `none` or `full`, which its NetworkPolicies follow. */
|
|
33
11
|
export const NET_MODE_LABEL = "alasio.dev/net-mode";
|
|
34
|
-
/** The harness a folder's bayma serves, as a path segment. */
|
|
35
|
-
export const HARNESS_LABEL = "alasio.dev/harness";
|
|
36
|
-
/** The resolvers a session with internet uses unless its template names others. */
|
|
37
|
-
export const DEFAULT_FULL_MODE_NAMESERVERS = ["1.1.1.1", "8.8.8.8"];
|
|
38
|
-
/** The argument a folder's bayma is given its state directory by, under its template's state root. */
|
|
39
|
-
export const STATE_DIR_ARG = "--state-dir";
|
|
40
12
|
/**
|
|
41
13
|
* The argument a session's bayma is given how long it holds a stop by, for alasio to
|
|
42
14
|
* snapshot it first (bayma's mcp-http help): a bayma run without it holds none.
|
|
@@ -50,7 +22,7 @@ export function sanitizePathToken(value) {
|
|
|
50
22
|
}
|
|
51
23
|
/**
|
|
52
24
|
* What a session's pod template carries of its whole-sandbox snapshots
|
|
53
|
-
* (../
|
|
25
|
+
* (../gateway/snapshots.ts): the hash of the template it was made from, which its
|
|
54
26
|
* snapshots record; the CPU features its sandbox is held to; and, of a pod restored from
|
|
55
27
|
* a snapshot, the image it is restored from, on its node under the snapshot cache, left
|
|
56
28
|
* paused until its node's agent resumes it, which its readiness gate waits for.
|
|
@@ -64,18 +36,6 @@ export const RESTORE_ANNOTATION = "dev.gvisor.internal.restore.host-image-path";
|
|
|
64
36
|
export const RESTORE_PAUSED_ANNOTATION = "dev.gvisor.internal.restore.paused";
|
|
65
37
|
/** The condition of a restored pod's readiness gate, which alasio sets once its sandbox is resumed. */
|
|
66
38
|
export const RESUMED_CONDITION = "alasio.dev/resumed";
|
|
67
|
-
/**
|
|
68
|
-
* The annotation of a suspended Sandbox naming the snapshot its pod was saved into, which
|
|
69
|
-
* alone it may be restored from: set as it is suspended, removed as it is next resumed,
|
|
70
|
-
* from that snapshot or not, so a snapshot outlives no resume of its Sandbox's.
|
|
71
|
-
*/
|
|
72
|
-
export const SNAPSHOT_ANNOTATION = "alasio.dev/snapshot";
|
|
73
|
-
/**
|
|
74
|
-
* The annotation naming the gVisor release that took the snapshot SNAPSHOT_ANNOTATION
|
|
75
|
-
* names, beside it, the only one that restores it: `alasio up` keeps every release one
|
|
76
|
-
* names (cli/src/kept-releases.ts).
|
|
77
|
-
*/
|
|
78
|
-
export const SNAPSHOT_RELEASE_ANNOTATION = "alasio.dev/snapshot-release";
|
|
79
39
|
/** Where a node agent keeps the snapshots it prepares, as `<environment>/<workspace>/<snapshot>` (../node-agent/cache.ts). */
|
|
80
40
|
export const SNAPSHOT_CACHE_DIR = "/var/lib/alasio/snapshots";
|
|
81
41
|
/**
|
|
@@ -83,26 +43,6 @@ export const SNAPSHOT_CACHE_DIR = "/var/lib/alasio/snapshots";
|
|
|
83
43
|
* workspace's ids sort as its snapshots were taken, then 32 random bits.
|
|
84
44
|
*/
|
|
85
45
|
export const SNAPSHOT_ID = "[0-9]{8}T[0-9]{9}Z-[0-9a-f]{8}";
|
|
86
|
-
/** A DNS label: an environment's name (its sessions' namespace) and a workspace's
|
|
46
|
+
/** A DNS label: an environment's name (its sessions' namespace) and a workspace's, as the snapshot cache's directories are named. */
|
|
87
47
|
export const NAME = /^[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?$/u;
|
|
88
|
-
/** The init container that holds a session's pod until its egress is confined: its name, and its resources. */
|
|
89
|
-
export const EGRESS_GATE = { name: "egress-gate", resources: { requests: { cpu: "10m", memory: "32Mi" }, limits: { memory: "64Mi" } } };
|
|
90
|
-
/**
|
|
91
|
-
* The egress gate's program: exits once three connections in a row to the API server
|
|
92
|
-
* fail, and fails the pod if they still succeed after two minutes. Runs on the agent
|
|
93
|
-
* image's Node.
|
|
94
|
-
*/
|
|
95
|
-
export const EGRESS_GATE_SCRIPT = [
|
|
96
|
-
"const net = require('node:net');",
|
|
97
|
-
"const host = process.env.KUBERNETES_SERVICE_HOST, port = Number(process.env.KUBERNETES_SERVICE_PORT);",
|
|
98
|
-
"const deadline = Date.now() + 120000; let refused = 0;",
|
|
99
|
-
"(function probe() {",
|
|
100
|
-
" const socket = net.connect({ host, port, timeout: 1000 });",
|
|
101
|
-
" const next = (blocked) => { socket.destroy(); refused = blocked ? refused + 1 : 0;",
|
|
102
|
-
" if (refused >= 3) process.exit(0);",
|
|
103
|
-
" if (Date.now() > deadline) { console.error('egress is not confined: is NetworkPolicy enforced in this cluster?'); process.exit(1); }",
|
|
104
|
-
" setTimeout(probe, 250); };",
|
|
105
|
-
" socket.once('connect', () => next(false)); socket.once('timeout', () => next(true)); socket.once('error', () => next(true));",
|
|
106
|
-
"})();",
|
|
107
|
-
].join("\n");
|
|
108
48
|
//# sourceMappingURL=sandbox-shape.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-shape.js","sourceRoot":"","sources":["../../../../src/kube/sandbox-shape.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sandbox-shape.js","sourceRoot":"","sources":["../../../../src/kube/sandbox-shape.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEvC,gFAAgF;AAChF,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAE9C,yGAAyG;AACzG,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,yEAAyE;AACzE,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC;AACjG,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,6BAA6B,CAAC;AACzE,oGAAoG;AACpG,MAAM,CAAC,MAAM,uBAAuB,GAAG,iCAAiC,CAAC;AACzE,0GAA0G;AAC1G,MAAM,CAAC,MAAM,kBAAkB,GAAG,6CAA6C,CAAC;AAChF,yGAAyG;AACzG,MAAM,CAAC,MAAM,yBAAyB,GAAG,oCAAoC,CAAC;AAC9E,uGAAuG;AACvG,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AACtD,8HAA8H;AAC9H,MAAM,CAAC,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAC9D;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,gCAAgC,CAAC;AAC5D,qIAAqI;AACrI,MAAM,CAAC,MAAM,IAAI,GAAG,uCAAuC,CAAC"}
|
|
@@ -14,6 +14,27 @@ export const NODE_AGENT_PORT = 8484;
|
|
|
14
14
|
* alone reaches it, as a node reaches the pods it runs.
|
|
15
15
|
*/
|
|
16
16
|
export const STORE_PROXY_PORT = 8485;
|
|
17
|
+
/**
|
|
18
|
+
* Where a node agent keeps, on its node's /run, a tmpfs, what outlives it until the node
|
|
19
|
+
* restarts: the Unix domain socket it serves the snapshots bucket on to its node's restores
|
|
20
|
+
* too, which a restore's checkpoint gofer dials by its path, whatever pod the agent runs in
|
|
21
|
+
* (STORE_SOCKET), and those restores' tokens, read back as it starts again
|
|
22
|
+
* (STORE_TOKENS_FILE), each only root's. Of the pods alasio makes, the agent alone mounts the
|
|
23
|
+
* node's /run (cli/src/manifests/node-agent.ts), and the sessions' pods are held to their
|
|
24
|
+
* templates, which mount none of it (cli/src/manifests/admission.ts sandboxPodPolicy). The
|
|
25
|
+
* host profile's mounts, which the operator gives alasio and the folder's bayma, could reach
|
|
26
|
+
* it, but both run as the operator's user (1000 unless the profile says), whom the socket's
|
|
27
|
+
* and the file's mode, 0600 and root's, keep out.
|
|
28
|
+
*/
|
|
29
|
+
export const NODE_AGENT_RUN_DIR = "/run/alasio/node-agent";
|
|
30
|
+
/** The variable that moves NODE_AGENT_RUN_DIR, as a test of the agent's own process does. */
|
|
31
|
+
export const NODE_AGENT_RUN_DIR_VARIABLE = "ALASIO_NODE_AGENT_RUN_DIR";
|
|
32
|
+
/** The socket a node agent serves the snapshots bucket on, on its node, in `runDir` (NODE_AGENT_RUN_DIR). */
|
|
33
|
+
export const storeSocket = (runDir) => `${runDir}/store.sock`;
|
|
34
|
+
/** The file a node agent keeps its restores' tokens in, on its node, in `runDir` (NODE_AGENT_RUN_DIR). */
|
|
35
|
+
export const storeTokensFile = (runDir) => `${runDir}/tokens.json`;
|
|
36
|
+
/** The URL a restore's gofer names the store by through STORE_SOCKET, which it signs: no host's, as the socket alone is dialled. */
|
|
37
|
+
export const STORE_SOCKET_ENDPOINT = "http://alasio-node-agent";
|
|
17
38
|
/** The variable that gives a node agent its pod's address, which it serves the bucket to its node on. */
|
|
18
39
|
export const POD_IP_VARIABLE = "POD_IP";
|
|
19
40
|
/**
|
|
@@ -36,6 +57,13 @@ export const gvisorDirectory = (release) => `${GVISOR_RELEASES}/${release}`;
|
|
|
36
57
|
* where `since` names none.
|
|
37
58
|
*/
|
|
38
59
|
export function restoresFromBucket(release, since) {
|
|
60
|
+
return releaseAtOrPast(release, since);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Whether gVisor's `release` is the fork's `since` or one past it, by its base's date and
|
|
64
|
+
* patch, then its own number; never where either names no release of the fork's.
|
|
65
|
+
*/
|
|
66
|
+
function releaseAtOrPast(release, since) {
|
|
39
67
|
const parts = (named) => {
|
|
40
68
|
const matched = /^(\d{8})\.(\d+)-eaucoin\.(\d+)$/u.exec(named);
|
|
41
69
|
return matched ? matched.slice(1).map(Number) : null;
|
|
@@ -46,6 +74,19 @@ export function restoresFromBucket(release, since) {
|
|
|
46
74
|
const differs = of.findIndex((part, index) => part !== first[index]);
|
|
47
75
|
return differs === -1 || (of[differs] ?? 0) > (first[differs] ?? 0);
|
|
48
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* The gofer a restore of a snapshot taken under gVisor's `release` asks for: through a socket,
|
|
79
|
+
* reading again pages a read of failed, of one at or past `since`, the first release that
|
|
80
|
+
* restores so, as cluster/node/pins.json says it (gvisor.restoresThroughSocketSince); none,
|
|
81
|
+
* the agent's own way, over TCP, of one before it, and of every release where `since` names none.
|
|
82
|
+
*/
|
|
83
|
+
export const goferOf = (release, since) => (releaseAtOrPast(release, since) ? { transport: "socket", pagesRetry: true } : null);
|
|
84
|
+
/**
|
|
85
|
+
* The name of a restore's pod, as the gateway makes it (../gateway/names.ts restorePodName): its
|
|
86
|
+
* pool's, `-restore-`, then seven of base 36's digits; the one name whose directory the node
|
|
87
|
+
* agent makes for it, before the pod is made.
|
|
88
|
+
*/
|
|
89
|
+
export const RESTORE_POD = /^[a-z0-9]([-a-z0-9]*[a-z0-9])?-restore-[0-9a-z]{7}$/u;
|
|
49
90
|
/** The variable that gives the node agent the first gVisor release that restores straight from the bucket (restoresFromBucket). */
|
|
50
91
|
export const RESTORES_FROM_BUCKET_SINCE_VARIABLE = "ALASIO_GVISOR_RESTORES_FROM_BUCKET_SINCE";
|
|
51
92
|
/** Where k3s's containerd reads its template, and runsc its options. */
|
|
@@ -61,6 +102,13 @@ export const gvisorHandler = (release) => `runsc-${gvisorLabel(release)}`;
|
|
|
61
102
|
export const gvisorRuntimeClass = (release) => `gvisor-${gvisorLabel(release)}`;
|
|
62
103
|
/** The version runsc of gVisor's `release` reports, and saves its images with: its release's tag. */
|
|
63
104
|
export const runscVersion = (release) => `release-${release}`;
|
|
105
|
+
/**
|
|
106
|
+
* Where a node has workspace storage mounted, held by a pod of its own, each workspace's
|
|
107
|
+
* files at `<environment>/<workspace>/files`.
|
|
108
|
+
*/
|
|
109
|
+
export const WORKSPACES_ROOT = "/var/lib/alasio/workspaces";
|
|
110
|
+
/** Where a node keeps the directory of each pod of a sandbox pool, `<namespace>/<pod>`, which the pod mounts by `subPathExpr` of its namespace and its name. */
|
|
111
|
+
export const ATTACH_ROOT = "/var/lib/alasio/attach";
|
|
64
112
|
/** The root the gVisor shims run runsc with for Kubernetes' containers, under the node's /run. */
|
|
65
113
|
export const RUNSC_ROOT = "/run/containerd/runsc/k8s.io";
|
|
66
114
|
/** The node's snapshot cache, where its sandboxes are restored from, as the admission policy holds a restore to. */
|
|
@@ -93,8 +141,10 @@ export const UNSYNCED_DOWNLOAD_BYTES = SNAPSHOT_PARTS_AT_ONCE * SNAPSHOT_SYNC_BY
|
|
|
93
141
|
export const NODE_AGENT_OWN_BYTES = 160 * 1024 ** 2;
|
|
94
142
|
/** The least memory limit a node agent runs under: its own, and a download's budget beside it. */
|
|
95
143
|
export const NODE_AGENT_MEMORY_FLOOR = NODE_AGENT_OWN_BYTES + UNSYNCED_DOWNLOAD_BYTES;
|
|
96
|
-
/** The variable holding the token
|
|
144
|
+
/** The variable holding the token the sandbox gateway presents to a node agent. */
|
|
97
145
|
export const NODE_AGENT_TOKEN_VARIABLE = "ALASIO_NODE_AGENT_TOKEN";
|
|
146
|
+
/** The variable holding workspace storage's metadata engine's address, its password in it, which the agent sets workspaces' quotas on alone. */
|
|
147
|
+
export const META_URL_VARIABLE = "META_URL";
|
|
98
148
|
/** The variable holding the most bytes the node's snapshot cache keeps. */
|
|
99
149
|
export const SNAPSHOT_CACHE_BYTES_VARIABLE = "ALASIO_SNAPSHOT_CACHE_BYTES";
|
|
100
150
|
/**
|
|
@@ -106,7 +156,7 @@ export const OPERATION_LIMIT_SECONDS = 15 * 60;
|
|
|
106
156
|
/**
|
|
107
157
|
* How long a restore from the bucket may take from its prepare to its resume, which its token
|
|
108
158
|
* lasts unless resumed before (./store-proxy.ts): the longest it takes, alasio waiting 3
|
|
109
|
-
* minutes for its pod to run (
|
|
159
|
+
* minutes for its pod to run (POD_RUNNING_TIMEOUT_MS in src/gateway/snapshots.ts), then for the
|
|
110
160
|
* agent's resume, and a margin.
|
|
111
161
|
*/
|
|
112
162
|
export const RESTORE_PREPARED_FOR_SECONDS = 5 * 60;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../../../src/node-agent/names.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAErC,yGAAyG;AACzG,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,8BAA8B,CAAC;AAE9D,qDAAqD;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,GAAG,eAAe,IAAI,OAAO,EAAE,CAAC;AAE5F;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,KAAa;IAC/D,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE;QAC9B,MAAM,OAAO,GAAG,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACvD,CAAC,CAAC;IACF,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACnD,IAAI,EAA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inds (see
|
|
3
3
|
* ../workspace/kind.ts): a folder, or a session filesystem identified by a volume id.
|
|
4
|
-
* A volume id is what alasio generates and stores, and its session's
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
import { Schema } from "effect";
|
|
8
|
-
/**
|
|
9
|
-
* The longest a volume id is: a DNS label's 63 characters, less a claim template's name
|
|
10
|
-
* of up to CLAIM_TEMPLATE_MAX and the hyphen after it, so its volume claims' names,
|
|
11
|
-
* `<template>-<id>` (../kube/sandboxes.ts claimName), are DNS labels too, as alasio's
|
|
12
|
-
* admission policy of its clones holds them to (cli/src/manifests/admission.ts).
|
|
4
|
+
* A volume id is what alasio generates and stores, and its session's workspace, which the
|
|
5
|
+
* sandbox gateway holds, is named for it (sessionKey).
|
|
13
6
|
*/
|
|
7
|
+
/** The longest a volume id is: a DNS label's 63 characters, with room to spare, as the ids alasio has stored are. */
|
|
14
8
|
export const VOLUME_ID_MAX = 58;
|
|
15
|
-
/** The longest a claim template's name is, of which a volume id's claims are named. */
|
|
16
|
-
export const CLAIM_TEMPLATE_MAX = 63 - 1 - VOLUME_ID_MAX;
|
|
17
9
|
/**
|
|
18
10
|
* A volume id is a DNS label of 3–58 characters from `[a-z0-9-]` that starts and ends
|
|
19
|
-
* with a letter or digit, as the names of
|
|
20
|
-
*
|
|
11
|
+
* with a letter or digit, as the names of what is made of it must be, a workspace's
|
|
12
|
+
* directory among them, of VOLUME_ID_MAX at most. alasio generates ids that already
|
|
21
13
|
* satisfy this, and this guards against any that would not.
|
|
22
14
|
*/
|
|
23
15
|
const VOLUME_ID_PATTERN = new RegExp(`^[a-z0-9][a-z0-9-]{1,${VOLUME_ID_MAX - 2}}[a-z0-9]$`, "u");
|
|
24
|
-
/** A volume id, as what comes from outside alasio is decoded. */
|
|
25
|
-
const VolumeId = Schema.String.check(Schema.isPattern(VOLUME_ID_PATTERN));
|
|
26
|
-
/**
|
|
27
|
-
* A session's token, `<volumeId>.<random>` (../kube/sandboxes.ts newToken), decoded into
|
|
28
|
-
* the session it names and the rest.
|
|
29
|
-
*/
|
|
30
|
-
export const SessionToken = Schema.TemplateLiteralParser([VolumeId, ".", Schema.NonEmptyString]);
|
|
31
16
|
export function isValidVolumeId(volumeId) {
|
|
32
17
|
return typeof volumeId === "string" && VOLUME_ID_PATTERN.test(volumeId);
|
|
33
18
|
}
|
|
@@ -41,4 +26,11 @@ export function assertValidVolumeId(volumeId) {
|
|
|
41
26
|
export function newVolumeId(random = () => crypto.randomUUID()) {
|
|
42
27
|
return `fs-${random().replace(/-/g, "").slice(0, 12)}`;
|
|
43
28
|
}
|
|
29
|
+
/** The key a session filesystem's workspace is bound by in the sandbox service: `sessionfs:<volumeId>`. */
|
|
30
|
+
export const sessionKey = (volumeId) => `sessionfs:${volumeId}`;
|
|
31
|
+
/** The volume id of the session filesystem `key` binds, where it binds one; else null. */
|
|
32
|
+
export function volumeIdOfKey(key) {
|
|
33
|
+
const volumeId = key.startsWith("sessionfs:") ? key.slice("sessionfs:".length) : "";
|
|
34
|
+
return isValidVolumeId(volumeId) ? volumeId : null;
|
|
35
|
+
}
|
|
44
36
|
//# sourceMappingURL=names.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../../../src/sandbox/names.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../../../src/sandbox/names.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qHAAqH;AACrH,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,IAAI,MAAM,CAAC,wBAAwB,aAAa,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;AAEjG,MAAM,UAAU,eAAe,CAAC,QAAiB;IAC/C,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,QAAiB;IACnD,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,aAAa,kEAAkE,CAAC,CAAC;IACrK,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAC,MAAM,GAAiB,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE;IAC1E,OAAO,MAAM,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACzD,CAAC;AAED,2GAA2G;AAC3G,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAU,EAAE,CAAC,aAAa,QAAQ,EAAE,CAAC;AAEhF,0FAA0F;AAC1F,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACpF,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
const RESOURCE_LISTS = {
|
|
2
|
+
traces: ["resourceSpans", "scopeSpans"],
|
|
3
|
+
metrics: ["resourceMetrics", "scopeMetrics"],
|
|
4
|
+
logs: ["resourceLogs", "scopeLogs"],
|
|
5
|
+
};
|
|
6
|
+
/** Thrown for a request that does not parse as one, which is then not exported. */
|
|
7
|
+
export class MalformedRequest extends Error {
|
|
8
|
+
name = "MalformedRequest";
|
|
9
|
+
}
|
|
10
|
+
function isStamped(key, stamp) {
|
|
11
|
+
return Object.hasOwn(stamp, key) || key.startsWith("alasio.");
|
|
12
|
+
}
|
|
13
|
+
// --- Binary protobuf ----------------------------------------------------------
|
|
14
|
+
// The levels the resource is at, by field number, the same for all three signals:
|
|
15
|
+
// Export{Trace,Metrics,Logs}ServiceRequest 1: repeated Resource{Spans,Metrics,Logs}
|
|
16
|
+
// Resource{Spans,Metrics,Logs} 1: Resource
|
|
17
|
+
// Resource 1: repeated KeyValue attributes
|
|
18
|
+
// KeyValue 1: string key, 2: AnyValue value
|
|
19
|
+
// AnyValue 1: string string_value
|
|
20
|
+
const VARINT = 0;
|
|
21
|
+
const FIXED64 = 1;
|
|
22
|
+
const LEN = 2;
|
|
23
|
+
const FIXED32 = 5;
|
|
24
|
+
function readVarint(buf, at) {
|
|
25
|
+
let value = 0;
|
|
26
|
+
for (let shift = 0; shift < 64; shift += 7) {
|
|
27
|
+
const byte = buf[at++];
|
|
28
|
+
if (byte === undefined)
|
|
29
|
+
throw new MalformedRequest("truncated varint");
|
|
30
|
+
value += (byte & 0x7f) * 2 ** shift;
|
|
31
|
+
if ((byte & 0x80) === 0)
|
|
32
|
+
return [value, at];
|
|
33
|
+
}
|
|
34
|
+
throw new MalformedRequest("overlong varint");
|
|
35
|
+
}
|
|
36
|
+
/** Each field of a message: its number, wire type, whole encoding, and value. */
|
|
37
|
+
function* fields(buf) {
|
|
38
|
+
let at = 0;
|
|
39
|
+
while (at < buf.length) {
|
|
40
|
+
const start = at;
|
|
41
|
+
let tag;
|
|
42
|
+
[tag, at] = readVarint(buf, at);
|
|
43
|
+
const field = Math.floor(tag / 8);
|
|
44
|
+
const wire = tag % 8;
|
|
45
|
+
if (field === 0)
|
|
46
|
+
throw new MalformedRequest("field number 0");
|
|
47
|
+
let valueStart = at;
|
|
48
|
+
if (wire === VARINT)
|
|
49
|
+
[, at] = readVarint(buf, at);
|
|
50
|
+
else if (wire === FIXED64)
|
|
51
|
+
at += 8;
|
|
52
|
+
else if (wire === FIXED32)
|
|
53
|
+
at += 4;
|
|
54
|
+
else if (wire === LEN) {
|
|
55
|
+
let length;
|
|
56
|
+
[length, valueStart] = readVarint(buf, at);
|
|
57
|
+
at = valueStart + length;
|
|
58
|
+
}
|
|
59
|
+
else
|
|
60
|
+
throw new MalformedRequest(`wire type ${wire}`);
|
|
61
|
+
if (at > buf.length)
|
|
62
|
+
throw new MalformedRequest("truncated field");
|
|
63
|
+
yield { field, wire, whole: buf.subarray(start, at), value: buf.subarray(valueStart, at) };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** A message field's value, which must be length-delimited. */
|
|
67
|
+
function message({ field, wire, value }) {
|
|
68
|
+
if (wire !== LEN)
|
|
69
|
+
throw new MalformedRequest(`field ${field} has wire type ${wire}`);
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
function varint(value) {
|
|
73
|
+
const bytes = [];
|
|
74
|
+
for (; value >= 0x80; value = Math.floor(value / 128))
|
|
75
|
+
bytes.push((value % 128) | 0x80);
|
|
76
|
+
bytes.push(value);
|
|
77
|
+
return Buffer.from(bytes);
|
|
78
|
+
}
|
|
79
|
+
function lengthDelimited(field, bytes) {
|
|
80
|
+
return Buffer.concat([varint(field * 8 + LEN), varint(bytes.length), bytes]);
|
|
81
|
+
}
|
|
82
|
+
/** A KeyValue's key, the last given as protobuf merges them, or "" for none. */
|
|
83
|
+
function keyOf(keyValue) {
|
|
84
|
+
let key = "";
|
|
85
|
+
for (const field of fields(keyValue)) {
|
|
86
|
+
if (field.field === 1)
|
|
87
|
+
key = message(field).toString("utf8");
|
|
88
|
+
}
|
|
89
|
+
return key;
|
|
90
|
+
}
|
|
91
|
+
function stampedAttributesProtobuf(stamp) {
|
|
92
|
+
return Object.entries(stamp).map(([key, value]) => lengthDelimited(1, Buffer.concat([
|
|
93
|
+
lengthDelimited(1, Buffer.from(key, "utf8")),
|
|
94
|
+
lengthDelimited(2, lengthDelimited(1, Buffer.from(value, "utf8"))),
|
|
95
|
+
])));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A Resource{Spans,Metrics,Logs} with one Resource: every Resource it held merged as
|
|
99
|
+
* protobuf merges repeated occurrences, less the stamped attributes, plus the stamp.
|
|
100
|
+
*/
|
|
101
|
+
function stampResourcePart(part, stamp) {
|
|
102
|
+
const resource = [];
|
|
103
|
+
const rest = [];
|
|
104
|
+
for (const field of fields(part)) {
|
|
105
|
+
if (field.field !== 1) {
|
|
106
|
+
rest.push(field.whole);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
for (const resourceField of fields(message(field))) {
|
|
110
|
+
if (resourceField.field === 1 && isStamped(keyOf(message(resourceField)), stamp))
|
|
111
|
+
continue;
|
|
112
|
+
resource.push(resourceField.whole);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return Buffer.concat([lengthDelimited(1, Buffer.concat([...resource, ...stampedAttributesProtobuf(stamp)])), ...rest]);
|
|
116
|
+
}
|
|
117
|
+
function stampProtobuf(body, stamp) {
|
|
118
|
+
return Buffer.concat([...fields(body)].map((field) => field.field === 1 ? lengthDelimited(1, stampResourcePart(message(field), stamp)) : field.whole));
|
|
119
|
+
}
|
|
120
|
+
// --- JSON ---------------------------------------------------------------------
|
|
121
|
+
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
122
|
+
function list(value, what) {
|
|
123
|
+
if (value === undefined)
|
|
124
|
+
return [];
|
|
125
|
+
if (!Array.isArray(value))
|
|
126
|
+
throw new MalformedRequest(`${what} is not a list`);
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
function object(value, what) {
|
|
130
|
+
if (value === undefined)
|
|
131
|
+
return {};
|
|
132
|
+
if (!isObject(value))
|
|
133
|
+
throw new MalformedRequest(`${what} is not an object`);
|
|
134
|
+
return value;
|
|
135
|
+
}
|
|
136
|
+
/** The fields of `source` named by `names` that it has. */
|
|
137
|
+
function only(source, names) {
|
|
138
|
+
return Object.fromEntries(names.filter((name) => source[name] !== undefined).map((name) => [name, source[name]]));
|
|
139
|
+
}
|
|
140
|
+
function stampJson(signal, body, stamp) {
|
|
141
|
+
let request;
|
|
142
|
+
try {
|
|
143
|
+
request = JSON.parse(body.toString("utf8"));
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
throw new MalformedRequest(error instanceof Error ? error.message : String(error));
|
|
147
|
+
}
|
|
148
|
+
const [partsName, scopesName] = RESOURCE_LISTS[signal];
|
|
149
|
+
const parts = list(object(request, "the request")[partsName], partsName).map((value) => {
|
|
150
|
+
const part = object(value, partsName);
|
|
151
|
+
const resource = object(part["resource"], "resource");
|
|
152
|
+
const attributes = list(resource["attributes"], "resource.attributes")
|
|
153
|
+
.filter((attribute) => !(isObject(attribute) && typeof attribute["key"] === "string" && isStamped(attribute["key"], stamp)));
|
|
154
|
+
return {
|
|
155
|
+
resource: {
|
|
156
|
+
...only(resource, ["droppedAttributesCount", "entityRefs"]),
|
|
157
|
+
attributes: [...attributes, ...Object.entries(stamp).map(([key, value]) => ({ key, value: { stringValue: value } }))],
|
|
158
|
+
},
|
|
159
|
+
...only(part, [scopesName, "schemaUrl"]),
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
return Buffer.from(JSON.stringify({ [partsName]: parts }), "utf8");
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* `body`, an OTLP export request for `signal` in `encoding` ("protobuf" or "json"),
|
|
166
|
+
* with its resources stamped. Throws MalformedRequest for one that does not parse.
|
|
167
|
+
*/
|
|
168
|
+
export function stampResources(signal, encoding, body, stamp) {
|
|
169
|
+
if (!Object.hasOwn(RESOURCE_LISTS, signal))
|
|
170
|
+
throw new Error(`unknown signal ${signal}`);
|
|
171
|
+
return encoding === "json" ? stampJson(signal, body, stamp) : stampProtobuf(body, stamp);
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=otlp-resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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pod's one way out without internet is the sandbox service's receiver
|
|
4
|
+
* (../receiver/receiver.ts), so its bayma exports there, with its binding's token, each signal
|
|
5
|
+
* the sandbox gateway exports, as the gateway tells the node agent attaching the workspace
|
|
6
|
+
* (../gateway/sessions.ts); the receiver stamps what arrives with what is known of the session
|
|
7
|
+
* and exports it where the stack's telemetry goes.
|
|
8
|
+
*/
|
|
9
|
+
import { parseKeyValueList, resolveTelemetry, sharedResourceAttributes, SIGNALS, telemetryEnabled } from "../telemetry/config.js";
|
|
10
|
+
/**
|
|
11
|
+
* The standard variables bayma inside a sandbox exports with, but for the endpoint and the
|
|
12
|
+
* token it sends, which are the sandbox's own: each signal `env`, the gateway's, exports, in
|
|
13
|
+
* the protocol it exports it in, and no other. Empty where it exports nothing.
|
|
14
|
+
*/
|
|
15
|
+
export function sandboxBaymaTelemetryEnv(env = process.env) {
|
|
16
|
+
const telemetry = resolveTelemetry(env);
|
|
17
|
+
if (!telemetryEnabled(telemetry))
|
|
18
|
+
return {};
|
|
19
|
+
const settings = {};
|
|
20
|
+
for (const signal of SIGNALS) {
|
|
21
|
+
const upper = signal.toUpperCase();
|
|
22
|
+
const exporter = telemetry[signal];
|
|
23
|
+
settings[`OTEL_${upper}_EXPORTER`] = exporter ? "otlp" : "none";
|
|
24
|
+
if (exporter)
|
|
25
|
+
settings[`OTEL_EXPORTER_OTLP_${upper}_PROTOCOL`] = exporter.protocol;
|
|
26
|
+
}
|
|
27
|
+
return settings;
|
|
28
|
+
}
|
|
29
|
+
/** The resource attributes a session's telemetry is stamped with. */
|
|
30
|
+
export function sandboxResource(volumeId, env = process.env) {
|
|
31
|
+
return { ...parseKeyValueList(sharedResourceAttributes(env)), "service.name": "bayma", "alasio.volume.id": volumeId };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* What a folder conversation's instance's telemetry is stamped with: bayma's, of the
|
|
35
|
+
* conversation, as alasio's own of the conversation is, and the harness it is under.
|
|
36
|
+
*/
|
|
37
|
+
export const folderResource = (harness, conversation, env = process.env) => ({
|
|
38
|
+
...parseKeyValueList(sharedResourceAttributes(env)),
|
|
39
|
+
"service.name": "bayma",
|
|
40
|
+
"alasio.conversation.id": conversation,
|
|
41
|
+
"alasio.harness": harness,
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../../../src/sandbox/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAGlI;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAG,GAAgC,OAAO,CAAC,GAAG;IACrF,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC;QAAE,OAAO,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QACnC,QAAQ,CAAC,QAAQ,KAAK,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QAChE,IAAI,QAAQ;YAAE,QAAQ,CAAC,sBAAsB,KAAK,WAAW,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACrF,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,eAAe,CAAC,QAAgB,EAAE,GAAG,GAAgC,OAAO,CAAC,GAAG;IAC9F,OAAO,EAAE,GAAG,iBAAiB,CAAC,wBAAwB,C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