@floegence/floe-webapp-protocol 0.14.3 → 0.15.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/client.d.ts +10 -0
- package/dist/contract.d.ts +27 -0
- package/dist/contracts/redeven_v1/codec/base64.d.ts +2 -0
- package/dist/contracts/redeven_v1/codec/fs.d.ts +15 -0
- package/dist/contracts/redeven_v1/codec/monitor.d.ts +4 -0
- package/dist/contracts/redeven_v1/codec/terminal.d.ts +30 -0
- package/dist/contracts/redeven_v1/contract.d.ts +49 -0
- package/dist/contracts/redeven_v1/index.d.ts +5 -0
- package/dist/contracts/redeven_v1/sdk/fs.d.ts +61 -0
- package/dist/contracts/redeven_v1/sdk/monitor.d.ts +23 -0
- package/dist/contracts/redeven_v1/sdk/terminal.d.ts +72 -0
- package/dist/contracts/redeven_v1/typeIds.d.ts +27 -0
- package/dist/contracts/redeven_v1/wire/fs.d.ts +61 -0
- package/dist/contracts/redeven_v1/wire/monitor.d.ts +23 -0
- package/dist/contracts/redeven_v1/wire/terminal.d.ts +87 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -10
- package/dist/index10.js +34 -0
- package/dist/index2.js +69 -67
- package/dist/index3.js +42 -37
- package/dist/index4.js +2 -0
- package/dist/index5.js +31 -25
- package/dist/index6.js +108 -0
- package/dist/index7.js +94 -0
- package/dist/index8.js +28 -0
- package/dist/index9.js +124 -0
- package/dist/rpc.d.ts +8 -13
- package/package.json +1 -1
- package/dist/types/common.d.ts +0 -99
- package/dist/types/index.d.ts +0 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
2
|
import type { ChannelInitGrant, Client, ClientObserverLike, DirectConnectInfo } from '@floegence/flowersec-core';
|
|
3
3
|
import { type ControlplaneConfig } from './controlplane';
|
|
4
|
+
import type { ProtocolContract } from './contract';
|
|
4
5
|
/**
|
|
5
6
|
* Connection status
|
|
6
7
|
*/
|
|
@@ -9,6 +10,7 @@ interface ProtocolContextValue {
|
|
|
9
10
|
status: () => ConnectionStatus;
|
|
10
11
|
error: () => Error | null;
|
|
11
12
|
client: () => Client | null;
|
|
13
|
+
contract: () => ProtocolContract;
|
|
12
14
|
connect: (config: ConnectConfig) => Promise<void>;
|
|
13
15
|
disconnect: () => void;
|
|
14
16
|
}
|
|
@@ -40,11 +42,19 @@ export interface ConnectConfig {
|
|
|
40
42
|
handshakeTimeoutMs?: number;
|
|
41
43
|
autoReconnect?: AutoReconnectConfig;
|
|
42
44
|
controlplane?: ControlplaneConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Provide a fresh grant for each connection attempt.
|
|
47
|
+
*
|
|
48
|
+
* This is the recommended way to support "reconnect requires new ticket/grant"
|
|
49
|
+
* flows (e.g. entry_ticket -> channel_init -> grant_client).
|
|
50
|
+
*/
|
|
51
|
+
getGrant?: () => Promise<ChannelInitGrant>;
|
|
43
52
|
grant?: ChannelInitGrant;
|
|
44
53
|
directInfo?: DirectConnectInfo;
|
|
45
54
|
}
|
|
46
55
|
export declare function ProtocolProvider(props: {
|
|
47
56
|
children: JSX.Element;
|
|
57
|
+
contract?: ProtocolContract;
|
|
48
58
|
}): JSX.Element;
|
|
49
59
|
export declare function useProtocol(): ProtocolContextValue;
|
|
50
60
|
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type RpcTransportCall = (typeId: number, payload: unknown) => Promise<{
|
|
2
|
+
payload: unknown;
|
|
3
|
+
error?: {
|
|
4
|
+
code: number;
|
|
5
|
+
message?: string;
|
|
6
|
+
};
|
|
7
|
+
}>;
|
|
8
|
+
export type RpcTransportNotify = (typeId: number, payload: unknown) => Promise<void> | void;
|
|
9
|
+
export type RpcTransportOnNotify = (typeId: number, handler: (payload: unknown) => void) => () => void;
|
|
10
|
+
export interface RpcClientLike {
|
|
11
|
+
rpc: {
|
|
12
|
+
call: RpcTransportCall;
|
|
13
|
+
notify: RpcTransportNotify;
|
|
14
|
+
onNotify: RpcTransportOnNotify;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface RpcHelpers {
|
|
18
|
+
call: <Req, Res>(typeId: number, payload: Req) => Promise<Res>;
|
|
19
|
+
notify: <Req>(typeId: number, payload: Req) => Promise<void>;
|
|
20
|
+
onNotify: <Payload>(typeId: number, handler: (payload: Payload) => void) => () => void;
|
|
21
|
+
}
|
|
22
|
+
export interface ProtocolContract<TApi = unknown> {
|
|
23
|
+
/** A stable identifier for logging and debugging (e.g. "redeven_v1"). */
|
|
24
|
+
id: string;
|
|
25
|
+
/** Build a typed RPC surface from the low-level transport helpers. */
|
|
26
|
+
createRpc: (helpers: RpcHelpers) => TApi;
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { wire_fs_copy_req, wire_fs_copy_resp, wire_fs_delete_req, wire_fs_delete_resp, wire_fs_get_home_resp, wire_fs_list_req, wire_fs_list_resp, wire_fs_read_file_req, wire_fs_read_file_resp, wire_fs_rename_req, wire_fs_rename_resp, wire_fs_write_file_req, wire_fs_write_file_resp } from '../wire/fs';
|
|
2
|
+
import type { FsCopyRequest, FsCopyResponse, FsDeleteRequest, FsDeleteResponse, FsGetHomeResponse, FsListRequest, FsListResponse, FsReadFileRequest, FsReadFileResponse, FsRenameRequest, FsRenameResponse, FsWriteFileRequest, FsWriteFileResponse } from '../sdk/fs';
|
|
3
|
+
export declare function toWireFsListRequest(req: FsListRequest): wire_fs_list_req;
|
|
4
|
+
export declare function fromWireFsListResponse(resp: wire_fs_list_resp): FsListResponse;
|
|
5
|
+
export declare function toWireFsReadFileRequest(req: FsReadFileRequest): wire_fs_read_file_req;
|
|
6
|
+
export declare function fromWireFsReadFileResponse(resp: wire_fs_read_file_resp): FsReadFileResponse;
|
|
7
|
+
export declare function toWireFsWriteFileRequest(req: FsWriteFileRequest): wire_fs_write_file_req;
|
|
8
|
+
export declare function fromWireFsWriteFileResponse(resp: wire_fs_write_file_resp): FsWriteFileResponse;
|
|
9
|
+
export declare function toWireFsDeleteRequest(req: FsDeleteRequest): wire_fs_delete_req;
|
|
10
|
+
export declare function fromWireFsDeleteResponse(resp: wire_fs_delete_resp): FsDeleteResponse;
|
|
11
|
+
export declare function toWireFsRenameRequest(req: FsRenameRequest): wire_fs_rename_req;
|
|
12
|
+
export declare function fromWireFsRenameResponse(resp: wire_fs_rename_resp): FsRenameResponse;
|
|
13
|
+
export declare function toWireFsCopyRequest(req: FsCopyRequest): wire_fs_copy_req;
|
|
14
|
+
export declare function fromWireFsCopyResponse(resp: wire_fs_copy_resp): FsCopyResponse;
|
|
15
|
+
export declare function fromWireFsGetHomeResponse(resp: wire_fs_get_home_resp): FsGetHomeResponse;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { wire_sys_monitor_req, wire_sys_monitor_resp } from '../wire/monitor';
|
|
2
|
+
import type { SysMonitorRequest, SysMonitorSnapshot } from '../sdk/monitor';
|
|
3
|
+
export declare function toWireSysMonitorRequest(req: SysMonitorRequest): wire_sys_monitor_req;
|
|
4
|
+
export declare function fromWireSysMonitorResponse(resp: wire_sys_monitor_resp): SysMonitorSnapshot;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { wire_terminal_history_req, wire_terminal_history_resp, wire_terminal_name_update_notify, wire_terminal_output_notify, wire_terminal_session_attach_req, wire_terminal_session_attach_resp, wire_terminal_session_create_req, wire_terminal_session_create_resp, wire_terminal_session_delete_req, wire_terminal_session_delete_resp, wire_terminal_session_list_resp, wire_terminal_session_stats_req, wire_terminal_session_stats_resp, wire_terminal_clear_req, wire_terminal_clear_resp, wire_terminal_input_notify, wire_terminal_resize_notify } from '../wire/terminal';
|
|
2
|
+
import type { TerminalClearRequest, TerminalClearResponse, TerminalHistoryRequest, TerminalHistoryResponse, TerminalNameUpdateEvent, TerminalOutputEvent, TerminalSessionAttachRequest, TerminalSessionAttachResponse, TerminalSessionCreateRequest, TerminalSessionCreateResponse, TerminalSessionDeleteRequest, TerminalSessionDeleteResponse, TerminalSessionInfo, TerminalSessionStatsRequest, TerminalSessionStatsResponse } from '../sdk/terminal';
|
|
3
|
+
export declare function toWireTerminalSessionCreateRequest(req: TerminalSessionCreateRequest): wire_terminal_session_create_req;
|
|
4
|
+
export declare function fromWireTerminalSessionCreateResponse(resp: wire_terminal_session_create_resp): TerminalSessionCreateResponse;
|
|
5
|
+
export declare function fromWireTerminalSessionListResponse(resp: wire_terminal_session_list_resp): {
|
|
6
|
+
sessions: TerminalSessionInfo[];
|
|
7
|
+
};
|
|
8
|
+
export declare function toWireTerminalSessionAttachRequest(req: TerminalSessionAttachRequest): wire_terminal_session_attach_req;
|
|
9
|
+
export declare function fromWireTerminalSessionAttachResponse(resp: wire_terminal_session_attach_resp): TerminalSessionAttachResponse;
|
|
10
|
+
export declare function toWireTerminalHistoryRequest(req: TerminalHistoryRequest): wire_terminal_history_req;
|
|
11
|
+
export declare function fromWireTerminalHistoryResponse(resp: wire_terminal_history_resp): TerminalHistoryResponse;
|
|
12
|
+
export declare function toWireTerminalClearRequest(req: TerminalClearRequest): wire_terminal_clear_req;
|
|
13
|
+
export declare function fromWireTerminalClearResponse(resp: wire_terminal_clear_resp): TerminalClearResponse;
|
|
14
|
+
export declare function toWireTerminalSessionDeleteRequest(req: TerminalSessionDeleteRequest): wire_terminal_session_delete_req;
|
|
15
|
+
export declare function fromWireTerminalSessionDeleteResponse(resp: wire_terminal_session_delete_resp): TerminalSessionDeleteResponse;
|
|
16
|
+
export declare function toWireTerminalSessionStatsRequest(req: TerminalSessionStatsRequest): wire_terminal_session_stats_req;
|
|
17
|
+
export declare function fromWireTerminalSessionStatsResponse(resp: wire_terminal_session_stats_resp): TerminalSessionStatsResponse;
|
|
18
|
+
export declare function fromWireTerminalOutputNotify(payload: wire_terminal_output_notify): TerminalOutputEvent | null;
|
|
19
|
+
export declare function fromWireTerminalNameUpdateNotify(payload: wire_terminal_name_update_notify): TerminalNameUpdateEvent | null;
|
|
20
|
+
export declare function toWireTerminalResizeNotify(args: {
|
|
21
|
+
sessionId: string;
|
|
22
|
+
connId: string;
|
|
23
|
+
cols: number;
|
|
24
|
+
rows: number;
|
|
25
|
+
}): wire_terminal_resize_notify;
|
|
26
|
+
export declare function toWireTerminalInputNotify(args: {
|
|
27
|
+
sessionId: string;
|
|
28
|
+
connId: string;
|
|
29
|
+
data: Uint8Array;
|
|
30
|
+
}): wire_terminal_input_notify;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ProtocolContract, RpcHelpers } from '../../contract';
|
|
2
|
+
import type { FsCopyRequest, FsCopyResponse, FsDeleteRequest, FsDeleteResponse, FsGetHomeResponse, FsListRequest, FsListResponse, FsReadFileRequest, FsReadFileResponse, FsRenameRequest, FsRenameResponse, FsWriteFileRequest, FsWriteFileResponse } from './sdk/fs';
|
|
3
|
+
import type { SysMonitorRequest, SysMonitorSnapshot } from './sdk/monitor';
|
|
4
|
+
import type { TerminalClearRequest, TerminalClearResponse, TerminalHistoryRequest, TerminalHistoryResponse, TerminalNameUpdateEvent, TerminalOutputEvent, TerminalSessionAttachRequest, TerminalSessionAttachResponse, TerminalSessionCreateRequest, TerminalSessionCreateResponse, TerminalSessionDeleteRequest, TerminalSessionDeleteResponse, TerminalSessionInfo, TerminalSessionStatsRequest, TerminalSessionStatsResponse } from './sdk/terminal';
|
|
5
|
+
export type RedevenV1Rpc = {
|
|
6
|
+
fs: {
|
|
7
|
+
getHome: () => Promise<FsGetHomeResponse>;
|
|
8
|
+
list: (req: FsListRequest) => Promise<FsListResponse>;
|
|
9
|
+
readFile: (req: FsReadFileRequest) => Promise<FsReadFileResponse>;
|
|
10
|
+
writeFile: (req: FsWriteFileRequest) => Promise<FsWriteFileResponse>;
|
|
11
|
+
rename: (req: FsRenameRequest) => Promise<FsRenameResponse>;
|
|
12
|
+
copy: (req: FsCopyRequest) => Promise<FsCopyResponse>;
|
|
13
|
+
delete: (req: FsDeleteRequest) => Promise<FsDeleteResponse>;
|
|
14
|
+
};
|
|
15
|
+
terminal: {
|
|
16
|
+
createSession: (req: TerminalSessionCreateRequest) => Promise<TerminalSessionCreateResponse>;
|
|
17
|
+
listSessions: () => Promise<{
|
|
18
|
+
sessions: TerminalSessionInfo[];
|
|
19
|
+
}>;
|
|
20
|
+
attach: (req: TerminalSessionAttachRequest) => Promise<TerminalSessionAttachResponse>;
|
|
21
|
+
history: (req: TerminalHistoryRequest) => Promise<TerminalHistoryResponse>;
|
|
22
|
+
clear: (req: TerminalClearRequest) => Promise<TerminalClearResponse>;
|
|
23
|
+
deleteSession: (req: TerminalSessionDeleteRequest) => Promise<TerminalSessionDeleteResponse>;
|
|
24
|
+
getSessionStats: (req: TerminalSessionStatsRequest) => Promise<TerminalSessionStatsResponse>;
|
|
25
|
+
resize: (args: {
|
|
26
|
+
sessionId: string;
|
|
27
|
+
connId: string;
|
|
28
|
+
cols: number;
|
|
29
|
+
rows: number;
|
|
30
|
+
}) => Promise<void>;
|
|
31
|
+
sendInput: (args: {
|
|
32
|
+
sessionId: string;
|
|
33
|
+
connId: string;
|
|
34
|
+
data: Uint8Array;
|
|
35
|
+
}) => Promise<void>;
|
|
36
|
+
sendTextInput: (args: {
|
|
37
|
+
sessionId: string;
|
|
38
|
+
connId: string;
|
|
39
|
+
text: string;
|
|
40
|
+
}) => Promise<void>;
|
|
41
|
+
onOutput: (handler: (event: TerminalOutputEvent) => void) => () => void;
|
|
42
|
+
onNameUpdate: (handler: (event: TerminalNameUpdateEvent) => void) => () => void;
|
|
43
|
+
};
|
|
44
|
+
monitor: {
|
|
45
|
+
getSysMonitor: (req?: SysMonitorRequest) => Promise<SysMonitorSnapshot>;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export declare function createRedevenV1Rpc(helpers: RpcHelpers): RedevenV1Rpc;
|
|
49
|
+
export declare const redevenV1Contract: ProtocolContract<RedevenV1Rpc>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type FsEncoding = 'utf8' | 'base64';
|
|
2
|
+
export interface FsFileInfo {
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
isDirectory: boolean;
|
|
6
|
+
size: number;
|
|
7
|
+
modifiedAt: number;
|
|
8
|
+
createdAt: number;
|
|
9
|
+
permissions?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface FsGetHomeResponse {
|
|
12
|
+
path: string;
|
|
13
|
+
}
|
|
14
|
+
export interface FsListRequest {
|
|
15
|
+
path: string;
|
|
16
|
+
showHidden?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface FsListResponse {
|
|
19
|
+
entries: FsFileInfo[];
|
|
20
|
+
}
|
|
21
|
+
export interface FsReadFileRequest {
|
|
22
|
+
path: string;
|
|
23
|
+
encoding?: FsEncoding;
|
|
24
|
+
}
|
|
25
|
+
export interface FsReadFileResponse {
|
|
26
|
+
content: string;
|
|
27
|
+
encoding: FsEncoding | string;
|
|
28
|
+
}
|
|
29
|
+
export interface FsWriteFileRequest {
|
|
30
|
+
path: string;
|
|
31
|
+
content: string;
|
|
32
|
+
encoding?: FsEncoding;
|
|
33
|
+
createDirs?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface FsWriteFileResponse {
|
|
36
|
+
success: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface FsDeleteRequest {
|
|
39
|
+
path: string;
|
|
40
|
+
recursive?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface FsDeleteResponse {
|
|
43
|
+
success: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface FsRenameRequest {
|
|
46
|
+
oldPath: string;
|
|
47
|
+
newPath: string;
|
|
48
|
+
}
|
|
49
|
+
export interface FsRenameResponse {
|
|
50
|
+
success: boolean;
|
|
51
|
+
newPath: string;
|
|
52
|
+
}
|
|
53
|
+
export interface FsCopyRequest {
|
|
54
|
+
sourcePath: string;
|
|
55
|
+
destPath: string;
|
|
56
|
+
overwrite?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface FsCopyResponse {
|
|
59
|
+
success: boolean;
|
|
60
|
+
newPath: string;
|
|
61
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type SysMonitorSortBy = 'cpu' | 'memory';
|
|
2
|
+
export type SysMonitorProcessInfo = {
|
|
3
|
+
pid: number;
|
|
4
|
+
name: string;
|
|
5
|
+
cpuPercent: number;
|
|
6
|
+
memoryBytes: number;
|
|
7
|
+
username: string;
|
|
8
|
+
};
|
|
9
|
+
export type SysMonitorSnapshot = {
|
|
10
|
+
cpuUsage: number;
|
|
11
|
+
cpuCores: number;
|
|
12
|
+
loadAverage?: number[];
|
|
13
|
+
networkBytesReceived: number;
|
|
14
|
+
networkBytesSent: number;
|
|
15
|
+
networkSpeedReceived: number;
|
|
16
|
+
networkSpeedSent: number;
|
|
17
|
+
platform: string;
|
|
18
|
+
processes: SysMonitorProcessInfo[];
|
|
19
|
+
timestampMs: number;
|
|
20
|
+
};
|
|
21
|
+
export type SysMonitorRequest = {
|
|
22
|
+
sortBy?: SysMonitorSortBy;
|
|
23
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export type TerminalSessionInfo = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
workingDir: string;
|
|
5
|
+
createdAtMs: number;
|
|
6
|
+
lastActiveAtMs: number;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type TerminalSessionCreateRequest = {
|
|
10
|
+
name?: string;
|
|
11
|
+
workingDir?: string;
|
|
12
|
+
cols: number;
|
|
13
|
+
rows: number;
|
|
14
|
+
};
|
|
15
|
+
export type TerminalSessionCreateResponse = {
|
|
16
|
+
session: TerminalSessionInfo;
|
|
17
|
+
};
|
|
18
|
+
export type TerminalSessionAttachRequest = {
|
|
19
|
+
sessionId: string;
|
|
20
|
+
connId: string;
|
|
21
|
+
cols: number;
|
|
22
|
+
rows: number;
|
|
23
|
+
};
|
|
24
|
+
export type TerminalSessionAttachResponse = {
|
|
25
|
+
ok: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type TerminalHistoryChunk = {
|
|
28
|
+
sequence: number;
|
|
29
|
+
timestampMs: number;
|
|
30
|
+
data: Uint8Array;
|
|
31
|
+
};
|
|
32
|
+
export type TerminalHistoryRequest = {
|
|
33
|
+
sessionId: string;
|
|
34
|
+
startSeq: number;
|
|
35
|
+
endSeq: number;
|
|
36
|
+
};
|
|
37
|
+
export type TerminalHistoryResponse = {
|
|
38
|
+
chunks: TerminalHistoryChunk[];
|
|
39
|
+
};
|
|
40
|
+
export type TerminalClearRequest = {
|
|
41
|
+
sessionId: string;
|
|
42
|
+
};
|
|
43
|
+
export type TerminalClearResponse = {
|
|
44
|
+
ok: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type TerminalSessionDeleteRequest = {
|
|
47
|
+
sessionId: string;
|
|
48
|
+
};
|
|
49
|
+
export type TerminalSessionDeleteResponse = {
|
|
50
|
+
ok: boolean;
|
|
51
|
+
};
|
|
52
|
+
export type TerminalSessionStatsRequest = {
|
|
53
|
+
sessionId: string;
|
|
54
|
+
};
|
|
55
|
+
export type TerminalSessionStatsResponse = {
|
|
56
|
+
history: {
|
|
57
|
+
totalBytes: number;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export type TerminalOutputEvent = {
|
|
61
|
+
sessionId: string;
|
|
62
|
+
data: Uint8Array;
|
|
63
|
+
sequence?: number;
|
|
64
|
+
timestampMs?: number;
|
|
65
|
+
echoOfInput?: boolean;
|
|
66
|
+
originalSource?: string;
|
|
67
|
+
};
|
|
68
|
+
export type TerminalNameUpdateEvent = {
|
|
69
|
+
sessionId: string;
|
|
70
|
+
newName: string;
|
|
71
|
+
workingDir: string;
|
|
72
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const redevenV1TypeIds: {
|
|
2
|
+
readonly fs: {
|
|
3
|
+
readonly list: 1001;
|
|
4
|
+
readonly readFile: 1002;
|
|
5
|
+
readonly writeFile: 1003;
|
|
6
|
+
readonly rename: 1004;
|
|
7
|
+
readonly copy: 1005;
|
|
8
|
+
readonly delete: 1006;
|
|
9
|
+
readonly getHome: 1010;
|
|
10
|
+
};
|
|
11
|
+
readonly terminal: {
|
|
12
|
+
readonly sessionCreate: 2001;
|
|
13
|
+
readonly sessionList: 2002;
|
|
14
|
+
readonly sessionAttach: 2003;
|
|
15
|
+
readonly output: 2004;
|
|
16
|
+
readonly resize: 2005;
|
|
17
|
+
readonly input: 2006;
|
|
18
|
+
readonly history: 2007;
|
|
19
|
+
readonly clear: 2008;
|
|
20
|
+
readonly sessionDelete: 2009;
|
|
21
|
+
readonly nameUpdate: 2010;
|
|
22
|
+
readonly sessionStats: 2011;
|
|
23
|
+
};
|
|
24
|
+
readonly monitor: {
|
|
25
|
+
readonly sysMonitor: 3001;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type wire_fs_get_home_req = Record<string, never>;
|
|
2
|
+
export type wire_fs_get_home_resp = {
|
|
3
|
+
path: string;
|
|
4
|
+
};
|
|
5
|
+
export type wire_fs_list_req = {
|
|
6
|
+
path: string;
|
|
7
|
+
show_hidden?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type wire_fs_file_info = {
|
|
10
|
+
name: string;
|
|
11
|
+
path: string;
|
|
12
|
+
is_directory: boolean;
|
|
13
|
+
size: number;
|
|
14
|
+
modified_at: number;
|
|
15
|
+
created_at: number;
|
|
16
|
+
permissions?: string;
|
|
17
|
+
};
|
|
18
|
+
export type wire_fs_list_resp = {
|
|
19
|
+
entries: wire_fs_file_info[];
|
|
20
|
+
};
|
|
21
|
+
export type wire_fs_read_file_req = {
|
|
22
|
+
path: string;
|
|
23
|
+
encoding?: 'utf8' | 'utf-8' | 'base64';
|
|
24
|
+
};
|
|
25
|
+
export type wire_fs_read_file_resp = {
|
|
26
|
+
content: string;
|
|
27
|
+
encoding: string;
|
|
28
|
+
};
|
|
29
|
+
export type wire_fs_write_file_req = {
|
|
30
|
+
path: string;
|
|
31
|
+
content: string;
|
|
32
|
+
encoding?: 'utf8' | 'utf-8' | 'base64';
|
|
33
|
+
create_dirs?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export type wire_fs_write_file_resp = {
|
|
36
|
+
success: boolean;
|
|
37
|
+
};
|
|
38
|
+
export type wire_fs_delete_req = {
|
|
39
|
+
path: string;
|
|
40
|
+
recursive?: boolean;
|
|
41
|
+
};
|
|
42
|
+
export type wire_fs_delete_resp = {
|
|
43
|
+
success: boolean;
|
|
44
|
+
};
|
|
45
|
+
export type wire_fs_rename_req = {
|
|
46
|
+
old_path: string;
|
|
47
|
+
new_path: string;
|
|
48
|
+
};
|
|
49
|
+
export type wire_fs_rename_resp = {
|
|
50
|
+
success: boolean;
|
|
51
|
+
new_path: string;
|
|
52
|
+
};
|
|
53
|
+
export type wire_fs_copy_req = {
|
|
54
|
+
source_path: string;
|
|
55
|
+
dest_path: string;
|
|
56
|
+
overwrite?: boolean;
|
|
57
|
+
};
|
|
58
|
+
export type wire_fs_copy_resp = {
|
|
59
|
+
success: boolean;
|
|
60
|
+
new_path: string;
|
|
61
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type wire_sys_monitor_sort_by = 'cpu' | 'memory';
|
|
2
|
+
export type wire_sys_monitor_req = {
|
|
3
|
+
sort_by?: wire_sys_monitor_sort_by;
|
|
4
|
+
};
|
|
5
|
+
export type wire_sys_monitor_process_info = {
|
|
6
|
+
pid: number;
|
|
7
|
+
name: string;
|
|
8
|
+
cpu_percent: number;
|
|
9
|
+
memory_bytes: number;
|
|
10
|
+
username: string;
|
|
11
|
+
};
|
|
12
|
+
export type wire_sys_monitor_resp = {
|
|
13
|
+
cpu_usage: number;
|
|
14
|
+
cpu_cores: number;
|
|
15
|
+
load_average?: number[];
|
|
16
|
+
network_bytes_received: number;
|
|
17
|
+
network_bytes_sent: number;
|
|
18
|
+
network_speed_received: number;
|
|
19
|
+
network_speed_sent: number;
|
|
20
|
+
platform: string;
|
|
21
|
+
processes: wire_sys_monitor_process_info[];
|
|
22
|
+
timestamp_ms: number;
|
|
23
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export type wire_terminal_session_info = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
working_dir: string;
|
|
5
|
+
created_at_ms: number;
|
|
6
|
+
last_active_at_ms: number;
|
|
7
|
+
is_active: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type wire_terminal_session_create_req = {
|
|
10
|
+
name?: string;
|
|
11
|
+
working_dir?: string;
|
|
12
|
+
cols: number;
|
|
13
|
+
rows: number;
|
|
14
|
+
};
|
|
15
|
+
export type wire_terminal_session_create_resp = {
|
|
16
|
+
session: wire_terminal_session_info;
|
|
17
|
+
};
|
|
18
|
+
export type wire_terminal_session_list_req = Record<string, never>;
|
|
19
|
+
export type wire_terminal_session_list_resp = {
|
|
20
|
+
sessions: wire_terminal_session_info[];
|
|
21
|
+
};
|
|
22
|
+
export type wire_terminal_session_attach_req = {
|
|
23
|
+
session_id: string;
|
|
24
|
+
conn_id: string;
|
|
25
|
+
cols: number;
|
|
26
|
+
rows: number;
|
|
27
|
+
};
|
|
28
|
+
export type wire_terminal_session_attach_resp = {
|
|
29
|
+
ok: boolean;
|
|
30
|
+
};
|
|
31
|
+
export type wire_terminal_input_notify = {
|
|
32
|
+
session_id: string;
|
|
33
|
+
conn_id: string;
|
|
34
|
+
data_b64: string;
|
|
35
|
+
};
|
|
36
|
+
export type wire_terminal_output_notify = {
|
|
37
|
+
session_id: string;
|
|
38
|
+
data_b64: string;
|
|
39
|
+
sequence?: number;
|
|
40
|
+
timestamp_ms?: number;
|
|
41
|
+
echo_of_input?: boolean;
|
|
42
|
+
original_source?: string;
|
|
43
|
+
};
|
|
44
|
+
export type wire_terminal_resize_notify = {
|
|
45
|
+
session_id: string;
|
|
46
|
+
conn_id: string;
|
|
47
|
+
cols: number;
|
|
48
|
+
rows: number;
|
|
49
|
+
};
|
|
50
|
+
export type wire_terminal_name_update_notify = {
|
|
51
|
+
session_id: string;
|
|
52
|
+
new_name: string;
|
|
53
|
+
working_dir: string;
|
|
54
|
+
};
|
|
55
|
+
export type wire_terminal_history_req = {
|
|
56
|
+
session_id: string;
|
|
57
|
+
start_seq: number;
|
|
58
|
+
end_seq: number;
|
|
59
|
+
};
|
|
60
|
+
export type wire_terminal_history_chunk = {
|
|
61
|
+
sequence: number;
|
|
62
|
+
timestamp_ms: number;
|
|
63
|
+
data_b64: string;
|
|
64
|
+
};
|
|
65
|
+
export type wire_terminal_history_resp = {
|
|
66
|
+
chunks: wire_terminal_history_chunk[];
|
|
67
|
+
};
|
|
68
|
+
export type wire_terminal_clear_req = {
|
|
69
|
+
session_id: string;
|
|
70
|
+
};
|
|
71
|
+
export type wire_terminal_clear_resp = {
|
|
72
|
+
ok: boolean;
|
|
73
|
+
};
|
|
74
|
+
export type wire_terminal_session_delete_req = {
|
|
75
|
+
session_id: string;
|
|
76
|
+
};
|
|
77
|
+
export type wire_terminal_session_delete_resp = {
|
|
78
|
+
ok: boolean;
|
|
79
|
+
};
|
|
80
|
+
export type wire_terminal_session_stats_req = {
|
|
81
|
+
session_id: string;
|
|
82
|
+
};
|
|
83
|
+
export type wire_terminal_session_stats_resp = {
|
|
84
|
+
history: {
|
|
85
|
+
total_bytes: number;
|
|
86
|
+
};
|
|
87
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ProtocolProvider, useProtocol, type ConnectionStatus, type ConnectConfig, type AutoReconnectConfig } from './client';
|
|
2
2
|
export { useRpc, RpcError, ProtocolNotConnectedError } from './rpc';
|
|
3
3
|
export { requestChannelGrant, type ControlplaneConfig } from './controlplane';
|
|
4
|
-
export
|
|
4
|
+
export type { ProtocolContract, RpcClientLike, RpcHelpers } from './contract';
|
|
5
|
+
export * from './contracts/redeven_v1';
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { ProtocolProvider as
|
|
2
|
-
import { ProtocolNotConnectedError as
|
|
3
|
-
import { requestChannelGrant as
|
|
4
|
-
import {
|
|
1
|
+
import { ProtocolProvider as o, useProtocol as t } from "./index2.js";
|
|
2
|
+
import { ProtocolNotConnectedError as n, RpcError as p, useRpc as d } from "./index3.js";
|
|
3
|
+
import { requestChannelGrant as m } from "./index4.js";
|
|
4
|
+
import { redevenV1TypeIds as a } from "./index5.js";
|
|
5
|
+
import { createRedevenV1Rpc as s, redevenV1Contract as v } from "./index6.js";
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
s as
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
n as ProtocolNotConnectedError,
|
|
8
|
+
o as ProtocolProvider,
|
|
9
|
+
p as RpcError,
|
|
10
|
+
s as createRedevenV1Rpc,
|
|
11
|
+
v as redevenV1Contract,
|
|
12
|
+
a as redevenV1TypeIds,
|
|
13
|
+
m as requestChannelGrant,
|
|
12
14
|
t as useProtocol,
|
|
13
15
|
d as useRpc
|
|
14
16
|
};
|
package/dist/index10.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function f() {
|
|
2
|
+
const n = globalThis.Buffer;
|
|
3
|
+
return !n || typeof n.from != "function" ? null : n;
|
|
4
|
+
}
|
|
5
|
+
function a(n) {
|
|
6
|
+
if (typeof btoa == "function") {
|
|
7
|
+
let e = "";
|
|
8
|
+
for (let r = 0; r < n.length; r += 32768) {
|
|
9
|
+
const o = n.subarray(r, r + 32768);
|
|
10
|
+
e += String.fromCharCode(...o);
|
|
11
|
+
}
|
|
12
|
+
return btoa(e);
|
|
13
|
+
}
|
|
14
|
+
const t = f();
|
|
15
|
+
if (t) return t.from(n).toString("base64");
|
|
16
|
+
throw new Error("Base64 encoding is not available in this environment");
|
|
17
|
+
}
|
|
18
|
+
function u(n) {
|
|
19
|
+
const t = String(n ?? "");
|
|
20
|
+
if (!t) return new Uint8Array();
|
|
21
|
+
if (typeof atob == "function") {
|
|
22
|
+
const i = atob(t), r = new Uint8Array(i.length);
|
|
23
|
+
for (let o = 0; o < i.length; o += 1)
|
|
24
|
+
r[o] = i.charCodeAt(o);
|
|
25
|
+
return r;
|
|
26
|
+
}
|
|
27
|
+
const e = f();
|
|
28
|
+
if (e) return new Uint8Array(e.from(t, "base64"));
|
|
29
|
+
throw new Error("Base64 decoding is not available in this environment");
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
u as bytesFromBase64,
|
|
33
|
+
a as bytesToBase64
|
|
34
|
+
};
|