@opengeni/runtime 4.3.0 → 4.4.0-canary.36927100590001

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.
Files changed (117) hide show
  1. package/dist/agent-instructions/base-behavior.d.ts +8 -0
  2. package/dist/agent-instructions/compose.d.ts +59 -0
  3. package/dist/agent-instructions/identity.d.ts +21 -0
  4. package/dist/agent-instructions/index.d.ts +6 -0
  5. package/dist/agent-instructions/modules/admin.d.ts +3 -0
  6. package/dist/agent-instructions/modules/artifacts.d.ts +7 -0
  7. package/dist/agent-instructions/modules/attachments.d.ts +3 -0
  8. package/dist/agent-instructions/modules/environment.d.ts +11 -0
  9. package/dist/agent-instructions/modules/goals.d.ts +3 -0
  10. package/dist/agent-instructions/modules/knowledge.d.ts +6 -0
  11. package/dist/agent-instructions/modules/machines.d.ts +3 -0
  12. package/dist/agent-instructions/modules/renderer-markdown.d.ts +6 -0
  13. package/dist/agent-instructions/modules/repositories.d.ts +7 -0
  14. package/dist/agent-instructions/modules/sandbox.d.ts +3 -0
  15. package/dist/agent-instructions/modules/skills.d.ts +3 -0
  16. package/dist/agent-instructions/modules/subagents.d.ts +3 -0
  17. package/dist/agent-instructions/runtime-mechanics.d.ts +7 -0
  18. package/dist/agent-instructions/types.d.ts +55 -0
  19. package/dist/assets/codemode-client.json +1 -1
  20. package/dist/{chunk-JUFVYQCY.js → chunk-VDXKKMMD.js} +457 -165
  21. package/dist/chunk-VDXKKMMD.js.map +1 -0
  22. package/dist/{chunk-22M75RJF.js → chunk-ZY655LYR.js} +1636 -709
  23. package/dist/chunk-ZY655LYR.js.map +1 -0
  24. package/dist/claude-subscription-usage.d.ts +3 -1
  25. package/dist/first-party-client.d.ts +1 -0
  26. package/dist/index.d.ts +37 -28
  27. package/dist/index.js +28 -2
  28. package/dist/input-wait-yield.d.ts +4 -0
  29. package/dist/interaction-tools.d.ts +1 -0
  30. package/dist/lazy-tool-transport.d.ts +6 -2
  31. package/dist/mcp-run-credentials.d.ts +3 -2
  32. package/dist/mcp-transport-logger.d.ts +10 -0
  33. package/dist/model-context-inspector.d.ts +17 -1
  34. package/dist/model-preparation-diagnostics.d.ts +9 -0
  35. package/dist/model-provider-routing.d.ts +4 -0
  36. package/dist/model-provider.d.ts +1 -0
  37. package/dist/model-request-capture.d.ts +9 -0
  38. package/dist/replayable-json-body.d.ts +2 -1
  39. package/dist/responses-terminal-error.d.ts +17 -0
  40. package/dist/sandbox/codemode-authority.d.ts +1 -0
  41. package/dist/sandbox/index.d.ts +3 -3
  42. package/dist/sandbox/index.js +5 -1
  43. package/dist/sandbox/provider-command-session.d.ts +6 -0
  44. package/dist/sandbox/providers/modal-command-control.d.ts +7 -0
  45. package/dist/sandbox/providers/modal-command-router-wire.d.ts +8 -0
  46. package/dist/sandbox/providers/modal-command-session.d.ts +2 -1
  47. package/dist/sandbox/providers/modal-command-start-errors.d.ts +9 -0
  48. package/dist/sandbox/providers/modal.d.ts +3 -0
  49. package/dist/sandbox/routing/routing-session.d.ts +5 -4
  50. package/dist/workspace-tool-gateway.js +2 -2
  51. package/package.json +12 -12
  52. package/src/agent-instructions/PROMPT_CHANGELOG.md +149 -0
  53. package/src/agent-instructions/base-behavior.ts +120 -0
  54. package/src/agent-instructions/compose.ts +153 -0
  55. package/src/agent-instructions/identity.ts +42 -0
  56. package/src/agent-instructions/index.ts +24 -0
  57. package/src/agent-instructions/modules/admin.ts +25 -0
  58. package/src/agent-instructions/modules/artifacts.ts +39 -0
  59. package/src/agent-instructions/modules/attachments.ts +12 -0
  60. package/src/agent-instructions/modules/environment.ts +60 -0
  61. package/src/agent-instructions/modules/goals.ts +15 -0
  62. package/src/agent-instructions/modules/knowledge.ts +21 -0
  63. package/src/agent-instructions/modules/machines.ts +17 -0
  64. package/src/agent-instructions/modules/renderer-markdown.ts +17 -0
  65. package/src/agent-instructions/modules/repositories.ts +28 -0
  66. package/src/agent-instructions/modules/sandbox.ts +63 -0
  67. package/src/agent-instructions/modules/skills.ts +19 -0
  68. package/src/agent-instructions/modules/subagents.ts +42 -0
  69. package/src/agent-instructions/runtime-mechanics.ts +55 -0
  70. package/src/agent-instructions/types.ts +83 -0
  71. package/src/bundled_default_skills/opengeni-client/SKILL.md +116 -37
  72. package/src/bundled_default_skills/opengeni-client/references/agent-recipes.md +18 -8
  73. package/src/bundled_default_skills/opengeni-client/references/api-workflows.md +24 -4
  74. package/src/bundled_default_skills/opengeni-client/references/chat-facade-fallback.md +23 -4
  75. package/src/bundled_default_skills/opengeni-client/references/compatibility-and-troubleshooting.md +34 -1
  76. package/src/bundled_default_skills/opengeni-client/references/configure-the-agent.md +248 -0
  77. package/src/bundled_default_skills/opengeni-client/references/customer-skill-template.md +2 -1
  78. package/src/bundled_default_skills/opengeni-client/references/data-tools-and-credentials.md +15 -4
  79. package/src/bundled_default_skills/opengeni-client/references/discovery-and-autonomy.md +2 -2
  80. package/src/bundled_default_skills/opengeni-client/references/isolation-and-authorization.md +5 -3
  81. package/src/bundled_default_skills/opengeni-client/references/product-integration-shapes.md +6 -5
  82. package/src/bundled_default_skills/opengeni-client/references/product-shapes-and-ui.md +36 -3
  83. package/src/bundled_default_skills/opengeni-client/references/proxy-from-any-backend.md +170 -0
  84. package/src/bundled_default_skills/opengeni-client/references/session-history-import.md +147 -0
  85. package/src/bundled_default_skills/opengeni-client/references/usage-allowances.md +189 -0
  86. package/src/bundled_default_skills/opengeni-help/SKILL.md +1 -1
  87. package/src/claude-subscription-usage.ts +23 -4
  88. package/src/first-party-client.ts +4 -0
  89. package/src/index.ts +260 -146
  90. package/src/input-wait-yield.ts +7 -0
  91. package/src/interaction-tools.ts +16 -2
  92. package/src/lazy-tool-transport.ts +46 -16
  93. package/src/mcp-run-credentials.ts +18 -3
  94. package/src/mcp-transport-logger.ts +46 -0
  95. package/src/model-context-inspector.ts +37 -3
  96. package/src/model-preparation-diagnostics.ts +48 -1
  97. package/src/model-provider-client.ts +5 -1
  98. package/src/model-provider-routing.ts +95 -1
  99. package/src/model-provider.ts +1 -0
  100. package/src/model-request-capture.ts +28 -1
  101. package/src/provider-history-adapter.ts +24 -3
  102. package/src/replayable-json-body.ts +19 -2
  103. package/src/responses-terminal-error.ts +136 -0
  104. package/src/sandbox/codemode-authority.ts +4 -0
  105. package/src/sandbox/codemode-client.ts +18 -16
  106. package/src/sandbox/index.ts +45 -9
  107. package/src/sandbox/provider-command-session.ts +12 -0
  108. package/src/sandbox/providers/modal-command-control.ts +118 -12
  109. package/src/sandbox/providers/modal-command-router-wire.ts +40 -4
  110. package/src/sandbox/providers/modal-command-session.ts +36 -1
  111. package/src/sandbox/providers/modal-command-start-errors.ts +27 -0
  112. package/src/sandbox/providers/modal-legacy-command-control.ts +60 -30
  113. package/src/sandbox/providers/modal.ts +43 -2
  114. package/src/sandbox/routing/routing-session.ts +61 -6
  115. package/src/sandbox/turn-tool-cancellation.ts +8 -1
  116. package/dist/chunk-22M75RJF.js.map +0 -1
  117. package/dist/chunk-JUFVYQCY.js.map +0 -1
