@opengeni/config 0.7.8 → 0.7.11
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.d.ts +2 -0
- package/dist/index.js +33 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +51 -4
package/dist/index.d.ts
CHANGED
|
@@ -125,6 +125,8 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
125
125
|
integrationsStateSecret: z.ZodOptional<z.ZodString>;
|
|
126
126
|
integrationsAllowPrivateNetworkTargets: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
127
127
|
integrationsOauthClientsJson: z.ZodDefault<z.ZodString>;
|
|
128
|
+
slackClientId: z.ZodOptional<z.ZodString>;
|
|
129
|
+
slackClientSecret: z.ZodOptional<z.ZodString>;
|
|
128
130
|
maxNestedAgentDepth: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
129
131
|
goalMaxAutoContinuations: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
130
132
|
goalNoProgressLimit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
package/dist/index.js
CHANGED
|
@@ -214,6 +214,8 @@ var SettingsSchema = z.object({
|
|
|
214
214
|
integrationsStateSecret: z.string().optional(),
|
|
215
215
|
integrationsAllowPrivateNetworkTargets: EnvBoolean.default(false),
|
|
216
216
|
integrationsOauthClientsJson: z.string().default("{}"),
|
|
217
|
+
slackClientId: z.string().optional(),
|
|
218
|
+
slackClientSecret: z.string().optional(),
|
|
217
219
|
// Undefined is meaningful: the migration boundary persists the product
|
|
218
220
|
// default of 3 when no deployment override is supplied.
|
|
219
221
|
maxNestedAgentDepth: z.coerce.number().int().nonnegative().max(MAX_NESTED_AGENT_DEPTH).optional(),
|
|
@@ -1123,6 +1125,8 @@ function getSettings() {
|
|
|
1123
1125
|
"OPENGENI_INTEGRATIONS_ALLOW_PRIVATE_NETWORK_TARGETS"
|
|
1124
1126
|
),
|
|
1125
1127
|
integrationsOauthClientsJson: optional("OPENGENI_INTEGRATIONS_OAUTH_CLIENTS_JSON"),
|
|
1128
|
+
slackClientId: optional("OPENGENI_SLACK_CLIENT_ID"),
|
|
1129
|
+
slackClientSecret: optional("OPENGENI_SLACK_CLIENT_SECRET"),
|
|
1126
1130
|
maxNestedAgentDepth: optional("OPENGENI_MAX_NESTED_AGENT_DEPTH"),
|
|
1127
1131
|
goalMaxAutoContinuations: optional("OPENGENI_GOAL_MAX_AUTO_CONTINUATIONS"),
|
|
1128
1132
|
goalNoProgressLimit: optional("OPENGENI_GOAL_NO_PROGRESS_LIMIT"),
|
|
@@ -2129,7 +2133,7 @@ function stableSandboxEnvironmentForRun(settings, workspaceEnvironment = {}, opt
|
|
|
2129
2133
|
...workspaceEnvironment
|
|
2130
2134
|
};
|
|
2131
2135
|
const descriptor = CAPABILITY_DESCRIPTORS[settings.sandboxBackend];
|
|
2132
|
-
if (settings.sandboxBackend !== "none" && settings.sandboxBackend !== "local") {
|
|
2136
|
+
if (settings.sandboxBackend !== "none" && settings.sandboxBackend !== "local" && settings.sandboxBackend !== "selfhosted") {
|
|
2133
2137
|
environment.HOME ??= descriptor.workspaceRoot;
|
|
2134
2138
|
}
|
|
2135
2139
|
const provisionedGitHelperBackend = settings.sandboxBackend !== "none" && settings.sandboxBackend !== "local" && settings.sandboxBackend !== "selfhosted";
|
|
@@ -2141,7 +2145,7 @@ function stableSandboxEnvironmentForRun(settings, workspaceEnvironment = {}, opt
|
|
|
2141
2145
|
environment.PATH = prependPathEntry(environment.PATH, environment.OPENGENI_GIT_CLI_WRAPPER_DIR);
|
|
2142
2146
|
}
|
|
2143
2147
|
if (settings.toolspaceEnabled) {
|
|
2144
|
-
environment.OPENGENI_TOOLSPACE_TOKEN_FILE ??= `${environment.HOME ?? descriptor.workspaceRoot}/.opengeni/toolspace-token`;
|
|
2148
|
+
environment.OPENGENI_TOOLSPACE_TOKEN_FILE ??= settings.sandboxBackend === "selfhosted" ? "$HOME/.opengeni/toolspace-token" : `${environment.HOME ?? descriptor.workspaceRoot}/.opengeni/toolspace-token`;
|
|
2145
2149
|
if (settings.ogtoolPackageSpec) {
|
|
2146
2150
|
environment.OPENGENI_OGTOOL_PACKAGE_SPEC ??= settings.ogtoolPackageSpec;
|
|
2147
2151
|
}
|
|
@@ -2441,6 +2445,7 @@ function positiveInt(value) {
|
|
|
2441
2445
|
function ensureBuiltInMcpServers(settings) {
|
|
2442
2446
|
const existing = settings.mcpServers.filter((server) => server.id !== "opengeni");
|
|
2443
2447
|
const firstPartyMcpUrl = firstPartyMcpServerUrl(settings);
|
|
2448
|
+
const firstPartyFilesMcpUrl = firstPartyFilesMcpServerUrl(firstPartyMcpUrl);
|
|
2444
2449
|
const firstPartyDocsMcpUrl = firstPartyDocumentsMcpServerUrl(firstPartyMcpUrl);
|
|
2445
2450
|
const hasFiles = existing.some((server) => server.id === "files");
|
|
2446
2451
|
const hasDocs = existing.some((server) => server.id === "docs");
|
|
@@ -2466,7 +2471,7 @@ function ensureBuiltInMcpServers(settings) {
|
|
|
2466
2471
|
{
|
|
2467
2472
|
id: "files",
|
|
2468
2473
|
name: "Files",
|
|
2469
|
-
url:
|
|
2474
|
+
url: firstPartyFilesMcpUrl,
|
|
2470
2475
|
allowedTools: ["files_get_download_url"],
|
|
2471
2476
|
cacheToolsList: true
|
|
2472
2477
|
}
|
|
@@ -2511,6 +2516,9 @@ function firstPartyMcpServerUrl(settings) {
|
|
|
2511
2516
|
function firstPartyDocumentsMcpServerUrl(mcpUrl) {
|
|
2512
2517
|
return `${mcpUrl.replace(/\/+$/, "")}/docs`;
|
|
2513
2518
|
}
|
|
2519
|
+
function firstPartyFilesMcpServerUrl(mcpUrl) {
|
|
2520
|
+
return `${mcpUrl.replace(/\/+$/, "")}/files`;
|
|
2521
|
+
}
|
|
2514
2522
|
function validateSettings(settings) {
|
|
2515
2523
|
temporalConnectionOptions(settings);
|
|
2516
2524
|
if (settings.toolspaceEnabled && !settings.delegationSecret) {
|
|
@@ -2559,6 +2567,28 @@ function validateSettings(settings) {
|
|
|
2559
2567
|
);
|
|
2560
2568
|
}
|
|
2561
2569
|
}
|
|
2570
|
+
if (Boolean(settings.slackClientId) !== Boolean(settings.slackClientSecret)) {
|
|
2571
|
+
throw new Error(
|
|
2572
|
+
"OPENGENI_SLACK_CLIENT_ID and OPENGENI_SLACK_CLIENT_SECRET must be configured together"
|
|
2573
|
+
);
|
|
2574
|
+
}
|
|
2575
|
+
if (settings.slackClientId) {
|
|
2576
|
+
if (!settings.publicBaseUrl) {
|
|
2577
|
+
throw new Error(
|
|
2578
|
+
"OPENGENI_PUBLIC_BASE_URL is required when the OpenGeni Slack app is configured"
|
|
2579
|
+
);
|
|
2580
|
+
}
|
|
2581
|
+
if (!settings.publicBaseUrl.startsWith("https://") && !["local", "test"].includes(settings.environment)) {
|
|
2582
|
+
throw new Error(
|
|
2583
|
+
"OPENGENI_PUBLIC_BASE_URL must use https when the OpenGeni Slack app is configured outside local/test"
|
|
2584
|
+
);
|
|
2585
|
+
}
|
|
2586
|
+
if (!settings.integrationsStateSecret) {
|
|
2587
|
+
throw new Error(
|
|
2588
|
+
"OPENGENI_INTEGRATIONS_STATE_SECRET is required when the OpenGeni Slack app is configured"
|
|
2589
|
+
);
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2562
2592
|
parseIntegrationsOauthClientsJson(settings.integrationsOauthClientsJson);
|
|
2563
2593
|
if (settings.productAccessMode === "configured" && !["local", "test"].includes(settings.environment) && !settings.delegationSecret && !settings.authRequired) {
|
|
2564
2594
|
throw new Error(
|