@opengeni/config 0.5.1 → 0.6.2

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
@@ -33,6 +33,7 @@ declare const AGENT_INSTRUCTIONS_CORE_PLACEHOLDER = "{{core}}";
33
33
  declare const DEFAULT_AGENT_INSTRUCTIONS: string;
34
34
  declare const McpServerConnectionRefSchema: z.ZodObject<{
35
35
  connectionId: z.ZodOptional<z.ZodString>;
36
+ provider: z.ZodOptional<z.ZodString>;
36
37
  providerDomain: z.ZodString;
37
38
  kind: z.ZodOptional<z.ZodEnum<{
38
39
  oauth2: "oauth2";
@@ -42,6 +43,10 @@ declare const McpServerConnectionRefSchema: z.ZodObject<{
42
43
  }>>;
43
44
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
45
  resource: z.ZodOptional<z.ZodString>;
46
+ selectedResources: z.ZodOptional<z.ZodArray<z.ZodObject<{
47
+ id: z.ZodString;
48
+ kind: z.ZodLiteral<"repository">;
49
+ }, z.core.$strict>>>;
45
50
  subjectScope: z.ZodOptional<z.ZodEnum<{
46
51
  workspace: "workspace";
47
52
  subject: "subject";
@@ -63,6 +68,12 @@ declare const SettingsSchema: z.ZodObject<{
63
68
  temporalHost: z.ZodDefault<z.ZodString>;
64
69
  temporalNamespace: z.ZodDefault<z.ZodString>;
65
70
  temporalTaskQueue: z.ZodDefault<z.ZodString>;
71
+ temporalTlsEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
72
+ temporalApiKey: z.ZodOptional<z.ZodString>;
73
+ temporalTlsServerName: z.ZodOptional<z.ZodString>;
74
+ temporalTlsRootCaCertificateBase64: z.ZodOptional<z.ZodString>;
75
+ temporalTlsClientCertificateBase64: z.ZodOptional<z.ZodString>;
76
+ temporalTlsClientPrivateKeyBase64: z.ZodOptional<z.ZodString>;
66
77
  startupDependencyRetryAttempts: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
67
78
  startupDependencyRetryInitialDelayMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
68
79
  startupDependencyRetryMaxDelayMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -98,6 +109,7 @@ declare const SettingsSchema: z.ZodObject<{
98
109
  streamControlEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
99
110
  toolspaceEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
100
111
  toolspaceMaxCallsPerTurn: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
112
+ ogtoolPackageSpec: z.ZodOptional<z.ZodString>;
101
113
  environmentsEncryptionKey: z.ZodOptional<z.ZodString>;
102
114
  integrationsEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
103
115
  integrationsStateSecret: z.ZodOptional<z.ZodString>;
@@ -111,6 +123,7 @@ declare const SettingsSchema: z.ZodObject<{
111
123
  contextCompactionThresholdRatio: z.ZodPipe<z.ZodDefault<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number, number>>;
112
124
  contextReservedOutputTokens: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
113
125
  contextAutoCompactThresholdTokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
126
+ modelToolOutputTruncationTokens: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
114
127
  authRequired: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
115
128
  accessKey: z.ZodOptional<z.ZodString>;
116
129
  authAllowHealth: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
@@ -134,7 +147,6 @@ declare const SettingsSchema: z.ZodObject<{
134
147
  codexProductSku: z.ZodOptional<z.ZodString>;
135
148
  codexToolSearchEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
136
149
  codexCredentialLeasingEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
137
- codexRotationNearExhaustionPct: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
138
150
  openaiReasoningEffort: z.ZodDefault<z.ZodEnum<{
139
151
  none: "none";
140
152
  minimal: "minimal";
@@ -345,6 +357,7 @@ declare const SettingsSchema: z.ZodObject<{
345
357
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
346
358
  connectionRef: z.ZodOptional<z.ZodObject<{
347
359
  connectionId: z.ZodOptional<z.ZodString>;
360
+ provider: z.ZodOptional<z.ZodString>;
348
361
  providerDomain: z.ZodString;
349
362
  kind: z.ZodOptional<z.ZodEnum<{
350
363
  oauth2: "oauth2";
@@ -354,6 +367,10 @@ declare const SettingsSchema: z.ZodObject<{
354
367
  }>>;
355
368
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
356
369
  resource: z.ZodOptional<z.ZodString>;
370
+ selectedResources: z.ZodOptional<z.ZodArray<z.ZodObject<{
371
+ id: z.ZodString;
372
+ kind: z.ZodLiteral<"repository">;
373
+ }, z.core.$strict>>>;
357
374
  subjectScope: z.ZodOptional<z.ZodEnum<{
358
375
  workspace: "workspace";
359
376
  subject: "subject";
@@ -363,6 +380,19 @@ declare const SettingsSchema: z.ZodObject<{
363
380
  }, z.core.$strip>;
364
381
  type Settings = z.infer<typeof SettingsSchema>;
365
382
  type McpServerConfig = Settings["mcpServers"][number];
383
+ type TemporalTlsConnectionConfig = {
384
+ serverNameOverride?: string;
385
+ serverRootCACertificate?: Uint8Array;
386
+ clientCertPair?: {
387
+ crt: Uint8Array;
388
+ key: Uint8Array;
389
+ };
390
+ };
391
+ type TemporalConnectionOptions = {
392
+ address: string;
393
+ tls?: true | TemporalTlsConnectionConfig;
394
+ apiKey?: string;
395
+ };
366
396
  type ModelPricing = {
367
397
  inputMicrosPerMillionTokens: number;
368
398
  cachedInputMicrosPerMillionTokens?: number | undefined;
@@ -423,6 +453,7 @@ declare const RegistryProviderSchema: z.ZodObject<{
423
453
  contextWindowTokens: z.ZodOptional<z.ZodNumber>;
424
454
  effectiveContextWindowTokens: z.ZodOptional<z.ZodNumber>;
425
455
  autoCompactTokenLimit: z.ZodOptional<z.ZodNumber>;
456
+ toolOutputTruncationTokens: z.ZodOptional<z.ZodNumber>;
426
457
  reasoningEffort: z.ZodOptional<z.ZodBoolean>;
427
458
  hostedWebSearch: z.ZodOptional<z.ZodBoolean>;
428
459
  pricing: z.ZodOptional<z.ZodObject<{
@@ -472,6 +503,7 @@ interface ConfiguredModel {
472
503
  contextWindowTokens?: number | undefined;
473
504
  effectiveContextWindowTokens?: number | undefined;
474
505
  autoCompactTokenLimit?: number | undefined;
506
+ toolOutputTruncationTokens?: number | undefined;
475
507
  reasoningEffort: boolean;
476
508
  hostedWebSearch: boolean;
477
509
  }
@@ -579,7 +611,7 @@ declare function contextInputBudgetTokens(settings: Pick<Settings, "contextWindo
579
611
  * metadata is authoritative when present; deployment defaults remain the
580
612
  * fallback for models that do not declare their own limits.
581
613
  */
582
- declare function settingsWithResolvedModelContext(settings: Settings, model: Pick<ConfiguredModel, "contextWindowTokens" | "effectiveContextWindowTokens" | "autoCompactTokenLimit">): Settings;
614
+ declare function settingsWithResolvedModelContext(settings: Settings, model: Pick<ConfiguredModel, "contextWindowTokens" | "effectiveContextWindowTokens" | "autoCompactTokenLimit" | "toolOutputTruncationTokens">): Settings;
583
615
  declare function configuredStaticUsageLimits(settings: Settings): StaticUsageLimitsConfig;
584
616
  declare function configuredEntitlements(settings: Settings): EntitlementsConfig;
585
617
  declare function calculateModelUsageCostMicros(settings: Settings, model: string, usage: ModelUsageInput): number;
@@ -590,6 +622,13 @@ declare function configuredAllowedReasoningEfforts(settings: Settings): Array<z.
590
622
  * Throws naming only the env var, never echoing its value.
591
623
  */
592
624
  declare function environmentsEncryptionKeyBytes(settings: Settings): Uint8Array | null;
625
+ /**
626
+ * Build one structurally compatible connection policy for both
627
+ * `@temporalio/client` and `@temporalio/worker`. An API key or any custom TLS
628
+ * material enables TLS automatically; the explicit flag covers server-auth TLS
629
+ * without credentials. Secret values are never included in validation errors.
630
+ */
631
+ declare function temporalConnectionOptions(settings: Settings): TemporalConnectionOptions;
593
632
  /**
594
633
  * The connection `search_path` for OpenGeni's db handles + the managed-auth pool
595
634
  * (Step I, §7.8 runtime half). Returns `undefined` when `dbSchema` is unset
@@ -597,7 +636,7 @@ declare function environmentsEncryptionKeyBytes(settings: Settings): Uint8Array
597
636
  * default (`public`) applies — byte-for-byte today's behavior. When `dbSchema`
598
637
  * is set (embedded), returns `"<schema>,opengeni_private,public"` — `public`
599
638
  * stays LAST so `gen_random_uuid()` (pgcrypto) and the `vector` type still
600
- * resolve (the SPIKE-1 live footgun). `opengeni_private` is on the path so the
639
+ * resolve (the schema-isolation contract live footgun). `opengeni_private` is on the path so the
601
640
  * RLS GUC-reader helpers resolve when referenced unqualified.
602
641
  */
603
642
  declare function dbSearchPath(settings: Pick<Settings, "dbSchema">): string | undefined;
@@ -733,7 +772,7 @@ declare function parseStaticEntitlementsJson(raw: string): EntitlementsConfig;
733
772
  declare function firstPartyMcpBaseUrl(settings: Settings): string;
734
773
  declare function firstPartyMcpWorkspaceUrl(settings: Settings, workspaceId: string): string;
735
774
  /**
736
- * Resolve the secret used to sign/verify scoped stream tokens (master-spine
775
+ * Resolve the secret used to sign/verify scoped stream tokens (sandbox contract
737
776
  * §C.3). Falls back to `delegationSecret` (the same HMAC envelope family —
738
777
  * `ogs_` vs `ogd_` prefix) so a deployment that already carries a delegation
739
778
  * secret does not need a second one. Returns undefined when neither is set,
@@ -742,13 +781,13 @@ declare function firstPartyMcpWorkspaceUrl(settings: Settings, workspaceId: stri
742
781
  declare function resolveStreamTokenSecret(settings: Settings): string | undefined;
743
782
  /**
744
783
  * True iff the desktop pixel plane must GRACEFULLY DEGRADE because desktop is
745
- * enabled but no stream-token secret is resolvable (I8/OD-8). When true,
784
+ * enabled but no stream-token secret is resolvable (stream-token availability contract). When true,
746
785
  * negotiateCapabilities forces DesktopStream.transport:null.
747
786
  */
748
787
  declare function streamTokenDegraded(settings: Settings): boolean;
749
788
  /**
750
789
  * Resolve the secret the control plane signs the enrollment bearer credential
751
- * with (the `oge_` envelope the agent presents back — M5/dossier §10.2). Falls
790
+ * with (the `oge_` envelope the agent presents back — M5). Falls
752
791
  * back to `delegationSecret` (the same HMAC envelope family) so a deployment that
753
792
  * already carries a delegation secret needs no second one. Returns undefined when
754
793
  * neither is set; when selfhosted is enabled but this is undefined, the poll route
@@ -758,7 +797,7 @@ declare function streamTokenDegraded(settings: Settings): boolean;
758
797
  declare function resolveEnrollmentSigningSecret(settings: Settings): string | undefined;
759
798
  /**
760
799
  * Resolve the HMAC secret the control plane signs the agent's relay PRODUCER token
761
- * with (the `ogr_` envelope; M8b/dossier §10.5). The RELAY verifies the producer
800
+ * with (the `ogr_` envelope; M8b). The RELAY verifies the producer
762
801
  * token with the SAME secret (injected into the relay via env). Prefers an explicit
763
802
  * `selfhostedRelayTokenSecret`, then the `streamTokenSecret` (the relay already
764
803
  * needs that one to verify the viewer's `ogs_` token, so a single secret can back
@@ -796,4 +835,4 @@ interface NatsControlPlaneAuth {
796
835
  }
797
836
  declare function resolveNatsControlPlaneAuth(settings: Settings): NatsControlPlaneAuth | null;
798
837
 
799
- export { AGENT_INSTRUCTIONS_CORE_PLACEHOLDER, type ConfiguredModel, DEFAULT_AGENT_INSTRUCTIONS, type EntitlementsConfig, type IntegrationOAuthClientConfig, IntegrationOAuthClientConfigSchema, type McpServerConfig, type McpServerConnectionRef, McpServerConnectionRefSchema, type ModelPricing, ModelProviderApi, type ModelUsageInput, type NatsCalloutConfig, type NatsControlPlaneAuth, type RegistryProvider, RegistryProviderKind, type ResolvedModelProvider, SANDBOX_REQUIRED_ENV, type SandboxRequiredEnv, type Settings, type StartupRetryOptions, type StaticUsageLimitsConfig, applyGitAuthPointerEnvironment, builtinProviderId, calculateModelUsageCostMicros, collectGitIdentityEnvironment, collectSandboxEnvironment, configuredAllowedModels, configuredAllowedReasoningEfforts, configuredEntitlements, configuredModelPricing, configuredModels, configuredProviders, configuredStaticUsageLimits, contextInputBudgetTokens, dbSearchPath, defaultModelPricing, effectiveModalIdleTimeoutSeconds, environmentsEncryptionKeyBytes, firstPartyMcpBaseUrl, firstPartyMcpWorkspaceUrl, getSettings, hasGitCredentialRepositorySelection, hasGitHubRepositorySelection, parseExposedPorts, parseIntegrationsOauthClientsJson, parseMcpServers, parseModelPricingJson, parseModelProvidersJson, parseSandboxWarmRateJson, parseStaticEntitlementsJson, parseStaticUsageLimitsJson, policyProviderIdForModel, requiredSandboxEnvForBackend, resolveEnrollmentSigningSecret, resolveModelProvider, resolveNatsCalloutConfig, resolveNatsControlPlaneAuth, resolveProviderApiKey, resolveRelayTokenSecret, resolveStreamTokenSecret, retryStartupDependency, sandboxEnvironmentVariableNames, sandboxLifecycleHookIds, sandboxPreparationProfiles, sandboxWarmRateMicrosPerSecond, settingsWithResolvedModelContext, stableSandboxEnvironmentForRun, startupRetryOptions, streamTokenDegraded };
838
+ export { AGENT_INSTRUCTIONS_CORE_PLACEHOLDER, type ConfiguredModel, DEFAULT_AGENT_INSTRUCTIONS, type EntitlementsConfig, type IntegrationOAuthClientConfig, IntegrationOAuthClientConfigSchema, type McpServerConfig, type McpServerConnectionRef, McpServerConnectionRefSchema, type ModelPricing, ModelProviderApi, type ModelUsageInput, type NatsCalloutConfig, type NatsControlPlaneAuth, type RegistryProvider, RegistryProviderKind, type ResolvedModelProvider, SANDBOX_REQUIRED_ENV, type SandboxRequiredEnv, type Settings, type StartupRetryOptions, type StaticUsageLimitsConfig, type TemporalConnectionOptions, type TemporalTlsConnectionConfig, applyGitAuthPointerEnvironment, builtinProviderId, calculateModelUsageCostMicros, collectGitIdentityEnvironment, collectSandboxEnvironment, configuredAllowedModels, configuredAllowedReasoningEfforts, configuredEntitlements, configuredModelPricing, configuredModels, configuredProviders, configuredStaticUsageLimits, contextInputBudgetTokens, dbSearchPath, defaultModelPricing, effectiveModalIdleTimeoutSeconds, environmentsEncryptionKeyBytes, firstPartyMcpBaseUrl, firstPartyMcpWorkspaceUrl, getSettings, hasGitCredentialRepositorySelection, hasGitHubRepositorySelection, parseExposedPorts, parseIntegrationsOauthClientsJson, parseMcpServers, parseModelPricingJson, parseModelProvidersJson, parseSandboxWarmRateJson, parseStaticEntitlementsJson, parseStaticUsageLimitsJson, policyProviderIdForModel, requiredSandboxEnvForBackend, resolveEnrollmentSigningSecret, resolveModelProvider, resolveNatsCalloutConfig, resolveNatsControlPlaneAuth, resolveProviderApiKey, resolveRelayTokenSecret, resolveStreamTokenSecret, retryStartupDependency, sandboxEnvironmentVariableNames, sandboxLifecycleHookIds, sandboxPreparationProfiles, sandboxWarmRateMicrosPerSecond, settingsWithResolvedModelContext, stableSandboxEnvironmentForRun, startupRetryOptions, streamTokenDegraded, temporalConnectionOptions };
package/dist/index.js CHANGED
@@ -63,7 +63,7 @@ var DEFAULT_AGENT_INSTRUCTIONS = [
63
63
  "You are an OpenGeni workspace agent.",
64
64
  "Follow the user's task and any enabled pack or skill instructions for the current role.",
65
65
  "Work inside the sandbox workspace and use filesystem and shell tools when useful.",
66
- "Repository resources are mounted under repos/<owner>/<repo>.",
66
+ "Repository resources are mounted under repos/<host>/<owner>/<repo> unless the session specifies another collision-free mount path.",
67
67
  "File resources are mounted under files/<file-id>/ unless the session specifies another mount path.",
68
68
  "Attached files are mounted read-only; copy them before modifying.",
69
69
  "Bundled skills are under .agents/ and can include infrastructure, marketing, or other role-specific guidance.",
@@ -74,13 +74,50 @@ var DEFAULT_AGENT_INSTRUCTIONS = [
74
74
  AGENT_INSTRUCTIONS_CORE_PLACEHOLDER
75
75
  ].join(" ");
76
76
  var McpServerConnectionRefSchema = z.object({
77
- connectionId: z.string().uuid().optional(),
77
+ // Standalone ids are UUIDs; embedded hosts may use any stable opaque id.
78
+ connectionId: z.string().min(1).optional(),
79
+ provider: z.string().min(1).max(128).optional(),
78
80
  providerDomain: z.string().min(1),
79
81
  kind: z.enum(["oauth2", "api_key", "app_install", "delegated"]).optional(),
80
82
  scopes: z.array(z.string().min(1)).optional(),
81
83
  resource: z.string().min(1).optional(),
84
+ selectedResources: z.array(
85
+ z.object({
86
+ id: z.string().min(1).max(512),
87
+ kind: z.literal("repository")
88
+ }).strict()
89
+ ).min(1).max(256).superRefine((resources, context) => {
90
+ const seen = /* @__PURE__ */ new Set();
91
+ for (const [index, resource] of resources.entries()) {
92
+ const key = `${resource.kind}\0${resource.id}`;
93
+ if (seen.has(key)) {
94
+ context.addIssue({
95
+ code: "custom",
96
+ message: "selectedResources must not contain duplicates",
97
+ path: [index]
98
+ });
99
+ }
100
+ seen.add(key);
101
+ }
102
+ }).optional(),
82
103
  subjectScope: z.enum(["workspace", "subject"]).optional()
83
- }).strict();
104
+ }).strict().superRefine((reference, context) => {
105
+ if (!reference.selectedResources) return;
106
+ if (!reference.connectionId) {
107
+ context.addIssue({
108
+ code: "custom",
109
+ message: "selectedResources requires connectionId",
110
+ path: ["connectionId"]
111
+ });
112
+ }
113
+ if (!reference.provider) {
114
+ context.addIssue({
115
+ code: "custom",
116
+ message: "selectedResources requires provider",
117
+ path: ["provider"]
118
+ });
119
+ }
120
+ });
84
121
  var SettingsSchema = z.object({
85
122
  serviceName: z.string().default("opengeni"),
86
123
  environment: z.string().default("local"),
@@ -93,7 +130,7 @@ var SettingsSchema = z.object({
93
130
  // topology. Default "" → standalone: no search_path scoping, server default
94
131
  // (`public`). When set (e.g. "opengeni"), the db handle + the managed-auth
95
132
  // pool send `search_path = "<dbSchema>","opengeni_private","public"` so every
96
- // query resolves into the dedicated schema with NO query rewrite (SPIKE-1 F1).
133
+ // query resolves into the dedicated schema with NO query rewrite (schema-isolation contract F1).
97
134
  dbSchema: z.string().default(""),
98
135
  // Step I (§7.7). RLS posture. "force" (default) = today's FORCE-RLS via the
99
136
  // non-owner `opengeni_app` role. "scoped" = the embedded owner-role path (the
@@ -103,6 +140,12 @@ var SettingsSchema = z.object({
103
140
  temporalHost: z.string().default("127.0.0.1:7233"),
104
141
  temporalNamespace: z.string().default("default"),
105
142
  temporalTaskQueue: z.string().default("opengeni-runs-ts"),
143
+ temporalTlsEnabled: EnvBoolean.default(false),
144
+ temporalApiKey: z.string().optional(),
145
+ temporalTlsServerName: z.string().optional(),
146
+ temporalTlsRootCaCertificateBase64: z.string().optional(),
147
+ temporalTlsClientCertificateBase64: z.string().optional(),
148
+ temporalTlsClientPrivateKeyBase64: z.string().optional(),
106
149
  startupDependencyRetryAttempts: z.coerce.number().int().positive().default(30),
107
150
  startupDependencyRetryInitialDelayMs: z.coerce.number().int().positive().default(1e3),
108
151
  startupDependencyRetryMaxDelayMs: z.coerce.number().int().positive().default(5e3),
@@ -122,11 +165,11 @@ var SettingsSchema = z.object({
122
165
  staticEntitlementsJson: z.string().default("{}"),
123
166
  staticUsageLimitsJson: z.string().default("{}"),
124
167
  delegationSecret: z.string().optional(),
125
- // Sandbox-surfacing scoped stream-token HMAC secret (master-spine §C.3 / I8).
168
+ // sandbox workspace scoped stream-token HMAC secret (sandbox contract §C.3 / stream-token availability contract).
126
169
  // When unset, the API falls back to `delegationSecret` (the same HMAC envelope
127
170
  // family, `ogs_` vs `ogd_` prefix). REQUIRED-WHEN-DESKTOP, but the absence of
128
171
  // BOTH while sandboxDesktopEnabled=true is a GRACEFUL DEGRADE (DesktopStream
129
- // transport:null + a loud boot warning), NOT a hard boot-fail (I8/OD-8).
172
+ // transport:null + a loud boot warning), NOT a hard boot-fail (stream-token availability contract).
130
173
  streamTokenSecret: z.string().optional(),
131
174
  // The desktop input plane (raw stream:control writes) is OFF in v1: even a
132
175
  // holder of stream:control gets 403 until this flips. Keeps stream:control a
@@ -134,6 +177,10 @@ var SettingsSchema = z.object({
134
177
  streamControlEnabled: EnvBoolean.default(false),
135
178
  toolspaceEnabled: EnvBoolean.default(false),
136
179
  toolspaceMaxCallsPerTurn: z.coerce.number().int().positive().default(200),
180
+ // Optional release-coherent bootstrap hint for custom rigs/connected machines
181
+ // that do not carry the stock-image ogtool binary. Exact stable versions only:
182
+ // the agent must never guess a tag or silently install `latest`.
183
+ ogtoolPackageSpec: z.string().regex(/^@opengeni\/ogtool@(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/u).optional(),
137
184
  environmentsEncryptionKey: z.string().optional(),
138
185
  integrationsEnabled: EnvBoolean.default(false),
139
186
  integrationsStateSecret: z.string().optional(),
@@ -178,6 +225,10 @@ var SettingsSchema = z.object({
178
225
  // Model-catalog auto-compact limit. When present it is clamped to
179
226
  // 90% of the raw window, matching Codex core's auto_compact_token_limit().
180
227
  contextAutoCompactThresholdTokens: z.coerce.number().int().positive().optional(),
228
+ // Provider-neutral fallback for canonical model-facing tool-result text.
229
+ // The current stable Codex catalog policy is 10k tokens; the truncator adds
230
+ // Codex's 1.2x JSON serialization allowance when applying it.
231
+ modelToolOutputTruncationTokens: z.coerce.number().int().positive().default(1e4),
181
232
  authRequired: EnvBoolean.default(false),
182
233
  accessKey: z.string().optional(),
183
234
  authAllowHealth: EnvBoolean.default(true),
@@ -213,15 +264,11 @@ var SettingsSchema = z.object({
213
264
  // tool that BM25-discloses only the matching connectors. Default OFF — a codex
214
265
  // turn is byte-for-byte unchanged until enabled. OPENGENI_CODEX_TOOL_SEARCH_ENABLED
215
266
  codexToolSearchEnabled: EnvBoolean.default(false),
216
- // OPE-21 atomic, workspace-local credential allocation. Default OFF is a
267
+ // credential allocator atomic, workspace-local credential allocation. Default OFF is a
217
268
  // deliberate rolling-deploy fence: migrate + roll every worker first, then
218
269
  // enable. Turning it off restores the legacy sticky selector without a schema
219
270
  // rollback; the additive lease table/cursor columns become inert.
220
271
  codexCredentialLeasingEnabled: EnvBoolean.default(false),
221
- // Multi-account P3 (auto-rotation): an account is "near exhaustion" — ineligible to be
222
- // rotated TO — when EITHER usage window (5h/weekly) is at/over this percent. Default 90 to
223
- // match the UI danger flip (UsageBar danger at pct >= 90). OPENGENI_CODEX_ROTATION_NEAR_EXHAUSTION_PCT.
224
- codexRotationNearExhaustionPct: z.coerce.number().int().min(1).max(100).default(90),
225
272
  openaiReasoningEffort: ReasoningEffort.default("low"),
226
273
  openaiAllowedReasoningEfforts: z.string().default("low,medium,high,xhigh"),
227
274
  openaiResponsesTransport: z.enum(["http", "websocket"]).default("http"),
@@ -360,7 +407,7 @@ var SettingsSchema = z.object({
360
407
  // recordingMaxSeconds is the ffmpeg -t hard ceiling (bounds a multi-day turn).
361
408
  recordingEnabled: EnvBoolean.default(true),
362
409
  recordingDefaultCodec: z.enum(["h264-mp4", "vp9-webm"]).default("h264-mp4"),
363
- // Workbench v2 turn-end workspace capture (dossier §10.1). When on, the turn
410
+ // Workbench v2 turn-end workspace capture. When on, the turn
364
411
  // activity probes the box's changed files off the live box at turn end and
365
412
  // persists a capture revision (blobs in @opengeni/storage) so the workbench
366
413
  // paints cold/offline sessions with zero machine round-trips. Best-effort and
@@ -442,7 +489,7 @@ var SettingsSchema = z.object({
442
489
  // 404 (invisible — the surface does not exist for this deployment) and the
443
490
  // selfhosted backend is inert; boot is unaffected. EnvBoolean (NOT
444
491
  // z.coerce.boolean(), which coerces "false" -> true). Flipped per-environment via
445
- // the deploy-staging IaC secret/configmap pattern (dossier §17/§25.1).
492
+ // the deploy-staging IaC secret/configmap pattern.
446
493
  sandboxSelfhostedEnabled: EnvBoolean.default(false),
447
494
  // Gates the op-stream (streaming exec) transport to Connected Machines. The
448
495
  // runner must ALSO advertise Capabilities.op_stream; default off, and legacy
@@ -462,7 +509,7 @@ var SettingsSchema = z.object({
462
509
  selfhostedNatsUrl: z.string().optional(),
463
510
  selfhostedRelayUrl: z.string().optional(),
464
511
  // The HMAC secret the control plane signs the agent's relay PRODUCER token with
465
- // (the `ogr_` envelope threaded into EnrollmentCredentials.relayToken; M8b/dossier
512
+ // (the `ogr_` envelope threaded into EnrollmentCredentials.relayToken; M8b/design
466
513
  // §10.5). The relay verifies the producer token with the SAME secret. Optional:
467
514
  // when ABSENT the poll returns an empty relayToken (graceful degrade — the stream
468
515
  // plane is simply unavailable until configured). Falls back to streamTokenSecret /
@@ -472,7 +519,7 @@ var SettingsSchema = z.object({
472
519
  // The minisign PUBLIC key the agent pins for self-update verification (handed to
473
520
  // the agent in EnrollmentCredentials; the SECRET key lives only in CI).
474
521
  agentUpdatePublicKey: z.string().optional(),
475
- // --- NATS auth-callout tenancy boundary (bring-your-own-compute M-AUTH; dossier
522
+ // --- NATS auth-callout tenancy boundary (bring-your-own-compute M-AUTH; design
476
523
  // §10.1 NATS Accounts per workspace + §17 the isolation smoke) -------------
477
524
  // nats-server is configured with AUTH CALLOUT: an external agent connects
478
525
  // presenting its `oge_` enrollment bearer as the connect auth-token; the server
@@ -675,6 +722,9 @@ var RegistryModelSchema = z.object({
675
722
  contextWindowTokens: z.number().int().positive().optional(),
676
723
  effectiveContextWindowTokens: z.number().int().positive().optional(),
677
724
  autoCompactTokenLimit: z.number().int().positive().optional(),
725
+ // Canonical model-facing function/tool-result policy. The runtime applies
726
+ // the same 1.2x serialization allowance as Codex when materializing output.
727
+ toolOutputTruncationTokens: z.number().int().positive().optional(),
678
728
  reasoningEffort: z.boolean().optional(),
679
729
  // model accepts a reasoning-effort control
680
730
  hostedWebSearch: z.boolean().optional(),
@@ -831,6 +881,14 @@ function getSettings() {
831
881
  temporalHost: optional("OPENGENI_TEMPORAL_HOST"),
832
882
  temporalNamespace: optional("OPENGENI_TEMPORAL_NAMESPACE"),
833
883
  temporalTaskQueue: optional("OPENGENI_TEMPORAL_TASK_QUEUE"),
884
+ temporalTlsEnabled: optional("OPENGENI_TEMPORAL_TLS_ENABLED"),
885
+ temporalApiKey: optional("OPENGENI_TEMPORAL_API_KEY"),
886
+ temporalTlsServerName: optional("OPENGENI_TEMPORAL_TLS_SERVER_NAME"),
887
+ temporalTlsRootCaCertificateBase64: optional(
888
+ "OPENGENI_TEMPORAL_TLS_ROOT_CA_CERTIFICATE_BASE64"
889
+ ),
890
+ temporalTlsClientCertificateBase64: optional("OPENGENI_TEMPORAL_TLS_CLIENT_CERTIFICATE_BASE64"),
891
+ temporalTlsClientPrivateKeyBase64: optional("OPENGENI_TEMPORAL_TLS_CLIENT_PRIVATE_KEY_BASE64"),
834
892
  startupDependencyRetryAttempts: optional("OPENGENI_STARTUP_DEPENDENCY_RETRY_ATTEMPTS"),
835
893
  startupDependencyRetryInitialDelayMs: optional(
836
894
  "OPENGENI_STARTUP_DEPENDENCY_RETRY_INITIAL_DELAY_MS"
@@ -853,6 +911,7 @@ function getSettings() {
853
911
  streamControlEnabled: optional("OPENGENI_STREAM_CONTROL_ENABLED"),
854
912
  toolspaceEnabled: optional("OPENGENI_TOOLSPACE_ENABLED"),
855
913
  toolspaceMaxCallsPerTurn: optional("OPENGENI_TOOLSPACE_MAX_CALLS_PER_TURN"),
914
+ ogtoolPackageSpec: optional("OPENGENI_OGTOOL_PACKAGE_SPEC"),
856
915
  environmentsEncryptionKey: optional("OPENGENI_ENVIRONMENTS_ENCRYPTION_KEY"),
857
916
  integrationsEnabled: optional("OPENGENI_INTEGRATIONS_ENABLED"),
858
917
  integrationsStateSecret: optional("OPENGENI_INTEGRATIONS_STATE_SECRET"),
@@ -868,6 +927,7 @@ function getSettings() {
868
927
  contextCompactionThresholdRatio: optional("OPENGENI_COMPACTION_THRESHOLD_RATIO"),
869
928
  contextReservedOutputTokens: optional("OPENGENI_CONTEXT_RESERVED_OUTPUT_TOKENS"),
870
929
  contextAutoCompactThresholdTokens: optional("OPENGENI_CONTEXT_AUTO_COMPACT_THRESHOLD_TOKENS"),
930
+ modelToolOutputTruncationTokens: optional("OPENGENI_MODEL_TOOL_OUTPUT_TRUNCATION_TOKENS"),
871
931
  authRequired: optional("OPENGENI_AUTH_REQUIRED"),
872
932
  accessKey: optional("OPENGENI_ACCESS_KEY"),
873
933
  authAllowHealth: optional("OPENGENI_AUTH_ALLOW_HEALTH"),
@@ -888,7 +948,6 @@ function getSettings() {
888
948
  codexToolSearchEnabled: optional("OPENGENI_CODEX_TOOL_SEARCH_ENABLED"),
889
949
  codexCredentialLeasingEnabled: optional("OPENGENI_CODEX_CREDENTIAL_LEASING_ENABLED"),
890
950
  codexProductSku: optional("OPENGENI_CODEX_PRODUCT_SKU"),
891
- codexRotationNearExhaustionPct: optional("OPENGENI_CODEX_ROTATION_NEAR_EXHAUSTION_PCT"),
892
951
  openaiReasoningEffort: optional("OPENGENI_OPENAI_REASONING_EFFORT"),
893
952
  openaiAllowedReasoningEfforts: optional("OPENGENI_OPENAI_ALLOWED_REASONING_EFFORTS"),
894
953
  openaiResponsesTransport: optional("OPENGENI_OPENAI_RESPONSES_TRANSPORT"),
@@ -1139,6 +1198,7 @@ function configuredModels(settings) {
1139
1198
  providerLabel: builtinLabel,
1140
1199
  api: "responses",
1141
1200
  contextWindowTokens: settings.contextWindowTokens,
1201
+ toolOutputTruncationTokens: settings.modelToolOutputTruncationTokens,
1142
1202
  reasoningEffort: true,
1143
1203
  hostedWebSearch: settings.webSearchEnabled
1144
1204
  }));
@@ -1154,6 +1214,7 @@ function configuredModels(settings) {
1154
1214
  ...model.contextWindowTokens === void 0 ? {} : { contextWindowTokens: model.contextWindowTokens },
1155
1215
  ...model.effectiveContextWindowTokens === void 0 ? {} : { effectiveContextWindowTokens: model.effectiveContextWindowTokens },
1156
1216
  ...model.autoCompactTokenLimit === void 0 ? {} : { autoCompactTokenLimit: model.autoCompactTokenLimit },
1217
+ ...model.toolOutputTruncationTokens === void 0 ? {} : { toolOutputTruncationTokens: model.toolOutputTruncationTokens },
1157
1218
  reasoningEffort: model.reasoningEffort ?? false,
1158
1219
  hostedWebSearch: model.hostedWebSearch ?? false
1159
1220
  });
@@ -1217,7 +1278,8 @@ function settingsWithResolvedModelContext(settings, model) {
1217
1278
  model.effectiveContextWindowTokens
1218
1279
  )
1219
1280
  },
1220
- ...model.autoCompactTokenLimit === void 0 ? {} : { contextAutoCompactThresholdTokens: model.autoCompactTokenLimit }
1281
+ ...model.autoCompactTokenLimit === void 0 ? {} : { contextAutoCompactThresholdTokens: model.autoCompactTokenLimit },
1282
+ ...model.toolOutputTruncationTokens === void 0 ? {} : { modelToolOutputTruncationTokens: model.toolOutputTruncationTokens }
1221
1283
  };
1222
1284
  }
1223
1285
  function configuredStaticUsageLimits(settings) {
@@ -1268,6 +1330,59 @@ function environmentsEncryptionKeyBytes(settings) {
1268
1330
  }
1269
1331
  return new Uint8Array(decoded);
1270
1332
  }
1333
+ function temporalConnectionOptions(settings) {
1334
+ const apiKey = settings.temporalApiKey?.trim() || void 0;
1335
+ const serverNameOverride = settings.temporalTlsServerName?.trim() || void 0;
1336
+ const rootCa = decodeTemporalTlsMaterial(
1337
+ settings.temporalTlsRootCaCertificateBase64,
1338
+ "OPENGENI_TEMPORAL_TLS_ROOT_CA_CERTIFICATE_BASE64"
1339
+ );
1340
+ const clientCertificate = decodeTemporalTlsMaterial(
1341
+ settings.temporalTlsClientCertificateBase64,
1342
+ "OPENGENI_TEMPORAL_TLS_CLIENT_CERTIFICATE_BASE64"
1343
+ );
1344
+ const clientPrivateKey = decodeTemporalTlsMaterial(
1345
+ settings.temporalTlsClientPrivateKeyBase64,
1346
+ "OPENGENI_TEMPORAL_TLS_CLIENT_PRIVATE_KEY_BASE64"
1347
+ );
1348
+ if (Boolean(clientCertificate) !== Boolean(clientPrivateKey)) {
1349
+ throw new Error(
1350
+ "OPENGENI_TEMPORAL_TLS_CLIENT_CERTIFICATE_BASE64 and OPENGENI_TEMPORAL_TLS_CLIENT_PRIVATE_KEY_BASE64 must both be set or both omitted"
1351
+ );
1352
+ }
1353
+ const tls = {};
1354
+ if (serverNameOverride) {
1355
+ tls.serverNameOverride = serverNameOverride;
1356
+ }
1357
+ if (rootCa) {
1358
+ tls.serverRootCACertificate = rootCa;
1359
+ }
1360
+ if (clientCertificate && clientPrivateKey) {
1361
+ tls.clientCertPair = { crt: clientCertificate, key: clientPrivateKey };
1362
+ }
1363
+ const hasCustomTls = Object.keys(tls).length > 0;
1364
+ const tlsEnabled = settings.temporalTlsEnabled || Boolean(apiKey) || hasCustomTls;
1365
+ return {
1366
+ address: settings.temporalHost,
1367
+ ...tlsEnabled ? { tls: hasCustomTls ? tls : true } : {},
1368
+ ...apiKey ? { apiKey } : {}
1369
+ };
1370
+ }
1371
+ function decodeTemporalTlsMaterial(value, settingName) {
1372
+ const encoded = value?.replace(/\s/g, "");
1373
+ if (!encoded) {
1374
+ return void 0;
1375
+ }
1376
+ if (!/^[A-Za-z0-9+/]+={0,2}$/.test(encoded) || encoded.length % 4 === 1) {
1377
+ throw new Error(`${settingName} must contain valid base64`);
1378
+ }
1379
+ const decoded = Buffer.from(encoded, "base64");
1380
+ const canonical = decoded.toString("base64").replace(/=+$/, "");
1381
+ if (decoded.length === 0 || canonical !== encoded.replace(/=+$/, "")) {
1382
+ throw new Error(`${settingName} must contain valid base64`);
1383
+ }
1384
+ return new Uint8Array(decoded);
1385
+ }
1271
1386
  function dbSearchPath(settings) {
1272
1387
  const schema = settings.dbSchema?.trim();
1273
1388
  if (!schema) {
@@ -1315,6 +1430,9 @@ function stableSandboxEnvironmentForRun(settings, workspaceEnvironment = {}, opt
1315
1430
  }
1316
1431
  if (settings.toolspaceEnabled) {
1317
1432
  environment.OPENGENI_TOOLSPACE_TOKEN_FILE ??= `${environment.HOME ?? descriptor.workspaceRoot}/.opengeni/toolspace-token`;
1433
+ if (settings.ogtoolPackageSpec) {
1434
+ environment.OPENGENI_OGTOOL_PACKAGE_SPEC ??= settings.ogtoolPackageSpec;
1435
+ }
1318
1436
  if (options.workspaceId) {
1319
1437
  environment.OPENGENI_TOOLSPACE_URL ??= firstPartyMcpWorkspaceUrl(
1320
1438
  settings,
@@ -1675,6 +1793,7 @@ function firstPartyDocumentsMcpServerUrl(mcpUrl) {
1675
1793
  return `${mcpUrl.replace(/\/+$/, "")}/docs`;
1676
1794
  }
1677
1795
  function validateSettings(settings) {
1796
+ temporalConnectionOptions(settings);
1678
1797
  if (settings.toolspaceEnabled && !settings.delegationSecret) {
1679
1798
  throw new Error("OPENGENI_DELEGATION_SECRET is required when OPENGENI_TOOLSPACE_ENABLED=true");
1680
1799
  }
@@ -2059,6 +2178,7 @@ export {
2059
2178
  settingsWithResolvedModelContext,
2060
2179
  stableSandboxEnvironmentForRun,
2061
2180
  startupRetryOptions,
2062
- streamTokenDegraded
2181
+ streamTokenDegraded,
2182
+ temporalConnectionOptions
2063
2183
  };
2064
2184
  //# sourceMappingURL=index.js.map