@@ -1,5 +1,7 @@
1
1
  type Observer = (providerId: string, response: Response) => void;
2
+ type Prepare = (providerId: string, headers: Headers) => Promise<Headers>;
2
3
  /** Like Codex usage headers: free observations within this turn's provider context. */
3
- export declare function withClaudeUsageObserver<T>(observer: Observer, run: () => Promise<T>): Promise<T>;
4
+ export declare function withClaudeUsageObserver<T>(observer: Observer, run: () => Promise<T>, prepare?: Prepare): Promise<T>;
5
+ export declare function prepareClaudeSubscriptionRequest(providerId: string, input: Parameters<typeof fetch>[0], init?: RequestInit): Promise<RequestInit | undefined>;
4
6
  export declare function observeClaudeUsageResponse(providerId: string, response: Response): void;
5
7
  export {};
@@ -14,6 +14,7 @@ export declare function createFirstPartyAttemptClient(input: {
14
14
  };
15
15
  selectedTools: readonly FirstPartyMcpToolName[];
16
16
  permissions?: readonly Permission[];
17
+ credentialRestriction?: "developer_setup";
17
18
  fetch?: typeof fetch;
18
19
  signal?: AbortSignal;
19
20
  }): OpenGeniClient;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { type SkillCatalogDescriptor } from "./skill-catalog.js";
9
9
  export { formatSkillCatalog, skillCatalogEntryIds, type SkillCatalogDescriptor, } from "./skill-catalog.js";
10
10
  import { AttemptToolEnvironment, type AttemptToolAuthorization, type AttemptToolDefinition } from "@opengeni/codemode";
11
11
  import { type ToolGateway, type ToolGatewayAuthorization, type ToolGatewayDefinition } from "@opengeni/tool-gateway";
12
- import { GenerateImageToolInput, type AttemptToolCatalog, type AttemptToolResult as AttemptToolResultValue, type GitCredentialProvider, type GitCredentialTransport, type HumanInputResponse, type McpServerConnectionRef, type Permission, type FirstPartyMcpToolName, type LatencyMode, type ReasoningEffort, type ResourceRef, type SessionGoalSnapshot, type ToolAuthNeededPayload, type ToolGatewayCaller, type ToolGatewayCatalog, type ToolGatewayCatalogEntry, type ToolDisplayMetadata, type ToolRef, type VideoGenerationCapabilities, type VideoGenerationToolResult, type ToolFamily } from "@opengeni/contracts";
12
+ import { GenerateImageToolInput, type ResolvedAgentConfig, type AttemptToolCatalog, type AttemptToolResult as AttemptToolResultValue, type GitCredentialProvider, type GitCredentialTransport, type HumanInputResponse, type McpServerConnectionRef, type Permission, type FirstPartyMcpToolName, type LatencyMode, type ReasoningEffort, type ResourceRef, type SessionGoalSnapshot, type ToolAuthNeededPayload, type ToolGatewayCaller, type ToolGatewayCatalog, type ToolGatewayCatalogEntry, type ToolDisplayMetadata, type ToolRef, type VideoGenerationCapabilities, type VideoGenerationToolResult, type ToolFamily } from "@opengeni/contracts";
13
13
  export { renderSessionGoalContext } from "@opengeni/contracts";
14
14
  import { McpAggregateToolListBudget } from "./mcp-network.js";
15
15
  import { type LazyToolTransport } from "./lazy-tool-transport.js";
