Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ts/packages/agentSdk/src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ export type SerializedError = {
export type ActionResultError = {
error: string;
fallbackToReasoning?: boolean | undefined;
// Stable machine-readable code for callers that need policy or retry
// decisions without parsing the display message.
errorCode?: string | undefined;
// Whether the caller may safely retry after changing the action.
retryable?: boolean | undefined;
// True when the failed action may already have changed external state.
mayHaveSideEffects?: boolean | undefined;
// Rich display to show in place of the plain `error` text (e.g. setup
// instructions with a config snippet, which need markdown to survive
// rendering). Optional — clients fall back to `error` when absent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{
"id": "dev-route-02",
"category": "dev-actions-routing",
"description": "PowerShell schema family includes the root flow schema",
"description": "PowerShell schema family includes the files namespace",
"required": true,
"setup": {
"requiredFlows": ["listFiles"]
Expand All @@ -51,7 +51,7 @@
"disposition": {
"status": "handled",
"path": "action",
"schemas": ["powershell"]
"schemas": ["powershell.powershell-files"]
}
}
}
Expand Down
17 changes: 14 additions & 3 deletions ts/packages/agents/powershell/scripts/scriptHost.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ try {
$expandedAllowedPaths = @()
foreach ($ap in $AllowedPaths) {
try {
$expandedAllowedPaths += $ExecutionContext.InvokeCommand.ExpandString($ap)
$expandedPath = $ExecutionContext.InvokeCommand.ExpandString($ap)
$expandedAllowedPaths += [System.IO.Path]::GetFullPath($expandedPath).TrimEnd('\', '/')
} catch {
$expandedAllowedPaths += $ap
}
Expand All @@ -77,11 +78,21 @@ try {
try { $isValidPath = Test-Path $val -IsValid } catch { }
if ($isValidPath) {
$resolvedPath = $null
try { $resolvedPath = (Resolve-Path $val -ErrorAction SilentlyContinue).Path } catch {}
try {
$resolvedPath = (Resolve-Path $val -ErrorAction SilentlyContinue).Path
if (-not $resolvedPath) {
$resolvedPath = [System.IO.Path]::GetFullPath($val)
}
$resolvedPath = $resolvedPath.TrimEnd('\', '/')
} catch {}
if ($resolvedPath) {
$pathAllowed = $false
foreach ($ap in $expandedAllowedPaths) {
if ($resolvedPath -like "$ap*") {
if (
$resolvedPath.Equals($ap, [System.StringComparison]::OrdinalIgnoreCase) -or
$resolvedPath.StartsWith("$ap\", [System.StringComparison]::OrdinalIgnoreCase) -or
$resolvedPath.StartsWith("$ap/", [System.StringComparison]::OrdinalIgnoreCase)
) {
$pathAllowed = $true
break
}
Expand Down
Loading
Loading