@lark-codem/codem-core 0.8.70-dev-answer.100102807620.0.g0ffaf54 → 0.8.70-dev.100102800535.0.g88395a7
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/bin/lib/control-fd.js +27 -4
- package/bin/lib/launch.js +4 -3
- package/bin/linco +1 -1
- package/package.json +7 -7
package/bin/lib/control-fd.js
CHANGED
|
@@ -20,9 +20,11 @@
|
|
|
20
20
|
// "an old linco that never writes fd 3" (codem-bridge says so in a comment). Net
|
|
21
21
|
// effect: `/space` reported success and the selection was silently lost.
|
|
22
22
|
//
|
|
23
|
-
//
|
|
23
|
+
// The legacy /space channel is unix only. linco's writer is a
|
|
24
|
+
// `#[cfg(not(unix))]` no-op on Windows
|
|
24
25
|
// (crates/linco-cli/src/space_channel.rs), so there is nothing to forward there and
|
|
25
|
-
// no reason to
|
|
26
|
+
// no reason to forward that legacy channel on Windows. Workflow's required
|
|
27
|
+
// pair is distinct and is inherited on every supported platform.
|
|
26
28
|
|
|
27
29
|
/// The env var through which codem-bridge advertises the control fd.
|
|
28
30
|
const CONTROL_FD_ENV = "CODEM_PROJECT_CHANNEL_FD";
|
|
@@ -30,6 +32,24 @@ const CONTROL_FD_ENV = "CODEM_PROJECT_CHANNEL_FD";
|
|
|
30
32
|
/// stdio for a plain interactive run: the terminal and nothing else.
|
|
31
33
|
const TERMINAL_STDIO = ["inherit", "inherit", "inherit"];
|
|
32
34
|
|
|
35
|
+
// Workflow's private request/reply transport uses fd 3 and fd 4. Unlike
|
|
36
|
+
// /space's optional notification, both channels are required for execution.
|
|
37
|
+
const WORKFLOW_RESOURCE_PROVIDER_ARG = "--workflow-resource-provider-v1";
|
|
38
|
+
|
|
39
|
+
function workflowProviderRequested(args = []) {
|
|
40
|
+
for (let i = 0; i < args.length; i++) {
|
|
41
|
+
// Core's prompt option allows hyphen-leading values, including this
|
|
42
|
+
// private flag or the option separator as literal user text.
|
|
43
|
+
if (args[i] === "--prompt" || args[i] === "-p") {
|
|
44
|
+
i++;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (args[i] === "--") return false;
|
|
48
|
+
if (args[i] === WORKFLOW_RESOURCE_PROVIDER_ARG) return true;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
33
53
|
/// Parse the advertised fd, or null when there is nothing to forward.
|
|
34
54
|
///
|
|
35
55
|
/// Only fd 3 is expressible here: `stdio` slots are positional, so the 4th entry
|
|
@@ -50,7 +70,10 @@ function controlFdFromEnv(env) {
|
|
|
50
70
|
|
|
51
71
|
/// Build the stdio array to hand the platform binary. Returns a fresh array —
|
|
52
72
|
/// `launch` mutates it when degrading after an EBADF.
|
|
53
|
-
function buildStdio({ env = process.env, platform = process.platform } = {}) {
|
|
73
|
+
function buildStdio({ env = process.env, platform = process.platform, args = process.argv.slice(2) } = {}) {
|
|
74
|
+
if (workflowProviderRequested(args)) {
|
|
75
|
+
return [...TERMINAL_STDIO, "inherit", "inherit"];
|
|
76
|
+
}
|
|
54
77
|
if (platform === "win32") {
|
|
55
78
|
return TERMINAL_STDIO.slice();
|
|
56
79
|
}
|
|
@@ -60,4 +83,4 @@ function buildStdio({ env = process.env, platform = process.platform } = {}) {
|
|
|
60
83
|
return [...TERMINAL_STDIO, "inherit"];
|
|
61
84
|
}
|
|
62
85
|
|
|
63
|
-
module.exports = { buildStdio, controlFdFromEnv, CONTROL_FD_ENV, TERMINAL_STDIO };
|
|
86
|
+
module.exports = { buildStdio, controlFdFromEnv, CONTROL_FD_ENV, TERMINAL_STDIO, workflowProviderRequested };
|
package/bin/lib/launch.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// naming an internal file instead of a sentence about their own machine. Both paths
|
|
12
12
|
// must funnel into the same reporter.
|
|
13
13
|
|
|
14
|
-
const { TERMINAL_STDIO } = require("./control-fd");
|
|
14
|
+
const { TERMINAL_STDIO, workflowProviderRequested } = require("./control-fd");
|
|
15
15
|
|
|
16
16
|
/// Human-readable follow-up for the errnos we can actually say something useful
|
|
17
17
|
/// about. Anything else falls through to the bare message.
|
|
@@ -62,7 +62,8 @@ function reportFatal({ error, binary, platform, stderr, exit }) {
|
|
|
62
62
|
/// `stdio` may carry a 4th slot for codem-bridge's /space control fd. If the host
|
|
63
63
|
/// advertised that fd but did not actually pass it, spawning fails with EBADF —
|
|
64
64
|
/// degrade to the terminal-only trio and start anyway rather than refusing to run
|
|
65
|
-
/// over a non-essential side channel.
|
|
65
|
+
/// over a non-essential side channel. Workflow's private fd 3/4 pair is
|
|
66
|
+
/// required: missing channels terminate launch instead of using that fallback.
|
|
66
67
|
function launch({
|
|
67
68
|
binary,
|
|
68
69
|
args,
|
|
@@ -80,7 +81,7 @@ function launch({
|
|
|
80
81
|
try {
|
|
81
82
|
child = attempt(stdio);
|
|
82
83
|
} catch (error) {
|
|
83
|
-
if (stdio.length > 3 && error && error.code === "EBADF") {
|
|
84
|
+
if (stdio.length > 3 && error && error.code === "EBADF" && !workflowProviderRequested(args)) {
|
|
84
85
|
stderr(
|
|
85
86
|
"linco: the host advertised a /space control fd it did not pass; continuing without it"
|
|
86
87
|
);
|
package/bin/linco
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-codem/codem-core",
|
|
3
|
-
"version": "0.8.70-dev
|
|
3
|
+
"version": "0.8.70-dev.100102800535.0.g88395a7",
|
|
4
4
|
"description": "CodeM CLI.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"bin": {
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"LICENSE"
|
|
12
12
|
],
|
|
13
13
|
"optionalDependencies": {
|
|
14
|
-
"@lark-codem/codem-core-darwin-arm64": "0.8.70-dev
|
|
15
|
-
"@lark-codem/codem-core-darwin-x64": "0.8.70-dev
|
|
16
|
-
"@lark-codem/codem-core-linux-arm64-gnu": "0.8.70-dev
|
|
17
|
-
"@lark-codem/codem-core-linux-x64-gnu": "0.8.70-dev
|
|
18
|
-
"@lark-codem/codem-core-win32-arm64-gnu": "0.8.70-dev
|
|
19
|
-
"@lark-codem/codem-core-win32-x64-msvc": "0.8.70-dev
|
|
14
|
+
"@lark-codem/codem-core-darwin-arm64": "0.8.70-dev.100102800535.0.g88395a7",
|
|
15
|
+
"@lark-codem/codem-core-darwin-x64": "0.8.70-dev.100102800535.0.g88395a7",
|
|
16
|
+
"@lark-codem/codem-core-linux-arm64-gnu": "0.8.70-dev.100102800535.0.g88395a7",
|
|
17
|
+
"@lark-codem/codem-core-linux-x64-gnu": "0.8.70-dev.100102800535.0.g88395a7",
|
|
18
|
+
"@lark-codem/codem-core-win32-arm64-gnu": "0.8.70-dev.100102800535.0.g88395a7",
|
|
19
|
+
"@lark-codem/codem-core-win32-x64-msvc": "0.8.70-dev.100102800535.0.g88395a7"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=18"
|