@@ -21,6 +21,8 @@ export { GMAIL_REST_API_BASE, GMAIL_REST_MCP_TOOLS, GmailRestMcpServer, OFFICIAL
21
21
  import { Agent, RunState, RunContext, type AgentInputItem, type CallModelInputFilter, type MCPServer, type Model, type ModelRequest, type SerializedTool, type Tool } from "@openai/agents";
22
22
  import { Capabilities, Manifest, type SandboxClient, type SandboxSessionLike, type SandboxSessionState } from "@openai/agents/sandbox";
23
23
  import OpenAI from "openai";
24
+ import { type AgentPromptResources, type RigInstructionsContext, type WorkspaceEnvironmentContext } from "./agent-instructions/index.js";
25
+ export { AGENT_PROMPT_MODULES, DEFAULT_AGENT_IDENTITY, INSTRUCTION_PRECEDENCE, SESSION_INSTRUCTIONS_PREAMBLE, composeModularAgentInstructions, composeOperationalContract, identityFromLegacyTemplate, resolveAgentIdentity, rigInstructions, workspaceEnvironmentInstructions, type AgentPromptContext, type AgentPromptResources, type ComposeModularAgentInstructionsInput, type ModularInstructionLayer, type RigInstructionsContext, type WorkspaceEnvironmentContext, } from "./agent-instructions/index.js";
24
26
  import { type ProviderContextTokenSignal } from "./context-compaction.js";
25
27
  import { type RunCredentialSessionReady } from "./sandbox/index.js";
26
28
  import { sandboxCommandExitCode, sandboxCommandOutput, sandboxCommandStillRunning, sandboxCommandStdout } from "./sandbox/command-result.js";
@@ -35,13 +37,15 @@ import { type WorkspaceSkillSearchPath } from "./workspace-skills.js";
35
37
  import { type EffectiveSkillSelection, type RuntimeSkillActivation, type RuntimeSkillIndexEntry } from "./runtime-skills.js";
36
38
  export { composeRuntimeSkills, loadNativeToolSkillArtifacts, readRuntimeSkill, skillCatalogFromComposition, type EffectiveSkillSelection, type InstalledSkillActivation, type NativeToolSkillSet, type RuntimeSkillActivation, type RuntimeSkillArtifact, type RuntimeSkillArtifactFile, type RuntimeSkillComposition, type RuntimeSkillDescriptor, type RuntimeSkillIndexEntry, type SessionSkillActivation, } from "./runtime-skills.js";
37
39
  import { type PersistentAgentInstructionInspection } from "./model-context-inspector.js";
40
+ import { type ModelCallLifecycle } from "./model-request-capture.js";
41
+ export { beforeModelRequest as awaitModelCallAdmission } from "./model-request-capture.js";
38
42
  import { type ModelPreparationMeasurement } from "./model-preparation-diagnostics.js";
39
43
  import type { ModelResponseUsage, NormalizedRuntimeEvent, SerializedHumanInputInterruption, SerializedInteractionInterventionInterruption } from "./run-events.js";
40
44
  export { buildPortableSkillArtifact, getSkillLibraryEntry, isSkillLibraryEntryId, listSkillLibraryEntries, loadSkillLibrarySkill, PORTABLE_SKILL_MAX_FILE_BYTES, PORTABLE_SKILL_MAX_FILES, PORTABLE_SKILL_MAX_TOTAL_BYTES, parsePortableSkillFrontmatter, skillLibraryRepositoryUrl, skillArtifactContentSha256, type PortableSkillArtifact, type SkillLibraryEntry, type SkillLibraryFile, type SkillLibrarySkill, } from "./skill-library.js";
41
45
  export { MCP_LIFECYCLE_OUTCOMES, MCP_LIFECYCLE_PHASES, MCP_LIFECYCLE_POLICIES, MCP_TOOL_CALL_OUTCOMES, SANDBOX_READINESS_REPLACEMENT_OUTCOMES, type McpLifecycleOutcome, type McpLifecyclePhase, type McpLifecyclePolicy, type McpToolCallOutcome, type RuntimeMetricsHooks, type SandboxReadinessReplacementOutcome, } from "./metrics.js";
42
46
  export type { ModelPreparationMeasurement, ModelPreparationPhase, } from "./model-preparation-diagnostics.js";
43
47
  export { markModelPreparationFirstSandboxOperation, recordModelPreparationMeasurement, } from "./model-preparation-diagnostics.js";
44
- export { CodexSubscriptionUnavailableError, OrganizationGatewayUnavailableError, OrganizationOpenRouterUnavailableError, MultiProviderModelProvider, OpenGeniChatCompletionsModel, OpenGeniResponsesModel, UNKNOWN_MODEL_FINISH_REASON_CODE, UnknownModelFinishReasonError, WorkspaceGatewayUnavailableError, WorkspaceOpenRouterUnavailableError, WorkspaceModelPolicyBlockedError, XaiSubscriptionUnavailableError, azureOpenAIDefaultQuery, buildModelInstance, buildOpenAIClientFromSettings, buildProviderClient, configureOpenAI, configureRuntimeMetricsHooks, modelRequestPolicyForProvider, normalizeVercelGatewayRequestBody, resolveTurnModel, vercelGatewayRoutingFetch, } from "./model-provider.js";
48
+ export { CodexSubscriptionUnavailableError, OrganizationGatewayUnavailableError, OrganizationOpenRouterUnavailableError, MultiProviderModelProvider, OpenGeniChatCompletionsModel, OpenGeniResponsesModel, ResponsesStreamingTerminalError, UNKNOWN_MODEL_FINISH_REASON_CODE, UnknownModelFinishReasonError, WorkspaceGatewayUnavailableError, WorkspaceOpenRouterUnavailableError, WorkspaceModelPolicyBlockedError, XaiSubscriptionUnavailableError, azureOpenAIDefaultQuery, buildModelInstance, buildOpenAIClientFromSettings, buildProviderClient, configureOpenAI, configureRuntimeMetricsHooks, modelRequestPolicyForProvider, normalizeVercelGatewayRequestBody, resolveTurnModel, vercelGatewayRoutingFetch, } from "./model-provider.js";
45
49
  export { appendWorkspaceGovernance, CompanyProfilePromptLimitError, hasActiveWorkspaceInstructionPolicy, renderWorkspaceGovernanceContext, WorkspaceGovernancePromptLimitError, type WorkspaceGovernanceContext, } from "./workspace-governance.js";
46
50
  export { buildModelContextSnapshot, buildModelContextSnapshotFromRequest, createModelVisibleContextCaptureFilter, joinPersistentAgentInstructionLayers, type PersistentAgentInstructionInspection, type PersistentAgentInstructionLayerDraft, } from "./model-context-inspector.js";
47
51
  export { createTurnToolCancellationController, TurnSandboxCommandCancelledError, } from "./sandbox/turn-tool-cancellation.js";
@@ -376,6 +380,8 @@ export type AttemptConnectorActionBinding = {
376
380
  resultOutcome?: (output: unknown) => "not_executed" | "uncertain" | null;
377
381
  };
378
382
  export type BuildAgentOptions = {
383
+ /** Durable router use survives capability and tool-policy changes. */
384
+ toolRouterInHistory?: boolean;
379
385
  /** Live authority fence for intrinsic sandbox tools outside the MCP gateway. */
380
386
  authorizeAttemptExecution?: () => Promise<void> | void;
381
387
  /** Trusted attempt-local wait receipt shared with prepared tools. */
@@ -501,6 +507,24 @@ export type BuildAgentOptions = {
501
507
  * metadata no longer enters the prompt-cache-critical system instructions.
502
508
  */
503
509
  persistentSessionSettings?: PersistentSessionSettings;
510
+ /**
511
+ * The session's frozen agent configuration. Absent or null keeps the legacy
512
+ * instructions byte-for-byte and the historical tool/provider request surface;
513
+ * a configuration selects the modular composer (identity, base behavior,
514
+ * runtime mechanics, capability modules) and gates tool families.
515
+ */
516
+ agentConfig?: ResolvedAgentConfig | null;
517
+ /**
518
+ * Modular composer only: the workspace identity tier (explicit workspace
519
+ * default identity, else the legacy `agentInstructions` persona). Unlike
520
+ * `instructionsTemplate`, workspace governance never drops it.
521
+ */
522
+ workspaceAgentIdentity?: string;
523
+ /**
524
+ * Modular composer only: resource facts for module selection. Derived from
525
+ * the build resources and options when omitted.
526
+ */
527
+ agentPromptResources?: AgentPromptResources;
504
528
  instructionsTemplate?: string;
505
529
  sessionInstructions?: string;
506
530
  skillActivations?: readonly RuntimeSkillActivation[];
@@ -521,36 +545,10 @@ export type BuildAgentOptions = {
521
545
  */
522
546
  onToolCancellationFence?: (fence: TurnToolCancellationFence) => void;
523
547
  };
524
- /**
525
- * Operator-facing metadata for the workspace environment attached to a run.
526
- * Surfaced verbatim in the agent instructions: the description is where
527
- * operators document how the exported credentials are meant to be used
528
- * (e.g. which variable holds a deploy key and how to clone with it), so an
529
- * agent must not have to rediscover that by enumerating `env` and guessing.
530
- * Only metadata belongs here — never variable values.
531
- */
532
- export type WorkspaceEnvironmentContext = {
533
- name: string;
534
- description?: string | null;
535
- variableNames?: string[];
536
- };
537
548
  /** @deprecated Persistent display metadata is no longer model-visible. */
538
549
  export type PersistentSessionSettings = {
539
550
  titleIsSet: boolean;
540
551
  };
541
- /**
542
- * The rig a session rides (M3): its name + the active version pinned onto the
543
- * session. Surfaced verbatim in the non-bypassable CORE instructions so the
544
- * agent understands its sandbox is a disposable fork of a shared, versioned
545
- * machine definition and how to promote a durable change. Absent for rig-less
546
- * sessions (the block never renders).
547
- */
548
- export type RigInstructionsContext = {
549
- name: string;
550
- version: number;
551
- };
552
- export declare function rigInstructions(rig: RigInstructionsContext): string[];
553
- export declare function workspaceEnvironmentInstructions(environment: WorkspaceEnvironmentContext): string[];
554
552
  /**
555
553
  * The non-bypassable CORE of the agent instructions: the goal-loop ownership
556
554
  * line (which names the opengeni__goal_* tools and is what keeps a long-running
@@ -590,6 +588,11 @@ export declare function appendPersistentSessionSettings(composed: string, _setti
590
588
  * An absent/blank value returns the composed string byte-for-byte.
591
589
  */
592
590
  export declare function appendWorkspaceMemory(composed: string, workspaceMemory?: string): string;
591
+ /**
592
+ * Resource facts for modular module selection. Every input is a session- or
593
+ * turn-level fact, so the composed prefix changes only when they change.
594
+ */
595
+ export declare function agentPromptResourcesFor(settings: Settings, resources: readonly ResourceRef[], options: Pick<BuildAgentOptions, "activeSandboxBackend" | "fileResourceDownloads" | "gitCredentialBindings" | "gitTokenSeed" | "gitTokenSeeds" | "workspaceEnvironment" | "rig">): AgentPromptResources;
593
596
  export declare function inspectPersistentAgentInstructions(settings: Settings, options: BuildAgentOptions): PersistentAgentInstructionInspection;
594
597
  /**
595
598
  * Appends the generic programmatic-tool-calling (codemode) directive to the
@@ -749,6 +752,8 @@ export type PrepareToolsOptions = {
749
752
  executionGeneration?: number;
750
753
  subjectId?: string;
751
754
  subjectLabel?: string;
755
+ /** Trusted immutable setup ceiling from the accepted execution policy. */
756
+ credentialRestriction?: "developer_setup";
752
757
  credentialSubjectId?: string;
753
758
  initiatingHumanSubjectId?: string | null;
754
759
  initiatingHumanExternalIdentity?: {
@@ -1039,6 +1044,10 @@ export declare function restoreInterruptedRunState(agent: Agent<any, any>, seria
1039
1044
  export declare const TURN_OPERATIONAL_NOTICE_PREFIX = "[OpenGeni turn-scoped operational notice]\n";
1040
1045
  export declare function prepareRunInput(agent: Agent<any, any>, input: AgentSegmentInput, options?: PrepareInputOptions): Promise<PreparedAgentInput>;
1041
1046
  export type RunAgentStreamOptions = {
1047
+ /** Producer-side gate before calling any resolved model/provider. */
1048
+ beforeModelRequest?: ModelCallLifecycle["beforeModelRequest"];
1049
+ /** Register terminal response settlement before the next producer model request. */
1050
+ onModelResponse?: ModelCallLifecycle["onModelResponse"];
1042
1051
  /** Abort the provider/tool loop when the owning activity is cancelled. */
1043
1052
  signal?: AbortSignal;
1044
1053
  /** Nonblocking phase measurements for request preparation before provider I/O. */
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ AGENT_PROMPT_MODULES,
2
3
  AssistantMessagePhaseTracker,
3
4
  CODEMODE_PROGRAMMATIC_DIRECTIVE,
4
5
  CODE_SEARCH_DIRECTIVE,
@@ -18,10 +19,12 @@ import {
18
19
  ConnectorActionBindingRejectedError,
19
20
  ConnectorActionExecutionError,
20
21
  ConnectorAttachmentTransferError,
22
+ DEFAULT_AGENT_IDENTITY,
21
23
  DEFAULT_COMPACTION_THRESHOLD_RATIO,
22
24
  EmptyCompactionSummaryError,
23
25
  GENESIS_TITLE_DIRECTIVE,
24
26
  HUMAN_INPUT_TOOL_NAME,
27
+ INSTRUCTION_PRECEDENCE,
25
28
  INTERACTION_ATTEMPT_TOOL_NAMES,
26
29
  InputWaitYield,
27
30
  MAX_COMPACTION_THRESHOLD_RATIO,
@@ -52,9 +55,11 @@ import {
52
55
  REMOTE_COMPACTION_V2_BETA_FEATURE,
53
56
  REMOTE_COMPACTION_V2_IMPLEMENTATION,
54
57
  REMOTE_V2_RETAINED_MESSAGE_TOKEN_BUDGET,
58
+ ResponsesStreamingTerminalError,
55
59
  RunMcpCredentialError,
56
60
  RunMcpCredentials,
57
61
  SANDBOX_READINESS_REPLACEMENT_OUTCOMES,
62
+ SESSION_INSTRUCTIONS_PREAMBLE,
58
63
  SESSION_TITLE_GENERATION_INPUT_MAX_CHARACTERS,
59
64
  SESSION_TITLE_GENERATION_INSTRUCTIONS,
60
65
  SESSION_TITLE_GENERATION_MAX_OUTPUT_TOKENS,
@@ -72,6 +77,7 @@ import {
72
77
  WorkspaceModelPolicyBlockedError,
73
78
  WorkspaceOpenRouterUnavailableError,
74
79
  XaiSubscriptionUnavailableError,
80
+ agentPromptResourcesFor,
75
81
  agentsErrorRunState,
76
82
  appendCodemodeInstructions,
77
83
  appendGenesisTitleDirective,
@@ -87,6 +93,7 @@ import {
87
93
  attemptToolCallMeta,
88
94
  azureCliLoginCommand,
89
95
  azureOpenAIDefaultQuery,
96
+ beforeModelRequest,
90
97
  boundModelToolOutputsFilterForSettings,
91
98
  buildAgentCapabilities,
92
99
  buildCompactionPromptInput,
@@ -115,6 +122,8 @@ import {
115
122
  compactionSummaryOutputTokens,
116
123
  compactionThresholdTokens,
117
124
  composeAgentInstructions,
125
+ composeModularAgentInstructions,
126
+ composeOperationalContract,
118
127
  composeRuntimeSkills,
119
128
  computerUse,
120
129
  configureOpenAI,
@@ -160,6 +169,7 @@ import {
160
169
  hasCanonicalEditableArtifactToolSurface,
161
170
  hasModelGeneratedItem,
162
171
  hasOpaqueProviderArtifact,
172
+ identityFromLegacyTemplate,
163
173
  incrementalModelInputProjectionFilter,
164
174
  inspectPersistentAgentInstructions,
165
175
  interruptionKindForCallItem,
@@ -231,6 +241,7 @@ import {
231
241
  repositoryUsesSandboxClone,
232
242
  repositoryWorkspaceSkillPathsOption,
233
243
  requestRemoteCompactionV2,
244
+ resolveAgentIdentity,
234
245
  resolveTurnModel,
235
246
  restoreGenericDispatchHistoryItems,
236
247
  restoreInterruptedRunState,
@@ -283,7 +294,7 @@ import {
283
294
  workspaceEnvironmentInstructions,
284
295
  wrapAttemptToolDefinitions,
285
296
  wrapAttemptToolExecute
286
- } from "./chunk-22M75RJF.js";
297
+ } from "./chunk-ZY655LYR.js";
287
298
  import {
288
299
  ActiveBackendUnresolvableError,
289
300
  BROWSER_CONTROL_ADMIN_TOKEN_FILE,
@@ -447,6 +458,7 @@ import {
447
458
  inspectRecordingArtifact,
448
459
  isConnectedMachineAbsolutePath,
449
460
  isExecSessionLostBanner,
461
+ isModalCommandStartOutcomeUnknownError,
450
462
  isModalTaskExecStartPreDispatchUnavailableError,
451
463
  isOpenSandboxLifecycleProxyPath,
452
464
  isProviderApiThrottleError,
@@ -494,6 +506,7 @@ import {
494
506
  recordingStorageKey,
495
507
  redactOpenSandboxSignedUriPath,
496
508
  relativeConnectedMachinePath,
509
+ renderRoutingMutationOutcomeUnknownToolResult,
497
510
  renderSelfhostedFault,
498
511
  renewSandboxProviderExpiration,
499
512
  repairSerializedRunStateExposedPorts,
@@ -560,7 +573,7 @@ import {
560
573
  withRunCredentialsClient,
561
574
  withRunCredentialsSession,
562
575
  withoutSandboxProviderIdentity
563
- } from "./chunk-JUFVYQCY.js";
576
+ } from "./chunk-VDXKKMMD.js";
564
577
  import "./chunk-7KVMU7O3.js";
565
578
  import "./chunk-4A4XTKKX.js";
566
579
  import "./chunk-GUJMCB7F.js";
@@ -591,6 +604,7 @@ import {
591
604
  } from "./chunk-ISNIWRWB.js";
592
605
  import "./chunk-PZ5AY32C.js";
593
606
  export {
607
+ AGENT_PROMPT_MODULES,
594
608
  ActiveBackendUnresolvableError,
595
609
  AssistantMessagePhaseTracker,
596
610
  BROWSER_CONTROL_ADMIN_TOKEN_FILE,
@@ -634,6 +648,7 @@ export {
634
648
  ConnectorActionBindingRejectedError,
635
649
  ConnectorActionExecutionError,
636
650
  ConnectorAttachmentTransferError,
651
+ DEFAULT_AGENT_IDENTITY,
637
652
  DEFAULT_COMPACTION_THRESHOLD_RATIO,
638
653
  DEFAULT_DESKTOP_GEOMETRY,
639
654
  DESKTOP_STREAM_PORT,
@@ -651,6 +666,7 @@ export {
651
666
  GMAIL_REST_MCP_TOOLS,
652
667
  GmailRestMcpServer,
653
668
  HUMAN_INPUT_TOOL_NAME,
669
+ INSTRUCTION_PRECEDENCE,
654
670
  INTERACTION_ATTEMPT_TOOL_NAMES,
655
671
  InMemoryOpStreamTransport,
656
672
  InputWaitYield,
@@ -704,6 +720,7 @@ export {
704
720
  REPOSITORY_DISCOVERY_LIMIT,
705
721
  RecordingError,
706
722
  RecordingUnavailableError,
723
+ ResponsesStreamingTerminalError,
707
724
  RoutingActiveRouteChangedError,
708
725
  RoutingBackendRecoveryRequiredError,
709
726
  RoutingMutationOutcomeUnknownError,
@@ -727,6 +744,7 @@ export {
727
744
  SELFHOSTED_RETRY_BACKOFF_CAP_MS,
728
745
  SELFHOSTED_RETRY_BACKOFF_FACTOR,
729
746
  SELFHOSTED_TIMEOUT_MAX_RETRIES,
747
+ SESSION_INSTRUCTIONS_PREAMBLE,
730
748
  SESSION_TITLE_GENERATION_INPUT_MAX_CHARACTERS,
731
749
  SESSION_TITLE_GENERATION_INSTRUCTIONS,
732
750
  SESSION_TITLE_GENERATION_MAX_OUTPUT_TOKENS,
@@ -773,6 +791,7 @@ export {
773
791
  WorkspaceOpenRouterUnavailableError,
774
792
  XaiSubscriptionUnavailableError,
775
793
  agentErrorToControlError,
794
+ agentPromptResourcesFor,
776
795
  agentsErrorRunState,
777
796
  appendCodemodeInstructions,
778
797
  appendGenesisTitleDirective,
@@ -790,6 +809,7 @@ export {
790
809
  assertProviderRegistryInvariants,
791
810
  assertSafeRelPath,
792
811
  attemptToolCallMeta,
812
+ beforeModelRequest as awaitModelCallAdmission,
793
813
  azureCliLoginCommand,
794
814
  azureOpenAIDefaultQuery,
795
815
  backendSupportsOs,
@@ -837,6 +857,8 @@ export {
837
857
  compactionSummaryOutputTokens,
838
858
  compactionThresholdTokens,
839
859
  composeAgentInstructions,
860
+ composeModularAgentInstructions,
861
+ composeOperationalContract,
840
862
  composeRuntimeSkills,
841
863
  computerUse,
842
864
  configureOpenAI,
@@ -920,6 +942,7 @@ export {
920
942
  hasModelGeneratedItem,
921
943
  hasOpaqueProviderArtifact,
922
944
  hasPersistableSandboxProviderIdentity,
945
+ identityFromLegacyTemplate,
923
946
  incrementalModelInputProjectionFilter,
924
947
  inlineWorkspaceArchiveForRestore,
925
948
  inspectModalSandboxLifecycle,
@@ -932,6 +955,7 @@ export {
932
955
  isExecSessionLostBanner,
933
956
  isMcpRequestTimeoutError,
934
957
  isMcpTransportConnectivityError,
958
+ isModalCommandStartOutcomeUnknownError,
935
959
  isModalTaskExecStartPreDispatchUnavailableError,
936
960
  isOfficialGmailMcpConfig,
937
961
  isOpenSandboxLifecycleProxyPath,
@@ -1040,6 +1064,7 @@ export {
1040
1064
  relativeConnectedMachinePath,
1041
1065
  releaseMcpResultCustomDataFromSdkEvent,
1042
1066
  renderCompactionPromptInputForChat,
1067
+ renderRoutingMutationOutcomeUnknownToolResult,
1043
1068
  renderSelfhostedFault,
1044
1069
  renderSessionGoalContext,
1045
1070
  renderWorkspaceGovernanceContext,
@@ -1052,6 +1077,7 @@ export {
1052
1077
  repositoryWorkspaceSkillPathsOption,
1053
1078
  requestRemoteCompactionV2,
1054
1079
  requirePersistableReplacementSandboxEnvelope,
1080
+ resolveAgentIdentity,
1055
1081
  resolveConnectedMachinePath,
1056
1082
  resolveConnectedMachineWorkspaceRoot,
1057
1083
  resolveModalCheckpointProviderBinding,
@@ -44,6 +44,10 @@ export declare class InputWaitYield {
44
44
  * rolls back the remote mutation nor replaces its durable attempt authority.
45
45
  */
46
46
  sealForSettlement(signal?: AbortSignal | undefined): Promise<void>;
47
+ /** A settled stream may need one final-reply handoff before attempt closure.
48
+ * Drain already-admitted receipts without reopening that stream's admission.
49
+ */
50
+ drainForHandoff(signal?: AbortSignal | undefined): Promise<void>;
47
51
  private endStream;
48
52
  private assertCurrent;
49
53
  private openTools;
@@ -23,6 +23,7 @@ export type CreateFirstPartyInteractionAttemptToolsInput = Omit<CreateInteractio
23
23
  scope: AttemptToolScope;
24
24
  subjectId?: string;
25
25
  subjectLabel?: string;
26
+ credentialRestriction?: "developer_setup";
26
27
  fetch?: typeof globalThis.fetch;
27
28
  };
28
29
  /**
@@ -14,6 +14,7 @@ export declare class LazyToolRuntime {
14
14
  private readonly deferredMcpServerIds;
15
15
  private readonly preparationIndependentToolNames;
16
16
  private readonly modelMcpServerIds;
17
+ private readonly conditionalRouter;
17
18
  readonly wrappedAgents: WeakSet<object>;
18
19
  readonly wrappedModels: WeakMap<Model, Model>;
19
20
  private currentTools;
@@ -25,8 +26,11 @@ export declare class LazyToolRuntime {
25
26
  private activeAgent;
26
27
  private activeRunContext;
27
28
  readonly controlTools: Tool[];
28
- constructor(transport: LazyToolTransport, mcpServerIds: ReadonlySet<string>, toolPreparationReady?: Promise<void> | undefined, deferredMcpServerIds?: ReadonlySet<string>, preparationIndependentToolNames?: ReadonlySet<string>, modelMcpServerIds?: () => ReadonlyMap<string, string>);
29
+ private routerWasExposed;
30
+ constructor(transport: LazyToolTransport, mcpServerIds: ReadonlySet<string>, toolPreparationReady?: Promise<void> | undefined, deferredMcpServerIds?: ReadonlySet<string>, preparationIndependentToolNames?: ReadonlySet<string>, modelMcpServerIds?: () => ReadonlyMap<string, string>, conditionalRouter?: boolean, routerInHistory?: boolean);
29
31
  hasPendingPreparation(): boolean;
32
+ prepareConditionalRouter(): Promise<void>;
33
+ visibleControlTools(): Tool[];
30
34
  ensurePrepared(): Promise<void>;
31
35
  resolveAuthorizedFunctionTool(name: string): Promise<Tool | null>;
32
36
  noteToolResolution(agent: object, runContext: unknown): void;
@@ -72,7 +76,7 @@ export declare function lazyToolRuntimeForAgent(agent: object): LazyToolRuntime
72
76
  * eager MCP tools stay in the first request; everything else is searchable.
73
77
  * Generic dispatch adds stable ordinary tool_search/tool_invoke schemas.
74
78
  */
75
- export declare function installLazyToolRuntime(agent: CloneCapableAgent, transport: LazyToolTransport, mcpServerIds: ReadonlySet<string>, toolPreparationReady?: Promise<void>, deferredMcpServerIds?: ReadonlySet<string>, preparationIndependentToolNames?: ReadonlySet<string>, modelMcpServerIds?: () => ReadonlyMap<string, string>): LazyToolRuntime;
79
+ export declare function installLazyToolRuntime(agent: CloneCapableAgent, transport: LazyToolTransport, mcpServerIds: ReadonlySet<string>, toolPreparationReady?: Promise<void>, deferredMcpServerIds?: ReadonlySet<string>, preparationIndependentToolNames?: ReadonlySet<string>, modelMcpServerIds?: () => ReadonlyMap<string, string>, conditionalRouter?: boolean, routerInHistory?: boolean): LazyToolRuntime;
76
80
  /** Restore internal real-tool calls to the provider's original dispatcher transcript. */
77
81
  export declare function restoreGenericDispatchHistory(input: ModelRequest["input"]): ModelRequest["input"];
78
82
  /** Per-item form used by the run-local memoized wire projector. */
@@ -1,7 +1,8 @@
1
- import { CredentialProviderMcpMaterial } from "@opengeni/contracts";
1
+ import { CredentialProviderMcpMaterial, type McpServerConnectionRef } from "@opengeni/contracts";
2
2
  export type RunMcpCredentialTarget = {
3
3
  id: string;
4
4
  url: string;
5
+ connectionRef?: McpServerConnectionRef | undefined;
5
6
  };
6
7
  export type RunMcpCredentialMaterial = {
7
8
  mcp?: CredentialProviderMcpMaterial;
@@ -26,7 +27,7 @@ export declare class RunMcpCredentials {
26
27
  /** Validate a complete replacement before changing any live request headers. */
27
28
  prepare(material: RunMcpCredentialMaterial | null): () => void;
28
29
  replace(material: RunMcpCredentialMaterial | null): void;
29
- /** Refuse credentials for omitted, local, or rewritten server routes. */
30
+ /** Refuse credentials for native, omitted, local, or rewritten server routes. */
30
31
  assertRemoteTargets(targets: readonly RunMcpCredentialTarget[]): void;
31
32
  excludeLocalTarget(id: string): void;
32
33
  has(id: string): boolean;
@@ -0,0 +1,10 @@
1
+ /** SDK cleanup warnings do not imply failed connect, discovery, or tool calls.
2
+ * Emit only fixed labels and the runtime's credential-safe error projection. */
3
+ export declare function createMcpTransportLogger(serverId: string, errorFields: (error: unknown, code: "mcp_cleanup_failed" | "mcp_transport_failed", serverId: string) => unknown): {
4
+ namespace: string;
5
+ debug: () => undefined;
6
+ error: (message: string, ...args: unknown[]) => void;
7
+ warn: (message: string, ...args: unknown[]) => void;
8
+ dontLogModelData: boolean;
9
+ dontLogToolData: boolean;
10
+ };
@@ -1,16 +1,32 @@
1
1
  import type { ModelRequest, RunContext, SerializedTool, Tool } from "@openai/agents";
2
- import type { ModelContextInstructionLayer, ModelContextInstructionLayerId, ModelContextSkill, ModelContextSnapshot } from "@opengeni/contracts";
2
+ import type { ModelContextInstructionLayer, ModelContextInstructionLayerId, ModelContextInstructionModule, ModelContextSkill, ModelContextSnapshot } from "@opengeni/contracts";
3
3
  import type { EffectiveSkillSelection } from "./runtime-skills.js";
4
4
  export type PersistentAgentInstructionLayerDraft = {
5
5
  id: ModelContextInstructionLayerId;
6
6
  title: string;
7
7
  content: string;
8
+ /** Modular operational contract only: its prompt modules in order. */
9
+ modules?: readonly ModelContextInstructionModule[];
10
+ /**
11
+ * Separator placed before this layer. Modular layers set it; legacy layers
12
+ * omit it and keep the historical joins byte-for-byte.
13
+ */
14
+ joinBefore?: string;
8
15
  };
9
16
  export declare function buildProviderRequestSnapshot(input: {
10
17
  provider: string;
11
18
  body: string | null;
12
19
  unavailableReason?: string;
13
20
  requestIndex: number;
21
+ /**
22
+ * The agent's persistent instruction layers. When the wire `instructions`
23
+ * start with them, the snapshot names those sections (identity, the
24
+ * operational contract with its prompt modules, governance, ...) so an
25
+ * inspector can show them with titles. The wire body stays the source of
26
+ * truth; an unrecognized prompt yields no sections.
27
+ */
28
+ persistentLayers?: readonly PersistentAgentInstructionLayerDraft[];
29
+ genesisTitleDirective?: string;
14
30
  }): ModelContextSnapshot;
15
31
  export type PersistentAgentInstructionInspection = {
16
32
  layers: readonly PersistentAgentInstructionLayerDraft[];
@@ -6,12 +6,21 @@ export type ModelPreparationMeasurement = {
6
6
  count?: number;
7
7
  };
8
8
  type ModelPreparationObserver = (measurement: ModelPreparationMeasurement) => void;
9
+ type ModelTransportFetch = (...args: Parameters<typeof fetch>) => ReturnType<typeof fetch>;
9
10
  export declare function withModelPreparationObserver<T>(observer: ModelPreparationObserver | undefined, callback: () => T): T;
10
11
  /** Bind one attempt-local durable checkpoint immediately before generic model
11
12
  * transport enters fetch. Cached provider clients are process-global, so this
12
13
  * authority must be async-local rather than stored on the client instance. */
13
14
  export declare function withModelTransportStartedObserver<T>(observer: (() => Promise<void> | void) | undefined, callback: () => T): T;
14
15
  export declare function recordModelTransportStarted(): Promise<void>;
16
+ /** The OpenAI SDK retries thrown fetch errors and replaces their identity with
17
+ * APIConnectionError. Carry only our pre-wire refusal through its HTTP-error
18
+ * path, which honors the retry veto. Native transports keep the original throw.
19
+ * Each fetch owns its context even when concurrent turns share a cached client.
20
+ */
21
+ export declare function sdkModelTransportAdmissionFetch(inner: ModelTransportFetch): ModelTransportFetch;
22
+ /** Restore the exact host-owned error after the SDK has suppressed retries. */
23
+ export declare function rethrowModelTransportAdmissionRefusal(headers: Headers): void;
15
24
  /** Record the first routed sandbox operation boundary without publishing an
16
25
  * overlapping parent duration. The observer receives only exclusive leaf
17
26
  * buckets; this boundary exists solely to split the surrounding SDK work. */
@@ -16,6 +16,10 @@ export declare class OpenGeniChatCompletionsModel extends OpenAIChatCompletionsM
16
16
  export declare class OpenGeniResponsesModel extends AppendOnlyOpenAIResponsesModel {
17
17
  protected readonly provider: ResolvedModelProvider;
18
18
  constructor(client: OpenAI, model: string, provider: ResolvedModelProvider);
19
+ protected _fetchResponse(request: ModelRequest, stream: false): Promise<OpenAI.Responses.Response>;
20
+ protected _fetchResponse(request: ModelRequest, stream: true): Promise<AsyncIterable<OpenAI.Responses.ResponseStreamEvent>>;
21
+ private classifiedResponseStream;
22
+ private ownsResponsesTerminalClassification;
19
23
  protected _buildResponsesCreateRequest(request: ModelRequest, stream: boolean): {
20
24
  requestData: Record<string, any>;
21
25
  sdkRequestHeaders: Record<string, string | null>;
@@ -1,4 +1,5 @@
1
1
  import type { Settings } from "@opengeni/config";
2
+ export { ResponsesStreamingTerminalError } from "./responses-terminal-error.js";
2
3
  export { CodexSubscriptionUnavailableError, OrganizationGatewayUnavailableError, OrganizationOpenRouterUnavailableError, UNKNOWN_MODEL_FINISH_REASON_CODE, UnknownModelFinishReasonError, WorkspaceGatewayUnavailableError, WorkspaceOpenRouterUnavailableError, WorkspaceModelPolicyBlockedError, XaiSubscriptionUnavailableError, } from "./model-provider-errors.js";
3
4
  export { azureOpenAIDefaultQuery, buildOpenAIClientFromSettings, buildProviderClient, configureRuntimeMetricsHooks, recordRuntimeMcpLifecycleMetric, recordRuntimeMcpToolCallMetric, } from "./model-provider-client.js";
4
5
  export { modelRequestPolicyForProvider, normalizeVercelGatewayRequestBody, } from "./model-provider-request-policy.js";
@@ -3,6 +3,15 @@ export type ModelRequestCapture = ((request: ModelRequest) => void | Promise<voi
3
3
  nextProviderRequestIndex?: () => number;
4
4
  onProviderRequest?: (provider: string, body: string | null, reason?: string, index?: number) => void | Promise<void>;
5
5
  };
6
+ /** Awaited producer-side authority, separate from observational request capture. */
7
+ export type ModelCallLifecycle = {
8
+ beforeModelRequest?: () => Promise<void>;
9
+ /** Register before yielding so the next model entry waits for consumer settlement. */
10
+ onModelResponse?: (event: StreamEvent) => Promise<void>;
11
+ };
12
+ export declare function withModelCallLifecycle<T>(lifecycle: ModelCallLifecycle, fn: () => T): T;
13
+ export declare function beforeModelRequest(): Promise<void>;
14
+ export declare function modelResponseSettlement(event: StreamEvent): Promise<void> | undefined;
6
15
  /** The same agent can re-enter runAgentStream after in-activity compaction. */
7
16
  export declare function nextModelContextCaptureIndex(agent: object): number;
8
17
  export declare function withModelRequestCapture<T>(capture: ModelRequestCapture | undefined, fn: () => T): T;
@@ -1,4 +1,4 @@
1
- import OpenAI from "openai";
1
+ import OpenAI, { type APIError } from "openai";
2
2
  import type { APIPromise } from "openai/core/api-promise";
3
3
  /** Internal fetch-init hook used only when a transport performs its own retry. */
4
4
  export declare const REPLAYABLE_REQUEST_BODY_FACTORY: unique symbol;
@@ -46,6 +46,7 @@ export declare function requestBodyText(body: BodyInit | null | undefined): Prom
46
46
  export declare class ReplayableJsonOpenAI extends OpenAI {
47
47
  private readonly modelRequestPolicy;
48
48
  constructor(options: OpenAIOptions, hooks?: ReplayableJsonOpenAIHooks);
49
+ protected makeStatusError(status: number, error: NonNullable<Parameters<typeof APIError.generate>[1]>, message: string | undefined, headers: Headers): APIError;
49
50
  post<Rsp>(path: string, opts?: OpenAIPostOptions): APIPromise<Rsp>;
50
51
  buildRequest(inputOptions: OpenAIBuildOptions, context?: OpenAIBuildContext): Promise<OpenAIBuildResult>;
51
52
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * An unsuccessful Responses terminal, intercepted before the Agents SDK
3
+ * replaces its provider code/diagnostic with a generic ModelBehaviorError.
4
+ * Only closed provider codes grant recovery; diagnostic wording does not.
5
+ * The exception message is structural so SDK logs/traces cannot expose detail.
6
+ */
7
+ export declare class ResponsesStreamingTerminalError extends Error {
8
+ readonly eventType: "response.failed" | "response.error" | "error";
9
+ readonly code: string | undefined;
10
+ readonly type: string | undefined;
11
+ readonly detail: string;
12
+ readonly headers: Headers;
13
+ readonly retryAfterSeconds: number | undefined;
14
+ readonly category: "safety" | "request" | "rate_limit" | "unavailable" | "unknown";
15
+ constructor(eventType: "response.failed" | "response.error" | "error", source: unknown, headers?: Headers);
16
+ }
17
+ export declare function responsesStreamingTerminalError(event: unknown, headers?: Headers): ResponsesStreamingTerminalError | undefined;
@@ -9,6 +9,7 @@ export type SandboxCodemodeAuthority = {
9
9
  turnId: string;
10
10
  attemptId: string;
11
11
  executionGeneration: number;
12
+ credentialRestriction?: "developer_setup";
12
13
  };
13
14
  export type MintedSandboxCodemodeToken = {
14
15
  token: string;
@@ -19,7 +19,7 @@ export { SandboxConfigError, SandboxExactResumeInstanceUnavailableError, Sandbox
19
19
  export { PROVIDER_REGISTRY, assertProviderRegistryInvariants, buildImmutableProviderImage, isProviderApiThrottleError, prepareProviderForTeardownAfterCapture, providerSupportsImmutableImageBuild, renewSandboxProviderExpiration, providerWorkspaceCapturePolicy, type ProviderRegistration, type ProviderConstructionContext, type ProviderExactResumeMode, type ProviderImmutableImageBuildInput, type ProviderImmutableImageBuildResult, type ProviderExpirationRenewalInput, type ProviderWorkspaceCapturePolicy, type ProviderWorkspaceCaptureTakeover, } from "./providers/index.js";
20
20
  export { classifyProviderSandboxFailure, isProviderSandboxGoneDuringRoutedOperation, isProviderSandboxNotFoundError, isProviderSandboxTransientError, type ProviderSandboxFailure, type ProviderSandboxFailureKind, } from "./provider-errors.js";
21
21
  export { WORKSPACE_ARCHIVE_DESCRIPTOR_VERSION, WorkspaceArchiveIntegrityError, captureVerifiedWorkspaceArchive, decodeNativeSnapshotRef, encodeNativeSnapshotRef, describeLegacyNativeSnapshotArchive, describeNativeSnapshotArchive, fingerprintSandboxWorkspace, inlineWorkspaceArchiveForRestore, parseWorkspaceArchiveDescriptor, readVerifiedWorkspaceArchive, verifyRestoredWorkspace, type NativeSnapshotDescriptor, type NativeSnapshotProvider, type NativeSnapshotRef, type TarWorkspaceArchiveDescriptor, type VerifiedWorkspaceArchive, type WorkspaceArchiveDescriptor, type WorkspaceArchiveIntegrityCode, type WorkspaceTreeFingerprint, } from "./workspace-archive.js";
22
- export { ensureModalRegistryImage, deleteModalCheckpointSnapshot, inspectModalSandboxLifecycle, isModalTaskExecStartPreDispatchUnavailableError, modalSessionMatchesCheckpointProviderBinding, modalSandboxAttributionEnvironment, modalSandboxAttributionTags, resolveModalCheckpointProviderBinding, findModalProviderCreateReceipt, resolveModalCheckpointProviderBindingForLiveSandbox, resolveModalCheckpointProviderBindingForSession, sweepModalOrphanSandboxes, tagModalSandbox, terminateModalSandboxById, type LiveModalSandboxLeaseAttribution, type ModalModuleLoader, type ModalCheckpointProviderBinding, type ModalOrphanSweepResult, type ModalOrphanSweepTermination, type ModalSandboxAttribution, type RevalidateModalOrphanTermination, } from "./providers/modal.js";
22
+ export { ensureModalRegistryImage, deleteModalCheckpointSnapshot, inspectModalSandboxLifecycle, isModalTaskExecStartPreDispatchUnavailableError, isModalCommandStartOutcomeUnknownError, modalSessionMatchesCheckpointProviderBinding, modalSandboxAttributionEnvironment, modalSandboxAttributionTags, resolveModalCheckpointProviderBinding, findModalProviderCreateReceipt, resolveModalCheckpointProviderBindingForLiveSandbox, resolveModalCheckpointProviderBindingForSession, sweepModalOrphanSandboxes, tagModalSandbox, terminateModalSandboxById, type LiveModalSandboxLeaseAttribution, type ModalModuleLoader, type ModalCheckpointProviderBinding, type ModalOrphanSweepResult, type ModalOrphanSweepTermination, type ModalSandboxAttribution, type RevalidateModalOrphanTermination, } from "./providers/modal.js";
23
23
  export { OpenSandboxClient, OpenSandboxSession, setOpenSandboxApplyDiff, type OpenSandboxApplyDiff, type OpenSandboxClientOptions, type OpenSandboxEditor, type OpenSandboxSessionState, } from "./providers/opensandbox-adapter.js";
24
24
  export { selectBackend, sdkBackendIdForSandboxBackend, sandboxBackendForSdkBackendId, backendSupportsOs, desktopCapableBackend, negotiateCapabilities, type NegotiationContext, } from "./select.js";
25
25
  export { STREAM_TOKEN_DEFAULT_TTL_SECONDS, mintStreamToken, verifyStreamToken, StreamTokenPayload, type MintStreamTokenInput, type StreamTokenPayloadType, } from "./stream-token.js";
@@ -49,7 +49,7 @@ export { nextDurableOpId, runWithToolCallCorrelation, sanitizeOpIdToken } from "
49
49
  export { negotiateSelfhostedCapabilities, selfhostedLiveness, selfhostedHeartbeatLiveness, SELFHOSTED_RECONNECT_WINDOW_MS, type SelfhostedNegotiationInput, type SelfhostedLivenessState, type SelfhostedEnrollment, } from "./selfhosted/capabilities.js";
50
50
  export { MockAgentResponder, type MockAgentResponderOptions, type MockExecHandler, } from "./selfhosted/testing.js";
51
51
  export { createMockSelfhostedOpStream, FakeOpRunner, type FakeOpScript, InMemoryOpStreamTransport, } from "./selfhosted/op-testing.js";
52
- export { isRoutingMutationOutcomeUnknownError, RoutingBackendRecoveryRequiredError, RoutingMutationOutcomeUnknownError, RoutingRetainedProcessNotFoundError, RoutingSandboxSession, RoutingWorkspaceRootChangedError, RoutingActiveRouteChangedError, RoutingUnsupportedError, type ActivePointer, type DefaultBackendLossResult, type RoutableBackendSession, type ResolvedActiveBackend, type RoutingMutationSettlementResult, type RoutingSandboxFirstOperationObservation, type RoutingSandboxFirstOperationObserver, type RoutingSandboxFirstOperationPhase, type RoutingSandboxFirstOperationPhaseObservation, type RoutingSandboxOperationObservation, type RoutingSandboxOperationObserver, type RoutingSandboxCaptureWaitObserver, type RoutingSandboxPhaseOutcome, type RoutingSandboxWaitObservation, type RoutingRetainedProcess, type RoutingRetainedProcessAdoption, type RoutingRetainedProcessTerminalProof, type RoutingSandboxSessionDeps, type RoutingTransitionEvent, } from "./routing/routing-session.js";
52
+ export { isRoutingMutationOutcomeUnknownError, RoutingBackendRecoveryRequiredError, RoutingMutationOutcomeUnknownError, renderRoutingMutationOutcomeUnknownToolResult, RoutingRetainedProcessNotFoundError, RoutingSandboxSession, RoutingWorkspaceRootChangedError, RoutingActiveRouteChangedError, RoutingUnsupportedError, type ActivePointer, type DefaultBackendLossResult, type RoutableBackendSession, type ResolvedActiveBackend, type RoutingMutationSettlementResult, type RoutingSandboxFirstOperationObservation, type RoutingSandboxFirstOperationObserver, type RoutingSandboxFirstOperationPhase, type RoutingSandboxFirstOperationPhaseObservation, type RoutingSandboxOperationObservation, type RoutingSandboxOperationObserver, type RoutingSandboxCaptureWaitObserver, type RoutingSandboxPhaseOutcome, type RoutingSandboxWaitObservation, type RoutingRetainedProcess, type RoutingRetainedProcessAdoption, type RoutingRetainedProcessTerminalProof, type RoutingSandboxSessionDeps, type RoutingTransitionEvent, } from "./routing/routing-session.js";
53
53
  export { makeActiveBackendResolver, ActiveBackendUnresolvableError, swapTargetEstablishability, type ActiveBackendResolverDeps, type RoutableSandbox, type BackendUnresolvableCode, type SwapTargetEstablishability, } from "./routing/backend-resolver.js";
54
54
  /**
55
55
  * Construct the raw provider SandboxClient for the configured backend. Registry-
@@ -165,7 +165,7 @@ export declare const MODAL_EXEC_READINESS_TIMEOUT_MS = 60000;
165
165
  /** A provider handle is not workspace readiness. Providers with asynchronous
166
166
  * startup must pass this bounded command probe before a caller publishes the
167
167
  * lease warm/ready. */
168
- export declare function verifySandboxExecReadiness(established: EstablishedSandboxSession, timeoutMs?: number): Promise<void>;
168
+ export declare function verifySandboxExecReadiness(established: EstablishedSandboxSession, timeoutMs?: number, signal?: AbortSignal): Promise<void>;
169
169
  export type SandboxCreatedCallback = (established: EstablishedSandboxSession) => Promise<void>;
170
170
  /** Resolve the stable OpenGeni identity first, then legacy SDK provider keys.
171
171
  * The fallback is compatibility-only: new envelopes always persist the stable