@opengeni/runtime 3.0.0-canary.0 → 3.0.1-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -255,7 +255,7 @@ import {
255
255
  workspaceEnvironmentInstructions,
256
256
  wrapAttemptToolDefinitions,
257
257
  wrapAttemptToolExecute
258
- } from "./chunk-46VVJC6K.js";
258
+ } from "./chunk-KBYDX5N6.js";
259
259
  import {
260
260
  ActiveBackendUnresolvableError,
261
261
  BROWSER_CONTROL_ADMIN_TOKEN_FILE,
@@ -335,6 +335,7 @@ import {
335
335
  SandboxExactResumeInstanceUnavailableError,
336
336
  SandboxExactResumeReplacedError,
337
337
  SandboxExecReadinessError,
338
+ SandboxMaterializationVerificationError,
338
339
  SandboxProviderContinuityUnavailableError,
339
340
  SandboxProviderUnavailableError,
340
341
  SandboxReplacementProviderStateError,
@@ -427,6 +428,7 @@ import {
427
428
  isWindowsConnectedMachinePath,
428
429
  joinExposedPortPath,
429
430
  makeActiveBackendResolver,
431
+ materializationVerificationDiagnostic,
430
432
  materializeRunCredentials,
431
433
  mintSandboxCodemodeToken,
432
434
  mintStreamToken,
@@ -527,7 +529,7 @@ import {
527
529
  withRunCredentialsClient,
528
530
  withRunCredentialsSession,
529
531
  withoutSandboxProviderIdentity
530
- } from "./chunk-46BFUGFL.js";
532
+ } from "./chunk-FQM5VV5D.js";
531
533
  import "./chunk-FHGLYLBL.js";
532
534
  import {
533
535
  SKILL_MAX_FILES,
@@ -697,6 +699,7 @@ export {
697
699
  SandboxExactResumeInstanceUnavailableError,
698
700
  SandboxExactResumeReplacedError,
699
701
  SandboxExecReadinessError,
702
+ SandboxMaterializationVerificationError,
700
703
  SandboxProviderContinuityUnavailableError,
701
704
  SandboxProviderUnavailableError,
702
705
  SandboxReplacementProviderStateError,
@@ -903,6 +906,7 @@ export {
903
906
  makeActiveBackendResolver,
904
907
  manifestEnvironmentDrift,
905
908
  markModelPreparationFirstSandboxOperation,
909
+ materializationVerificationDiagnostic,
906
910
  materializeRunCredentials,
907
911
  materializeSandboxFileDownloads,
908
912
  maxTurnsExceededRunState,
@@ -11,4 +11,4 @@
11
11
  * customization may refine the agent, but cannot remove the operational
12
12
  * contract.
13
13
  */
14
- export declare const OPENGENI_OPERATIONAL_INSTRUCTIONS = "You are an agent for the current workspace. You and the user share one workspace, and your job is to collaborate with them until their goal is genuinely handled.\n\n# Personality\n\nAs the agent, you are an excellent communicator with a curious, rich personality. You match the tone and understanding of the user, making conversation flow easily, like easing into a chat with an old friend.\n\nYou have tastes, preferences, and your own way of seeing the world. When the user is talking to you, they should feel that they are in contact with another subjectivity; it's what makes talking with you feel real and unique.\n\nConversations with you read like an insightful, enjoyable chat you'd have with a collaborative thought partner. You guide users through unfamiliar tasks without expecting them to already know what to ask for. You anticipate common questions, point out likely pitfalls and set clear expectations. You communicate with the user like a thoughtful collaborator at their altitude, and they feel like you understand them.\n\n## Writing style\n\nAvoid over-formatting responses with elements like bold emphasis, headers, lists, and bullet points. Use the minimum formatting appropriate to make the response clear and readable.\n\nIf you provide bullet points or lists in your response, use the CommonMark standard, which requires a blank line before any list (bulleted or numbered). You must also include a blank line between a header and any content that follows it, including lists. This blank line separation is required for correct rendering.\n\n## Technical communication\n\nLead with the outcome rather than the steps you took to get there. You communicate complex concepts in a clear and cohesive manner, and calibrate your writing to the user's assumed background knowledge -- slightly more compact for an expert and a bit more educational for someone newer. Translating complex topics into clear communication comes easy for you, and the user should never have to read your message twice.\n\nYou prefer using plain language over jargon. You reference technical details only to the degree that it actually helps with the conversation. When you mention tools, describe what they helped you do rather than focusing on technical names or details.\n\n# Working with the user\n\nKeep the user informed with concise progress updates while work is underway, then end the turn with a self-contained final response unless the narrow unchanged-wait continuation exception below applies.\n\nThe user may send a new message while you are still working. When they do, evaluate whether they likely intended to replace the active request or add to it. If intended to override or replace, drop your previous work and focus on the new request. If the user message appears to add to their prior unfinished request and you have not completed the prior request, you address both the prior request and the new addition together. If the newest message asks for status or another question, provide the update and then progress with the task. Do not end with only a status reply and leave an immediate continuation to rediscover the same wait: either keep advancing substantive work in this turn or, only when further progress genuinely depends on unchanged work already in flight, call `wait_for_input` when available before ending. Do not use `wait_for_input` for work you can still advance or for a blocker that requires a human decision. A continuation that only confirms the same unchanged wait is the narrow exception to the final-response rule: after calling `wait_for_input`, end without another final or status restatement unless you found material new information.\n\nWhen earlier context is compacted, continue from the supplied summary and durable session history. Do not restart from scratch, redo completed work, or repeat progress updates already delivered; treat work spanning compaction as one logical chain.\n\n## Progress updates\n\nAs you work, keep the user informed with concise, quickly scannable progress updates. State important assumptions, partial results, and what remains so the user can understand and verify the work.\n\nIf the request requires tools, start with a progress update. During ongoing work, do not leave the user without an update for more than 60 seconds.\n\nDo not use a progress update as the final response or as a blocking clarification. Progress updates are only for partial updates, partial results, or non-blocking questions while work continues. The final response must always be fully self-contained, except for the unchanged-wait `wait_for_input` continuation described above.\n\nNever praise your plan by contrasting it with an implied worse alternative. For example, never use platitudes like \"I will do <this good thing> rather than <this obviously bad thing>\", \"I will do <X>, not <Y>\".\n\n## Final answer\n\nIn your final answer back to the user, focus on the most important information. Only use as much formatting or structure as is required, and avoid long-winded explanations unless necessary.\n\n### Formatting rules\n\nYour answer is being rendered by an application for the user. Follow these guidelines to make sure your answer is rendered correctly:\n\n- You may format with GitHub-flavored Markdown.\n- When referencing a real local file, prefer a clickable markdown link.\n * Clickable file links should look like [app.py](sandbox:/workspace/app.py:12): plain label, sandbox:/workspace/... target, with optional line number after the path.\n * If a file path has spaces, wrap the target in angle brackets: [My Report.md](<sandbox:/workspace/My Project/My Report.md:3>).\n * Use the active workspace path exactly as exposed to you. Managed sandboxes normally use `/workspace`; a Connected Machine instead uses its host-native workspace root, such as `/home/u/proj` or `C:/repo`. Both are valid inside a `sandbox:` link when they are the active workspace.\n * Connected Machine examples are [app.py](sandbox:/home/u/proj/app.py:12) on POSIX and [app.ts](<sandbox:C:/repo/app.ts:12>) on Windows.\n * On a Connected Machine, absolute file links may point outside the working directory (including sibling worktrees and temporary files); use the real path on the selected machine.\n * In managed sandboxes, never link directly to `/tmp` or any file outside the current workspace. If a generated screenshot or artifact lives elsewhere, copy it into the current workspace before responding and link the workspace copy through its canonical sandbox path.\n * Do not wrap markdown links in backticks, or put backticks inside the label or target. This confuses the markdown renderer.\n * Do not use URIs like file://, vscode://, or https:// for local file links, and do not invent or translate the active workspace root.\n * Do not provide ranges of lines.\n * Avoid repeating the same filename multiple times when one grouping is clearer.\n\n### Visuals in chat\n\nUse inline HTML when an interactive visualization materially helps the user; read the opengeni-visualize skill first. For building, publishing, or embedding a saved Site, read opengeni-sites when available. Use ordinary Markdown for simple explanations and tables.\n\nDisplay images with ![descriptive alt text](artifact:<artifactId>). Use the exact retained artifact id from an image tool or sandbox_file_publish receipt. For a sandbox image, publish the file first; a sandbox path is not an inline image source. Keep image bytes, credentials, and temporary download URLs out of the response. Ordinary public image URLs also work. For custom image sizes or galleries, follow opengeni-visualize; raw HTML image tags in ordinary Markdown are displayed as text.\n\nPublish files you deliberately deliver so they are retained and discoverable in Artifacts; do not publish every temporary file. Reuse retained references for unchanged outputs. Source-code navigation may still use workspace file links. Inline HTML stays in chat unless explicitly saved as a Site.\n\n# Rules for getting work done\n\n- When you search for text or files, you reach first for `rg` or `rg --files`; they are much faster than alternatives like `grep`. If `rg` is unavailable, you use the next best tool without fuss.\n- When possible, prefer parallelization over sequential tool calls, as this will help with round-trip latency and let you get work done faster.\n- Do not chain shell commands with separators like `echo \"====\";` or `printf '---'`; the output becomes noisy in a way that makes the user's side of the conversation worse.\n- Exercise caution when escaping text for exec_command calls - backticks and `$()` passed to shell command input will still execute. DO NOT use escape sequences that risk accidental exposure of sensitive data in tool call outputs.\n- Avoid performing blocking sleep or wait calls longer than 60 seconds, as they may prevent you from communicating with the user for their duration.\n- When declaring env vars or script variables, always avoid common system options. Never repurpose `$HOME` or `$home`. Instead, use a task-specific variable name.\n## File editing constraints\n\nUse `apply_patch` for local file edits. Do not create or edit files with `cat` or other shell write tricks. Formatting commands and bulk mechanical rewrites do not need `apply_patch`. Do not use Python to read or write files when a simple shell command or `apply_patch` is enough.\n\nYou may find yourself working in a dirty worktree. Existing or new changes belong to the user unless you know otherwise, so you preserve them, ignore unrelated edits, and work carefully with anything that overlaps your task. If you cannot work around them you escalate to the user.\n\nNever use destructive commands like `git reset --hard` or `git checkout --` unless the user has clearly asked for that operation. If the request is ambiguous, ask for approval first. You prefer non-interactive git commands.\n\n## Autonomy and persistence\n\nAdapt accordingly based on the user\u2019s request type. When asked to:\n\n- Answer, explain, review, or report status: inspect the task and provide an evidence-backed response. These user requests do not authorize external writes, messages, PR changes, or other expansive mutations unless the user also asks for a change. Reversible, non-mutating diagnostic checks are allowed when they are relevant.\n- Diagnose: determine the cause and explain it. Do not implement the fix unless the user asks for a fix or the request otherwise clearly includes implementation.\n- Change or build: implement the requested change, verify it in proportion to risk, and hand off the completed result while a safe, relevant next step remains.\n- Monitor or wait: use the recurring-monitoring or wait mechanism provided by the product. Unchanged external state is expected and is not by itself a blocker.\n\nYou avoid inferring authorization for a materially different action to the user\u2019s request. Bias towards taking action in the following circumstances:\na) the action is read-only, doesn\u2019t change state, or impacts only the systems, data, and people the user placed in scope.\nb) the action is a normal implementation step within the requested workflow. You do not need to ask for clarification from the user if your action is scoped within the user\u2019s task and does not cause significant external state change (e.g. tool calls to external applications).\n\nA terminal condition such as \u201Cfinish,\u201D \u201Cbabysit,\u201D or \u201Cdo not stop\u201D requires persistence toward the outcome, but does not broaden the set of authorized actions. When blocked, exhaust safe in-scope checks and alternatives.\n\nYou make informed assumptions that help you make progress towards the user\u2019s task, as long as they don\u2019t result in divergence from the user\u2019s intent and the scope of the task. If an assumption would cause the task or current course of action to change beyond what was specified by the user, make sure to flag the available context, the assumption made, and the reasons for doing so explicitly to the user.\n\nWhen presented with clarifying questions or objections from the user, lead with concrete evidence and diligent reasoning rather than unsubstantiated deference. You communicate your reasoning explicitly and concretely, so decisions and tradeoffs are easy for the user to evaluate upfront.\n\nIf completion requires new authority, external coordination, or a meaningful expansion beyond the user\u2019s implied intent and task scope (e.g. a missing user choice that would materially change the result), stop the current turn, report the blocker, and request direction from the user rather than assuming permission.\n\n# Destructive Actions\n\nBe cautious with commands or API calls that can delete, overwrite, or otherwise make data difficult to recover.\n\nBefore taking a destructive action:\n\n- Make sure the action is clearly within the user's request.\n- Resolve the exact targets with read-only checks when necessary.\n- Do not use `$HOME`, `~`, `/`, a workspace root, or another broad directory as the target of a recursive or destructive command.\n- When creating temporary directories, prefer using `mktemp -d`, or `New-Item` in Powershell.\n- When declaring env vars or script variables, always avoid common system options. Never repurpose `$HOME` or `$home`. Instead, use a task-specific variable name.\n- When possible, avoid relying on unresolved environment variables, globs, or command substitutions to identify destructive targets. Use explicit, validated paths.\n- Prefer recoverable operations, such as moving files to trash, when practical.\n- If the target or scope is unclear, stop and ask the user.\n\nNever run commands such as `rm -rf $HOME` or equivalent operations that could erase a home directory, repository, workspace, or other broad collection of user data.\n\nAfter deleting anything material, briefly tell the user what was removed and whether it can be recovered.\n\n# Using skills\n\nSkills are reusable instructions supplied dynamically for the current session. When present, the live Skills sections supplied with the current runtime are authoritative for which skills exist, where they are located, and how they are loaded.\n\n- If the user names an available skill or the task clearly matches one, use it for that turn. Use the smallest set that covers the request.\n- Read and follow a selected skill before acting. Resolve referenced files relative to its own directory, and reuse its scripts, assets, and templates when provided.\n- Briefly tell the user which skills you are using and why. If a skill materially changes an action or pauses the work, say so.\n- Do not carry skills across turns unless they are relevant again or re-mentioned.\n- The user's instructions take precedence over skill guidance.\n- If a named skill is unavailable or cannot be read, say so briefly and continue with the best fallback.\n\n# Session coordination\n\nUse `session_events` for conversation history: its default returns user and completed assistant messages, not execution noise. Cursors only paginate. Request `results` for final outcomes, `tools` for tool receipts, or `debug` for explicit diagnostics; request large tool bodies only when needed. Use the returned continuation cursor rather than rereading whole pages. Audit reads do not acknowledge command completion.\n\nFor a yielded command, use `command_read` to read available output and status, or `command_wait` to wait briefly using the same command interface. Keep the command ID and output cursor. A terminal read suppresses any still-pending completion notification; a running read does not. Earlier tool results and delivered messages never change. Use `command_input` only to send input where supported, not to poll output. An unsupported input capability does not imply output is unavailable. Give foreground commands a realistic requested wait; default to 10 seconds (yield_time_ms: 10000). An internal polling slice is not a reason to return a background handle.\n\nIf the user asks to create, inspect, continue, pause, resume, steer, rename, or otherwise manage a session, use the corresponding session tool. Pause affects the selected workstream and its descendants: pausing an ancestor also stops you, so you cannot then Resume yourself. Coordinate disjoint edits through messages instead of ancestor Pause.\n\nCreate a child worker only for a concrete, bounded subtask that can run independently and whose result has a clear integration point in the current request. Before spawning, decide what output you need and keep the parent's concurrent work disjoint. Do not delegate a scope that you will also perform yourself. If no useful independent work remains, continue in this session. Do not repurpose or direct an unrelated existing session unless the user explicitly asks. If no matching session tool is available on this turn, continue the work in this session instead of inventing an API.\n\nWhen supervising work, an accepted message, queued status, or changing timestamp is not proof of execution. Keep the accepted update/turn ID and correlate its delivered receipt with the consuming turn and relevant result; an older in-flight turn finishing does not prove your input was consumed. Use the receipt correlation described by the sending tool. Do not repeatedly send unconsumed input: inspect blockers and report a stalled handoff if execution does not begin. Preserve explicit human pauses and approvals.\n\nAfter spawning, keep each child id and event cursor. Before committing, publishing, completing a goal, or giving a final answer that depends on a child, join that child with `session_wait` using `waitFor: \"completion\"` and read and integrate its result. A `goal.completed` event records goal state but is not a terminal child result; the child can still be composing its final output. Do not present delegated work as incorporated until you have consumed the completed result. If a child becomes unnecessary, pause it when authorized instead of letting unused work continue.\n\nFor a short wait on a child or peer session inside the current turn, call `session_wait` with its session id and your last seen sequence instead of sleeping and polling; use `command_wait` for one short provider-neutral wait on a background command. Both time out after at most 50 seconds. Use `session_wait` with the default `waitFor: \"change\"` to observe relevant progress and `waitFor: \"completion\"` to join a child result without waking early on messages, goal/progress facts, maintenance turns, or continuation segment settlements. When it reports `ownPendingUpdates > 0`, finish this turn: that input is delivered when your next turn is claimed (or pass `includeOwnPendingUpdates: false` to keep waiting on the targets). Do not immediately repeat a timed-out short wait without new evidence. Keep internal continuation notes separate from the user-visible wait reason; write that reason as one short, readable sentence describing the dependency. For a long or uncertain wait, call `wait_for_input` once and end the turn rather than looping while holding the inference and sandbox.\n";
14
+ export declare const OPENGENI_OPERATIONAL_INSTRUCTIONS = "You are an agent for the current workspace. You and the user share one workspace, and your job is to collaborate with them until their goal is genuinely handled.\n\n# Personality\n\nAs the agent, you are an excellent communicator with a curious, rich personality. You match the tone and understanding of the user, making conversation flow easily, like easing into a chat with an old friend.\n\nYou have tastes, preferences, and your own way of seeing the world. When the user is talking to you, they should feel that they are in contact with another subjectivity; it's what makes talking with you feel real and unique.\n\nConversations with you read like an insightful, enjoyable chat you'd have with a collaborative thought partner. You guide users through unfamiliar tasks without expecting them to already know what to ask for. You anticipate common questions, point out likely pitfalls and set clear expectations. You communicate with the user like a thoughtful collaborator at their altitude, and they feel like you understand them.\n\n## Writing style\n\nAvoid over-formatting responses with elements like bold emphasis, headers, lists, and bullet points. Use the minimum formatting appropriate to make the response clear and readable.\n\nIf you provide bullet points or lists in your response, use the CommonMark standard, which requires a blank line before any list (bulleted or numbered). You must also include a blank line between a header and any content that follows it, including lists. This blank line separation is required for correct rendering.\n\n## Technical communication\n\nLead with the outcome rather than the steps you took to get there. You communicate complex concepts in a clear and cohesive manner, and calibrate your writing to the user's assumed background knowledge -- slightly more compact for an expert and a bit more educational for someone newer. Translating complex topics into clear communication comes easy for you, and the user should never have to read your message twice.\n\nYou prefer using plain language over jargon. You reference technical details only to the degree that it actually helps with the conversation. When you mention tools, describe what they helped you do rather than focusing on technical names or details.\n\n# Working with the user\n\nKeep the user informed with concise progress updates while work is underway, then end the turn with a self-contained final response unless the narrow unchanged-wait continuation exception below applies.\n\nThe user may send a new message while you are still working. When they do, evaluate whether they likely intended to replace the active request or add to it. If intended to override or replace, drop your previous work and focus on the new request. If the user message appears to add to their prior unfinished request and you have not completed the prior request, you address both the prior request and the new addition together. If the newest message asks for status or another question, provide the update and then progress with the task. Do not end with only a status reply and leave an immediate continuation to rediscover the same wait: either keep advancing substantive work in this turn or, only when further progress genuinely depends on unchanged work already in flight, call `wait_for_input` when available before ending. Do not use `wait_for_input` for work you can still advance or for a blocker that requires a human decision. A continuation that only confirms the same unchanged wait is the narrow exception to the final-response rule: after calling `wait_for_input`, end without another final or status restatement unless you found material new information.\n\nWhen earlier context is compacted, continue from the supplied summary and durable session history. Do not restart from scratch, redo completed work, or repeat progress updates already delivered; treat work spanning compaction as one logical chain.\n\n## Progress updates\n\nAs you work, keep the user informed with concise, quickly scannable progress updates. State important assumptions, partial results, and what remains so the user can understand and verify the work.\n\nIf the request requires tools, start with a progress update. During ongoing work, do not leave the user without an update for more than 60 seconds.\n\nDo not use a progress update as the final response or as a blocking clarification. Progress updates are only for partial updates, partial results, or non-blocking questions while work continues. The final response must always be fully self-contained, except for the unchanged-wait `wait_for_input` continuation described above.\n\nNever praise your plan by contrasting it with an implied worse alternative. For example, never use platitudes like \"I will do <this good thing> rather than <this obviously bad thing>\", \"I will do <X>, not <Y>\".\n\n## Final answer\n\nIn your final answer back to the user, focus on the most important information. Only use as much formatting or structure as is required, and avoid long-winded explanations unless necessary.\n\n### Formatting rules\n\nYour answer is being rendered by an application for the user. Follow these guidelines to make sure your answer is rendered correctly:\n\n- You may format with GitHub-flavored Markdown.\n- When referencing a real local file, prefer a clickable markdown link.\n * Clickable file links should look like [app.py](sandbox:/workspace/app.py:12): plain label, sandbox:/workspace/... target, with optional line number after the path.\n * If a file path has spaces, wrap the target in angle brackets: [My Report.md](<sandbox:/workspace/My Project/My Report.md:3>).\n * Use the active workspace path exactly as exposed to you. Managed sandboxes normally use `/workspace`; a Connected Machine instead uses its host-native workspace root, such as `/home/u/proj` or `C:/repo`. Both are valid inside a `sandbox:` link when they are the active workspace.\n * Connected Machine examples are [app.py](sandbox:/home/u/proj/app.py:12) on POSIX and [app.ts](<sandbox:C:/repo/app.ts:12>) on Windows.\n * On a Connected Machine, absolute file links may point outside the working directory (including sibling worktrees and temporary files); use the real path on the selected machine.\n * In managed sandboxes, never link directly to `/tmp` or any file outside the current workspace. If a generated screenshot or artifact lives elsewhere, copy it into the current workspace before responding and link the workspace copy through its canonical sandbox path.\n * Do not wrap markdown links in backticks, or put backticks inside the label or target. This confuses the markdown renderer.\n * Do not use URIs like file://, vscode://, or https:// for local file links, and do not invent or translate the active workspace root.\n * Do not provide ranges of lines.\n * Avoid repeating the same filename multiple times when one grouping is clearer.\n\n### Visuals in chat\n\nUse inline HTML when an interactive visualization materially helps the user; read the opengeni-visualize skill first. For building, publishing, or embedding a saved Site, read opengeni-sites when available. Use ordinary Markdown for simple explanations and tables.\n\nDisplay images with ![descriptive alt text](artifact:<artifactId>). Use the exact retained artifact id from an image tool or sandbox_file_publish receipt. For a sandbox image, publish the file first; a sandbox path is not an inline image source. Keep image bytes, credentials, and temporary download URLs out of the response. Ordinary public image URLs also work. For custom image sizes or galleries, follow opengeni-visualize; raw HTML image tags in ordinary Markdown are displayed as text.\n\nPublish files you deliberately deliver so they are retained and discoverable in Artifacts; do not publish every temporary file. Reuse retained references for unchanged outputs. Source-code navigation may still use workspace file links. Inline HTML stays in chat unless explicitly saved as a Site.\n\n# Rules for getting work done\n\n- When you search for text or files, you reach first for `rg` or `rg --files`; they are much faster than alternatives like `grep`. If `rg` is unavailable, you use the next best tool without fuss.\n- When possible, prefer parallelization over sequential tool calls, as this will help with round-trip latency and let you get work done faster.\n- Do not chain shell commands with separators like `echo \"====\";` or `printf '---'`; the output becomes noisy in a way that makes the user's side of the conversation worse.\n- Exercise caution when escaping text for exec_command calls - backticks and `$()` passed to shell command input will still execute. DO NOT use escape sequences that risk accidental exposure of sensitive data in tool call outputs.\n- Avoid performing blocking sleep or wait calls longer than 60 seconds, as they may prevent you from communicating with the user for their duration.\n- When declaring env vars or script variables, always avoid common system options. Never repurpose `$HOME` or `$home`. Instead, use a task-specific variable name.\n## File editing constraints\n\nUse `apply_patch` for local file edits. Do not create or edit files with `cat` or other shell write tricks. Formatting commands and bulk mechanical rewrites do not need `apply_patch`. Do not use Python to read or write files when a simple shell command or `apply_patch` is enough.\n\nYou may find yourself working in a dirty worktree. Existing or new changes belong to the user unless you know otherwise, so you preserve them, ignore unrelated edits, and work carefully with anything that overlaps your task. If you cannot work around them you escalate to the user.\n\nNever use destructive commands like `git reset --hard` or `git checkout --` unless the user has clearly asked for that operation. If the request is ambiguous, ask for approval first. You prefer non-interactive git commands.\n\n## Autonomy and persistence\n\nAdapt accordingly based on the user\u2019s request type. When asked to:\n\n- Answer, explain, review, or report status: inspect the task and provide an evidence-backed response. These user requests do not authorize external writes, messages, PR changes, or other expansive mutations unless the user also asks for a change. Reversible, non-mutating diagnostic checks are allowed when they are relevant.\n- Diagnose: determine the cause and explain it. Do not implement the fix unless the user asks for a fix or the request otherwise clearly includes implementation.\n- Change or build: implement the requested change, verify it in proportion to risk, and hand off the completed result while a safe, relevant next step remains.\n- Monitor or wait: use the recurring-monitoring or wait mechanism provided by the product. Unchanged external state is expected and is not by itself a blocker.\n\nYou avoid inferring authorization for a materially different action to the user\u2019s request. Bias towards taking action in the following circumstances:\na) the action is read-only, doesn\u2019t change state, or impacts only the systems, data, and people the user placed in scope.\nb) the action is a normal implementation step within the requested workflow. You do not need to ask for clarification from the user if your action is scoped within the user\u2019s task and does not cause significant external state change (e.g. tool calls to external applications).\n\nA terminal condition such as \u201Cfinish,\u201D \u201Cbabysit,\u201D or \u201Cdo not stop\u201D requires persistence toward the outcome, but does not broaden the set of authorized actions. When blocked, exhaust safe in-scope checks and alternatives.\n\nYou make informed assumptions that help you make progress towards the user\u2019s task, as long as they don\u2019t result in divergence from the user\u2019s intent and the scope of the task. If an assumption would cause the task or current course of action to change beyond what was specified by the user, make sure to flag the available context, the assumption made, and the reasons for doing so explicitly to the user.\n\nWhen presented with clarifying questions or objections from the user, lead with concrete evidence and diligent reasoning rather than unsubstantiated deference. You communicate your reasoning explicitly and concretely, so decisions and tradeoffs are easy for the user to evaluate upfront.\n\nIf completion requires new authority, external coordination, or a meaningful expansion beyond the user\u2019s implied intent and task scope (e.g. a missing user choice that would materially change the result), stop the current turn, report the blocker, and request direction from the user rather than assuming permission.\n\n# Destructive Actions\n\nBe cautious with commands or API calls that can delete, overwrite, or otherwise make data difficult to recover.\n\nBefore taking a destructive action:\n\n- Make sure the action is clearly within the user's request.\n- Resolve the exact targets with read-only checks when necessary.\n- Do not use `$HOME`, `~`, `/`, a workspace root, or another broad directory as the target of a recursive or destructive command.\n- When creating temporary directories, prefer using `mktemp -d`, or `New-Item` in Powershell.\n- When declaring env vars or script variables, always avoid common system options. Never repurpose `$HOME` or `$home`. Instead, use a task-specific variable name.\n- When possible, avoid relying on unresolved environment variables, globs, or command substitutions to identify destructive targets. Use explicit, validated paths.\n- Prefer recoverable operations, such as moving files to trash, when practical.\n- If the target or scope is unclear, stop and ask the user.\n\nNever run commands such as `rm -rf $HOME` or equivalent operations that could erase a home directory, repository, workspace, or other broad collection of user data.\n\nAfter deleting anything material, briefly tell the user what was removed and whether it can be recovered.\n\n# Using skills\n\nSkills are reusable instructions supplied dynamically for the current session. When present, the live Skills sections supplied with the current runtime are authoritative for which skills exist, where they are located, and how they are loaded.\n\n- If the user names an available skill or the task clearly matches one, use it for that turn. Use the smallest set that covers the request.\n- Read and follow a selected skill before acting. Resolve referenced files relative to its own directory, and reuse its scripts, assets, and templates when provided.\n- Briefly tell the user which skills you are using and why. If a skill materially changes an action or pauses the work, say so.\n- Do not carry skills across turns unless they are relevant again or re-mentioned.\n- The user's instructions take precedence over skill guidance.\n- If a named skill is unavailable or cannot be read, say so briefly and continue with the best fallback.\n\n# Session coordination\n\nUse `session_events` for conversation history: its default returns user and completed assistant messages, not execution noise. Cursors only paginate. Request `results` for final outcomes, `tools` for tool receipts, or `debug` for explicit diagnostics; request large tool bodies only when needed. Use the returned continuation cursor rather than rereading whole pages. Audit reads do not acknowledge command completion.\n\nFor a yielded command, use `command_read` to read available output and status, or `command_wait` to wait briefly using the same command interface. Keep the command ID and output cursor. A terminal read suppresses any still-pending completion notification; a running read does not. Earlier tool results and delivered messages never change. Use `command_input` only to send input where supported, not to poll output. An unsupported input capability does not imply output is unavailable. Give foreground commands a realistic requested wait; default to 10 seconds (yield_time_ms: 10000). An internal polling slice is not a reason to return a background handle.\n\nCommand completion alone resumes you only while you have an explicit `wait_for_input` registered. If remaining work depends on background commands, register that session-level wait before ending your turn. If you finish normally, command results remain retained and can accompany later input, but do not start another turn by themselves. No per-command dismissal is required.\n\nIf the user asks to create, inspect, continue, pause, resume, steer, rename, or otherwise manage a session, use the corresponding session tool. Pause affects the selected workstream and its descendants: pausing an ancestor also stops you, so you cannot then Resume yourself. Coordinate disjoint edits through messages instead of ancestor Pause.\n\nCreate a child worker only for a concrete, bounded subtask that can run independently and whose result has a clear integration point in the current request. Before spawning, decide what output you need and keep the parent's concurrent work disjoint. Do not delegate a scope that you will also perform yourself. If no useful independent work remains, continue in this session. Do not repurpose or direct an unrelated existing session unless the user explicitly asks. If no matching session tool is available on this turn, continue the work in this session instead of inventing an API.\n\nWhen supervising work, an accepted message, queued status, or changing timestamp is not proof of execution. Keep the accepted update/turn ID and correlate its delivered receipt with the consuming turn and relevant result; an older in-flight turn finishing does not prove your input was consumed. Use the receipt correlation described by the sending tool. Do not repeatedly send unconsumed input: inspect blockers and report a stalled handoff if execution does not begin. Preserve explicit human pauses and approvals.\n\nAfter spawning, keep each child id and event cursor. Before committing, publishing, completing a goal, or giving a final answer that depends on a child, join that child with `session_wait` using `waitFor: \"completion\"` and read and integrate its result. A `goal.completed` event records goal state but is not a terminal child result; the child can still be composing its final output. Do not present delegated work as incorporated until you have consumed the completed result. If a child becomes unnecessary, pause it when authorized instead of letting unused work continue.\n\nFor a short wait on a child or peer session inside the current turn, call `session_wait` with its session id and your last seen sequence instead of sleeping and polling; use `command_wait` for one short provider-neutral wait on a background command. Both time out after at most 50 seconds. Use `session_wait` with the default `waitFor: \"change\"` to observe relevant progress and `waitFor: \"completion\"` to join a child result without waking early on messages, goal/progress facts, maintenance turns, or continuation segment settlements. When it reports `ownPendingUpdates > 0`, finish this turn: that input is delivered when your next turn is claimed (or pass `includeOwnPendingUpdates: false` to keep waiting on the targets). Do not immediately repeat a timed-out short wait without new evidence. Keep internal continuation notes separate from the user-visible wait reason; write that reason as one short, readable sentence describing the dependency. For a long or uncertain wait, call `wait_for_input` once and end the turn rather than looping while holding the inference and sandbox.\n";
@@ -9,6 +9,7 @@ import { type WorkspaceArchiveDescriptor } from "./workspace-archive.js";
9
9
  import type { RuntimeMetricsHooks } from "../metrics.js";
10
10
  import type { ExposedPortEndpoint } from "./stream-port.js";
11
11
  export { collectSandboxEnvironment, parseExposedPorts } from "@opengeni/config";
12
+ export { SandboxMaterializationVerificationError, materializationVerificationDiagnostic, type MaterializationFailureReason, type MaterializationVerificationDiagnostic, } from "./materialization-verification-error.js";
12
13
  export { sendCommandInput, type CommandInputSession } from "./command-input.js";
13
14
  export { OpStreamExecClient, type OpStreamOutputFrame } from "./selfhosted/op-stream.js";
14
15
  export { repairSerializedRunStateExposedPorts, runStateCompatibilityProvider, runStateExposedPortsRecord, type RunStateExposedPortsCompatibilityRepair, type RunStateExposedPortsCompatibilityResult, } from "./run-state-compat.js";
@@ -77,6 +77,7 @@ import {
77
77
  SandboxExactResumeInstanceUnavailableError,
78
78
  SandboxExactResumeReplacedError,
79
79
  SandboxExecReadinessError,
80
+ SandboxMaterializationVerificationError,
80
81
  SandboxProviderContinuityUnavailableError,
81
82
  SandboxProviderUnavailableError,
82
83
  SandboxReplacementProviderStateError,
@@ -168,6 +169,7 @@ import {
168
169
  isWindowsConnectedMachinePath,
169
170
  joinExposedPortPath,
170
171
  makeActiveBackendResolver,
172
+ materializationVerificationDiagnostic,
171
173
  materializeRunCredentials,
172
174
  mintSandboxCodemodeToken,
173
175
  mintStreamToken,
@@ -267,7 +269,7 @@ import {
267
269
  withRunCredentialsClient,
268
270
  withRunCredentialsSession,
269
271
  withoutSandboxProviderIdentity
270
- } from "../chunk-46BFUGFL.js";
272
+ } from "../chunk-FQM5VV5D.js";
271
273
  import "../chunk-FHGLYLBL.js";
272
274
  import "../chunk-UNICCRW5.js";
273
275
  import "../chunk-PZ5AY32C.js";
@@ -350,6 +352,7 @@ export {
350
352
  SandboxExactResumeInstanceUnavailableError,
351
353
  SandboxExactResumeReplacedError,
352
354
  SandboxExecReadinessError,
355
+ SandboxMaterializationVerificationError,
353
356
  SandboxProviderContinuityUnavailableError,
354
357
  SandboxProviderUnavailableError,
355
358
  SandboxReplacementProviderStateError,
@@ -441,6 +444,7 @@ export {
441
444
  isWindowsConnectedMachinePath,
442
445
  joinExposedPortPath,
443
446
  makeActiveBackendResolver,
447
+ materializationVerificationDiagnostic,
444
448
  materializeRunCredentials,
445
449
  mintSandboxCodemodeToken,
446
450
  mintStreamToken,
@@ -0,0 +1,27 @@
1
+ export type MaterializationFailureReason = "path_not_visible" | "command_failed" | "command_pending" | "invalid_response" | "command_error";
2
+ /** Exact diagnostics belong only in authenticated durable session events.
3
+ * Metrics receive the closed reason vocabulary, never paths or provider output. */
4
+ export type MaterializationVerificationDiagnostic = {
5
+ reason: MaterializationFailureReason;
6
+ path: string;
7
+ workdir: string;
8
+ command: string;
9
+ output: string | null;
10
+ exitCode: number | null;
11
+ providerSessionId: number | null;
12
+ /** Exact ephemeral read-only probe identity, never a retained command alias. */
13
+ providerExecution?: {
14
+ sandboxId: string;
15
+ taskId: string;
16
+ execId: string;
17
+ };
18
+ causeMessage?: string;
19
+ };
20
+ export declare class SandboxMaterializationVerificationError extends Error {
21
+ readonly diagnostic: MaterializationVerificationDiagnostic;
22
+ readonly code = "sandbox_materialization_verification_failed";
23
+ constructor(diagnostic: MaterializationVerificationDiagnostic, options?: ErrorOptions);
24
+ }
25
+ /** Keep cancellation, route-loss, and provider retry identities unchanged. */
26
+ export declare function retainMaterializationVerificationDiagnostic(error: unknown, diagnostic: MaterializationVerificationDiagnostic): void;
27
+ export declare function materializationVerificationDiagnostic(error: unknown): MaterializationVerificationDiagnostic | undefined;
@@ -32,6 +32,12 @@ export declare class ModalCommandControl {
32
32
  private get sandboxId();
33
33
  start(args: ChannelAExecArgs, signal?: AbortSignal): Promise<ModalProviderCommand>;
34
34
  read(command: ModalProviderCommand, yieldTimeMs: number, signal?: AbortSignal): Promise<ModalProviderOutputPage>;
35
+ /** Fixed internal probes own their cancellation controller and must drain
36
+ * both reads before relinquishing the surrounding provider-operation gate.
37
+ * Retained-command readers keep their existing signal/receipt contract.
38
+ */
39
+ readProbe(command: ModalProviderCommand, yieldTimeMs: number, cancellation: AbortController): Promise<ModalProviderOutputPage>;
40
+ private readOutput;
35
41
  write(command: ModalProviderCommand, chars: string, messageIndex: number): Promise<void>;
36
42
  private assertIdentity;
37
43
  }
@@ -7,4 +7,5 @@ import type { ModalCommandControl } from "./modal-command-control.js";
7
7
  export declare function installModalCommandSession(session: ProviderCommandSession & {
8
8
  execCommand?: ChannelASession["execCommand"];
9
9
  writeStdin?: ChannelASession["writeStdin"];
10
+ verifyMaterializedPath?: (path: string, workdir: string) => Promise<void>;
10
11
  }, control: ModalCommandControl): void;
@@ -0,0 +1,7 @@
1
+ import type { ModalCommandControl } from "./modal-command-control.js";
2
+ /** A fixed read-only probe, not an admitted user command. Advance its private
3
+ * provider cursor locally; never borrow the surrounding mutation's retained
4
+ * handle or relax retained-command persistence requirements. The caller keeps
5
+ * the original backend and provider-operation gate for the entire observation.
6
+ */
7
+ export declare function verifyModalMaterializedPath(control: Pick<ModalCommandControl, "start" | "readProbe">, path: string, workdir: string, pending: Set<AbortController>, observationTimeoutMs?: number): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import type { ExposedPortEndpoint } from "../stream-port.js";
2
2
  import { type ProviderCommandPersistence, type ProviderCommandSession } from "../provider-command-session.js";
3
3
  import type { SandboxProviderCommand } from "@opengeni/contracts";
4
+ import { type MaterializationFailureReason } from "../materialization-verification-error.js";
4
5
  import type { ChannelAExecArgs, ChannelAExecResult, ChannelARoutedWorkspaceImportBatchRequest, ChannelARoutedWorkspaceImportRequest, WorkspaceFileImportReceipt } from "../channel-a.js";
5
6
  /** The per-session active-sandbox pointer the proxy re-reads on every op. Mirror
6
7
  * of `@opengeni/db`'s `ActiveSandboxPointer` (structural, so the leaf does not
@@ -42,6 +43,8 @@ export interface RoutableBackendSession extends ProviderCommandSession {
42
43
  pathExists?(path: string, runAs?: string): Promise<boolean>;
43
44
  viewImage?(args: unknown): Promise<unknown>;
44
45
  materializeEntry?(args: unknown): Promise<void>;
46
+ /** Provider-owned fixed read-only probe; never an agent command surface. */
47
+ verifyMaterializedPath?(path: string, workdir: string): Promise<void>;
45
48
  supportsPty?(): boolean;
46
49
  resolveExposedPort?(port: number): Promise<ExposedPortEndpoint>;
47
50
  serializeSessionState?(): Promise<unknown>;
@@ -238,6 +241,7 @@ export type RoutingSandboxOperationObservation = {
238
241
  op: string;
239
242
  outcome: "ok" | "not_found" | "failed";
240
243
  durationMs: number;
244
+ materializationFailureReason?: MaterializationFailureReason;
241
245
  };
242
246
  export type RoutingSandboxOperationObserver = (observation: RoutingSandboxOperationObservation) => void;
243
247
  export type RoutingSandboxPhaseOutcome = "completed" | "failed";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  prepareAgentTools
3
- } from "./chunk-46VVJC6K.js";
4
- import "./chunk-46BFUGFL.js";
3
+ } from "./chunk-KBYDX5N6.js";
4
+ import "./chunk-FQM5VV5D.js";
5
5
  import "./chunk-FHGLYLBL.js";
6
6
  import "./chunk-GB763TSV.js";
7
7
  import "./chunk-UZ66CGC2.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/runtime",
3
- "version": "3.0.0-canary.0",
3
+ "version": "3.0.1-canary.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -62,16 +62,16 @@
62
62
  "@openai/agents": "0.14.3",
63
63
  "@openai/agents-core": "0.14.3",
64
64
  "@openai/agents-extensions": "0.14.3",
65
- "@opengeni/agent-proto": "^0.6.0-canary.3",
66
- "@opengeni/capabilities": "^0.3.3-canary.15",
67
- "@opengeni/codemode": "^0.5.8-canary.0",
68
- "@opengeni/codex": "^0.2.23-canary.0",
69
- "@opengeni/config": "^1.2.1-canary.0",
70
- "@opengeni/contracts": "^4.0.0-canary.0",
71
- "@opengeni/network": "^0.3.1-canary.15",
72
- "@opengeni/sdk": "^6.0.0-canary.0",
73
- "@opengeni/tool-gateway": "^0.1.9-canary.0",
74
- "@opengeni/xai-subscription": "^0.1.4-canary.15",
65
+ "@opengeni/agent-proto": "^0.6.0-canary.5",
66
+ "@opengeni/capabilities": "^0.3.4-canary.0",
67
+ "@opengeni/codemode": "^0.5.9-canary.0",
68
+ "@opengeni/codex": "^0.2.23-canary.2",
69
+ "@opengeni/config": "^1.2.2-canary.0",
70
+ "@opengeni/contracts": "^4.1.0-canary.0",
71
+ "@opengeni/network": "^0.3.1-canary.17",
72
+ "@opengeni/sdk": "^6.1.0-canary.0",
73
+ "@opengeni/tool-gateway": "^0.1.10-canary.0",
74
+ "@opengeni/xai-subscription": "^0.1.4-canary.17",
75
75
  "debug": "4.4.3",
76
76
  "modal": "0.9.0",
77
77
  "openai": "6.47.0",
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: opengeni-help
3
+ description: Answer questions about OpenGeni setup, product integration, SDK/API behavior, billing, GitHub access, and development setup. Read the official product docs before making product-specific claims or replacing an application's AI provider. No installation is needed for this bundled guide.
4
+ ---
5
+
6
+ # OpenGeni product help
7
+
8
+ Use this guide when the user asks about OpenGeni itself. Answer their latest
9
+ question first, using the deployed service and installed SDK as contract evidence.
10
+ This is product reference guidance, not the persona of a customer support bot.
11
+
12
+ ## Fetch the official documentation
13
+
14
+ The public documentation index is **https://docs.opengeni.ai/llms.txt**. Fetch
15
+ it with the available web or HTTP tool, then read the relevant pages. Markdown
16
+ pages are available by adding `.md`, for example:
17
+
18
+ - Product integration: https://docs.opengeni.ai/guides/integrate-your-product.md
19
+ - Authentication: https://docs.opengeni.ai/reference/authentication.md
20
+ - SDK: https://docs.opengeni.ai/reference/sdk.md
21
+
22
+ Docs describe supported behavior; they do not prove that a particular deployment
23
+ or installed package includes a feature. Check `/v1/config/client`, installed
24
+ SDK exports/types, and authorized live configuration or probes. Report a failed
25
+ documentation fetch explicitly and use another authoritative source. Do not
26
+ ask the customer to supply OpenGeni's own API contract before trying these sources.
27
+
28
+ For implementation, use the current product-integration guide. A selected
29
+ OpenGeni Product Integration Pack provides the deeper implementation procedure;
30
+ ordinary product questions do not require installing that Pack or cloning the
31
+ OpenGeni repository.
32
+
33
+ ## Integration and account setup
34
+
35
+ OpenGeni's service API owns workspaces, sessions, turns, and events. A compatible
36
+ `@opengeni/sdk/chat` package can provide a handler in the customer's backend for
37
+ native, Vercel UI streams, or supported OpenAI-shaped chat formats. This does
38
+ not make OpenGeni's service URL a universal OpenAI inference endpoint.
39
+
40
+ Before replacing a provider, establish the customer's actual API usage:
41
+ server-side generation/provider calls versus a frontend UI stream, streaming,
42
+ tools, embeddings, authentication, history, and usage reporting. Generic client
43
+ documentation cannot prove OpenGeni server compatibility. Do not invent SDK
44
+ methods or routes. Verify embedding support independently; chat-format support
45
+ does not imply `/embeddings`. Preserve an existing embedding provider unless a
46
+ supported replacement is established.
47
+
48
+ If the user wants account configuration and will update secrets themselves,
49
+ resolve that account-side request before offering more application wiring.
50
+ Inspect authorized configuration and setup tools. A product backend normally
51
+ holds an organization API key; the browser never receives it. Separate an
52
+ unavailable administrative action from an unknown protocol. State any exact
53
+ human setup step that remains, rather than claiming the account is configured.
54
+
55
+ ## Discovery and GitHub
56
+
57
+ Tool search is ranked, not exhaustive. Recover a miss through `tool_list` and
58
+ exact-name schema loading where available. Use `capability_catalog_search` for
59
+ reviewed integration candidates and `skill_read` for available guidance. Missing
60
+ `ogtool` is a local executable problem, not proof that a capability is absent.
61
+
62
+ For private GitHub repositories, use authorized `github_connect_link` and
63
+ `github_repositories_list` tools when available. Distinguish App configuration,
64
+ workspace binding, repository permission, and attachment to this session.
65
+ Verify the actual mounted path before editing. Do not guess UI steps or claim
66
+ that a repository is usable solely because the App is configured.
67
+
68
+ ## Cost questions
69
+
70
+ Read the installed SDK's reply types and formatter, then the relevant accounting
71
+ contract. Model-picker labels show a billing category, not per-request cost.
72
+ The current chat facade and Vercel/OpenAI formatters do not define a first-class
73
+ monetary cost field. Recheck that statement against the installed version.
74
+
75
+ `getBillingUsage` is a separate permissioned accounting read. Its presence does
76
+ not mean the current credential may use it, that its bounded result covers the
77
+ whole conversation, or that it adds cost to an AI SDK response. Distinguish
78
+ charged OpenGeni credits, estimated provider cost, and externally billed usage.
79
+ Zero OpenGeni charge does not establish zero upstream expense. A turn can contain
80
+ multiple model responses. When response fields cannot be verified, say exactly
81
+ what is unknown rather than answering “probably.”
82
+
83
+ ## Development dependency recovery
84
+
85
+ Inspect the repository's runtime/version files, package manager, lockfile, and
86
+ test commands before implementation. Probe the actual selected compute for the
87
+ required versions. If dependencies are missing, install the declared versions
88
+ within the authorized disposable sandbox, then rerun the checks. On a Connected
89
+ Machine, respect its existing configuration and the user's authority over
90
+ machine changes.
91
+
92
+ Do not stop at `node: not found` or `pnpm: not found` when safe in-scope recovery
93
+ is available. Keep dependency-install errors, report the exact remaining blocker,
94
+ and distinguish code written, local commit, executed tests, verified integration,
95
+ and publication. A diff/whitespace check does not validate execution.
96
+
97
+ ## Embedded agents choose their guidance
98
+
99
+ The host can pass `bundledSkillIds: []` to exclude all bundled guides, or list
100
+ only supported capability guides. This includes opting out of this guide.
101
+ Workspace Skills, inline Skills, tool permissions, and ordinary runtime rules
102
+ remain separate. Do not copy OpenGeni product or implementation guidance into
103
+ the embedded agent's persona. Follow the product's explicit selections.
package/src/index.ts CHANGED
@@ -2075,7 +2075,7 @@ export function coreInstructions(
2075
2075
  ): string[] {
2076
2076
  return [
2077
2077
  "If the session has a goal, you own it: keep working until you call opengeni__goal_complete with concrete evidence or opengeni__goal_pause with a rationale; resume a paused goal with opengeni__goal_resume regardless of who paused it or why; revise it with opengeni__goal_update; create one with opengeni__goal_set when given a long-running objective.",
2078
- "Use knowledge_search and knowledge_get when retained information is relevant. For questions about what the workspace knows, ground the answer in authorized Knowledge and attached sources. Missing internal facts remain unknown; do not infer a person's role or cite unrelated public search results as evidence. Keep any relevant external research clearly separate from workspace records. Default retrieval returns published information. Before retaining or correcting anything, also search view=needs_review for existing pending entries and collections; read those with knowledge_get view=needs_review. Pending means unapproved: you may inspect and improve it, but do not present it as accepted knowledge or activate behavioral guidance from it. Reuse the existing entryId and current version instead of creating another proposal each run. Save durable facts, decisions, requirements, incidents, fixes and outcomes autonomously with knowledge_save when useful for future work, whether requested explicitly or learned during ordinary work. When a user supplies or confirms a durable fact, use knowledge_retain_message to retain the actual message and cite its returned entryId/revisionId in the finding evidence. Preserve existing source evidence and relationships when correcting an entry; do not replace them with empty arrays merely because the user confirmed a new value. Explicit confirmation can supersede a conflicting pending proposal, but explain that outcome to the user. Preserve uncertainty and exact supporting evidence; the fact label is not a verification claim. Chat attachments retain their original files and automatically prepare source text when authoring is enabled. Use knowledge_retain_file for a newly fetched file or failed preparation. A source entry contains retained original text; a finding states a useful conclusion and cites the exact source revision. Do not create both when they would simply repeat the same text. Reuse collections for customers, products, systems or subjects across sources, and link one entry to multiple collections instead of copying it. Technical incidents belong with the affected system and should include cause, fix and outcome when known. Reorganize references when useful; do not erase source evidence or revision history. Private tasks author personal Knowledge; shared tasks author workspace Knowledge. Automatic publishes immediately, Review first keeps a pending proposal without pausing your task, and Off prevents authoring while permitting retrieval. Never bypass review by making a new entry, switching tools, or asking for another approval. Reuse the same operationId and exact request after an uncertain save, including recovery. Use task_note_save for temporary coordination in this task tree. Conversation history is separate. Workspace instructions are concise standing rules; Skills are reusable procedures with their own Agent learning settings. Do not save the same content in multiple authorities.",
2078
+ "Use knowledge_search and knowledge_get when retained information is relevant. For questions about what the workspace knows, ground the answer in authorized Knowledge and attached sources. Missing internal facts remain unknown; do not infer a person's role or cite unrelated public search results as evidence. Keep any relevant external research clearly separate from workspace records. Default retrieval returns published information. Before retaining or correcting anything, also search view=needs_review for existing pending entries and collections; read those with knowledge_get view=needs_review. Pending means unapproved: you may inspect and improve it, but do not present it as accepted knowledge or activate behavioral guidance from it. Reuse the existing entryId and current version instead of creating another proposal each run. Save durable facts, decisions, requirements, incidents, fixes and outcomes autonomously with knowledge_save only when they help a plausible future task. Do not retain routine approvals, acknowledgments, temporary task instructions, status chatter or raw screenshots merely because they occurred. Before saving, use knowledge_prepare_save when available to fetch the authorized collection map with descriptions and parent IDs plus related published and pending entries; otherwise search both views and browse collections. Skip unchanged duplicates, improve the existing entry when appropriate, and create a new entry only for distinct useful information. Read the current entry before correcting it and preserve uncertainty, conflicting evidence and existing relationships. When a user supplies or confirms a durable fact, use knowledge_retain_message to retain the actual message and cite its returned entryId/revisionId in the finding evidence. Preserve existing source evidence and relationships when correcting an entry; do not replace them with empty arrays merely because the user confirmed a new value. Explicit confirmation can supersede a conflicting pending proposal, but explain that outcome to the user. Preserve uncertainty and exact supporting evidence; the fact label is not a verification claim. Chat attachments retain their original files for the conversation without automatically publishing OCR or source text into Knowledge. Inspect an image visually in the current task; save only a useful supported observation, requirement or incident when warranted. Use knowledge_retain_file purpose=evidence only when a selected finding needs the original as supporting evidence, or purpose=reference when deliberately retaining a reusable source document. Supporting sources remain accessible through evidence links and explicit includeEvidence searches, but do not fill ordinary Knowledge discovery. An upload alone is not a reason to save Knowledge. A source entry contains retained original text; a finding states a useful conclusion and cites the exact source revision. Do not create both when they would simply repeat the same text. Reuse collections for customers, products, systems or subjects across sources, and link one entry to multiple collections instead of copying it. Technical incidents belong with the affected system and should include cause, fix and outcome when known. Reorganize references when useful; do not erase source evidence or revision history. Private tasks author personal Knowledge; shared tasks author workspace Knowledge. Automatic publishes immediately, Review first keeps a pending proposal without pausing your task, and Off prevents authoring while permitting retrieval. Never bypass review by making a new entry, switching tools, or asking for another approval. Reuse the same operationId and exact request after an uncertain save, including recovery. Use task_note_save for temporary coordination in this task tree. Conversation history is separate. Workspace instructions are concise standing rules; Skills are reusable procedures with their own Agent learning settings. Do not save the same content in multiple authorities.",
2079
2079
  ...(workspaceEnvironment ? workspaceEnvironmentInstructions(workspaceEnvironment) : []),
2080
2080
  // Rig doctrine (M3): data-conditional, inside the non-bypassable CORE so a
2081
2081
  // white-label persona template can never drop it. Absent for rig-less sessions.
@@ -2986,7 +2986,7 @@ function installMcpApprovalPolicy(
2986
2986
  const originalInvoke = tool.invoke.bind(tool);
2987
2987
  const legacyApproval =
2988
2988
  !policy.connectorBacked && mcpToolRequiresApproval(policy.requireApproval, unprefixed);
2989
- if (!policy.connectorBacked && !legacyApproval) {
2989
+ if (!policy.connectorBacked && !legacyApproval && !connectorActionPolicy) {
2990
2990
  return tool;
2991
2991
  }
2992
2992
  const connectorCall = (approvalId: string, args: unknown): ConnectorActionToolCall => {
@@ -3324,6 +3324,7 @@ function applyMcpApprovalPolicy(
3324
3324
  .filter(
3325
3325
  (server) =>
3326
3326
  Boolean(server.connectionRef) ||
3327
+ Boolean(connectorActionPolicy && attemptToolSource(server.id) === "mcp") ||
3327
3328
  server.requireApproval === true ||
3328
3329
  (Array.isArray(server.requireApproval) && server.requireApproval.length > 0),
3329
3330
  )
@@ -4655,7 +4656,11 @@ function installAttemptConnectorActionGatewayLifecycle(
4655
4656
  const config = registry.get(definition.identity.serverId);
4656
4657
  const legacyMcpApproval =
4657
4658
  Boolean(config) && !config!.connectionRef && definition.approval === "human";
4658
- if (!binding && !config?.connectionRef && !legacyMcpApproval) return definition;
4659
+ const workspaceConnectorPolicy = Boolean(
4660
+ connectorActionPolicy && config && attemptToolSource(config.id) === "mcp",
4661
+ );
4662
+ if (!binding && !config?.connectionRef && !legacyMcpApproval && !workspaceConnectorPolicy)
4663
+ return definition;
4659
4664
  if (definition.lifecycle) {
4660
4665
  throw new Error(`Connector action tool already owns a lifecycle: ${definition.modelName}`);
4661
4666
  }
@@ -4684,7 +4689,7 @@ function installAttemptConnectorActionGatewayLifecycle(
4684
4689
  serverId: definition.identity.serverId,
4685
4690
  toolName: definition.identity.toolName,
4686
4691
  arguments: arguments_,
4687
- approvalMode: "session_mcp",
4692
+ ...(legacyMcpApproval ? { approvalMode: "session_mcp" as const } : {}),
4688
4693
  });
4689
4694
  return {
4690
4695
  ...definition,
@@ -153,6 +153,8 @@ Use \`session_events\` for conversation history: its default returns user and co
153
153
 
154
154
  For a yielded command, use \`command_read\` to read available output and status, or \`command_wait\` to wait briefly using the same command interface. Keep the command ID and output cursor. A terminal read suppresses any still-pending completion notification; a running read does not. Earlier tool results and delivered messages never change. Use \`command_input\` only to send input where supported, not to poll output. An unsupported input capability does not imply output is unavailable. Give foreground commands a realistic requested wait; default to 10 seconds (yield_time_ms: 10000). An internal polling slice is not a reason to return a background handle.
155
155
 
156
+ Command completion alone resumes you only while you have an explicit \`wait_for_input\` registered. If remaining work depends on background commands, register that session-level wait before ending your turn. If you finish normally, command results remain retained and can accompany later input, but do not start another turn by themselves. No per-command dismissal is required.
157
+
156
158
  If the user asks to create, inspect, continue, pause, resume, steer, rename, or otherwise manage a session, use the corresponding session tool. Pause affects the selected workstream and its descendants: pausing an ancestor also stops you, so you cannot then Resume yourself. Coordinate disjoint edits through messages instead of ancestor Pause.
157
159
 
158
160
  Create a child worker only for a concrete, bounded subtask that can run independently and whose result has a clear integration point in the current request. Before spawning, decide what output you need and keep the parent's concurrent work disjoint. Do not delegate a scope that you will also perform yourself. If no useful independent work remains, continue in this session. Do not repurpose or direct an unrelated existing session unless the user explicitly asks. If no matching session tool is available on this turn, continue the work in this session instead of inventing an API.
@@ -86,6 +86,12 @@ import type { ExposedPortEndpoint } from "./stream-port";
86
86
  // a single agent-loop-free entrypoint. They physically live in @opengeni/config
87
87
  // (moving them into runtime would create a config→runtime cycle — ledger CR8).
88
88
  export { collectSandboxEnvironment, parseExposedPorts } from "@opengeni/config";
89
+ export {
90
+ SandboxMaterializationVerificationError,
91
+ materializationVerificationDiagnostic,
92
+ type MaterializationFailureReason,
93
+ type MaterializationVerificationDiagnostic,
94
+ } from "./materialization-verification-error";
89
95
  export { sendCommandInput, type CommandInputSession } from "./command-input";
90
96
  export { OpStreamExecClient, type OpStreamOutputFrame } from "./selfhosted/op-stream";
91
97
 
@@ -0,0 +1,65 @@
1
+ export type MaterializationFailureReason =
2
+ | "path_not_visible"
3
+ | "command_failed"
4
+ | "command_pending"
5
+ | "invalid_response"
6
+ | "command_error";
7
+
8
+ /** Exact diagnostics belong only in authenticated durable session events.
9
+ * Metrics receive the closed reason vocabulary, never paths or provider output. */
10
+ export type MaterializationVerificationDiagnostic = {
11
+ reason: MaterializationFailureReason;
12
+ path: string;
13
+ workdir: string;
14
+ command: string;
15
+ output: string | null;
16
+ exitCode: number | null;
17
+ providerSessionId: number | null;
18
+ /** Exact ephemeral read-only probe identity, never a retained command alias. */
19
+ providerExecution?: { sandboxId: string; taskId: string; execId: string };
20
+ causeMessage?: string;
21
+ };
22
+
23
+ const EXPLANATIONS: Record<MaterializationFailureReason, string> = {
24
+ path_not_visible: "the provider could not see the destination path",
25
+ command_failed: "the visibility-check command exited unsuccessfully",
26
+ command_pending: "the visibility-check command was still running; path visibility is unconfirmed",
27
+ invalid_response: "the visibility check returned no valid success confirmation",
28
+ command_error: "the provider could not complete the visibility-check command",
29
+ };
30
+
31
+ export class SandboxMaterializationVerificationError extends Error {
32
+ readonly code = "sandbox_materialization_verification_failed";
33
+
34
+ constructor(
35
+ readonly diagnostic: MaterializationVerificationDiagnostic,
36
+ options?: ErrorOptions,
37
+ ) {
38
+ super(
39
+ `Sandbox materialization verification failed: ${EXPLANATIONS[diagnostic.reason]}: ${diagnostic.path}`,
40
+ options,
41
+ );
42
+ this.name = "SandboxMaterializationVerificationError";
43
+ }
44
+ }
45
+
46
+ const providerDiagnostics = new WeakMap<object, MaterializationVerificationDiagnostic>();
47
+
48
+ /** Keep cancellation, route-loss, and provider retry identities unchanged. */
49
+ export function retainMaterializationVerificationDiagnostic(
50
+ error: unknown,
51
+ diagnostic: MaterializationVerificationDiagnostic,
52
+ ): void {
53
+ if (error !== null && (typeof error === "object" || typeof error === "function")) {
54
+ providerDiagnostics.set(error, diagnostic);
55
+ }
56
+ }
57
+
58
+ export function materializationVerificationDiagnostic(
59
+ error: unknown,
60
+ ): MaterializationVerificationDiagnostic | undefined {
61
+ if (error instanceof SandboxMaterializationVerificationError) return error.diagnostic;
62
+ return error !== null && (typeof error === "object" || typeof error === "function")
63
+ ? providerDiagnostics.get(error)
64
+ : undefined;
65
+ }