@cofy-x/axern-sdk 0.5.1 → 0.7.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/README.md +39 -52
- package/dist/client/index.d.ts +12 -11
- package/dist/client/index.js +64 -65
- package/dist/config/index.d.ts +0 -1
- package/dist/config/index.js +2 -4
- package/dist/generated/proto.js +0 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +2 -2
- package/dist/network-policy.d.ts +41 -0
- package/dist/network-policy.js +132 -0
- package/dist/node/attached_process.d.ts +1 -2
- package/dist/node/attached_process.js +12 -26
- package/dist/node/client.d.ts +4 -6
- package/dist/node/client.js +2 -9
- package/dist/node/exec.d.ts +1 -3
- package/dist/node/exec.js +0 -43
- package/dist/proto/axern/control/admin/v1/access.proto +12 -5
- package/dist/proto/axern/control/admin/v1/audit.proto +14 -16
- package/dist/proto/axern/control/admin/v1/node.proto +23 -67
- package/dist/proto/axern/control/admin/v1/reliability.proto +11 -78
- package/dist/proto/axern/control/capability/v1/capability.proto +35 -90
- package/dist/proto/axern/control/common/v1/common.proto +72 -102
- package/dist/proto/axern/control/environment/v1/environment.proto +42 -26
- package/dist/proto/axern/control/gateway/v1/gateway.proto +18 -59
- package/dist/proto/axern/control/identity/v1/identity.proto +1 -1
- package/dist/proto/axern/control/namespace/v1/namespace.proto +2 -3
- package/dist/proto/axern/control/quota/v1/quota.proto +22 -32
- package/dist/proto/axern/control/run/v1/run.proto +26 -22
- package/dist/proto/axern/control/secret/v1/secret.proto +1 -3
- package/dist/proto/axern/control/tunnel/v1/tunnel.proto +18 -25
- package/dist/proto/axern/node/sandbox/v1/node.proto +59 -375
- package/dist/sandbox/index.d.ts +5 -9
- package/dist/sandbox/index.js +14 -22
- package/dist/sandbox/lifecycle.d.ts +1 -1
- package/dist/sandbox/lifecycle.js +55 -17
- package/dist/tunnel/connector.js +1 -1
- package/dist/tunnel/control.d.ts +0 -1
- package/dist/tunnel/control.js +0 -1
- package/dist/tunnel/runtime.d.ts +0 -1
- package/dist/tunnel/runtime.js +0 -1
- package/dist/tunnel/types.d.ts +0 -1
- package/dist/types.d.ts +4 -21
- package/dist/types.js +1 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/proto/axern/control/admin/v1/allocation_lifecycle.proto +0 -91
- package/dist/proto/axern/control/admin/v1/service.proto +0 -18
- package/dist/proto/axern/control/admin/v1/storage.proto +0 -81
- package/dist/proto/axern/control/agentprofile/v1/agent_profile.proto +0 -169
- package/dist/proto/axern/control/catalog/v1/catalog.proto +0 -127
- package/dist/proto/axern/control/function/v1/function.proto +0 -130
- package/dist/proto/axern/control/function/v1/function_types.proto +0 -233
- package/dist/proto/axern/control/node/v1/node_control.proto +0 -443
- package/dist/proto/axern/control/rollout/v1/rollout.proto +0 -344
- package/dist/proto/axern/control/service/v1/service.proto +0 -96
- package/dist/proto/axern/control/service/v1/service_event.proto +0 -47
- package/dist/proto/axern/control/service/v1/service_replica.proto +0 -78
- package/dist/proto/axern/control/service/v1/service_types.proto +0 -155
- package/dist/proto/axern/control/storage/v1/storage.proto +0 -107
- package/dist/proto/axern/control/storage/v1/storage_types.proto +0 -125
- package/dist/proto/axern/data/artifact/v1/artifact.proto +0 -19
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 cofy-x
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { isIP } from "node:net";
|
|
7
|
+
import { domainToASCII } from "node:url";
|
|
8
|
+
const maxRules = 256;
|
|
9
|
+
export class NetworkPolicy {
|
|
10
|
+
wire;
|
|
11
|
+
constructor(wire) {
|
|
12
|
+
this.wire = wire;
|
|
13
|
+
}
|
|
14
|
+
static strict(options = {}) {
|
|
15
|
+
const domains = normalizeDomains(options.domains ?? []);
|
|
16
|
+
const cidrRules = normalizeCIDRRules(options.cidrRules ?? []);
|
|
17
|
+
if (domains.length + cidrRules.length > maxRules) {
|
|
18
|
+
throw new RangeError(`network policy may contain at most ${maxRules} rules`);
|
|
19
|
+
}
|
|
20
|
+
return new NetworkPolicy({
|
|
21
|
+
strict: {
|
|
22
|
+
allowed_domains: domains,
|
|
23
|
+
allowed_cidrs: cidrRules.map((rule) => ({
|
|
24
|
+
cidr: rule.cidr,
|
|
25
|
+
protocol: rule.protocol === "tcp" ? 1 : 2,
|
|
26
|
+
ports: rule.ports.map((port) => ({ start: port.start, end: port.end })),
|
|
27
|
+
})),
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
static allowDomains(...domains) {
|
|
32
|
+
return NetworkPolicy.strict({ domains });
|
|
33
|
+
}
|
|
34
|
+
static denyDns(...domains) {
|
|
35
|
+
const normalized = normalizeDomains(domains);
|
|
36
|
+
if (normalized.length === 0)
|
|
37
|
+
throw new RangeError("denyDns requires at least one domain");
|
|
38
|
+
return new NetworkPolicy({ dns_deny: { denied_domains: normalized } });
|
|
39
|
+
}
|
|
40
|
+
static denyAll() {
|
|
41
|
+
return NetworkPolicy.strict();
|
|
42
|
+
}
|
|
43
|
+
/** @internal */
|
|
44
|
+
toWire() {
|
|
45
|
+
return structuredClone(this.wire);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function portRange(start, end = start) {
|
|
49
|
+
if (!Number.isInteger(start) || !Number.isInteger(end) || start < 1 || end < start || end > 65535) {
|
|
50
|
+
throw new RangeError("ports must be an inclusive range within 1..65535");
|
|
51
|
+
}
|
|
52
|
+
return Object.freeze({ start, end });
|
|
53
|
+
}
|
|
54
|
+
export function cidrRule(cidr, protocol, ...ports) {
|
|
55
|
+
return normalizeCIDRRule({ cidr, protocol, ports });
|
|
56
|
+
}
|
|
57
|
+
function normalizeDomains(values) {
|
|
58
|
+
const result = [];
|
|
59
|
+
const seen = new Set();
|
|
60
|
+
for (const value of values) {
|
|
61
|
+
let raw = value.trim().toLowerCase();
|
|
62
|
+
const wildcard = raw.startsWith("*.");
|
|
63
|
+
if (wildcard)
|
|
64
|
+
raw = raw.slice(2);
|
|
65
|
+
raw = raw.replace(/\.+$/, "");
|
|
66
|
+
if (raw === "" || /[/:@?#*]/u.test(raw) || isIP(raw) !== 0) {
|
|
67
|
+
throw new TypeError(`invalid domain rule ${JSON.stringify(value)}`);
|
|
68
|
+
}
|
|
69
|
+
const ascii = domainToASCII(raw).toLowerCase();
|
|
70
|
+
const labels = ascii.split(".");
|
|
71
|
+
if (ascii === "" || Buffer.byteLength(ascii, "ascii") > 253 || labels.some((label) => label === "" || label.length > 63)) {
|
|
72
|
+
throw new TypeError(`invalid domain rule ${JSON.stringify(value)}`);
|
|
73
|
+
}
|
|
74
|
+
const normalized = wildcard ? `*.${ascii}` : ascii;
|
|
75
|
+
if (!seen.has(normalized)) {
|
|
76
|
+
seen.add(normalized);
|
|
77
|
+
result.push(normalized);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
function normalizeCIDRRules(values) {
|
|
83
|
+
const result = [];
|
|
84
|
+
const seen = new Set();
|
|
85
|
+
for (const value of values) {
|
|
86
|
+
const rule = normalizeCIDRRule(value);
|
|
87
|
+
const key = JSON.stringify(rule);
|
|
88
|
+
if (!seen.has(key)) {
|
|
89
|
+
seen.add(key);
|
|
90
|
+
result.push(rule);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
function normalizeCIDRRule(value) {
|
|
96
|
+
const cidr = value.cidr.trim();
|
|
97
|
+
const separator = cidr.lastIndexOf("/");
|
|
98
|
+
const address = separator < 0 ? "" : cidr.slice(0, separator);
|
|
99
|
+
const prefix = separator < 0 ? -1 : Number(cidr.slice(separator + 1));
|
|
100
|
+
const family = isIP(address);
|
|
101
|
+
if ((family !== 4 && family !== 6) || !Number.isInteger(prefix) || prefix < 0 || prefix > (family === 4 ? 32 : 128)) {
|
|
102
|
+
throw new TypeError(`invalid CIDR ${JSON.stringify(value.cidr)}`);
|
|
103
|
+
}
|
|
104
|
+
if (isProtectedCIDR(address, prefix, family)) {
|
|
105
|
+
throw new TypeError(`CIDR ${JSON.stringify(value.cidr)} targets a protected address range`);
|
|
106
|
+
}
|
|
107
|
+
if (value.protocol !== "tcp" && value.protocol !== "udp")
|
|
108
|
+
throw new TypeError("CIDR protocol must be tcp or udp");
|
|
109
|
+
if (value.ports.length === 0)
|
|
110
|
+
throw new RangeError("CIDR rule requires at least one port range");
|
|
111
|
+
const ports = value.ports.map((port) => portRange(port.start, port.end));
|
|
112
|
+
return Object.freeze({ cidr, protocol: value.protocol, ports: Object.freeze(ports) });
|
|
113
|
+
}
|
|
114
|
+
function isProtectedCIDR(address, prefix, family) {
|
|
115
|
+
if (family === 4) {
|
|
116
|
+
const value = address.split(".").reduce((result, octet) => (result << 8n) | BigInt(octet), 0n);
|
|
117
|
+
const protectedRanges = [
|
|
118
|
+
[0n, 32],
|
|
119
|
+
[1684301000n, 32], // 100.100.100.200
|
|
120
|
+
[2130706432n, 8], // 127.0.0.0
|
|
121
|
+
[2851995648n, 16], // 169.254.0.0
|
|
122
|
+
[3221225664n, 32], // 192.0.0.192
|
|
123
|
+
[3758096384n, 4], // 224.0.0.0
|
|
124
|
+
];
|
|
125
|
+
return protectedRanges.some(([base, bits]) => prefix >= bits && (value >> BigInt(32 - bits)) === (base >> BigInt(32 - bits)));
|
|
126
|
+
}
|
|
127
|
+
const canonical = new URL(`http://[${address}]/`).hostname.slice(1, -1).toLowerCase();
|
|
128
|
+
if (prefix >= 128 && (canonical === "::" || canonical === "::1"))
|
|
129
|
+
return true;
|
|
130
|
+
const first = Number.parseInt(canonical.split(":", 1)[0] || "0", 16);
|
|
131
|
+
return (prefix >= 10 && first >= 0xfe80 && first <= 0xfebf) || (prefix >= 8 && first >= 0xff00 && first <= 0xffff);
|
|
132
|
+
}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* Copyright 2026 cofy-x
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { Command,
|
|
6
|
+
import type { Command, ProcessOptions } from "../types.js";
|
|
7
7
|
import { NodeClientContext } from "./context.js";
|
|
8
8
|
import { SandboxProcess } from "./process.js";
|
|
9
9
|
export declare function process(ctx: NodeClientContext, command: Command, options?: ProcessOptions): Promise<SandboxProcess>;
|
|
10
|
-
export declare function processImage(ctx: NodeClientContext, image: string, command: Command, options?: ImageProcessOptions): Promise<SandboxProcess>;
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
* Copyright 2026 cofy-x
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { mapRpcError } from "../errors/index.js";
|
|
6
|
+
import { mapRpcError, SandboxValidationError } from "../errors/index.js";
|
|
7
7
|
import { normalizeCommand } from "../validation.js";
|
|
8
|
-
import { execSpec
|
|
8
|
+
import { execSpec } from "./exec.js";
|
|
9
9
|
import { SandboxProcess } from "./process.js";
|
|
10
10
|
export async function process(ctx, command, options = {}) {
|
|
11
11
|
const argv = normalizeCommand(command);
|
|
12
|
+
const initialSize = processInitialSize(options);
|
|
12
13
|
const client = ctx.rpcClient();
|
|
13
14
|
const call = client
|
|
14
15
|
.Process();
|
|
@@ -20,6 +21,7 @@ export async function process(ctx, command, options = {}) {
|
|
|
20
21
|
call.write({
|
|
21
22
|
open: ctx.authRequest({
|
|
22
23
|
spec: execSpec(argv, options),
|
|
24
|
+
...(initialSize === undefined ? {} : { initial_size: initialSize }),
|
|
23
25
|
}),
|
|
24
26
|
});
|
|
25
27
|
try {
|
|
@@ -31,30 +33,14 @@ export async function process(ctx, command, options = {}) {
|
|
|
31
33
|
throw mapRpcError(error, "sandbox process", ctx.allocationId);
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
function processInitialSize(options) {
|
|
37
|
+
const cols = options.initialCols ?? 0;
|
|
38
|
+
const rows = options.initialRows ?? 0;
|
|
39
|
+
if ((cols === 0) !== (rows === 0)) {
|
|
40
|
+
throw new SandboxValidationError("initialCols and initialRows must both be zero or both be positive");
|
|
37
41
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const call = client
|
|
41
|
-
.ProcessImage();
|
|
42
|
-
const sandboxProcess = new SandboxProcess({
|
|
43
|
-
allocationId: ctx.allocationId,
|
|
44
|
-
call,
|
|
45
|
-
closeClient: () => client.close(),
|
|
46
|
-
});
|
|
47
|
-
call.write({
|
|
48
|
-
open: ctx.authRequest({
|
|
49
|
-
spec: imageProcessSpec(image, argv, options),
|
|
50
|
-
}),
|
|
51
|
-
});
|
|
52
|
-
try {
|
|
53
|
-
await sandboxProcess.waitReady();
|
|
54
|
-
return sandboxProcess;
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
await sandboxProcess.close();
|
|
58
|
-
throw mapRpcError(error, "sandbox image process", ctx.allocationId);
|
|
42
|
+
if (cols < 0 || rows < 0 || !Number.isInteger(cols) || !Number.isInteger(rows)) {
|
|
43
|
+
throw new SandboxValidationError("initialCols and initialRows must be non-negative integers");
|
|
59
44
|
}
|
|
45
|
+
return cols === 0 ? undefined : { cols, rows };
|
|
60
46
|
}
|
package/dist/node/client.d.ts
CHANGED
|
@@ -4,22 +4,20 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type * as grpc from "@grpc/grpc-js";
|
|
7
|
-
import type { ChmodOptions, CapabilityStatus, Command, ComputerUseDisplay, ComputerUseKeyboardOptions, ComputerUseMouseOptions, ComputerUseScreenshot, ComputerUseScreenshotOptions, ComputerUseStatus, CopyOptions, DownloadArchiveOptions, ExecOptions, ExecResult,
|
|
7
|
+
import type { ChmodOptions, CapabilityStatus, Command, ComputerUseDisplay, ComputerUseKeyboardOptions, ComputerUseMouseOptions, ComputerUseScreenshot, ComputerUseScreenshotOptions, ComputerUseStatus, CopyOptions, DownloadArchiveOptions, ExecOptions, ExecResult, MkdirOptions, MoveOptions, NodeCallOptions, ProcessOptions, RemoveOptions, SandboxFileInfo, TouchOptions, UploadArchiveOptions, WriteFileOptions } from "../types.js";
|
|
8
8
|
import type { SandboxProcess } from "./process.js";
|
|
9
|
-
export interface
|
|
9
|
+
export interface AllocationClientOptions {
|
|
10
10
|
allocationId: string;
|
|
11
11
|
target: string;
|
|
12
12
|
credentials: grpc.ChannelCredentials;
|
|
13
13
|
channelOptions?: grpc.ChannelOptions;
|
|
14
14
|
}
|
|
15
|
-
export declare class
|
|
15
|
+
export declare class AllocationClient {
|
|
16
16
|
readonly allocationId: string;
|
|
17
17
|
private readonly ctx;
|
|
18
|
-
constructor(options:
|
|
18
|
+
constructor(options: AllocationClientOptions);
|
|
19
19
|
exec(command: Command, options?: ExecOptions): Promise<ExecResult>;
|
|
20
20
|
process(command: Command, options?: ProcessOptions): Promise<SandboxProcess>;
|
|
21
|
-
execImage(image: string, command: Command, options?: ImageExecOptions): Promise<ExecResult>;
|
|
22
|
-
processImage(image: string, command: Command, options?: ImageProcessOptions): Promise<SandboxProcess>;
|
|
23
21
|
capabilityStatus(options?: NodeCallOptions): Promise<CapabilityStatus>;
|
|
24
22
|
computerUseStatus(options?: NodeCallOptions): Promise<ComputerUseStatus>;
|
|
25
23
|
computerUseScreenshot(options?: ComputerUseScreenshotOptions): Promise<ComputerUseScreenshot>;
|
package/dist/node/client.js
CHANGED
|
@@ -7,11 +7,10 @@ import { uploadArchive, downloadArchive } from "./archive.js";
|
|
|
7
7
|
import { capabilityStatus } from "./capabilities.js";
|
|
8
8
|
import * as computerUse from "./computer_use.js";
|
|
9
9
|
import { process as startProcess } from "./attached_process.js";
|
|
10
|
-
import { processImage as startImageProcess } from "./attached_process.js";
|
|
11
10
|
import { NodeClientContext } from "./context.js";
|
|
12
|
-
import { exec
|
|
11
|
+
import { exec } from "./exec.js";
|
|
13
12
|
import * as files from "./files.js";
|
|
14
|
-
export class
|
|
13
|
+
export class AllocationClient {
|
|
15
14
|
allocationId;
|
|
16
15
|
ctx;
|
|
17
16
|
constructor(options) {
|
|
@@ -24,12 +23,6 @@ export class NodeSandboxClient {
|
|
|
24
23
|
async process(command, options = {}) {
|
|
25
24
|
return startProcess(this.ctx, command, options);
|
|
26
25
|
}
|
|
27
|
-
async execImage(image, command, options = {}) {
|
|
28
|
-
return execImage(this.ctx, image, command, options);
|
|
29
|
-
}
|
|
30
|
-
async processImage(image, command, options = {}) {
|
|
31
|
-
return startImageProcess(this.ctx, image, command, options);
|
|
32
|
-
}
|
|
33
26
|
async capabilityStatus(options = {}) {
|
|
34
27
|
return capabilityStatus(this.ctx, options);
|
|
35
28
|
}
|
package/dist/node/exec.d.ts
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* Copyright 2026 cofy-x
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { Command, ExecOptions, ExecResult,
|
|
6
|
+
import type { Command, ExecOptions, ExecResult, ProcessOptions } from "../types.js";
|
|
7
7
|
import type { NodeClientContext } from "./context.js";
|
|
8
8
|
export declare function exec(ctx: NodeClientContext, command: Command, options?: ExecOptions): Promise<ExecResult>;
|
|
9
|
-
export declare function execImage(ctx: NodeClientContext, image: string, command: Command, options?: ImageExecOptions): Promise<ExecResult>;
|
|
10
9
|
export declare function execSpec(argv: string[], options: ExecOptions | ProcessOptions): Record<string, unknown>;
|
|
11
|
-
export declare function imageProcessSpec(image: string, argv: string[], options: ImageExecOptions | ImageProcessOptions): Record<string, unknown>;
|
|
12
10
|
export declare function execResult(response: Record<string, unknown>): ExecResult;
|
package/dist/node/exec.js
CHANGED
|
@@ -25,28 +25,6 @@ export async function exec(ctx, command, options = {}) {
|
|
|
25
25
|
throw mapRpcError(error, "sandbox exec", ctx.allocationId);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
export async function execImage(ctx, image, command, options = {}) {
|
|
29
|
-
if (image.trim() === "") {
|
|
30
|
-
throw new Error("image is required");
|
|
31
|
-
}
|
|
32
|
-
const argv = normalizeCommand(command);
|
|
33
|
-
try {
|
|
34
|
-
const response = await ctx.withAuthRetry(options.leaseTtlSeconds ?? 300, async (client) => unary(client, "ExecImage", ctx.authRequest({
|
|
35
|
-
spec: imageProcessSpec(image, argv, options),
|
|
36
|
-
}), options.rpcTimeoutMs));
|
|
37
|
-
const result = execResult(response);
|
|
38
|
-
if (options.check === true && result.exitCode !== 0) {
|
|
39
|
-
throw new SandboxExecError(argv, result);
|
|
40
|
-
}
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
if (error instanceof SandboxExecError) {
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
throw mapRpcError(error, "sandbox exec image", ctx.allocationId);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
28
|
export function execSpec(argv, options) {
|
|
51
29
|
return {
|
|
52
30
|
argv,
|
|
@@ -57,27 +35,6 @@ export function execSpec(argv, options) {
|
|
|
57
35
|
user: options.user ?? "",
|
|
58
36
|
};
|
|
59
37
|
}
|
|
60
|
-
export function imageProcessSpec(image, argv, options) {
|
|
61
|
-
return {
|
|
62
|
-
image,
|
|
63
|
-
argv,
|
|
64
|
-
env: options.env ?? {},
|
|
65
|
-
cwd: options.cwd ?? "",
|
|
66
|
-
timeout_seconds: options.timeoutSeconds ?? 0,
|
|
67
|
-
tty: options.tty ?? false,
|
|
68
|
-
user: options.user ?? "",
|
|
69
|
-
mounts: imageProcessMounts(options.mounts),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function imageProcessMounts(mounts) {
|
|
73
|
-
const effective = mounts ?? [{ sandboxPath: "/workspace", targetPath: "/workspace" }];
|
|
74
|
-
return effective.map((mount) => ({
|
|
75
|
-
sandbox_path: mount.sandboxPath,
|
|
76
|
-
target_path: mount.targetPath,
|
|
77
|
-
readonly: mount.readonly ?? false,
|
|
78
|
-
options: [...(mount.options ?? [])],
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
38
|
export function execResult(response) {
|
|
82
39
|
const stdout = Buffer.from(response.stdout ?? []);
|
|
83
40
|
const stderr = Buffer.from(response.stderr ?? []);
|
|
@@ -30,7 +30,12 @@ enum AccessRole {
|
|
|
30
30
|
ACCESS_ROLE_NAMESPACE_ADMIN = 2;
|
|
31
31
|
ACCESS_ROLE_NAMESPACE_EDITOR = 3;
|
|
32
32
|
ACCESS_ROLE_NAMESPACE_VIEWER = 4;
|
|
33
|
-
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
enum CredentialKind {
|
|
36
|
+
CREDENTIAL_KIND_UNSPECIFIED = 0;
|
|
37
|
+
CREDENTIAL_KIND_X509 = 1;
|
|
38
|
+
CREDENTIAL_KIND_SSH = 2;
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
message Principal {
|
|
@@ -39,19 +44,19 @@ message Principal {
|
|
|
39
44
|
string display_name = 3;
|
|
40
45
|
PrincipalKind kind = 4;
|
|
41
46
|
PrincipalStatus status = 5;
|
|
42
|
-
|
|
43
|
-
google.protobuf.Timestamp
|
|
44
|
-
google.protobuf.Timestamp updated_at = 8;
|
|
47
|
+
google.protobuf.Timestamp created_at = 6;
|
|
48
|
+
google.protobuf.Timestamp updated_at = 7;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
message PrincipalCredential {
|
|
48
52
|
string credential_id = 1;
|
|
49
53
|
string principal_id = 2;
|
|
50
54
|
string fingerprint = 3;
|
|
51
|
-
google.protobuf.Timestamp
|
|
55
|
+
google.protobuf.Timestamp expires_at = 4;
|
|
52
56
|
string label = 5;
|
|
53
57
|
google.protobuf.Timestamp created_at = 6;
|
|
54
58
|
google.protobuf.Timestamp revoked_at = 7;
|
|
59
|
+
CredentialKind kind = 8;
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
message RoleBinding {
|
|
@@ -83,6 +88,8 @@ message AddPrincipalCredentialRequest {
|
|
|
83
88
|
string principal_id = 1;
|
|
84
89
|
bytes certificate_der = 2;
|
|
85
90
|
string label = 3;
|
|
91
|
+
string ssh_public_key = 4;
|
|
92
|
+
google.protobuf.Timestamp expires_at = 5;
|
|
86
93
|
}
|
|
87
94
|
message AddPrincipalCredentialResponse { PrincipalCredential credential = 1; }
|
|
88
95
|
|
|
@@ -11,27 +11,25 @@ enum AdminAuditOperation {
|
|
|
11
11
|
ADMIN_AUDIT_OPERATION_FORCE_ALLOCATION_LIFECYCLE_RETRY = 1;
|
|
12
12
|
ADMIN_AUDIT_OPERATION_FAIL_ALLOCATION_LIFECYCLE_RETRY = 2;
|
|
13
13
|
ADMIN_AUDIT_OPERATION_CLEAR_ALLOCATION_LIFECYCLE_RETRY = 3;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
ADMIN_AUDIT_OPERATION_RETIRE_NODE = 4;
|
|
15
|
+
ADMIN_AUDIT_OPERATION_CREATE_PRINCIPAL = 5;
|
|
16
|
+
ADMIN_AUDIT_OPERATION_DISABLE_PRINCIPAL = 6;
|
|
17
|
+
ADMIN_AUDIT_OPERATION_ADD_CREDENTIAL = 7;
|
|
18
|
+
ADMIN_AUDIT_OPERATION_REVOKE_CREDENTIAL = 8;
|
|
19
|
+
ADMIN_AUDIT_OPERATION_GRANT_ROLE_BINDING = 9;
|
|
20
|
+
ADMIN_AUDIT_OPERATION_REVOKE_ROLE_BINDING = 10;
|
|
21
|
+
ADMIN_AUDIT_OPERATION_BOOTSTRAP_ACCESS = 11;
|
|
22
|
+
ADMIN_AUDIT_OPERATION_ADMIT_NODE = 12;
|
|
23
|
+
ADMIN_AUDIT_OPERATION_REVOKE_NODE = 13;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
enum AdminAuditTargetType {
|
|
27
27
|
ADMIN_AUDIT_TARGET_TYPE_UNSPECIFIED = 0;
|
|
28
28
|
ADMIN_AUDIT_TARGET_TYPE_ALLOCATION = 1;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
ADMIN_AUDIT_TARGET_TYPE_CREDENTIAL = 6;
|
|
34
|
-
ADMIN_AUDIT_TARGET_TYPE_ROLE_BINDING = 7;
|
|
29
|
+
ADMIN_AUDIT_TARGET_TYPE_NODE = 2;
|
|
30
|
+
ADMIN_AUDIT_TARGET_TYPE_PRINCIPAL = 3;
|
|
31
|
+
ADMIN_AUDIT_TARGET_TYPE_CREDENTIAL = 4;
|
|
32
|
+
ADMIN_AUDIT_TARGET_TYPE_ROLE_BINDING = 5;
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
message AdminAuditEvent {
|
|
@@ -6,12 +6,12 @@ option go_package = "github.com/cofy-x/axern/sdk/go/gen/axern/control/admin/v1;a
|
|
|
6
6
|
|
|
7
7
|
import "google/protobuf/timestamp.proto";
|
|
8
8
|
import "axern/control/capability/v1/capability.proto";
|
|
9
|
-
import "axern/control/node/v1/node_control.proto";
|
|
10
9
|
|
|
11
10
|
enum AdminNodeLifecycleStatus {
|
|
12
11
|
ADMIN_NODE_LIFECYCLE_STATUS_UNSPECIFIED = 0;
|
|
13
12
|
ADMIN_NODE_LIFECYCLE_STATUS_ACTIVE = 1;
|
|
14
|
-
|
|
13
|
+
ADMIN_NODE_LIFECYCLE_STATUS_REVOKED = 2;
|
|
14
|
+
ADMIN_NODE_LIFECYCLE_STATUS_RETIRED = 3;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
message AdminNode {
|
|
@@ -22,8 +22,8 @@ message AdminNode {
|
|
|
22
22
|
bool axnoded_ready = 5;
|
|
23
23
|
int64 heartbeat_age_seconds = 6;
|
|
24
24
|
int64 summary_age_seconds = 7;
|
|
25
|
-
google.protobuf.Timestamp
|
|
26
|
-
google.protobuf.Timestamp
|
|
25
|
+
google.protobuf.Timestamp admitted_at = 8;
|
|
26
|
+
google.protobuf.Timestamp last_heartbeat_at = 9;
|
|
27
27
|
google.protobuf.Timestamp retired_at = 10;
|
|
28
28
|
string retired_reason = 11;
|
|
29
29
|
}
|
|
@@ -36,67 +36,40 @@ message ListAdminNodesResponse {
|
|
|
36
36
|
repeated AdminNode nodes = 1;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
message
|
|
39
|
+
message AdmitAdminNodeRequest {
|
|
40
40
|
string node_id = 1;
|
|
41
|
-
string
|
|
41
|
+
string enrollment_token = 2;
|
|
42
|
+
string operator_reason = 3;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
message
|
|
45
|
+
message AdmitAdminNodeResponse {
|
|
45
46
|
AdminNode node = 1;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
message
|
|
49
|
+
message RevokeAdminNodeRequest {
|
|
49
50
|
string node_id = 1;
|
|
51
|
+
string operator_reason = 2;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
message
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
message AdminCapabilityTransition {
|
|
57
|
-
string transition_id = 1;
|
|
58
|
-
string node_id = 2;
|
|
59
|
-
string snapshot_id = 3;
|
|
60
|
-
int64 snapshot_sequence = 4;
|
|
61
|
-
axern.control.capability.v1.CapabilityKey key = 5;
|
|
62
|
-
axern.control.capability.v1.CapabilityState old_state = 6;
|
|
63
|
-
axern.control.capability.v1.CapabilityState new_state = 7;
|
|
64
|
-
axern.control.capability.v1.CapabilityEvidence old_evidence = 8;
|
|
65
|
-
axern.control.capability.v1.CapabilityEvidence new_evidence = 9;
|
|
66
|
-
axern.control.capability.v1.CapabilityReasonCode old_reason_code = 10;
|
|
67
|
-
axern.control.capability.v1.CapabilityReasonCode new_reason_code = 11;
|
|
68
|
-
string reason = 12;
|
|
69
|
-
google.protobuf.Timestamp observed_at = 13;
|
|
70
|
-
google.protobuf.Timestamp reported_at = 14;
|
|
54
|
+
message RevokeAdminNodeResponse {
|
|
55
|
+
AdminNode node = 1;
|
|
71
56
|
}
|
|
72
57
|
|
|
73
|
-
message
|
|
58
|
+
message RetireAdminNodeRequest {
|
|
74
59
|
string node_id = 1;
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
message ListNodeCapabilityTransitionsResponse {
|
|
79
|
-
repeated AdminCapabilityTransition transitions = 1;
|
|
60
|
+
string operator_reason = 2;
|
|
80
61
|
}
|
|
81
62
|
|
|
82
|
-
message
|
|
83
|
-
|
|
84
|
-
string node_id = 2;
|
|
85
|
-
repeated axern.control.capability.v1.CapabilityDependency pending_dependencies = 3;
|
|
86
|
-
int32 attempts = 4;
|
|
87
|
-
google.protobuf.Timestamp next_run_at = 5;
|
|
88
|
-
google.protobuf.Timestamp lease_expires_at = 6;
|
|
89
|
-
string last_error = 7;
|
|
90
|
-
google.protobuf.Timestamp updated_at = 8;
|
|
63
|
+
message RetireAdminNodeResponse {
|
|
64
|
+
AdminNode node = 1;
|
|
91
65
|
}
|
|
92
66
|
|
|
93
|
-
message
|
|
67
|
+
message GetNodeCapabilitySnapshotRequest {
|
|
94
68
|
string node_id = 1;
|
|
95
|
-
int32 limit = 2;
|
|
96
69
|
}
|
|
97
70
|
|
|
98
|
-
message
|
|
99
|
-
|
|
71
|
+
message GetNodeCapabilitySnapshotResponse {
|
|
72
|
+
axern.control.capability.v1.CapabilitySnapshot snapshot = 1;
|
|
100
73
|
}
|
|
101
74
|
|
|
102
75
|
message GetAllocationCapabilityDiagnosticsRequest {
|
|
@@ -106,32 +79,15 @@ message GetAllocationCapabilityDiagnosticsRequest {
|
|
|
106
79
|
message GetAllocationCapabilityDiagnosticsResponse {
|
|
107
80
|
string allocation_id = 1;
|
|
108
81
|
string node_id = 2;
|
|
109
|
-
repeated axern.control.capability.v1.
|
|
110
|
-
|
|
111
|
-
axern.control.capability.v1.CapabilityConditionSet condition_set = 5;
|
|
112
|
-
AdminCapabilityReconcileItem reconcile = 6;
|
|
113
|
-
int64 allocation_attempt = 7;
|
|
114
|
-
bool create_admission_recorded = 8;
|
|
115
|
-
string create_dependency_set_digest = 9;
|
|
116
|
-
google.protobuf.Timestamp create_admitted_at = 10;
|
|
117
|
-
AllocationMemoryAdmissionEvidence memory_admission = 11;
|
|
118
|
-
axern.control.node.v1.AllocationMemoryObservation latest_memory_observation = 12;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
message AllocationMemoryAdmissionEvidence {
|
|
122
|
-
int64 sandbox_memory_request_bytes = 1;
|
|
123
|
-
int64 sandbox_memory_limit_bytes = 2;
|
|
124
|
-
axern.control.node.v1.NodeMemoryBudget node_memory_budget = 3;
|
|
125
|
-
google.protobuf.Timestamp summary_collected_at = 4;
|
|
126
|
-
int64 node_local_commitment_bytes = 5;
|
|
127
|
-
google.protobuf.Timestamp admitted_at = 6;
|
|
82
|
+
repeated axern.control.capability.v1.CapabilityRequirement requirements = 3;
|
|
83
|
+
axern.control.capability.v1.CapabilityConditionSet condition_set = 4;
|
|
128
84
|
}
|
|
129
85
|
|
|
130
86
|
service NodeAdmin {
|
|
87
|
+
rpc AdmitAdminNode(AdmitAdminNodeRequest) returns (AdmitAdminNodeResponse) {}
|
|
131
88
|
rpc ListAdminNodes(ListAdminNodesRequest) returns (ListAdminNodesResponse) {}
|
|
89
|
+
rpc RevokeAdminNode(RevokeAdminNodeRequest) returns (RevokeAdminNodeResponse) {}
|
|
132
90
|
rpc RetireAdminNode(RetireAdminNodeRequest) returns (RetireAdminNodeResponse) {}
|
|
133
91
|
rpc GetNodeCapabilitySnapshot(GetNodeCapabilitySnapshotRequest) returns (GetNodeCapabilitySnapshotResponse) {}
|
|
134
|
-
rpc ListNodeCapabilityTransitions(ListNodeCapabilityTransitionsRequest) returns (ListNodeCapabilityTransitionsResponse) {}
|
|
135
|
-
rpc ListCapabilityReconcileQueue(ListCapabilityReconcileQueueRequest) returns (ListCapabilityReconcileQueueResponse) {}
|
|
136
92
|
rpc GetAllocationCapabilityDiagnostics(GetAllocationCapabilityDiagnosticsRequest) returns (GetAllocationCapabilityDiagnosticsResponse) {}
|
|
137
93
|
}
|