@opengeni/config 0.22.0 → 0.22.5-canary.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/index.d.ts CHANGED
@@ -594,6 +594,8 @@ declare const SettingsSchema: z.ZodObject<{
594
594
  modalImageId: z.ZodOptional<z.ZodString>;
595
595
  modalImageRegistrySecret: z.ZodOptional<z.ZodString>;
596
596
  modalTimeoutSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
597
+ modalSandboxCpu: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
598
+ modalSandboxMemoryMiB: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
597
599
  modalTokenId: z.ZodOptional<z.ZodString>;
598
600
  modalTokenSecret: z.ZodOptional<z.ZodString>;
599
601
  modalEnvironment: z.ZodOptional<z.ZodString>;
@@ -608,8 +610,6 @@ declare const SettingsSchema: z.ZodObject<{
608
610
  sandboxTerminalEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
609
611
  streamResolutionWidth: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
610
612
  streamResolutionHeight: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
611
- computerUseEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
612
- computerUseReadOnly: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
613
613
  recordingEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
614
614
  recordingDefaultCodec: z.ZodDefault<z.ZodEnum<{
615
615
  "h264-mp4": "h264-mp4";
@@ -778,6 +778,10 @@ declare const SettingsSchema: z.ZodObject<{
778
778
  betterAuthAllowedHosts: z.ZodDefault<z.ZodString>;
779
779
  betterAuthCookieDomain: z.ZodOptional<z.ZodString>;
780
780
  betterAuthTrustedOrigins: z.ZodDefault<z.ZodString>;
781
+ managedAuthGoogleClientId: z.ZodOptional<z.ZodString>;
782
+ managedAuthGoogleClientSecret: z.ZodOptional<z.ZodString>;
783
+ managedAuthGithubClientId: z.ZodOptional<z.ZodString>;
784
+ managedAuthGithubClientSecret: z.ZodOptional<z.ZodString>;
781
785
  managedAuthSessionSetMode: z.ZodDefault<z.ZodEnum<{
782
786
  broker: "broker";
783
787
  dual: "dual";
package/dist/index.js CHANGED
@@ -651,6 +651,13 @@ var SettingsSchema = z.object({
651
651
  // larger timeout—is what lets a session outlive one finite provider box.
652
652
  // Knob: OPENGENI_MODAL_TIMEOUT_SECONDS.
653
653
  modalTimeoutSeconds: z.coerce.number().int().positive().max(86400).default(86400),
654
+ // Optional provider reservations for every new Modal sandbox. CPU is measured
655
+ // in physical cores and may be fractional; memory is measured in MiB. Leave
656
+ // both unset to preserve Modal's provider defaults. The Agents adapter stores
657
+ // the resolved values in its session state so snapshot replacement and exact
658
+ // resume cannot silently change the reservation.
659
+ modalSandboxCpu: z.coerce.number().positive().optional(),
660
+ modalSandboxMemoryMiB: z.coerce.number().int().positive().optional(),
654
661
  modalTokenId: z.string().optional(),
655
662
  modalTokenSecret: z.string().optional(),
656
663
  modalEnvironment: z.string().optional(),
@@ -688,8 +695,8 @@ var SettingsSchema = z.object({
688
695
  // cell advertises mode "interactive" — the noVNC viewer can drive mouse+keyboard
689
696
  // into :0 (x11vnc runs without -viewonly). Turn it OFF for a genuinely read-only
690
697
  // deployment: the cell reports mode "read-only" and the client disables the
691
- // "Take control" affordance. Independent of computerUseReadOnly (the AGENT
692
- // driver); this gates the HUMAN viewer plane.
698
+ // "Take control" affordance. This gates the HUMAN viewer plane; agent
699
+ // interaction is authorized through managed ComputerSession tools.
693
700
  sandboxDesktopInteractive: EnvBoolean.default(true),
694
701
  // REAL PTY terminal toggle (P5.t): gates the ttyd pty-ws plane (7681) the API
695
702
  // mints over the SAME tunnel as the desktop. Defaults ON — the interactive
@@ -703,13 +710,7 @@ var SettingsSchema = z.object({
703
710
  // down→up restart. Defaults match the proven spike geometry (1280x800).
704
711
  streamResolutionWidth: z.coerce.number().int().positive().default(1280),
705
712
  streamResolutionHeight: z.coerce.number().int().positive().default(800),
706
- // P4.3 computer-use: the agent drives the SAME :0 humans watch (xdotool/XTEST +
707
- // scrot). Gated by sandboxDesktopEnabled + a desktop-capable backend in
708
- // buildAgentCapabilities; computerUseReadOnly:false is the agent-driver default
709
- // (it must click/type — the human viewer plane is the read-only one).
710
- computerUseEnabled: EnvBoolean.default(true),
711
- computerUseReadOnly: EnvBoolean.default(false),
712
- // P4.3 recording loop: ffmpeg x11grab of :0 → mp4/webm → @opengeni/storage.
713
+ // Recording loop: ffmpeg x11grab of :0 mp4/webm → @opengeni/storage.
713
714
  // recordingMaxBytes caps the in-memory finalize buffer (≤ storage single-PUT);
714
715
  // recordingMaxSeconds is the ffmpeg -t hard ceiling (bounds a multi-day turn).
715
716
  recordingEnabled: EnvBoolean.default(true),
@@ -1065,6 +1066,10 @@ var SettingsSchema = z.object({
1065
1066
  betterAuthAllowedHosts: z.string().default(""),
1066
1067
  betterAuthCookieDomain: z.string().optional(),
1067
1068
  betterAuthTrustedOrigins: z.string().default(""),
1069
+ managedAuthGoogleClientId: z.string().optional(),
1070
+ managedAuthGoogleClientSecret: z.string().optional(),
1071
+ managedAuthGithubClientId: z.string().optional(),
1072
+ managedAuthGithubClientSecret: z.string().optional(),
1068
1073
  // Rolling browser login-slot compatibility. Repository/deployment default is
1069
1074
  // deliberately legacy; changing to broker is an operator-authorized rollout.
1070
1075
  managedAuthSessionSetMode: z.enum(["legacy", "dual", "broker"]).default("legacy"),
@@ -1915,6 +1920,8 @@ function getSettings() {
1915
1920
  modalImageId: optional("OPENGENI_MODAL_IMAGE_ID"),
1916
1921
  modalImageRegistrySecret: optional("OPENGENI_MODAL_IMAGE_REGISTRY_SECRET"),
1917
1922
  modalTimeoutSeconds: optional("OPENGENI_MODAL_TIMEOUT_SECONDS"),
1923
+ modalSandboxCpu: optional("OPENGENI_MODAL_SANDBOX_CPU"),
1924
+ modalSandboxMemoryMiB: optional("OPENGENI_MODAL_SANDBOX_MEMORY_MIB"),
1918
1925
  modalTokenId: optional("OPENGENI_MODAL_TOKEN_ID"),
1919
1926
  modalTokenSecret: optional("OPENGENI_MODAL_TOKEN_SECRET"),
1920
1927
  modalEnvironment: optional("OPENGENI_MODAL_ENVIRONMENT"),
@@ -1925,8 +1932,6 @@ function getSettings() {
1925
1932
  sandboxTerminalEnabled: optional("OPENGENI_SANDBOX_TERMINAL_ENABLED"),
1926
1933
  streamResolutionWidth: optional("OPENGENI_STREAM_RESOLUTION_WIDTH"),
1927
1934
  streamResolutionHeight: optional("OPENGENI_STREAM_RESOLUTION_HEIGHT"),
1928
- computerUseEnabled: optional("OPENGENI_COMPUTER_USE_ENABLED"),
1929
- computerUseReadOnly: optional("OPENGENI_COMPUTER_USE_READONLY"),
1930
1935
  recordingEnabled: optional("OPENGENI_RECORDING_ENABLED"),
1931
1936
  workspaceCaptureEnabled: optional("OPENGENI_WORKSPACE_CAPTURE"),
1932
1937
  recordingDefaultCodec: optional("OPENGENI_RECORDING_DEFAULT_CODEC"),
@@ -2082,6 +2087,10 @@ function getSettings() {
2082
2087
  betterAuthAllowedHosts: optional("OPENGENI_BETTER_AUTH_ALLOWED_HOSTS"),
2083
2088
  betterAuthCookieDomain: optional("OPENGENI_BETTER_AUTH_COOKIE_DOMAIN"),
2084
2089
  betterAuthTrustedOrigins: optional("OPENGENI_BETTER_AUTH_TRUSTED_ORIGINS"),
2090
+ managedAuthGoogleClientId: optional("OPENGENI_MANAGED_AUTH_GOOGLE_CLIENT_ID"),
2091
+ managedAuthGoogleClientSecret: optional("OPENGENI_MANAGED_AUTH_GOOGLE_CLIENT_SECRET"),
2092
+ managedAuthGithubClientId: optional("OPENGENI_MANAGED_AUTH_GITHUB_CLIENT_ID"),
2093
+ managedAuthGithubClientSecret: optional("OPENGENI_MANAGED_AUTH_GITHUB_CLIENT_SECRET"),
2085
2094
  managedAuthSessionSetMode: optional("OPENGENI_MANAGED_AUTH_SESSION_SET_MODE"),
2086
2095
  resendApiKey: optional("OPENGENI_RESEND_API_KEY"),
2087
2096
  emailFrom: optional("OPENGENI_EMAIL_FROM"),
@@ -2697,8 +2706,9 @@ function canonicalJson(value) {
2697
2706
  };
2698
2707
  return JSON.stringify(normalize(value));
2699
2708
  }
2700
- function definitionVersionFor(model, provider) {
2709
+ function definitionVersionFor(model, provider, options = {}) {
2701
2710
  const requestMetadata = staticRequestMetadataForDigest(provider);
2711
+ const includeWireProfile = options.includeWireProfile ?? true;
2702
2712
  const digestInput = canonicalJson({
2703
2713
  schemaVersion: model.schemaVersion,
2704
2714
  id: model.id,
@@ -2707,7 +2717,7 @@ function definitionVersionFor(model, provider) {
2707
2717
  provider: {
2708
2718
  adapterKind: provider.kind,
2709
2719
  wireApi: provider.api,
2710
- wireProfile: provider.wireProfile,
2720
+ ...includeWireProfile ? { wireProfile: provider.wireProfile } : {},
2711
2721
  baseUrl: provider.baseUrl ?? null,
2712
2722
  defaultHeaders: requestMetadata.headers,
2713
2723
  defaultQuery: requestMetadata.query
@@ -2721,6 +2731,11 @@ function definitionVersionFor(model, provider) {
2721
2731
  });
2722
2732
  return `sha256:${createHash("sha256").update("opengeni:model-definition:v1\n", "utf8").update(digestInput, "utf8").digest("hex")}`;
2723
2733
  }
2734
+ function legacyImplicitOpenAiDefinitionVersionFor(model, provider) {
2735
+ if (provider.wireProfile !== "openai") return null;
2736
+ const { definitionVersion: _definitionVersion, ...modelWithoutVersion } = model;
2737
+ return definitionVersionFor(modelWithoutVersion, provider, { includeWireProfile: false });
2738
+ }
2724
2739
  function builtinProviderId(settings) {
2725
2740
  return settings.openaiProvider === "azure" ? "azure" : "openai";
2726
2741
  }
@@ -3103,7 +3118,12 @@ function assertTurnExecutionPolicyMatchesConfigV1(settings, policy, expected) {
3103
3118
  if (!resolved) {
3104
3119
  throw new Error("Turn execution policy model is no longer configured");
3105
3120
  }
3106
- const mismatched = parsed.providerId !== resolved.provider.id || parsed.upstreamModelId !== resolved.model.upstreamModelId || parsed.wireApi !== resolved.model.api || parsed.definitionVersion !== resolved.model.definitionVersion || canonicalJson(parsed.credentialSource) !== canonicalJson(resolved.model.credentialSource) || canonicalJson(parsed.billing) !== canonicalJson(resolved.model.billing);
3121
+ const legacyImplicitOpenAiDefinitionVersion = legacyImplicitOpenAiDefinitionVersionFor(
3122
+ resolved.model,
3123
+ resolved.provider
3124
+ );
3125
+ const definitionVersionMatches = parsed.definitionVersion === resolved.model.definitionVersion || parsed.definitionVersion === legacyImplicitOpenAiDefinitionVersion;
3126
+ const mismatched = parsed.providerId !== resolved.provider.id || parsed.upstreamModelId !== resolved.model.upstreamModelId || parsed.wireApi !== resolved.model.api || !definitionVersionMatches || canonicalJson(parsed.credentialSource) !== canonicalJson(resolved.model.credentialSource) || canonicalJson(parsed.billing) !== canonicalJson(resolved.model.billing);
3107
3127
  if (mismatched) {
3108
3128
  throw new Error("Turn execution policy does not match the current provider definition");
3109
3129
  }
@@ -3891,6 +3911,37 @@ function validateSettings(settings) {
3891
3911
  );
3892
3912
  }
3893
3913
  }
3914
+ if (Boolean(settings.managedAuthGoogleClientId) !== Boolean(settings.managedAuthGoogleClientSecret)) {
3915
+ throw new Error(
3916
+ "OPENGENI_MANAGED_AUTH_GOOGLE_CLIENT_ID and OPENGENI_MANAGED_AUTH_GOOGLE_CLIENT_SECRET must be configured together"
3917
+ );
3918
+ }
3919
+ if (Boolean(settings.managedAuthGithubClientId) !== Boolean(settings.managedAuthGithubClientSecret)) {
3920
+ throw new Error(
3921
+ "OPENGENI_MANAGED_AUTH_GITHUB_CLIENT_ID and OPENGENI_MANAGED_AUTH_GITHUB_CLIENT_SECRET must be configured together"
3922
+ );
3923
+ }
3924
+ const managedSocialAuthConfigured = Boolean(
3925
+ settings.managedAuthGoogleClientId || settings.managedAuthGithubClientId
3926
+ );
3927
+ if (managedSocialAuthConfigured) {
3928
+ if (settings.productAccessMode !== "managed") {
3929
+ throw new Error(
3930
+ "Managed Google/GitHub authentication requires OPENGENI_PRODUCT_ACCESS_MODE=managed"
3931
+ );
3932
+ }
3933
+ const publicOrigin = canonicalPublicOrigin(settings.publicBaseUrl);
3934
+ if (!publicOrigin) {
3935
+ throw new Error(
3936
+ "OPENGENI_PUBLIC_BASE_URL must be a credential-free HTTP(S) origin when managed social authentication is configured"
3937
+ );
3938
+ }
3939
+ if (!publicOrigin.startsWith("https://") && !["local", "test"].includes(settings.environment)) {
3940
+ throw new Error(
3941
+ "OPENGENI_PUBLIC_BASE_URL must use https when managed social authentication is configured outside local/test"
3942
+ );
3943
+ }
3944
+ }
3894
3945
  environmentsEncryptionKeyBytes(settings);
3895
3946
  if (settings.integrationsEnabled) {
3896
3947
  if (settings.productAccessMode === "managed" && !settings.publicBaseUrl) {
@@ -3947,11 +3998,6 @@ function validateSettings(settings) {
3947
3998
  "OPENGENI_INTEGRATIONS_ENABLED=true is required when personal GitHub OAuth is enabled"
3948
3999
  );
3949
4000
  }
3950
- if (settings.productAccessMode !== "managed") {
3951
- throw new Error(
3952
- "OPENGENI_GITHUB_PERSONAL_OAUTH_ENABLED=true requires OPENGENI_PRODUCT_ACCESS_MODE=managed"
3953
- );
3954
- }
3955
4001
  if (!settings.githubPersonalOauthClientId || !settings.githubPersonalOauthClientSecret) {
3956
4002
  throw new Error(
3957
4003
  "personal GitHub OAuth requires OPENGENI_GITHUB_PERSONAL_OAUTH_CLIENT_ID and OPENGENI_GITHUB_PERSONAL_OAUTH_CLIENT_SECRET"