@cofy-x/axern-sdk 0.2.0-bootstrap.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.
Files changed (92) hide show
  1. package/README.md +169 -0
  2. package/dist/client/index.d.ts +63 -0
  3. package/dist/client/index.js +213 -0
  4. package/dist/config/index.d.ts +15 -0
  5. package/dist/config/index.js +65 -0
  6. package/dist/errors/index.d.ts +46 -0
  7. package/dist/errors/index.js +123 -0
  8. package/dist/generated/proto.d.ts +10 -0
  9. package/dist/generated/proto.js +80 -0
  10. package/dist/index.d.ts +19 -0
  11. package/dist/index.js +13 -0
  12. package/dist/node/archive.d.ts +9 -0
  13. package/dist/node/archive.js +41 -0
  14. package/dist/node/attached_process.d.ts +10 -0
  15. package/dist/node/attached_process.js +60 -0
  16. package/dist/node/capabilities.d.ts +8 -0
  17. package/dist/node/capabilities.js +51 -0
  18. package/dist/node/client.d.ts +44 -0
  19. package/dist/node/client.js +96 -0
  20. package/dist/node/computer_use.d.ts +12 -0
  21. package/dist/node/computer_use.js +81 -0
  22. package/dist/node/context.d.ts +22 -0
  23. package/dist/node/context.js +37 -0
  24. package/dist/node/exec.d.ts +12 -0
  25. package/dist/node/exec.js +93 -0
  26. package/dist/node/files.d.ts +18 -0
  27. package/dist/node/files.js +101 -0
  28. package/dist/node/process.d.ts +36 -0
  29. package/dist/node/process.js +144 -0
  30. package/dist/node/streams.d.ts +8 -0
  31. package/dist/node/streams.js +70 -0
  32. package/dist/proto/axern/common/file/v1/file.proto +31 -0
  33. package/dist/proto/axern/control/admin/v1/allocation_lifecycle.proto +91 -0
  34. package/dist/proto/axern/control/admin/v1/audit.proto +53 -0
  35. package/dist/proto/axern/control/admin/v1/node.proto +49 -0
  36. package/dist/proto/axern/control/admin/v1/reliability.proto +184 -0
  37. package/dist/proto/axern/control/admin/v1/service.proto +18 -0
  38. package/dist/proto/axern/control/admin/v1/storage.proto +81 -0
  39. package/dist/proto/axern/control/agentprofile/v1/agent_profile.proto +169 -0
  40. package/dist/proto/axern/control/catalog/v1/catalog.proto +127 -0
  41. package/dist/proto/axern/control/common/v1/common.proto +171 -0
  42. package/dist/proto/axern/control/environment/v1/environment.proto +94 -0
  43. package/dist/proto/axern/control/function/v1/function.proto +130 -0
  44. package/dist/proto/axern/control/function/v1/function_types.proto +233 -0
  45. package/dist/proto/axern/control/gateway/v1/gateway.proto +60 -0
  46. package/dist/proto/axern/control/namespace/v1/namespace.proto +52 -0
  47. package/dist/proto/axern/control/node/v1/node_control.proto +302 -0
  48. package/dist/proto/axern/control/quota/v1/quota.proto +113 -0
  49. package/dist/proto/axern/control/rollout/v1/rollout.proto +344 -0
  50. package/dist/proto/axern/control/run/v1/run.proto +88 -0
  51. package/dist/proto/axern/control/secret/v1/secret.proto +75 -0
  52. package/dist/proto/axern/control/service/v1/service.proto +96 -0
  53. package/dist/proto/axern/control/service/v1/service_event.proto +47 -0
  54. package/dist/proto/axern/control/service/v1/service_replica.proto +74 -0
  55. package/dist/proto/axern/control/service/v1/service_types.proto +155 -0
  56. package/dist/proto/axern/control/storage/v1/storage.proto +107 -0
  57. package/dist/proto/axern/control/storage/v1/storage_types.proto +125 -0
  58. package/dist/proto/axern/control/tunnel/v1/tunnel.proto +195 -0
  59. package/dist/proto/axern/data/artifact/v1/artifact.proto +19 -0
  60. package/dist/proto/axern/node/sandbox/v1/node.proto +652 -0
  61. package/dist/proto/axern/tunnel/v1/tunnel.proto +50 -0
  62. package/dist/resources.d.ts +13 -0
  63. package/dist/resources.js +107 -0
  64. package/dist/sandbox/archive.d.ts +8 -0
  65. package/dist/sandbox/archive.js +228 -0
  66. package/dist/sandbox/index.d.ts +86 -0
  67. package/dist/sandbox/index.js +204 -0
  68. package/dist/sandbox/lifecycle.d.ts +11 -0
  69. package/dist/sandbox/lifecycle.js +57 -0
  70. package/dist/tunnel/connector.d.ts +34 -0
  71. package/dist/tunnel/connector.js +141 -0
  72. package/dist/tunnel/control.d.ts +22 -0
  73. package/dist/tunnel/control.js +91 -0
  74. package/dist/tunnel/debug.d.ts +6 -0
  75. package/dist/tunnel/debug.js +19 -0
  76. package/dist/tunnel/relay.d.ts +17 -0
  77. package/dist/tunnel/relay.js +41 -0
  78. package/dist/tunnel/runtime.d.ts +34 -0
  79. package/dist/tunnel/runtime.js +118 -0
  80. package/dist/tunnel/session.d.ts +25 -0
  81. package/dist/tunnel/session.js +95 -0
  82. package/dist/tunnel/target.d.ts +7 -0
  83. package/dist/tunnel/target.js +28 -0
  84. package/dist/tunnel/types.d.ts +25 -0
  85. package/dist/tunnel/types.js +6 -0
  86. package/dist/types.d.ts +219 -0
  87. package/dist/types.js +8 -0
  88. package/dist/validation.d.ts +10 -0
  89. package/dist/validation.js +37 -0
  90. package/dist/version.d.ts +7 -0
  91. package/dist/version.js +9 -0
  92. package/package.json +57 -0
