@deepseek-ai/dsh-win32-process 0.1.6-alpha.1 → 0.1.7-alpha.1
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.i18n.yaml +2 -2
- package/README.md +2 -0
- package/README.zh.md +2 -0
- package/lib/index.js +73 -50
- package/lib/types/abi.d.ts +4 -0
- package/lib/types/ffi.d.ts +16 -9
- package/lib/types/koffi.d.ts +49 -0
- package/lib/types/process.d.ts +3 -2
- package/package.json +5 -4
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/subprocess/win32-process/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 155ca3807791a83fef437af67312b3480ce7d2a2
|
|
6
|
+
README.zh.md: f0c4439af27ef45c88d73bcba54851d789da063d
|
package/README.md
CHANGED
|
@@ -32,6 +32,8 @@ This low-level Win32 process library is consumed by the Windows ACL sandbox and
|
|
|
32
32
|
- **Ordinary settlement operations** — `pollProcessExit()` publishes direct exit separately, while `isJobEmpty()` reads `QueryInformationJobObject(JobObjectBasicAccountingInformation)` until `ActiveProcesses` reaches zero. Checked Job termination and handle closure keep the runner as the only native owner.
|
|
33
33
|
- **Explicit settlement ownership** — `waitForProcessExit()` waits and closes a sandbox process handle; ordinary runner process polling, Job accounting, and checked Job termination/closure remain separate operations. `drainPipe()` reuses one native count slot while draining, frees it, and closes the pipe read handle. Each caller owns its result composition and returned handles.
|
|
34
34
|
|
|
35
|
+
Process creation sets `STARTF_USESHOWWINDOW` with `SW_HIDE` before target code runs. It preserves console inheritance and does not add `CREATE_NO_WINDOW` or `CREATE_NEW_CONSOLE`, which can fail DLL initialization under the restricted token. Existing parent console windows are not hidden.
|
|
36
|
+
|
|
35
37
|
The Windows ACL sandbox adds SID, DACL, grant, workspace, and public child policy above these primitives.
|
|
36
38
|
|
|
37
39
|
- **Inherited control descriptor** — Job creation accepts an optional fd-7 pipe. `STARTUPINFO.cbReserved2/lpReserved2` carries an eight-slot CRT descriptor table with standard handles, closed slots 3–6, and the control pipe at slot 7. The table is allocated until CreateProcess returns; temporary handle inheritance is reset on success and failure. Initializing the slot before Node starts avoids overwriting descriptors Node has already allocated.
|
package/README.zh.md
CHANGED
|
@@ -32,6 +32,8 @@ kind: "package-library"
|
|
|
32
32
|
- **ordinary 结算操作** — `pollProcessExit()` 单独发布 direct exit,`isJobEmpty()` 则读取 `QueryInformationJobObject(JobObjectBasicAccountingInformation)`,直到 `ActiveProcesses` 归零。带检查的 Job 终止与句柄关闭使 runner 保持唯一 native owner。
|
|
33
33
|
- **显式结算归属** — `waitForProcessExit()` 等待并关闭沙箱 process 句柄;ordinary runner 的 process polling、Job accounting 与 checked Job termination/closure 是独立操作。`drainPipe()` 在排空期间复用一个 native count slot,释放该分配并关闭管道读取句柄。每个调用方拥有自己的 result 组合与返回句柄。
|
|
34
34
|
|
|
35
|
+
进程创建在目标代码运行前设置 `STARTF_USESHOWWINDOW` 和 `SW_HIDE`。它保留控制台继承,不添加可能导致受限令牌下 DLL 初始化失败的 `CREATE_NO_WINDOW` 或 `CREATE_NEW_CONSOLE`。已有的父进程控制台窗口不会被隐藏。
|
|
36
|
+
|
|
35
37
|
Windows ACL 沙箱在这些原语上增加 SID、DACL、grant、workspace 与公共 child 策略。
|
|
36
38
|
|
|
37
39
|
- **继承控制描述符**——Job 创建接受可选的 fd-7 管道。`STARTUPINFO.cbReserved2/lpReserved2` 携带八槽 CRT 描述符表,其中包含标准句柄、关闭的槽 3–6,以及槽 7 的控制管道。该表保留到 CreateProcess 返回;临时句柄继承在成功和失败时均恢复。在 Node 启动前初始化该槽可避免覆盖 Node 已分配的描述符。
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createLazyRequire } from "@deepseek-ai/dsh-lazy-require";
|
|
2
2
|
/** Win32 code reporting a caller-provided buffer is too small. */
|
|
3
3
|
const ERROR_INSUFFICIENT_BUFFER = 122;
|
|
4
4
|
/** Job limit that terminates every member when the final Job handle closes. */
|
|
@@ -19,10 +19,13 @@ var Win32Error = class extends Error {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
//#endregion
|
|
22
|
+
//#region lib/types/koffi.js
|
|
23
|
+
/** Process-realm lazy access to Koffi's CommonJS entry. */
|
|
24
|
+
/** Load Koffi on the first Win32 native operation. */
|
|
25
|
+
const requireKoffi = createLazyRequire("koffi", import.meta.url);
|
|
26
|
+
//#endregion
|
|
22
27
|
//#region lib/types/ffi.js
|
|
23
28
|
/** Lazy Koffi bindings for generic Win32 process, stdio, and Job operations. */
|
|
24
|
-
const PVOID = koffi.pointer("void");
|
|
25
|
-
const PPVOID = koffi.pointer(PVOID);
|
|
26
29
|
/**
|
|
27
30
|
* Return whether a Koffi pointer represents NULL.
|
|
28
31
|
* @param value - pointer value returned by Koffi or a Win32 call.
|
|
@@ -31,51 +34,64 @@ const PPVOID = koffi.pointer(PVOID);
|
|
|
31
34
|
function isNullPtr(value) {
|
|
32
35
|
return value === null || value === void 0 || value === 0n;
|
|
33
36
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
37
|
+
let cachedTypes;
|
|
38
|
+
/** Resolve Koffi pointer and process layouts on the first native operation. */
|
|
39
|
+
function win32Types() {
|
|
40
|
+
if (cachedTypes !== void 0) return cachedTypes;
|
|
41
|
+
const koffi = requireKoffi();
|
|
42
|
+
const PVOID = koffi.pointer("void");
|
|
43
|
+
const PPVOID = koffi.pointer(PVOID);
|
|
44
|
+
const STARTUPINFOW = koffi.struct("DSH_STARTUPINFOW", {
|
|
45
|
+
cb: "uint32",
|
|
46
|
+
lpReserved: "str16",
|
|
47
|
+
lpDesktop: "str16",
|
|
48
|
+
lpTitle: "str16",
|
|
49
|
+
dwX: "uint32",
|
|
50
|
+
dwY: "uint32",
|
|
51
|
+
dwXSize: "uint32",
|
|
52
|
+
dwYSize: "uint32",
|
|
53
|
+
dwXCountChars: "uint32",
|
|
54
|
+
dwYCountChars: "uint32",
|
|
55
|
+
dwFillAttribute: "uint32",
|
|
56
|
+
dwFlags: "uint32",
|
|
57
|
+
wShowWindow: "uint16",
|
|
58
|
+
cbReserved2: "uint16",
|
|
59
|
+
lpReserved2: koffi.pointer("uint8"),
|
|
60
|
+
hStdInput: PVOID,
|
|
61
|
+
hStdOutput: PVOID,
|
|
62
|
+
hStdError: PVOID
|
|
63
|
+
});
|
|
64
|
+
const PROCESS_INFORMATION = koffi.struct("DSH_PROCESS_INFORMATION", {
|
|
65
|
+
hProcess: PVOID,
|
|
66
|
+
hThread: PVOID,
|
|
67
|
+
dwProcessId: "uint32",
|
|
68
|
+
dwThreadId: "uint32"
|
|
69
|
+
});
|
|
70
|
+
/* v8 ignore start -- ABI guards are pinned by native header probes. */
|
|
71
|
+
if (STARTUPINFOW.size !== 104) throw new Error(`STARTUPINFOW layout mismatch: koffi computed ${STARTUPINFOW.size}, expected 104`);
|
|
72
|
+
if (PROCESS_INFORMATION.size !== 24) throw new Error(`PROCESS_INFORMATION layout mismatch: koffi computed ${PROCESS_INFORMATION.size}, expected 24`);
|
|
73
|
+
/* v8 ignore stop */
|
|
74
|
+
return cachedTypes = {
|
|
75
|
+
PVOID,
|
|
76
|
+
PPVOID,
|
|
77
|
+
STARTUPINFOW,
|
|
78
|
+
PROCESS_INFORMATION
|
|
79
|
+
};
|
|
80
|
+
}
|
|
66
81
|
/**
|
|
67
82
|
* Allocate a pointer-sized out-parameter slot.
|
|
68
83
|
* @returns allocated native slot.
|
|
69
84
|
*/
|
|
70
85
|
function allocPtrSlot() {
|
|
71
|
-
|
|
86
|
+
const { PVOID } = win32Types();
|
|
87
|
+
return requireKoffi().alloc(PVOID, 1);
|
|
72
88
|
}
|
|
73
89
|
/**
|
|
74
90
|
* Allocate a uint32 out-parameter slot.
|
|
75
91
|
* @returns allocated native slot.
|
|
76
92
|
*/
|
|
77
93
|
function allocUint32() {
|
|
78
|
-
return
|
|
94
|
+
return requireKoffi().alloc("uint32", 1);
|
|
79
95
|
}
|
|
80
96
|
/**
|
|
81
97
|
* Decode a pointer out-parameter.
|
|
@@ -83,7 +99,7 @@ function allocUint32() {
|
|
|
83
99
|
* @returns decoded pointer, or null for address zero.
|
|
84
100
|
*/
|
|
85
101
|
function decodePtr(slot) {
|
|
86
|
-
const value =
|
|
102
|
+
const value = requireKoffi().decode(slot, win32Types().PVOID);
|
|
87
103
|
return isNullPtr(value) ? null : value;
|
|
88
104
|
}
|
|
89
105
|
/**
|
|
@@ -92,14 +108,14 @@ function decodePtr(slot) {
|
|
|
92
108
|
* @returns decoded unsigned value.
|
|
93
109
|
*/
|
|
94
110
|
function decodeUint32(slot) {
|
|
95
|
-
return
|
|
111
|
+
return requireKoffi().decode(slot, "uint32");
|
|
96
112
|
}
|
|
97
113
|
/**
|
|
98
114
|
* Allocate a zeroed STARTUPINFOW.
|
|
99
115
|
* @returns allocated struct pointer.
|
|
100
116
|
*/
|
|
101
117
|
function allocStartupInfo() {
|
|
102
|
-
return
|
|
118
|
+
return requireKoffi().alloc(win32Types().STARTUPINFOW, 1);
|
|
103
119
|
}
|
|
104
120
|
/**
|
|
105
121
|
* Encode the stdio-bearing STARTUPINFOW fields.
|
|
@@ -107,14 +123,14 @@ function allocStartupInfo() {
|
|
|
107
123
|
* @param fields - fields required for inherited stdio.
|
|
108
124
|
*/
|
|
109
125
|
function encodeStartupInfo(startupInfo, fields) {
|
|
110
|
-
|
|
126
|
+
requireKoffi().encode(startupInfo, win32Types().STARTUPINFOW, fields);
|
|
111
127
|
}
|
|
112
128
|
/**
|
|
113
129
|
* Allocate a zeroed PROCESS_INFORMATION.
|
|
114
130
|
* @returns allocated struct pointer.
|
|
115
131
|
*/
|
|
116
132
|
function allocProcessInfo() {
|
|
117
|
-
return
|
|
133
|
+
return requireKoffi().alloc(win32Types().PROCESS_INFORMATION, 1);
|
|
118
134
|
}
|
|
119
135
|
/**
|
|
120
136
|
* Decode PROCESS_INFORMATION.
|
|
@@ -122,13 +138,14 @@ function allocProcessInfo() {
|
|
|
122
138
|
* @returns process/thread handles and ids.
|
|
123
139
|
*/
|
|
124
140
|
function decodeProcessInfo(processInfo) {
|
|
125
|
-
return
|
|
141
|
+
return requireKoffi().decode(processInfo, win32Types().PROCESS_INFORMATION);
|
|
126
142
|
}
|
|
127
143
|
let cachedContext;
|
|
128
144
|
let cached;
|
|
129
145
|
/* v8 ignore start -- exercised by native Windows ABI and sandbox jobs. */
|
|
130
146
|
function bindingContext() {
|
|
131
147
|
if (cachedContext !== void 0) return cachedContext;
|
|
148
|
+
const koffi = requireKoffi();
|
|
132
149
|
const kernel32 = koffi.load("kernel32.dll");
|
|
133
150
|
const advapi32 = koffi.load("advapi32.dll");
|
|
134
151
|
const bind = (lib, name, result, args) => lib.func("__stdcall", name, result, args);
|
|
@@ -141,6 +158,8 @@ function bindingContext() {
|
|
|
141
158
|
}
|
|
142
159
|
function bindings() {
|
|
143
160
|
if (cached !== void 0) return cached;
|
|
161
|
+
const koffi = requireKoffi();
|
|
162
|
+
const { PVOID, PPVOID, STARTUPINFOW, PROCESS_INFORMATION } = win32Types();
|
|
144
163
|
const { kernel32, advapi32, bind } = bindingContext();
|
|
145
164
|
const node = koffi.load(null);
|
|
146
165
|
cached = {
|
|
@@ -365,7 +384,7 @@ function encodeWindowsEnvironment(env) {
|
|
|
365
384
|
return Buffer.from(`${strings.join("\0")}\0\0`, "utf16le");
|
|
366
385
|
}
|
|
367
386
|
function freeNative(pointer) {
|
|
368
|
-
if (pointer !== void 0)
|
|
387
|
+
if (pointer !== void 0) requireKoffi().free(pointer);
|
|
369
388
|
}
|
|
370
389
|
function closeBestEffort(api, handle) {
|
|
371
390
|
if (!isNullPtr(handle)) api.closeHandle(handle);
|
|
@@ -391,7 +410,7 @@ function createPipe(api, owned) {
|
|
|
391
410
|
};
|
|
392
411
|
} finally {
|
|
393
412
|
freeNative(writeSlot);
|
|
394
|
-
|
|
413
|
+
requireKoffi().free(readSlot);
|
|
395
414
|
}
|
|
396
415
|
}
|
|
397
416
|
function closeOwned(api, owned, handle) {
|
|
@@ -408,6 +427,7 @@ function createRestrictedProcess(api, options, commandLine, creationFlags, start
|
|
|
408
427
|
}
|
|
409
428
|
/**
|
|
410
429
|
* Spawn a process with anonymous-pipe stdout/stderr and immediate stdin EOF.
|
|
430
|
+
* New console windows start hidden without changing console inheritance.
|
|
411
431
|
* @param api - active binding table.
|
|
412
432
|
* @param options - command, cwd, args, and restricted primary token.
|
|
413
433
|
* @returns caller-owned process and pipe read handles.
|
|
@@ -428,7 +448,8 @@ function spawnPipedProcess(api, options) {
|
|
|
428
448
|
startupInfo = allocStartupInfo();
|
|
429
449
|
encodeStartupInfo(startupInfo, {
|
|
430
450
|
cb: 104,
|
|
431
|
-
dwFlags:
|
|
451
|
+
dwFlags: 257,
|
|
452
|
+
wShowWindow: 0,
|
|
432
453
|
hStdInput: stdIn.read,
|
|
433
454
|
hStdOutput: stdOut.write,
|
|
434
455
|
hStdError: stdErr.write
|
|
@@ -585,6 +606,7 @@ function spawnJobProcess(api, options, resolveStdio, createName, create) {
|
|
|
585
606
|
control: stdio.control
|
|
586
607
|
});
|
|
587
608
|
if (controlBytes !== void 0) {
|
|
609
|
+
const koffi = requireKoffi();
|
|
588
610
|
controlDescriptorBlock = {
|
|
589
611
|
pointer: koffi.alloc("uint8", controlBytes.length),
|
|
590
612
|
length: controlBytes.length
|
|
@@ -594,7 +616,8 @@ function spawnJobProcess(api, options, resolveStdio, createName, create) {
|
|
|
594
616
|
startupInfo = allocStartupInfo();
|
|
595
617
|
encodeStartupInfo(startupInfo, {
|
|
596
618
|
cb: 104,
|
|
597
|
-
dwFlags:
|
|
619
|
+
dwFlags: 257,
|
|
620
|
+
wShowWindow: 0,
|
|
598
621
|
hStdInput: stdio.stdin,
|
|
599
622
|
hStdOutput: stdio.stdout,
|
|
600
623
|
hStdError: stdio.stderr,
|
|
@@ -656,7 +679,7 @@ function spawnJobProcess(api, options, resolveStdio, createName, create) {
|
|
|
656
679
|
};
|
|
657
680
|
}
|
|
658
681
|
/**
|
|
659
|
-
* Spawn a restricted-token process suspended, assign its Job, then resume it.
|
|
682
|
+
* Spawn a restricted-token process suspended with hidden initial windows, assign its Job, then resume it.
|
|
660
683
|
* @param api - active binding table.
|
|
661
684
|
* @param options - command, cwd, args, and restricted primary token.
|
|
662
685
|
* @returns caller-owned process and Job handles after successful resume.
|
|
@@ -670,7 +693,7 @@ function spawnInheritedJobProcess(api, options) {
|
|
|
670
693
|
return spawnJobProcess(api, options, () => inheritedStandardHandles(api, options.controlFileDescriptor), "CreateProcessAsUserW", (startupInfo, processInfo) => createRestrictedProcess(api, options, commandLine, 4, startupInfo, processInfo));
|
|
671
694
|
}
|
|
672
695
|
/**
|
|
673
|
-
* Spawn an ordinary process suspended, assign its Job, then resume it.
|
|
696
|
+
* Spawn an ordinary process suspended with hidden initial windows, assign its Job, then resume it.
|
|
674
697
|
* @param api - active binding table.
|
|
675
698
|
* @param options - command, cwd, argv, and target carrier descriptors.
|
|
676
699
|
* @returns caller-owned process and Job handles after successful resume.
|
|
@@ -702,7 +725,7 @@ function pollProcessExit(api, process) {
|
|
|
702
725
|
if (api.getExitCodeProcess(process, exitCodeSlot) === 0) throwLastError(api, "GetExitCodeProcess");
|
|
703
726
|
return decodeUint32(exitCodeSlot);
|
|
704
727
|
} finally {
|
|
705
|
-
|
|
728
|
+
requireKoffi().free(exitCodeSlot);
|
|
706
729
|
}
|
|
707
730
|
}
|
|
708
731
|
/**
|
package/lib/types/abi.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/** Generic Win32 process, stdio, and Job Object constants verified on x64. */
|
|
2
2
|
/** STARTUPINFOW uses the standard input, output, and error handles. */
|
|
3
3
|
export declare const STARTF_USESTDHANDLES = 256;
|
|
4
|
+
/** STARTUPINFOW applies wShowWindow when creating a console window. */
|
|
5
|
+
export declare const STARTF_USESHOWWINDOW = 1;
|
|
6
|
+
/** Initial window visibility that preserves the child's console attachment. */
|
|
7
|
+
export declare const SW_HIDE = 0;
|
|
4
8
|
/** HandleInformation flag that permits child inheritance. */
|
|
5
9
|
export declare const HANDLE_FLAG_INHERIT = 1;
|
|
6
10
|
/** Infinite WaitForSingleObject timeout. */
|
package/lib/types/ffi.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/** Lazy Koffi bindings for generic Win32 process, stdio, and Job operations. */
|
|
2
|
-
import
|
|
2
|
+
import { type Koffi } from './koffi.ts';
|
|
3
3
|
declare const nativePtr: unique symbol;
|
|
4
4
|
/** Koffi native pointer branded against accidental numeric use. */
|
|
5
5
|
export type NativePtr = bigint & {
|
|
6
6
|
readonly [nativePtr]: true;
|
|
7
7
|
};
|
|
8
|
-
type Ptr = ReturnType<
|
|
8
|
+
type Ptr = ReturnType<Koffi['pointer']>;
|
|
9
9
|
/** Loaded Win32 libraries and the shared stdcall binder used by process extensions. */
|
|
10
10
|
export interface Win32BindingContext {
|
|
11
11
|
/** Kernel process, handle, pipe, and Job APIs. */
|
|
12
|
-
readonly kernel32: ReturnType<
|
|
12
|
+
readonly kernel32: ReturnType<Koffi['load']>;
|
|
13
13
|
/** Token and security APIs. */
|
|
14
|
-
readonly advapi32: ReturnType<
|
|
14
|
+
readonly advapi32: ReturnType<Koffi['load']>;
|
|
15
15
|
/** Bind one stdcall function from a loaded Win32 library. */
|
|
16
|
-
readonly bind: (library: ReturnType<
|
|
16
|
+
readonly bind: (library: ReturnType<Koffi['load']>, name: string, result: Ptr | string, args: Array<Ptr | string>) => unknown;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Return whether a Koffi pointer represents NULL.
|
|
@@ -25,6 +25,7 @@ export declare function isNullPtr(value: NativePtr | null | undefined): value is
|
|
|
25
25
|
export interface StartupInfoInput {
|
|
26
26
|
cb: number;
|
|
27
27
|
dwFlags: number;
|
|
28
|
+
wShowWindow: number;
|
|
28
29
|
hStdInput: NativePtr;
|
|
29
30
|
hStdOutput: NativePtr;
|
|
30
31
|
hStdError: NativePtr;
|
|
@@ -66,10 +67,16 @@ export interface Win32ProcessBindings {
|
|
|
66
67
|
export interface CurrentTokenProcessBindings extends Win32ProcessBindings {
|
|
67
68
|
uvGetOsfhandle(fileDescriptor: number): NativePtr | null;
|
|
68
69
|
}
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Materialize the Koffi STARTUPINFOW layout on first native use.
|
|
72
|
+
* @returns the cached native struct type.
|
|
73
|
+
*/
|
|
74
|
+
export declare function startupInfoType(): ReturnType<Koffi['struct']>;
|
|
75
|
+
/**
|
|
76
|
+
* Materialize the Koffi PROCESS_INFORMATION layout on first native use.
|
|
77
|
+
* @returns the cached native struct type.
|
|
78
|
+
*/
|
|
79
|
+
export declare function processInformationType(): ReturnType<Koffi['struct']>;
|
|
73
80
|
/**
|
|
74
81
|
* Allocate a pointer-sized out-parameter slot.
|
|
75
82
|
* @returns allocated native slot.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Process-realm lazy access to Koffi's CommonJS entry. */
|
|
2
|
+
import type koffi from 'koffi';
|
|
3
|
+
/** Koffi runtime export type. */
|
|
4
|
+
export type Koffi = typeof koffi;
|
|
5
|
+
/** Load Koffi on the first Win32 native operation. */
|
|
6
|
+
export declare const requireKoffi: () => {
|
|
7
|
+
LibraryHandle: import("koffi").LibraryHandle;
|
|
8
|
+
TypeObject: import("koffi").TypeObject;
|
|
9
|
+
Union: import("koffi").Union;
|
|
10
|
+
address: typeof import("koffi").address;
|
|
11
|
+
alias: typeof import("koffi").alias;
|
|
12
|
+
alignof: typeof import("koffi").alignof;
|
|
13
|
+
alloc: typeof import("koffi").alloc;
|
|
14
|
+
array: typeof import("koffi").array;
|
|
15
|
+
as: typeof import("koffi").as;
|
|
16
|
+
call: typeof import("koffi").call;
|
|
17
|
+
config: typeof import("koffi").config;
|
|
18
|
+
decode: typeof import("koffi").decode;
|
|
19
|
+
disposable: typeof import("koffi").disposable;
|
|
20
|
+
encode: typeof import("koffi").encode;
|
|
21
|
+
enumeration: typeof import("koffi").enumeration;
|
|
22
|
+
errno: typeof import("koffi").errno;
|
|
23
|
+
extension: typeof import("koffi").extension;
|
|
24
|
+
free: typeof import("koffi").free;
|
|
25
|
+
inout: typeof import("koffi").inout;
|
|
26
|
+
introspect: typeof import("koffi").introspect;
|
|
27
|
+
load: typeof import("koffi").load;
|
|
28
|
+
node: typeof import("koffi").node;
|
|
29
|
+
offsetof: typeof import("koffi").offsetof;
|
|
30
|
+
opaque: typeof import("koffi").opaque;
|
|
31
|
+
os: typeof import("koffi").os;
|
|
32
|
+
out: typeof import("koffi").out;
|
|
33
|
+
pack: typeof import("koffi").pack;
|
|
34
|
+
pointer: typeof import("koffi").pointer;
|
|
35
|
+
proto: typeof import("koffi").proto;
|
|
36
|
+
register: typeof import("koffi").register;
|
|
37
|
+
reset: typeof import("koffi").reset;
|
|
38
|
+
resolve: typeof import("koffi").resolve;
|
|
39
|
+
sizeof: typeof import("koffi").sizeof;
|
|
40
|
+
stats: typeof import("koffi").stats;
|
|
41
|
+
struct: typeof import("koffi").struct;
|
|
42
|
+
type: typeof import("koffi").type;
|
|
43
|
+
types: typeof import("koffi").types;
|
|
44
|
+
union: typeof import("koffi").union;
|
|
45
|
+
unregister: typeof import("koffi").unregister;
|
|
46
|
+
version: typeof import("koffi").version;
|
|
47
|
+
view: typeof import("koffi").view;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=koffi.d.ts.map
|
package/lib/types/process.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ export interface SpawnedJobProcess {
|
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Spawn a process with anonymous-pipe stdout/stderr and immediate stdin EOF.
|
|
70
|
+
* New console windows start hidden without changing console inheritance.
|
|
70
71
|
* @param api - active binding table.
|
|
71
72
|
* @param options - command, cwd, args, and restricted primary token.
|
|
72
73
|
* @returns caller-owned process and pipe read handles.
|
|
@@ -88,7 +89,7 @@ export declare function drainPipe(api: Win32ProcessBindings, handle: NativePtr):
|
|
|
88
89
|
*/
|
|
89
90
|
export declare function waitForProcessExit(api: Win32ProcessBindings, process: NativePtr): number;
|
|
90
91
|
/**
|
|
91
|
-
* Spawn a restricted-token process suspended, assign its Job, then resume it.
|
|
92
|
+
* Spawn a restricted-token process suspended with hidden initial windows, assign its Job, then resume it.
|
|
92
93
|
* @param api - active binding table.
|
|
93
94
|
* @param options - command, cwd, args, and restricted primary token.
|
|
94
95
|
* @returns caller-owned process and Job handles after successful resume.
|
|
@@ -99,7 +100,7 @@ export declare function waitForProcessExit(api: Win32ProcessBindings, process: N
|
|
|
99
100
|
*/
|
|
100
101
|
export declare function spawnInheritedJobProcess(api: Win32ProcessBindings, options: RestrictedProcessSpawnOptions): SpawnedJobProcess;
|
|
101
102
|
/**
|
|
102
|
-
* Spawn an ordinary process suspended, assign its Job, then resume it.
|
|
103
|
+
* Spawn an ordinary process suspended with hidden initial windows, assign its Job, then resume it.
|
|
103
104
|
* @param api - active binding table.
|
|
104
105
|
* @param options - command, cwd, argv, and target carrier descriptors.
|
|
105
106
|
* @returns caller-owned process and Job handles after successful resume.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-win32-process",
|
|
3
3
|
"description": "Shared low-level Win32 process, stdio, and Job Object primitives",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,12 +27,13 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
30
|
+
"@deepseek-ai/cordis": "^4.0.3"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"koffi": "^3.1.0"
|
|
33
|
+
"koffi": "^3.1.0",
|
|
34
|
+
"@deepseek-ai/dsh-lazy-require": "^0.1.7-alpha.1"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
37
|
+
"@deepseek-ai/cordis": "^4.0.3"
|
|
37
38
|
}
|
|
38
39
|
}
|