oasis_test 0.1.91 → 0.1.92
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/index.js +64 -29
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -141010,6 +141010,41 @@ var init_base = __esm({
|
|
|
141010
141010
|
}
|
|
141011
141011
|
});
|
|
141012
141012
|
|
|
141013
|
+
// ../connectors/src/logger.ts
|
|
141014
|
+
function ts() {
|
|
141015
|
+
return (/* @__PURE__ */ new Date()).toISOString().slice(11, 23);
|
|
141016
|
+
}
|
|
141017
|
+
function log(tag, msg, extra) {
|
|
141018
|
+
const suffix = extra ? " " + JSON.stringify(extra) : "";
|
|
141019
|
+
console.log(`[${ts()}] ${tag} ${msg}${suffix}`);
|
|
141020
|
+
}
|
|
141021
|
+
var init_logger = __esm({
|
|
141022
|
+
"../connectors/src/logger.ts"() {
|
|
141023
|
+
"use strict";
|
|
141024
|
+
}
|
|
141025
|
+
});
|
|
141026
|
+
|
|
141027
|
+
// ../connectors/src/_base/host-isolation.ts
|
|
141028
|
+
function hostIsolationEnabled(env = process.env) {
|
|
141029
|
+
const v2 = env[HOST_ISOLATION_ENV];
|
|
141030
|
+
return v2 === "1" || v2 === "true";
|
|
141031
|
+
}
|
|
141032
|
+
function logHostIdentityFallback(keys, where) {
|
|
141033
|
+
if (keys.length === 0) return;
|
|
141034
|
+
log(
|
|
141035
|
+
where,
|
|
141036
|
+
`\u26A0 \u5BBF\u4E3B\u673A\u8EAB\u4EFD\u9694\u79BB\u5DF2\u5173\u95ED\uFF08${HOST_ISOLATION_ENV} \u672A\u5F00\uFF09\uFF1A\u672A\u63A5\u901A\u7684\u8FDE\u63A5\u5668\u4E0D\u518D\u5C4F\u853D\u5BBF\u4E3B\u673A\u767B\u5F55\u6001\uFF0C\u672C\u8F6E ${keys.join(", ")} \u4FDD\u6301\u5BBF\u4E3B\u673A\u9ED8\u8BA4\u503C \u2014\u2014 agent \u8C03 gh/git \u65F6\u7528\u7684\u662F**\u8FD9\u53F0\u673A\u5668\u4E0A\u90A3\u4E2A\u8D26\u53F7**\uFF08\u6743\u9650\u901A\u5E38\u6BD4\u8FDE\u63A5\u5668\u8EAB\u4EFD\u66F4\u5927\uFF09\uFF0Ccommit \u7F72\u540D\u8D70 git config --global\u3002`
|
|
141037
|
+
);
|
|
141038
|
+
}
|
|
141039
|
+
var HOST_ISOLATION_ENV;
|
|
141040
|
+
var init_host_isolation = __esm({
|
|
141041
|
+
"../connectors/src/_base/host-isolation.ts"() {
|
|
141042
|
+
"use strict";
|
|
141043
|
+
init_logger();
|
|
141044
|
+
HOST_ISOLATION_ENV = "OASIS_CONNECTOR_HOST_ISOLATION";
|
|
141045
|
+
}
|
|
141046
|
+
});
|
|
141047
|
+
|
|
141013
141048
|
// ../connectors/src/feishu/index.ts
|
|
141014
141049
|
function parseFeishuTokenResponse(data, nowMs) {
|
|
141015
141050
|
const accessToken = String(data["access_token"] ?? "");
|
|
@@ -142025,20 +142060,6 @@ var init_registry2 = __esm({
|
|
|
142025
142060
|
}
|
|
142026
142061
|
});
|
|
142027
142062
|
|
|
142028
|
-
// ../connectors/src/logger.ts
|
|
142029
|
-
function ts() {
|
|
142030
|
-
return (/* @__PURE__ */ new Date()).toISOString().slice(11, 23);
|
|
142031
|
-
}
|
|
142032
|
-
function log(tag, msg, extra) {
|
|
142033
|
-
const suffix = extra ? " " + JSON.stringify(extra) : "";
|
|
142034
|
-
console.log(`[${ts()}] ${tag} ${msg}${suffix}`);
|
|
142035
|
-
}
|
|
142036
|
-
var init_logger = __esm({
|
|
142037
|
-
"../connectors/src/logger.ts"() {
|
|
142038
|
-
"use strict";
|
|
142039
|
-
}
|
|
142040
|
-
});
|
|
142041
|
-
|
|
142042
142063
|
// ../connectors/src/provision.ts
|
|
142043
142064
|
function collectCredentials(connector, ctx) {
|
|
142044
142065
|
const creds = {};
|
|
@@ -142090,19 +142111,24 @@ async function buildConnectorProvision(ctx) {
|
|
|
142090
142111
|
log("[provision]", `${connector.config.slug}: \u88C5\u914D\u5931\u8D25\uFF08\u8BE5\u8FDE\u63A5\u5668\u672C\u8F6E\u4E0D\u53EF\u7528\uFF09: ${String(err)}`);
|
|
142091
142112
|
}
|
|
142092
142113
|
}
|
|
142093
|
-
const
|
|
142094
|
-
|
|
142095
|
-
|
|
142096
|
-
|
|
142097
|
-
const
|
|
142098
|
-
|
|
142099
|
-
|
|
142100
|
-
|
|
142114
|
+
const pendingIsolation = [...isolationKeys].filter((k2) => !envOverrides[k2]);
|
|
142115
|
+
if (!hostIsolationEnabled()) {
|
|
142116
|
+
logHostIdentityFallback(pendingIsolation, "[provision]");
|
|
142117
|
+
} else {
|
|
142118
|
+
const isolationRoot = await (0, import_promises5.mkdtemp)((0, import_node_path8.join)((0, import_node_os4.tmpdir)(), "oasis-isolate-"));
|
|
142119
|
+
let isolationUsed = false;
|
|
142120
|
+
for (const key of isolationKeys) {
|
|
142121
|
+
if (envOverrides[key]) continue;
|
|
142122
|
+
const dir = (0, import_node_path8.join)(isolationRoot, key.toLowerCase());
|
|
142123
|
+
await (0, import_promises5.mkdir)(dir, { recursive: true, mode: 448 });
|
|
142124
|
+
envOverrides[key] = dir;
|
|
142125
|
+
isolationUsed = true;
|
|
142126
|
+
}
|
|
142127
|
+
if (!isolationUsed) await (0, import_promises5.rm)(isolationRoot, { recursive: true, force: true });
|
|
142128
|
+
else cleanups.push(async () => {
|
|
142129
|
+
await (0, import_promises5.rm)(isolationRoot, { recursive: true, force: true });
|
|
142130
|
+
});
|
|
142101
142131
|
}
|
|
142102
|
-
if (!isolationUsed) await (0, import_promises5.rm)(isolationRoot, { recursive: true, force: true });
|
|
142103
|
-
else cleanups.push(async () => {
|
|
142104
|
-
await (0, import_promises5.rm)(isolationRoot, { recursive: true, force: true });
|
|
142105
|
-
});
|
|
142106
142132
|
const cleanup = async () => {
|
|
142107
142133
|
for (const fn of cleanups) await fn().catch(() => {
|
|
142108
142134
|
});
|
|
@@ -142122,6 +142148,7 @@ var init_provision = __esm({
|
|
|
142122
142148
|
"use strict";
|
|
142123
142149
|
init_base();
|
|
142124
142150
|
init_registry2();
|
|
142151
|
+
init_host_isolation();
|
|
142125
142152
|
init_logger();
|
|
142126
142153
|
import_promises5 = require("node:fs/promises");
|
|
142127
142154
|
import_node_os4 = require("node:os");
|
|
@@ -142180,11 +142207,12 @@ async function prepareConnectorsForJob(job, deps) {
|
|
|
142180
142207
|
if (droppedWrappers > 0) log("[node-connectors]", `\u4E22\u5F03 ${droppedWrappers} \u6761\u672C\u673A\u4E0D\u53EF\u7528\u7684 wrapper \u8DEF\u5F84`);
|
|
142181
142208
|
const staleKeys = /* @__PURE__ */ new Set();
|
|
142182
142209
|
const isolationKeys = /* @__PURE__ */ new Set();
|
|
142210
|
+
const isolate = hostIsolationEnabled();
|
|
142183
142211
|
for (const connector of createAllConnectors()) {
|
|
142184
142212
|
if (injected.has(connector.config.slug)) continue;
|
|
142185
142213
|
const isolation = new Set(connector.hostCredentialIsolationEnvKeys ?? []);
|
|
142186
142214
|
for (const key of connector.injectedEnvKeys) {
|
|
142187
|
-
if (isolation.has(key)) isolationKeys.add(key);
|
|
142215
|
+
if (isolate && isolation.has(key)) isolationKeys.add(key);
|
|
142188
142216
|
else staleKeys.add(key);
|
|
142189
142217
|
}
|
|
142190
142218
|
}
|
|
@@ -142198,7 +142226,12 @@ async function prepareConnectorsForJob(job, deps) {
|
|
|
142198
142226
|
delete jobEnv[key];
|
|
142199
142227
|
dropped++;
|
|
142200
142228
|
}
|
|
142201
|
-
if (
|
|
142229
|
+
if (!isolate) {
|
|
142230
|
+
logHostIdentityFallback(
|
|
142231
|
+
createAllConnectors().filter((c) => !injected.has(c.config.slug)).flatMap((c) => [...c.hostCredentialIsolationEnvKeys ?? []]),
|
|
142232
|
+
"[node-connectors]"
|
|
142233
|
+
);
|
|
142234
|
+
} else if (isolationKeys.size > 0) {
|
|
142202
142235
|
const isolationRoot = await (0, import_promises6.mkdtemp)((0, import_node_path9.join)((0, import_node_os5.tmpdir)(), "oasis-node-isolate-"));
|
|
142203
142236
|
for (const key of isolationKeys) {
|
|
142204
142237
|
const dir = (0, import_node_path9.join)(isolationRoot, key.toLowerCase());
|
|
@@ -142285,6 +142318,7 @@ var init_prepare_job = __esm({
|
|
|
142285
142318
|
import_node_path9 = require("node:path");
|
|
142286
142319
|
init_base();
|
|
142287
142320
|
init_registry2();
|
|
142321
|
+
init_host_isolation();
|
|
142288
142322
|
init_logger();
|
|
142289
142323
|
SESSION_CREDENTIAL_RENEW_INTERVAL_MS = 30 * 6e4;
|
|
142290
142324
|
}
|
|
@@ -146890,6 +146924,7 @@ var init_src5 = __esm({
|
|
|
146890
146924
|
init_base();
|
|
146891
146925
|
init_base();
|
|
146892
146926
|
init_base();
|
|
146927
|
+
init_host_isolation();
|
|
146893
146928
|
init_feishu();
|
|
146894
146929
|
init_scopes();
|
|
146895
146930
|
init_oauth();
|
|
@@ -187089,7 +187124,7 @@ function syncRuntimeAssets(candidateRoots, binDir) {
|
|
|
187089
187124
|
}
|
|
187090
187125
|
|
|
187091
187126
|
// src/index.ts
|
|
187092
|
-
var PKG_VERSION = true ? "0.1.
|
|
187127
|
+
var PKG_VERSION = true ? "0.1.92" : "dev";
|
|
187093
187128
|
var OASIS_DIR = path29.join(os9.homedir(), ".oasis");
|
|
187094
187129
|
var CONFIG_FILE = path29.join(OASIS_DIR, "node-config.json");
|
|
187095
187130
|
var PID_FILE = path29.join(OASIS_DIR, "node.pid");
|