Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -1488,8 +1488,18 @@ public sealed record DirectoryEntry
/// <summary>Base name of the entry</summary>
public required string Name { get; init; }

/// <summary>Whether the entry is a file or directory</summary>
/// <summary>Whether the entry is a file or directory.
///
/// For a symbolic link (`isSymlink: true`), this reports the resolved target
/// kind when known and permitted by the receiver's access policy, or `'file'`
/// as a non-expandable fallback when the target was not inspected or could
/// not be resolved or accessed.</summary>
public required string Type { get; init; }

/// <summary>Whether the entry is a symbolic link. Callers that need target resolution
/// or canonical URIs SHOULD use `resourceResolve`.</summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? IsSymlink { get; init; }
}

/// <summary>Copies a resource from one URI to another on the server's filesystem.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ private static (object decoded, string reencoded) DecodeAndReencode(string type,
return Wrap(Ser.Deserialize<ResourceReadParams>(inputJson));
case "ResourceReadResult":
return Wrap(Ser.Deserialize<ResourceReadResult>(inputJson));
case "ResourceListResult":
return Wrap(Ser.Deserialize<ResourceListResult>(inputJson));
case "AuthenticateParams":
return Wrap(Ser.Deserialize<AuthenticateParams>(inputJson));
default:
Expand Down
10 changes: 9 additions & 1 deletion clients/go/ahptypes/commands.generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,8 +1037,16 @@ type ResourceListResult struct {
type DirectoryEntry struct {
// Base name of the entry
Name string `json:"name"`
// Whether the entry is a file or directory
// Whether the entry is a file or directory.
//
// For a symbolic link (`isSymlink: true`), this reports the resolved target
// kind when known and permitted by the receiver's access policy, or `'file'`
// as a non-expandable fallback when the target was not inspected or could
// not be resolved or accessed.
Type string `json:"type"`
// Whether the entry is a symbolic link. Callers that need target resolution
// or canonical URIs SHOULD use `resourceResolve`.
IsSymlink *bool `json:"isSymlink,omitempty"`
}

// Copies a resource from one URI to another on the server's filesystem.
Expand Down
4 changes: 4 additions & 0 deletions clients/go/ahptypes/roundtrip_fixture_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ func decodeAndReencode(t *testing.T, name, typ, inputJSON string) string {
var v ResourceReadResult
dec(&v)
return enc(&v)
case "ResourceListResult":
var v ResourceListResult
dec(&v)
return enc(&v)
case "AuthenticateParams":
var v AuthenticateParams
dec(&v)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1290,9 +1290,19 @@ data class DirectoryEntry(
*/
val name: String,
/**
* Whether the entry is a file or directory
* Whether the entry is a file or directory.
*
* For a symbolic link (`isSymlink: true`), this reports the resolved target
* kind when known and permitted by the receiver's access policy, or `'file'`
* as a non-expandable fallback when the target was not inspected or could
* not be resolved or accessed.
*/
val type: String,
/**
* Whether the entry is a symbolic link. Callers that need target resolution
* or canonical URIs SHOULD use `resourceResolve`.
*/
val type: String
val isSymlink: Boolean? = null
)

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import com.microsoft.agenthostprotocol.generated.TcpResetParams
import com.microsoft.agenthostprotocol.generated.CreateTcpConnectionParams
import com.microsoft.agenthostprotocol.generated.ResourceReadParams
import com.microsoft.agenthostprotocol.generated.ResourceReadResult
import com.microsoft.agenthostprotocol.generated.ResourceListResult
import com.microsoft.agenthostprotocol.generated.JsonRpcErrorResponse
import com.microsoft.agenthostprotocol.generated.JsonRpcNotification
import com.microsoft.agenthostprotocol.generated.JsonRpcRequest
Expand Down Expand Up @@ -282,6 +283,7 @@ class RoundTripCorpusTest {
"CreateTcpConnectionParams" -> rt(CreateTcpConnectionParams.serializer())
"ResourceReadParams" -> rt(ResourceReadParams.serializer())
"ResourceReadResult" -> rt(ResourceReadResult.serializer())
"ResourceListResult" -> rt(ResourceListResult.serializer())
"AuthenticateParams" -> rt(AuthenticateParams.serializer())
else -> fail(
"$file: unknown wire type \"$typeName\". " +
Expand Down
11 changes: 10 additions & 1 deletion clients/rust/crates/ahp-types/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,8 +1377,17 @@ pub struct ResourceListResult {
pub struct DirectoryEntry {
/// Base name of the entry
pub name: String,
/// Whether the entry is a file or directory
/// Whether the entry is a file or directory.
///
/// For a symbolic link (`isSymlink: true`), this reports the resolved target
/// kind when known and permitted by the receiver's access policy, or `'file'`
/// as a non-expandable fallback when the target was not inspected or could
/// not be resolved or accessed.
pub r#type: String,
/// Whether the entry is a symbolic link. Callers that need target resolution
/// or canonical URIs SHOULD use `resourceResolve`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_symlink: Option<bool>,
}

/// Copies a resource from one URI to another on the server's filesystem.
Expand Down
4 changes: 3 additions & 1 deletion clients/rust/crates/ahp-types/tests/roundtrip_corpus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ use ahp_types::{
commands::{
AuthenticateParams, ChangesetOperationTarget, ChatSource, CreateChatParams,
CreateTcpConnectionParams, Implementation, InitializeResult, ReconnectParams,
ReconnectResult, ResourceReadParams, ResourceReadResult, SubscribeParams, SubscribeResult,
ReconnectResult, ResourceListResult, ResourceReadParams, ResourceReadResult,
SubscribeParams, SubscribeResult,
},
common::StringOrMarkdown,
messages::JsonRpcMessage,
Expand Down Expand Up @@ -245,6 +246,7 @@ fn decode_and_reencode(file: &str, type_name: &str, input_json: &str) -> Result<
"CreateTcpConnectionParams" => round_trip!(CreateTcpConnectionParams),
"ResourceReadParams" => round_trip!(ResourceReadParams),
"ResourceReadResult" => round_trip!(ResourceReadResult),
"ResourceListResult" => round_trip!(ResourceListResult),
"AuthenticateParams" => round_trip!(AuthenticateParams),
other => Err(format!(
"{}: unknown wire type {:?}. Add a decode entry to decode_and_reencode.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1514,15 +1514,25 @@ public struct ResourceListResult: Codable, Sendable, Equatable {
public struct DirectoryEntry: Codable, Sendable, Equatable {
/// Base name of the entry
public var name: String
/// Whether the entry is a file or directory
/// Whether the entry is a file or directory.
///
/// For a symbolic link (`isSymlink: true`), this reports the resolved target
/// kind when known and permitted by the receiver's access policy, or `'file'`
/// as a non-expandable fallback when the target was not inspected or could
/// not be resolved or accessed.
public var type: String
/// Whether the entry is a symbolic link. Callers that need target resolution
/// or canonical URIs SHOULD use `resourceResolve`.
public var isSymlink: Bool?

public init(
name: String,
type: String
type: String,
isSymlink: Bool? = nil
) {
self.name = name
self.type = type
self.isSymlink = isSymlink
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ final class TypesRoundTripFixtureTests: XCTestCase {
return try reencode(dec.decode(ResourceReadParams.self, from: inputData))
case "ResourceReadResult":
return try reencode(dec.decode(ResourceReadResult.self, from: inputData))
case "ResourceListResult":
return try reencode(dec.decode(ResourceListResult.self, from: inputData))
case "AuthenticateParams":
return try reencode(dec.decode(AuthenticateParams.self, from: inputData))
default:
Expand Down
3 changes: 2 additions & 1 deletion clients/typescript/test/types-round-trip.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import type {
import type { SessionAddedParams } from '../src/types/channels-root/notifications.js';
import type {
Implementation, InitializeResult, SubscribeParams, SubscribeResult, ReconnectParams, ReconnectResult,
ResourceReadParams, ResourceReadResult, AuthenticateParams,
ResourceListResult, ResourceReadParams, ResourceReadResult, AuthenticateParams,
} from '../src/types/common/commands.js';
import type { ChannelFrameParams, ChannelCreditParams } from '../src/types/common/notifications.js';
import type { TcpDataParams, TcpEofParams, TcpResetParams } from '../src/types/channels-tcp/notifications.js';
Expand Down Expand Up @@ -264,6 +264,7 @@ function bindToType(file: string, type: string, parsed: unknown): void {
case 'CreateTcpConnectionParams': void (parsed as CreateTcpConnectionParams); break;
case 'ResourceReadParams': void (parsed as ResourceReadParams); break;
case 'ResourceReadResult': void (parsed as ResourceReadResult); break;
case 'ResourceListResult': void (parsed as ResourceListResult); break;
case 'AuthenticateParams': void (parsed as AuthenticateParams); break;
default:
throw new Error(
Expand Down
5 changes: 5 additions & 0 deletions docs/.changes/20261123-directory-entry-is-symlink.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "added",
"message": "Optional `isSymlink` boolean flag on `DirectoryEntry` in `resourceList` results.",
"issues": [624]
}
6 changes: 5 additions & 1 deletion schema/commands.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,11 @@
"file",
"directory"
],
"description": "Whether the entry is a file or directory"
"description": "Whether the entry is a file or directory.\n\nFor a symbolic link (`isSymlink: true`), this reports the resolved target\nkind when known and permitted by the receiver's access policy, or `'file'`\nas a non-expandable fallback when the target was not inspected or could\nnot be resolved or accessed."
},
"isSymlink": {
"type": "boolean",
"description": "Whether the entry is a symbolic link. Callers that need target resolution\nor canonical URIs SHOULD use `resourceResolve`."
}
},
"required": [
Expand Down
6 changes: 5 additions & 1 deletion schema/errors.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6973,7 +6973,11 @@
"file",
"directory"
],
"description": "Whether the entry is a file or directory"
"description": "Whether the entry is a file or directory.\n\nFor a symbolic link (`isSymlink: true`), this reports the resolved target\nkind when known and permitted by the receiver's access policy, or `'file'`\nas a non-expandable fallback when the target was not inspected or could\nnot be resolved or accessed."
},
"isSymlink": {
"type": "boolean",
"description": "Whether the entry is a symbolic link. Callers that need target resolution\nor canonical URIs SHOULD use `resourceResolve`."
}
},
"required": [
Expand Down
14 changes: 13 additions & 1 deletion types/common/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1125,8 +1125,20 @@ export interface ResourceListParams extends BaseParams {
export interface DirectoryEntry {
/** Base name of the entry */
name: string;
/** Whether the entry is a file or directory */
/**
* Whether the entry is a file or directory.
*
* For a symbolic link (`isSymlink: true`), this reports the resolved target
* kind when known and permitted by the receiver's access policy, or `'file'`
* as a non-expandable fallback when the target was not inspected or could
* not be resolved or accessed.
*/
type: 'file' | 'directory';
/**
* Whether the entry is a symbolic link. Callers that need target resolution
* or canonical URIs SHOULD use `resourceResolve`.
*/
isSymlink?: boolean;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "resource-list-symlink-result",
"group": "A",
"description": "DirectoryEntry carries optional isSymlink: omitted stays absent on re-encode, while explicit true and false values are preserved alongside file and directory types.",
"type": "ResourceListResult",
"input": {
"entries": [
{ "name": "src", "type": "directory" },
{ "name": "shared", "type": "directory", "isSymlink": true },
{ "name": "broken-link", "type": "file", "isSymlink": true },
{ "name": "README.md", "type": "file", "isSymlink": false }
]
},
"acceptableOutputs": [
{
"entries": [
{ "name": "src", "type": "directory" },
{ "name": "shared", "type": "directory", "isSymlink": true },
{ "name": "broken-link", "type": "file", "isSymlink": true },
{ "name": "README.md", "type": "file", "isSymlink": false }
]
}
]
}
Loading