@opengeni/config 0.5.0 → 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>;
@@ -105,13 +117,13 @@ declare const SettingsSchema: z.ZodObject<{
105
117
  integrationsOauthClientsJson: z.ZodDefault<z.ZodString>;
106
118
  goalMaxAutoContinuations: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
107
119
  goalNoProgressLimit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
108
- childCompletionParentWakeEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
109
120
  agentMaxModelCallsPerTurn: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
110
121
  contextWindowTokens: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
111
122
  contextEffectiveWindowTokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
112
123
  contextCompactionThresholdRatio: z.ZodPipe<z.ZodDefault<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number, number>>;
113
124
  contextReservedOutputTokens: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
114
125
  contextAutoCompactThresholdTokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
126
+ modelToolOutputTruncationTokens: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
115
127
  authRequired: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
116
128
  accessKey: z.ZodOptional<z.ZodString>;
117
129
  authAllowHealth: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
@@ -135,7 +147,6 @@ declare const SettingsSchema: z.ZodObject<{
135
147
  codexProductSku: z.ZodOptional<z.ZodString>;
136
148
  codexToolSearchEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
137
149
  codexCredentialLeasingEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
138
- codexRotationNearExhaustionPct: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
139
150
  openaiReasoningEffort: z.ZodDefault<z.ZodEnum<{
140
151
  none: "none";
141
152
  minimal: "minimal";
@@ -346,6 +357,7 @@ declare const SettingsSchema: z.ZodObject<{
346
357
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
347
358
  connectionRef: z.ZodOptional<z.ZodObject<{
348
359
  connectionId: z.ZodOptional<z.ZodString>;
360
+ provider: z.ZodOptional<z.ZodString>;
349
361
  providerDomain: z.ZodString;
350
362
  kind: z.ZodOptional<z.ZodEnum<{
351
363
  oauth2: "oauth2";
@@ -355,6 +367,10 @@ declare const SettingsSchema: z.ZodObject<{
355
367
  }>>;
356
368
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
357
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>>>;
358
374
  subjectScope: z.ZodOptional<z.ZodEnum<{
359
375
  workspace: "workspace";
360
376
  subject: "subject";
@@ -364,6 +380,19 @@ declare const SettingsSchema: z.ZodObject<{
364
380
  }, z.core.$strip>;
365
381
  type Settings = z.infer<typeof SettingsSchema>;
366
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
+ };
367
396
  type ModelPricing = {
368
397
  inputMicrosPerMillionTokens: number;
369
398
  cachedInputMicrosPerMillionTokens?: number | undefined;
@@ -424,6 +453,7 @@ declare const RegistryProviderSchema: z.ZodObject<{
424
453
  contextWindowTokens: z.ZodOptional<z.ZodNumber>;
425
454
  effectiveContextWindowTokens: z.ZodOptional<z.ZodNumber>;
426
455
  autoCompactTokenLimit: z.ZodOptional<z.ZodNumber>;
456
+ toolOutputTruncationTokens: z.ZodOptional<z.ZodNumber>;
427
457
  reasoningEffort: z.ZodOptional<z.ZodBoolean>;
428
458
  hostedWebSearch: z.ZodOptional<z.ZodBoolean>;
429
459
  pricing: z.ZodOptional<z.ZodObject<{
@@ -473,6 +503,7 @@ interface ConfiguredModel {
473
503
  contextWindowTokens?: number | undefined;
474
504
  effectiveContextWindowTokens?: number | undefined;
475
505
  autoCompactTokenLimit?: number | undefined;
506
+ toolOutputTruncationTokens?: number | undefined;
476
507
  reasoningEffort: boolean;
477
508
  hostedWebSearch: boolean;
478
509
  }
@@ -580,7 +611,7 @@ declare function contextInputBudgetTokens(settings: Pick<Settings, "contextWindo
580
611
  * metadata is authoritative when present; deployment defaults remain the
581
612
  * fallback for models that do not declare their own limits.
582
613
  */
583
- 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;
584
615
  declare function configuredStaticUsageLimits(settings: Settings): StaticUsageLimitsConfig;
585
616
  declare function configuredEntitlements(settings: Settings): EntitlementsConfig;
586
617
  declare function calculateModelUsageCostMicros(settings: Settings, model: string, usage: ModelUsageInput): number;
@@ -591,6 +622,13 @@ declare function configuredAllowedReasoningEfforts(settings: Settings): Array<z.
591
622
  * Throws naming only the env var, never echoing its value.
592
623
  */
593
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;
594
632
  /**
595
633
  * The connection `search_path` for OpenGeni's db handles + the managed-auth pool
596
634
  * (Step I, §7.8 runtime half). Returns `undefined` when `dbSchema` is unset
@@ -598,7 +636,7 @@ declare function environmentsEncryptionKeyBytes(settings: Settings): Uint8Array
598
636
  * default (`public`) applies — byte-for-byte today's behavior. When `dbSchema`
599
637
  * is set (embedded), returns `"<schema>,opengeni_private,public"` — `public`
600
638
  * stays LAST so `gen_random_uuid()` (pgcrypto) and the `vector` type still
601
- * 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
602
640
  * RLS GUC-reader helpers resolve when referenced unqualified.
603
641
  */
604
642
  declare function dbSearchPath(settings: Pick<Settings, "dbSchema">): string | undefined;
@@ -734,7 +772,7 @@ declare function parseStaticEntitlementsJson(raw: string): EntitlementsConfig;
734
772
  declare function firstPartyMcpBaseUrl(settings: Settings): string;
735
773
  declare function firstPartyMcpWorkspaceUrl(settings: Settings, workspaceId: string): string;
736
774
  /**
737
- * 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
738
776
  * §C.3). Falls back to `delegationSecret` (the same HMAC envelope family —
739
777
  * `ogs_` vs `ogd_` prefix) so a deployment that already carries a delegation
740
778
  * secret does not need a second one. Returns undefined when neither is set,
@@ -743,13 +781,13 @@ declare function firstPartyMcpWorkspaceUrl(settings: Settings, workspaceId: stri
743
781
  declare function resolveStreamTokenSecret(settings: Settings): string | undefined;
744
782
  /**
745
783
  * True iff the desktop pixel plane must GRACEFULLY DEGRADE because desktop is
746
- * 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,
747
785
  * negotiateCapabilities forces DesktopStream.transport:null.
748
786
  */
749
787
  declare function streamTokenDegraded(settings: Settings): boolean;
750
788
  /**
751
789
  * Resolve the secret the control plane signs the enrollment bearer credential
752
- * with (the `oge_` envelope the agent presents back — M5/dossier §10.2). Falls
790
+ * with (the `oge_` envelope the agent presents back — M5). Falls
753
791
  * back to `delegationSecret` (the same HMAC envelope family) so a deployment that
754
792
  * already carries a delegation secret needs no second one. Returns undefined when
755
793
  * neither is set; when selfhosted is enabled but this is undefined, the poll route
@@ -759,7 +797,7 @@ declare function streamTokenDegraded(settings: Settings): boolean;
759
797
  declare function resolveEnrollmentSigningSecret(settings: Settings): string | undefined;
760
798
  /**
761
799
  * Resolve the HMAC secret the control plane signs the agent's relay PRODUCER token
762
- * with (the `ogr_` envelope; M8b/dossier §10.5). The RELAY verifies the producer
800
+ * with (the `ogr_` envelope; M8b). The RELAY verifies the producer
763
801
  * token with the SAME secret (injected into the relay via env). Prefers an explicit
764
802
  * `selfhostedRelayTokenSecret`, then the `streamTokenSecret` (the relay already
765
803
  * needs that one to verify the viewer's `ogs_` token, so a single secret can back
@@ -797,4 +835,4 @@ interface NatsControlPlaneAuth {
797
835
  }
798
836
  declare function resolveNatsControlPlaneAuth(settings: Settings): NatsControlPlaneAuth | null;
799
837
 
800
- 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(),
@@ -146,10 +193,6 @@ var SettingsSchema = z.object({
146
193
  // it then acts as a hard ceiling that per-goal overrides can only lower.
147
194
  goalMaxAutoContinuations: z.coerce.number().int().positive().optional(),
148
195
  goalNoProgressLimit: z.coerce.number().int().positive().default(3),
149
- // Temporary safety valve: spawned child sessions still run and retain their
150
- // own durable events/goals, but terminal child episodes do not create parent
151
- // system updates or inference work unless explicitly enabled.
152
- childCompletionParentWakeEnabled: EnvBoolean.default(false),
153
196
  // Per-segment ceiling on agent loop turns (model calls) within a single
154
197
  // session turn. Effectively unbounded by default for the same reason as
155
198
  // above; the graceful max-turns valve (idle + goal continuation, never a
@@ -182,6 +225,10 @@ var SettingsSchema = z.object({
182
225
  // Model-catalog auto-compact limit. When present it is clamped to
183
226
  // 90% of the raw window, matching Codex core's auto_compact_token_limit().
184
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),
185
232
  authRequired: EnvBoolean.default(false),
186
233
  accessKey: z.string().optional(),
187
234
  authAllowHealth: EnvBoolean.default(true),
@@ -217,15 +264,11 @@ var SettingsSchema = z.object({
217
264
  // tool that BM25-discloses only the matching connectors. Default OFF — a codex
218
265
  // turn is byte-for-byte unchanged until enabled. OPENGENI_CODEX_TOOL_SEARCH_ENABLED
219
266
  codexToolSearchEnabled: EnvBoolean.default(false),
220
- // OPE-21 atomic, workspace-local credential allocation. Default OFF is a
267
+ // credential allocator atomic, workspace-local credential allocation. Default OFF is a
221
268
  // deliberate rolling-deploy fence: migrate + roll every worker first, then
222
269
  // enable. Turning it off restores the legacy sticky selector without a schema
223
270
  // rollback; the additive lease table/cursor columns become inert.
224
271
  codexCredentialLeasingEnabled: EnvBoolean.default(false),
225
- // Multi-account P3 (auto-rotation): an account is "near exhaustion" — ineligible to be
226
- // rotated TO — when EITHER usage window (5h/weekly) is at/over this percent. Default 90 to
227
- // match the UI danger flip (UsageBar danger at pct >= 90). OPENGENI_CODEX_ROTATION_NEAR_EXHAUSTION_PCT.
228
- codexRotationNearExhaustionPct: z.coerce.number().int().min(1).max(100).default(90),
229
272
  openaiReasoningEffort: ReasoningEffort.default("low"),
230
273
  openaiAllowedReasoningEfforts: z.string().default("low,medium,high,xhigh"),
231
274
  openaiResponsesTransport: z.enum(["http", "websocket"]).default("http"),
@@ -364,7 +407,7 @@ var SettingsSchema = z.object({
364
407
  // recordingMaxSeconds is the ffmpeg -t hard ceiling (bounds a multi-day turn).
365
408
  recordingEnabled: EnvBoolean.default(true),
366
409
  recordingDefaultCodec: z.enum(["h264-mp4", "vp9-webm"]).default("h264-mp4"),
367
- // Workbench v2 turn-end workspace capture (dossier §10.1). When on, the turn
410
+ // Workbench v2 turn-end workspace capture. When on, the turn
368
411
  // activity probes the box's changed files off the live box at turn end and
369
412
  // persists a capture revision (blobs in @opengeni/storage) so the workbench
370
413
  // paints cold/offline sessions with zero machine round-trips. Best-effort and
@@ -446,7 +489,7 @@ var SettingsSchema = z.object({
446
489
  // 404 (invisible — the surface does not exist for this deployment) and the
447
490
  // selfhosted backend is inert; boot is unaffected. EnvBoolean (NOT
448
491
  // z.coerce.boolean(), which coerces "false" -> true). Flipped per-environment via
449
- // the deploy-staging IaC secret/configmap pattern (dossier §17/§25.1).
492
+ // the deploy-staging IaC secret/configmap pattern.
450
493
  sandboxSelfhostedEnabled: EnvBoolean.default(false),
451
494
  // Gates the op-stream (streaming exec) transport to Connected Machines. The
452
495
  // runner must ALSO advertise Capabilities.op_stream; default off, and legacy
@@ -466,7 +509,7 @@ var SettingsSchema = z.object({
466
509
  selfhostedNatsUrl: z.string().optional(),
467
510
  selfhostedRelayUrl: z.string().optional(),
468
511
  // The HMAC secret the control plane signs the agent's relay PRODUCER token with
469
- // (the `ogr_` envelope threaded into EnrollmentCredentials.relayToken; M8b/dossier
512
+ // (the `ogr_` envelope threaded into EnrollmentCredentials.relayToken; M8b/design
470
513
  // §10.5). The relay verifies the producer token with the SAME secret. Optional:
471
514
  // when ABSENT the poll returns an empty relayToken (graceful degrade — the stream
472
515
  // plane is simply unavailable until configured). Falls back to streamTokenSecret /
@@ -476,7 +519,7 @@ var SettingsSchema = z.object({
476
519
  // The minisign PUBLIC key the agent pins for self-update verification (handed to
477
520
  // the agent in EnrollmentCredentials; the SECRET key lives only in CI).
478
521
  agentUpdatePublicKey: z.string().optional(),
479
- // --- 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
480
523
  // §10.1 NATS Accounts per workspace + §17 the isolation smoke) -------------
481
524
  // nats-server is configured with AUTH CALLOUT: an external agent connects
482
525
  // presenting its `oge_` enrollment bearer as the connect auth-token; the server
@@ -679,6 +722,9 @@ var RegistryModelSchema = z.object({
679
722
  contextWindowTokens: z.number().int().positive().optional(),
680
723
  effectiveContextWindowTokens: z.number().int().positive().optional(),
681
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(),
682
728
  reasoningEffort: z.boolean().optional(),
683
729
  // model accepts a reasoning-effort control
684
730
  hostedWebSearch: z.boolean().optional(),
@@ -835,6 +881,14 @@ function getSettings() {
835
881
  temporalHost: optional("OPENGENI_TEMPORAL_HOST"),
836
882
  temporalNamespace: optional("OPENGENI_TEMPORAL_NAMESPACE"),
837
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"),
838
892
  startupDependencyRetryAttempts: optional("OPENGENI_STARTUP_DEPENDENCY_RETRY_ATTEMPTS"),
839
893
  startupDependencyRetryInitialDelayMs: optional(
840
894
  "OPENGENI_STARTUP_DEPENDENCY_RETRY_INITIAL_DELAY_MS"
@@ -857,6 +911,7 @@ function getSettings() {
857
911
  streamControlEnabled: optional("OPENGENI_STREAM_CONTROL_ENABLED"),
858
912
  toolspaceEnabled: optional("OPENGENI_TOOLSPACE_ENABLED"),
859
913
  toolspaceMaxCallsPerTurn: optional("OPENGENI_TOOLSPACE_MAX_CALLS_PER_TURN"),
914
+ ogtoolPackageSpec: optional("OPENGENI_OGTOOL_PACKAGE_SPEC"),
860
915
  environmentsEncryptionKey: optional("OPENGENI_ENVIRONMENTS_ENCRYPTION_KEY"),
861
916
  integrationsEnabled: optional("OPENGENI_INTEGRATIONS_ENABLED"),
862
917
  integrationsStateSecret: optional("OPENGENI_INTEGRATIONS_STATE_SECRET"),
@@ -866,13 +921,13 @@ function getSettings() {
866
921
  integrationsOauthClientsJson: optional("OPENGENI_INTEGRATIONS_OAUTH_CLIENTS_JSON"),
867
922
  goalMaxAutoContinuations: optional("OPENGENI_GOAL_MAX_AUTO_CONTINUATIONS"),
868
923
  goalNoProgressLimit: optional("OPENGENI_GOAL_NO_PROGRESS_LIMIT"),
869
- childCompletionParentWakeEnabled: optional("OPENGENI_CHILD_COMPLETION_PARENT_WAKE_ENABLED"),
870
924
  agentMaxModelCallsPerTurn: optional("OPENGENI_AGENT_MAX_MODEL_CALLS_PER_TURN"),
871
925
  contextWindowTokens: optional("OPENGENI_CONTEXT_WINDOW_TOKENS"),
872
926
  contextEffectiveWindowTokens: optional("OPENGENI_CONTEXT_EFFECTIVE_WINDOW_TOKENS"),
873
927
  contextCompactionThresholdRatio: optional("OPENGENI_COMPACTION_THRESHOLD_RATIO"),
874
928
  contextReservedOutputTokens: optional("OPENGENI_CONTEXT_RESERVED_OUTPUT_TOKENS"),
875
929
  contextAutoCompactThresholdTokens: optional("OPENGENI_CONTEXT_AUTO_COMPACT_THRESHOLD_TOKENS"),
930
+ modelToolOutputTruncationTokens: optional("OPENGENI_MODEL_TOOL_OUTPUT_TRUNCATION_TOKENS"),
876
931
  authRequired: optional("OPENGENI_AUTH_REQUIRED"),
877
932
  accessKey: optional("OPENGENI_ACCESS_KEY"),
878
933
  authAllowHealth: optional("OPENGENI_AUTH_ALLOW_HEALTH"),
@@ -893,7 +948,6 @@ function getSettings() {
893
948
  codexToolSearchEnabled: optional("OPENGENI_CODEX_TOOL_SEARCH_ENABLED"),
894
949
  codexCredentialLeasingEnabled: optional("OPENGENI_CODEX_CREDENTIAL_LEASING_ENABLED"),
895
950
  codexProductSku: optional("OPENGENI_CODEX_PRODUCT_SKU"),
896
- codexRotationNearExhaustionPct: optional("OPENGENI_CODEX_ROTATION_NEAR_EXHAUSTION_PCT"),
897
951
  openaiReasoningEffort: optional("OPENGENI_OPENAI_REASONING_EFFORT"),
898
952
  openaiAllowedReasoningEfforts: optional("OPENGENI_OPENAI_ALLOWED_REASONING_EFFORTS"),
899
953
  openaiResponsesTransport: optional("OPENGENI_OPENAI_RESPONSES_TRANSPORT"),
@@ -1144,6 +1198,7 @@ function configuredModels(settings) {
1144
1198
  providerLabel: builtinLabel,
1145
1199
  api: "responses",
1146
1200
  contextWindowTokens: settings.contextWindowTokens,
1201
+ toolOutputTruncationTokens: settings.modelToolOutputTruncationTokens,
1147
1202
  reasoningEffort: true,
1148
1203
  hostedWebSearch: settings.webSearchEnabled
1149
1204
  }));
@@ -1159,6 +1214,7 @@ function configuredModels(settings) {
1159
1214
  ...model.contextWindowTokens === void 0 ? {} : { contextWindowTokens: model.contextWindowTokens },
1160
1215
  ...model.effectiveContextWindowTokens === void 0 ? {} : { effectiveContextWindowTokens: model.effectiveContextWindowTokens },
1161
1216
  ...model.autoCompactTokenLimit === void 0 ? {} : { autoCompactTokenLimit: model.autoCompactTokenLimit },
1217
+ ...model.toolOutputTruncationTokens === void 0 ? {} : { toolOutputTruncationTokens: model.toolOutputTruncationTokens },
1162
1218
  reasoningEffort: model.reasoningEffort ?? false,
1163
1219
  hostedWebSearch: model.hostedWebSearch ?? false
1164
1220
  });
@@ -1222,7 +1278,8 @@ function settingsWithResolvedModelContext(settings, model) {
1222
1278
  model.effectiveContextWindowTokens
1223
1279
  )
1224
1280
  },
1225
- ...model.autoCompactTokenLimit === void 0 ? {} : { contextAutoCompactThresholdTokens: model.autoCompactTokenLimit }
1281
+ ...model.autoCompactTokenLimit === void 0 ? {} : { contextAutoCompactThresholdTokens: model.autoCompactTokenLimit },
1282
+ ...model.toolOutputTruncationTokens === void 0 ? {} : { modelToolOutputTruncationTokens: model.toolOutputTruncationTokens }
1226
1283
  };
1227
1284
  }
1228
1285
  function configuredStaticUsageLimits(settings) {
@@ -1273,6 +1330,59 @@ function environmentsEncryptionKeyBytes(settings) {
1273
1330
  }
1274
1331
  return new Uint8Array(decoded);
1275
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
+ }
1276
1386
  function dbSearchPath(settings) {
1277
1387
  const schema = settings.dbSchema?.trim();
1278
1388
  if (!schema) {
@@ -1320,6 +1430,9 @@ function stableSandboxEnvironmentForRun(settings, workspaceEnvironment = {}, opt
1320
1430
  }
1321
1431
  if (settings.toolspaceEnabled) {
1322
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
+ }
1323
1436
  if (options.workspaceId) {
1324
1437
  environment.OPENGENI_TOOLSPACE_URL ??= firstPartyMcpWorkspaceUrl(
1325
1438
  settings,
@@ -1680,6 +1793,7 @@ function firstPartyDocumentsMcpServerUrl(mcpUrl) {
1680
1793
  return `${mcpUrl.replace(/\/+$/, "")}/docs`;
1681
1794
  }
1682
1795
  function validateSettings(settings) {
1796
+ temporalConnectionOptions(settings);
1683
1797
  if (settings.toolspaceEnabled && !settings.delegationSecret) {
1684
1798
  throw new Error("OPENGENI_DELEGATION_SECRET is required when OPENGENI_TOOLSPACE_ENABLED=true");
1685
1799
  }
@@ -2064,6 +2178,7 @@ export {
2064
2178
  settingsWithResolvedModelContext,
2065
2179
  stableSandboxEnvironmentForRun,
2066
2180
  startupRetryOptions,
2067
- streamTokenDegraded
2181
+ streamTokenDegraded,
2182
+ temporalConnectionOptions
2068
2183
  };
2069
2184
  //# sourceMappingURL=index.js.map