@@ -0,0 +1,93 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 cofy-x
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { mapRpcError, SandboxExecError } from "../errors/index.js";
7
+ import { unary } from "../generated/proto.js";
8
+ import { normalizeCommand } from "../validation.js";
9
+ export async function exec(ctx, command, options = {}) {
10
+ const argv = normalizeCommand(command);
11
+ try {
12
+ const response = await ctx.withAuthRetry(options.leaseTtlSeconds ?? 300, async (client) => unary(client, "Exec", ctx.authRequest({
13
+ spec: execSpec(argv, options),
14
+ }), options.rpcTimeoutMs));
15
+ const result = execResult(response);
16
+ if (options.check === true && result.exitCode !== 0) {
17
+ throw new SandboxExecError(argv, result);
18
+ }
19
+ return result;
20
+ }
21
+ catch (error) {
22
+ if (error instanceof SandboxExecError) {
23
+ throw error;
24
+ }
25
+ throw mapRpcError(error, "sandbox exec", ctx.allocationId);
26
+ }
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
+ export function execSpec(argv, options) {
51
+ return {
52
+ argv,
53
+ env: options.env ?? {},
54
+ cwd: options.cwd ?? "",
55
+ timeout_seconds: options.timeoutSeconds ?? 0,
56
+ tty: options.tty ?? false,
57
+ user: options.user ?? "",
58
+ };
59
+ }
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
+ export function execResult(response) {
82
+ const stdout = Buffer.from(response.stdout ?? []);
83
+ const stderr = Buffer.from(response.stderr ?? []);
84
+ return {
85
+ exitCode: Number(response.exit_code ?? 0),
86
+ stdout,
87
+ stderr,
88
+ stdoutTruncated: response.stdout_truncated === true,
89
+ stderrTruncated: response.stderr_truncated === true,
90
+ stdoutText: (encoding = "utf8") => stdout.toString(encoding),
91
+ stderrText: (encoding = "utf8") => stderr.toString(encoding),
92
+ };
93
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 cofy-x
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { ChmodOptions, CopyOptions, MkdirOptions, MoveOptions, RemoveOptions, SandboxFileInfo, TouchOptions, WriteFileOptions } from "../types.js";
7
+ import type { NodeClientContext } from "./context.js";
8
+ export declare function stat(ctx: NodeClientContext, path: string): Promise<SandboxFileInfo>;
9
+ export declare function listDir(ctx: NodeClientContext, path: string): Promise<SandboxFileInfo[]>;
10
+ export declare function exists(ctx: NodeClientContext, path: string): Promise<boolean>;
11
+ export declare function readFile(ctx: NodeClientContext, path: string): Promise<Buffer>;
12
+ export declare function writeFile(ctx: NodeClientContext, path: string, data: Buffer | Uint8Array | string, options?: WriteFileOptions): Promise<void>;
13
+ export declare function mkdir(ctx: NodeClientContext, path: string, options?: MkdirOptions): Promise<void>;
14
+ export declare function remove(ctx: NodeClientContext, path: string, options?: RemoveOptions): Promise<void>;
15
+ export declare function copy(ctx: NodeClientContext, srcPath: string, dstPath: string, options?: CopyOptions): Promise<void>;
16
+ export declare function move(ctx: NodeClientContext, srcPath: string, dstPath: string, options?: MoveOptions): Promise<void>;
17
+ export declare function chmod(ctx: NodeClientContext, path: string, mode: number, options?: ChmodOptions): Promise<void>;
18
+ export declare function touch(ctx: NodeClientContext, path: string, options?: TouchOptions): Promise<void>;
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 cofy-x
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { mapRpcError } from "../errors/index.js";
7
+ import { unary } from "../generated/proto.js";
8
+ import { nonEmptyPath } from "../validation.js";
9
+ export async function stat(ctx, path) {
10
+ const response = await fileUnary(ctx, "StatFile", { path: nonEmptyPath(path) });
11
+ return fileInfo(response.info);
12
+ }
13
+ export async function listDir(ctx, path) {
14
+ const response = await fileUnary(ctx, "ListDir", { path: nonEmptyPath(path) });
15
+ return (response.entries ?? []).map(fileInfo);
16
+ }
17
+ export async function exists(ctx, path) {
18
+ const response = await fileUnary(ctx, "Exists", { path: nonEmptyPath(path) });
19
+ return response.exists === true;
20
+ }
21
+ export async function readFile(ctx, path) {
22
+ const response = await fileUnary(ctx, "ReadFile", { path: nonEmptyPath(path) });
23
+ return Buffer.from(response.data ?? []);
24
+ }
25
+ export async function writeFile(ctx, path, data, options = {}) {
26
+ await fileUnary(ctx, "WriteFile", {
27
+ path: nonEmptyPath(path),
28
+ data: Buffer.isBuffer(data) ? data : Buffer.from(data),
29
+ create_parents: options.createParents ?? false,
30
+ });
31
+ }
32
+ export async function mkdir(ctx, path, options = {}) {
33
+ await fileUnary(ctx, "Mkdir", { path: nonEmptyPath(path), parents: options.parents ?? false });
34
+ }
35
+ export async function remove(ctx, path, options = {}) {
36
+ await fileUnary(ctx, "Remove", {
37
+ path: nonEmptyPath(path),
38
+ recursive: options.recursive ?? false,
39
+ force: options.force ?? false,
40
+ });
41
+ }
42
+ export async function copy(ctx, srcPath, dstPath, options = {}) {
43
+ await fileUnary(ctx, "Copy", {
44
+ src_path: nonEmptyPath(srcPath),
45
+ dst_path: nonEmptyPath(dstPath),
46
+ recursive: options.recursive ?? false,
47
+ overwrite: options.overwrite ?? false,
48
+ });
49
+ }
50
+ export async function move(ctx, srcPath, dstPath, options = {}) {
51
+ await fileUnary(ctx, "Move", {
52
+ src_path: nonEmptyPath(srcPath),
53
+ dst_path: nonEmptyPath(dstPath),
54
+ overwrite: options.overwrite ?? false,
55
+ });
56
+ }
57
+ export async function chmod(ctx, path, mode, options = {}) {
58
+ await fileUnary(ctx, "Chmod", {
59
+ path: nonEmptyPath(path),
60
+ mode,
61
+ recursive: options.recursive ?? false,
62
+ });
63
+ }
64
+ export async function touch(ctx, path, options = {}) {
65
+ await fileUnary(ctx, "Touch", {
66
+ path: nonEmptyPath(path),
67
+ create: options.create ?? true,
68
+ mtime_ns: options.mtimeNs ?? 0,
69
+ });
70
+ }
71
+ async function fileUnary(ctx, method, payload) {
72
+ try {
73
+ return await ctx.withAuthRetry(300, (client) => unary(client, method, ctx.authRequest(payload)));
74
+ }
75
+ catch (error) {
76
+ throw mapRpcError(error, `sandbox ${method}`, ctx.allocationId);
77
+ }
78
+ }
79
+ function fileInfo(input) {
80
+ return {
81
+ path: String(input?.path ?? ""),
82
+ kind: fileKind(input?.kind),
83
+ size: Number(input?.size ?? 0),
84
+ mode: Number(input?.mode ?? 0),
85
+ mtimeNs: Number(input?.mtime_ns ?? 0),
86
+ };
87
+ }
88
+ function fileKind(kind) {
89
+ switch (kind) {
90
+ case 1:
91
+ return "file";
92
+ case 2:
93
+ return "directory";
94
+ case 3:
95
+ return "symlink";
96
+ case 4:
97
+ return "other";
98
+ default:
99
+ return "unspecified";
100
+ }
101
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 cofy-x
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type * as grpc from "@grpc/grpc-js";
7
+ import type { ProcessEvent, ProcessResult } from "../types.js";
8
+ export interface SandboxProcessOptions {
9
+ allocationId: string;
10
+ call: grpc.ClientDuplexStream<Record<string, unknown>, Record<string, unknown>>;
11
+ closeClient: () => void;
12
+ }
13
+ export declare class SandboxProcess {
14
+ readonly allocationId: string;
15
+ private readonly call;
16
+ private readonly closeClient;
17
+ private readonly queue;
18
+ private readonly waiters;
19
+ private error;
20
+ private ended;
21
+ private exit?;
22
+ constructor(options: SandboxProcessOptions);
23
+ write(data: Buffer | Uint8Array | string): void;
24
+ closeStdin(): void;
25
+ resize(cols: number, rows: number): void;
26
+ signal(signal: string): void;
27
+ terminate(): void;
28
+ kill(): void;
29
+ waitReady(): Promise<void>;
30
+ wait(): Promise<ProcessResult>;
31
+ close(): Promise<void>;
32
+ events(): AsyncIterable<ProcessEvent>;
33
+ private nextEvent;
34
+ private enqueue;
35
+ private finish;
36
+ }
@@ -0,0 +1,144 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 cofy-x
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { mapRpcError } from "../errors/index.js";
7
+ export class SandboxProcess {
8
+ allocationId;
9
+ call;
10
+ closeClient;
11
+ queue = [];
12
+ waiters = [];
13
+ error;
14
+ ended = false;
15
+ exit;
16
+ constructor(options) {
17
+ this.allocationId = options.allocationId;
18
+ this.call = options.call;
19
+ this.closeClient = options.closeClient;
20
+ this.call.on("data", (message) => this.enqueue(processEvent(message)));
21
+ this.call.on("error", (error) => {
22
+ this.error = error;
23
+ this.finish();
24
+ });
25
+ this.call.on("end", () => this.finish());
26
+ }
27
+ write(data) {
28
+ this.call.write({ stdin: Buffer.isBuffer(data) ? data : Buffer.from(data) });
29
+ }
30
+ closeStdin() {
31
+ this.call.write({ close_stdin: true });
32
+ }
33
+ resize(cols, rows) {
34
+ this.call.write({ resize: { cols, rows } });
35
+ }
36
+ signal(signal) {
37
+ this.call.write({ signal: { signal } });
38
+ }
39
+ terminate() {
40
+ this.signal("TERM");
41
+ }
42
+ kill() {
43
+ this.signal("KILL");
44
+ }
45
+ async waitReady() {
46
+ const next = await this.nextEvent();
47
+ if (next.done === true) {
48
+ if (this.error !== undefined) {
49
+ throw this.error;
50
+ }
51
+ throw new Error("sandbox process stream ended before ready");
52
+ }
53
+ if (next.value.kind !== "ready") {
54
+ this.queue.unshift(next.value);
55
+ }
56
+ }
57
+ async wait() {
58
+ if (this.exit !== undefined) {
59
+ return this.exit;
60
+ }
61
+ for await (const event of this.events()) {
62
+ if (event.kind === "exit") {
63
+ return { exitCode: event.exitCode, message: event.message };
64
+ }
65
+ }
66
+ if (this.error !== undefined) {
67
+ throw mapRpcError(this.error, "sandbox process", this.allocationId);
68
+ }
69
+ throw new Error("sandbox process stream ended before exit");
70
+ }
71
+ async close() {
72
+ this.call.end();
73
+ this.closeClient();
74
+ }
75
+ async *events() {
76
+ while (true) {
77
+ const next = await this.nextEvent();
78
+ if (next.done === true) {
79
+ if (this.error !== undefined) {
80
+ throw mapRpcError(this.error, "sandbox process", this.allocationId);
81
+ }
82
+ return;
83
+ }
84
+ yield next.value;
85
+ if (next.value.kind === "exit") {
86
+ return;
87
+ }
88
+ }
89
+ }
90
+ nextEvent() {
91
+ const event = this.queue.shift();
92
+ if (event !== undefined) {
93
+ return Promise.resolve({ done: false, value: event });
94
+ }
95
+ if (this.ended) {
96
+ return Promise.resolve({ done: true, value: undefined });
97
+ }
98
+ return new Promise((resolve) => this.waiters.push(resolve));
99
+ }
100
+ enqueue(event) {
101
+ if (event.kind === "exit") {
102
+ this.exit = { exitCode: event.exitCode, message: event.message };
103
+ this.call.end();
104
+ this.closeClient();
105
+ }
106
+ const waiter = this.waiters.shift();
107
+ if (waiter !== undefined) {
108
+ waiter({ done: false, value: event });
109
+ }
110
+ else {
111
+ this.queue.push(event);
112
+ }
113
+ }
114
+ finish() {
115
+ if (this.ended) {
116
+ return;
117
+ }
118
+ this.ended = true;
119
+ this.closeClient();
120
+ for (const waiter of this.waiters.splice(0)) {
121
+ waiter({ done: true, value: undefined });
122
+ }
123
+ }
124
+ }
125
+ function processEvent(message) {
126
+ if ("ready" in message) {
127
+ return { kind: "ready" };
128
+ }
129
+ if ("stdout" in message) {
130
+ return { kind: "stdout", data: Buffer.from(message.stdout ?? []) };
131
+ }
132
+ if ("stderr" in message) {
133
+ return { kind: "stderr", data: Buffer.from(message.stderr ?? []) };
134
+ }
135
+ if ("exit" in message) {
136
+ const exit = message.exit;
137
+ return {
138
+ kind: "exit",
139
+ exitCode: Number(exit?.exit_code ?? 0),
140
+ message: String(exit?.message ?? ""),
141
+ };
142
+ }
143
+ return { kind: "ready" };
144
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 cofy-x
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import * as grpc from "@grpc/grpc-js";
7
+ export declare function uploadArchiveStream(client: grpc.Client, open: Record<string, unknown>, chunks: AsyncIterable<Buffer | Uint8Array>, deadlineMs: number | undefined): Promise<void>;
8
+ export declare function downloadArchiveStream(client: grpc.Client, request: Record<string, unknown>, deadlineMs: number | undefined): AsyncIterable<Buffer>;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 cofy-x
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import * as grpc from "@grpc/grpc-js";
7
+ export function uploadArchiveStream(client, open, chunks, deadlineMs) {
8
+ return new Promise((resolve, reject) => {
9
+ const callback = (error) => {
10
+ if (error) {
11
+ reject(error);
12
+ }
13
+ else {
14
+ resolve();
15
+ }
16
+ };
17
+ const fn = client.UploadArchive;
18
+ const call = deadlineMs === undefined
19
+ ? fn.call(client, callback)
20
+ : fn.call(client, new grpc.Metadata(), { deadline: Date.now() + deadlineMs }, callback);
21
+ void (async () => {
22
+ try {
23
+ await writeStream(call, { open });
24
+ for await (const chunk of chunks) {
25
+ if (chunk.byteLength > 0) {
26
+ await writeStream(call, { chunk: Buffer.from(chunk) });
27
+ }
28
+ }
29
+ call.end();
30
+ }
31
+ catch (error) {
32
+ call.destroy(error instanceof Error ? error : new Error(String(error)));
33
+ reject(error);
34
+ }
35
+ })();
36
+ });
37
+ }
38
+ export function downloadArchiveStream(client, request, deadlineMs) {
39
+ const fn = client.DownloadArchive;
40
+ const call = deadlineMs === undefined
41
+ ? fn.call(client, request)
42
+ : fn.call(client, request, new grpc.Metadata(), { deadline: Date.now() + deadlineMs });
43
+ return streamChunks(call);
44
+ }
45
+ async function* streamChunks(call) {
46
+ for await (const message of call) {
47
+ const chunk = message.chunk;
48
+ if (chunk !== undefined && chunk.byteLength > 0) {
49
+ yield Buffer.from(chunk);
50
+ }
51
+ }
52
+ }
53
+ function writeStream(stream, value) {
54
+ return new Promise((resolve, reject) => {
55
+ const onError = (error) => {
56
+ stream.off("error", onError);
57
+ reject(error);
58
+ };
59
+ stream.once("error", onError);
60
+ stream.write(value, (error) => {
61
+ stream.off("error", onError);
62
+ if (error) {
63
+ reject(error);
64
+ }
65
+ else {
66
+ resolve();
67
+ }
68
+ });
69
+ });
70
+ }
@@ -0,0 +1,31 @@
1
+ syntax = "proto3";
2
+
3
+ package axern.common.file.v1;
4
+
5
+ option go_package = "github.com/cofy-x/axern/sdk/go/gen/axern/common/file/v1;filev1";
6
+
7
+ enum SandboxFileKind {
8
+ SANDBOX_FILE_KIND_UNSPECIFIED = 0;
9
+ SANDBOX_FILE_KIND_FILE = 1;
10
+ SANDBOX_FILE_KIND_DIRECTORY = 2;
11
+ SANDBOX_FILE_KIND_SYMLINK = 3;
12
+ SANDBOX_FILE_KIND_OTHER = 4;
13
+ }
14
+
15
+ enum SandboxArchiveFormat {
16
+ SANDBOX_ARCHIVE_FORMAT_UNSPECIFIED = 0;
17
+ SANDBOX_ARCHIVE_FORMAT_TAR = 1;
18
+ }
19
+
20
+ enum SandboxArchiveSymlinkPolicy {
21
+ SANDBOX_ARCHIVE_SYMLINK_POLICY_UNSPECIFIED = 0;
22
+ SANDBOX_ARCHIVE_SYMLINK_POLICY_REJECT = 1;
23
+ }
24
+
25
+ message SandboxFileInfo {
26
+ string path = 1;
27
+ SandboxFileKind kind = 2;
28
+ int64 size = 3;
29
+ uint32 mode = 4;
30
+ int64 mtime_ns = 5;
31
+ }
@@ -0,0 +1,91 @@
1
+ syntax = "proto3";
2
+
3
+ package axern.control.admin.v1;
4
+
5
+ option go_package = "github.com/cofy-x/axern/sdk/go/gen/axern/control/admin/v1;adminv1";
6
+
7
+ import "google/protobuf/timestamp.proto";
8
+
9
+ enum AllocationLifecycleRetryOwnerType {
10
+ ALLOCATION_LIFECYCLE_RETRY_OWNER_TYPE_UNSPECIFIED = 0;
11
+ ALLOCATION_LIFECYCLE_RETRY_OWNER_TYPE_RUN = 1;
12
+ ALLOCATION_LIFECYCLE_RETRY_OWNER_TYPE_SERVICE = 2;
13
+ }
14
+
15
+ enum AllocationLifecycleRetryReason {
16
+ ALLOCATION_LIFECYCLE_RETRY_REASON_UNSPECIFIED = 0;
17
+ ALLOCATION_LIFECYCLE_RETRY_REASON_CREATE = 1;
18
+ ALLOCATION_LIFECYCLE_RETRY_REASON_DELETE = 2;
19
+ }
20
+
21
+ message AllocationLifecycleRetry {
22
+ string allocation_id = 1;
23
+ string owner_id = 2;
24
+ AllocationLifecycleRetryOwnerType owner_type = 3;
25
+ string environment_id = 4;
26
+ AllocationLifecycleRetryReason reason = 5;
27
+ string node_id = 6;
28
+ string node_target = 7;
29
+ int64 attempt = 8;
30
+ int32 reconcile_attempts = 9;
31
+ string last_error = 10;
32
+ google.protobuf.Timestamp next_run_at = 11;
33
+ google.protobuf.Timestamp created_at = 12;
34
+ google.protobuf.Timestamp updated_at = 13;
35
+ int64 age_seconds = 14;
36
+ bool due = 15;
37
+ bool clearable = 16;
38
+ string clear_blocked_reason = 17;
39
+ }
40
+
41
+ message AllocationLifecycleRetryFilter {
42
+ AllocationLifecycleRetryOwnerType owner_type = 1;
43
+ AllocationLifecycleRetryReason reason = 2;
44
+ bool due_only = 3;
45
+ }
46
+
47
+ message ListAllocationLifecycleRetriesRequest {
48
+ AllocationLifecycleRetryFilter filter = 1;
49
+ int32 limit = 2;
50
+ }
51
+
52
+ message ListAllocationLifecycleRetriesResponse {
53
+ repeated AllocationLifecycleRetry retries = 1;
54
+ }
55
+
56
+ message ForceAllocationLifecycleRetryRequest {
57
+ string allocation_id = 1;
58
+ AllocationLifecycleRetryReason reason = 2;
59
+ string operator_reason = 3;
60
+ }
61
+
62
+ message ForceAllocationLifecycleRetryResponse {
63
+ AllocationLifecycleRetry retry = 1;
64
+ }
65
+
66
+ message FailAllocationLifecycleRetryRequest {
67
+ string allocation_id = 1;
68
+ AllocationLifecycleRetryReason reason = 2;
69
+ string operator_reason = 3;
70
+ }
71
+
72
+ message FailAllocationLifecycleRetryResponse {
73
+ AllocationLifecycleRetry failed_retry = 1;
74
+ }
75
+
76
+ message ClearAllocationLifecycleRetryRequest {
77
+ string allocation_id = 1;
78
+ AllocationLifecycleRetryReason reason = 2;
79
+ string operator_reason = 3;
80
+ }
81
+
82
+ message ClearAllocationLifecycleRetryResponse {
83
+ AllocationLifecycleRetry cleared_retry = 1;
84
+ }
85
+
86
+ service AllocationLifecycleAdmin {
87
+ rpc ListAllocationLifecycleRetries(ListAllocationLifecycleRetriesRequest) returns (ListAllocationLifecycleRetriesResponse) {}
88
+ rpc ForceAllocationLifecycleRetry(ForceAllocationLifecycleRetryRequest) returns (ForceAllocationLifecycleRetryResponse) {}
89
+ rpc FailAllocationLifecycleRetry(FailAllocationLifecycleRetryRequest) returns (FailAllocationLifecycleRetryResponse) {}
90
+ rpc ClearAllocationLifecycleRetry(ClearAllocationLifecycleRetryRequest) returns (ClearAllocationLifecycleRetryResponse) {}
91
+ }
@@ -0,0 +1,53 @@
1
+ syntax = "proto3";
2
+
3
+ package axern.control.admin.v1;
4
+
5
+ option go_package = "github.com/cofy-x/axern/sdk/go/gen/axern/control/admin/v1;adminv1";
6
+
7
+ import "google/protobuf/timestamp.proto";
8
+
9
+ enum AdminAuditOperation {
10
+ ADMIN_AUDIT_OPERATION_UNSPECIFIED = 0;
11
+ ADMIN_AUDIT_OPERATION_FORCE_ALLOCATION_LIFECYCLE_RETRY = 1;
12
+ ADMIN_AUDIT_OPERATION_FAIL_ALLOCATION_LIFECYCLE_RETRY = 2;
13
+ ADMIN_AUDIT_OPERATION_CLEAR_ALLOCATION_LIFECYCLE_RETRY = 3;
14
+ ADMIN_AUDIT_OPERATION_RETRY_STORAGE_BINDING = 4;
15
+ ADMIN_AUDIT_OPERATION_PURGE_SERVICE = 5;
16
+ ADMIN_AUDIT_OPERATION_RETIRE_NODE = 6;
17
+ }
18
+
19
+ enum AdminAuditTargetType {
20
+ ADMIN_AUDIT_TARGET_TYPE_UNSPECIFIED = 0;
21
+ ADMIN_AUDIT_TARGET_TYPE_ALLOCATION = 1;
22
+ ADMIN_AUDIT_TARGET_TYPE_STORAGE_BINDING = 2;
23
+ ADMIN_AUDIT_TARGET_TYPE_SERVICE = 3;
24
+ ADMIN_AUDIT_TARGET_TYPE_NODE = 4;
25
+ }
26
+
27
+ message AdminAuditEvent {
28
+ string event_id = 1;
29
+ AdminAuditOperation operation = 2;
30
+ AdminAuditTargetType target_type = 3;
31
+ string target_id = 4;
32
+ string operator_reason = 5;
33
+ google.protobuf.Timestamp created_at = 6;
34
+ }
35
+
36
+ message AdminAuditEventFilter {
37
+ AdminAuditOperation operation = 1;
38
+ AdminAuditTargetType target_type = 2;
39
+ string target_id = 3;
40
+ }
41
+
42
+ message ListAdminAuditEventsRequest {
43
+ AdminAuditEventFilter filter = 1;
44
+ int32 limit = 2;
45
+ }
46
+
47
+ message ListAdminAuditEventsResponse {
48
+ repeated AdminAuditEvent events = 1;
49
+ }
50
+
51
+ service AdminAudit {
52
+ rpc ListAdminAuditEvents(ListAdminAuditEventsRequest) returns (ListAdminAuditEventsResponse) {}
53
+ }