Skip to content

Commit 878c04e

Browse files
Extend client native manifest support
Closes #90
1 parent 21c0734 commit 878c04e

9 files changed

Lines changed: 1005 additions & 4 deletions

File tree

src/Netclaw.SkillClient/Models.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,24 @@ public sealed record ErrorResponse
221221
/// JSON serialization context for AOT support.
222222
/// </summary>
223223
[JsonSerializable(typeof(RfcSkillIndex))]
224+
[JsonSerializable(typeof(NativeRootManifest))]
225+
[JsonSerializable(typeof(NativeSkillCollectionIndex))]
226+
[JsonSerializable(typeof(NativeSkillCollectionPage))]
227+
[JsonSerializable(typeof(NativeSkillIdentityIndex))]
228+
[JsonSerializable(typeof(NativeSkillVersionDetail))]
229+
[JsonSerializable(typeof(NativeSubAgentCollectionIndex))]
230+
[JsonSerializable(typeof(NativeSubAgentCollectionPage))]
231+
[JsonSerializable(typeof(NativeSubAgentIdentityIndex))]
232+
[JsonSerializable(typeof(NativeSubAgentVersionDetail))]
224233
[JsonSerializable(typeof(IReadOnlyList<SkillSummary>))]
225234
[JsonSerializable(typeof(IReadOnlyList<SkillVersionSummary>))]
226235
[JsonSerializable(typeof(SkillVersionSummary))]
227236
[JsonSerializable(typeof(SkillUploadResponse))]
237+
[JsonSerializable(typeof(SubAgentUploadResponse))]
238+
[JsonSerializable(typeof(SubAgentSummary))]
239+
[JsonSerializable(typeof(SubAgentVersionSummary))]
240+
[JsonSerializable(typeof(IReadOnlyList<SubAgentSummary>))]
241+
[JsonSerializable(typeof(IReadOnlyList<SubAgentVersionSummary>))]
228242
[JsonSerializable(typeof(CreateApiKeyResponse))]
229243
[JsonSerializable(typeof(ApiKeySummary))]
230244
[JsonSerializable(typeof(IReadOnlyList<ApiKeySummary>))]
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
// -----------------------------------------------------------------------
2+
// <copyright file="NativeManifestClient.cs" company="Petabridge, LLC">
3+
// Copyright (C) 2026 - 2026 Petabridge, LLC <https://petabridge.com>
4+
// </copyright>
5+
// -----------------------------------------------------------------------
6+
using System.Net.Http.Json;
7+
8+
namespace Netclaw.SkillClient;
9+
10+
public sealed partial class SkillServerClient
11+
{
12+
public async Task<NativeRootManifest?> GetManifestAsync(CancellationToken ct = default)
13+
{
14+
return await _httpClient.GetFromJsonAsync(
15+
"manifest.json",
16+
SkillServerClientJsonContext.Default.NativeRootManifest,
17+
ct);
18+
}
19+
20+
public Task<NativeSkillCollectionIndex?> GetNativeSkillIndexAsync(CancellationToken ct = default)
21+
{
22+
return GetNativeSkillIndexByHrefAsync("manifest/skills/index.json", ct);
23+
}
24+
25+
public Task<NativeSkillCollectionIndex?> GetNativeSkillIndexAsync(
26+
NativeManifestLink link,
27+
CancellationToken ct = default)
28+
{
29+
return GetNativeSkillIndexByHrefAsync(link.Href, ct);
30+
}
31+
32+
public async Task<NativeSkillCollectionIndex?> GetNativeSkillIndexByHrefAsync(
33+
string href,
34+
CancellationToken ct = default)
35+
{
36+
return await _httpClient.GetFromJsonAsync(
37+
href,
38+
SkillServerClientJsonContext.Default.NativeSkillCollectionIndex,
39+
ct);
40+
}
41+
42+
public Task<NativeSkillCollectionPage?> GetNativeSkillPageAsync(
43+
NativeManifestPageLink link,
44+
CancellationToken ct = default)
45+
{
46+
return GetNativeSkillPageAsync(link.Href, ct);
47+
}
48+
49+
public async Task<NativeSkillCollectionPage?> GetNativeSkillPageAsync(
50+
string href,
51+
CancellationToken ct = default)
52+
{
53+
return await _httpClient.GetFromJsonAsync(
54+
href,
55+
SkillServerClientJsonContext.Default.NativeSkillCollectionPage,
56+
ct);
57+
}
58+
59+
public Task<NativeSkillIdentityIndex?> GetNativeSkillIdentityAsync(
60+
NativeSkillPageItem item,
61+
CancellationToken ct = default)
62+
{
63+
return GetNativeSkillIdentityByHrefAsync(item.Href, ct);
64+
}
65+
66+
public Task<NativeSkillIdentityIndex?> GetNativeSkillIdentityAsync(string name, CancellationToken ct = default)
67+
{
68+
return GetNativeSkillIdentityByHrefAsync(
69+
$"manifest/skills/{Uri.EscapeDataString(name)}/index.json",
70+
ct);
71+
}
72+
73+
public async Task<NativeSkillIdentityIndex?> GetNativeSkillIdentityByHrefAsync(
74+
string href,
75+
CancellationToken ct = default)
76+
{
77+
return await _httpClient.GetFromJsonAsync(
78+
href,
79+
SkillServerClientJsonContext.Default.NativeSkillIdentityIndex,
80+
ct);
81+
}
82+
83+
public Task<NativeSkillVersionDetail?> GetNativeSkillVersionAsync(
84+
NativeSkillVersionLink link,
85+
CancellationToken ct = default)
86+
{
87+
return GetNativeSkillVersionByHrefAsync(link.Href, ct);
88+
}
89+
90+
public Task<NativeSkillVersionDetail?> GetNativeSkillVersionAsync(
91+
string name,
92+
string version,
93+
CancellationToken ct = default)
94+
{
95+
return GetNativeSkillVersionByHrefAsync(
96+
$"manifest/skills/{Uri.EscapeDataString(name)}/versions/{Uri.EscapeDataString(version)}.json",
97+
ct);
98+
}
99+
100+
public async Task<NativeSkillVersionDetail?> GetNativeSkillVersionByHrefAsync(
101+
string href,
102+
CancellationToken ct = default)
103+
{
104+
return await _httpClient.GetFromJsonAsync(
105+
href,
106+
SkillServerClientJsonContext.Default.NativeSkillVersionDetail,
107+
ct);
108+
}
109+
110+
public Task<NativeSubAgentCollectionIndex?> GetNativeSubAgentIndexAsync(CancellationToken ct = default)
111+
{
112+
return GetNativeSubAgentIndexByHrefAsync("manifest/subagents/index.json", ct);
113+
}
114+
115+
public Task<NativeSubAgentCollectionIndex?> GetNativeSubAgentIndexAsync(
116+
NativeManifestLink link,
117+
CancellationToken ct = default)
118+
{
119+
return GetNativeSubAgentIndexByHrefAsync(link.Href, ct);
120+
}
121+
122+
public async Task<NativeSubAgentCollectionIndex?> GetNativeSubAgentIndexByHrefAsync(
123+
string href,
124+
CancellationToken ct = default)
125+
{
126+
return await _httpClient.GetFromJsonAsync(
127+
href,
128+
SkillServerClientJsonContext.Default.NativeSubAgentCollectionIndex,
129+
ct);
130+
}
131+
132+
public Task<NativeSubAgentCollectionPage?> GetNativeSubAgentPageAsync(
133+
NativeManifestPageLink link,
134+
CancellationToken ct = default)
135+
{
136+
return GetNativeSubAgentPageAsync(link.Href, ct);
137+
}
138+
139+
public async Task<NativeSubAgentCollectionPage?> GetNativeSubAgentPageAsync(
140+
string href,
141+
CancellationToken ct = default)
142+
{
143+
return await _httpClient.GetFromJsonAsync(
144+
href,
145+
SkillServerClientJsonContext.Default.NativeSubAgentCollectionPage,
146+
ct);
147+
}
148+
149+
public Task<NativeSubAgentIdentityIndex?> GetNativeSubAgentIdentityAsync(
150+
NativeSubAgentPageItem item,
151+
CancellationToken ct = default)
152+
{
153+
return GetNativeSubAgentIdentityByHrefAsync(item.Href, ct);
154+
}
155+
156+
public Task<NativeSubAgentIdentityIndex?> GetNativeSubAgentIdentityAsync(
157+
string name,
158+
CancellationToken ct = default)
159+
{
160+
return GetNativeSubAgentIdentityByHrefAsync(
161+
$"manifest/subagents/{Uri.EscapeDataString(name)}/index.json",
162+
ct);
163+
}
164+
165+
public async Task<NativeSubAgentIdentityIndex?> GetNativeSubAgentIdentityByHrefAsync(
166+
string href,
167+
CancellationToken ct = default)
168+
{
169+
return await _httpClient.GetFromJsonAsync(
170+
href,
171+
SkillServerClientJsonContext.Default.NativeSubAgentIdentityIndex,
172+
ct);
173+
}
174+
175+
public Task<NativeSubAgentVersionDetail?> GetNativeSubAgentVersionAsync(
176+
NativeSubAgentVersionLink link,
177+
CancellationToken ct = default)
178+
{
179+
return GetNativeSubAgentVersionByHrefAsync(link.Href, ct);
180+
}
181+
182+
public Task<NativeSubAgentVersionDetail?> GetNativeSubAgentVersionAsync(
183+
string name,
184+
string version,
185+
CancellationToken ct = default)
186+
{
187+
return GetNativeSubAgentVersionByHrefAsync(
188+
$"manifest/subagents/{Uri.EscapeDataString(name)}/versions/{Uri.EscapeDataString(version)}.json",
189+
ct);
190+
}
191+
192+
public async Task<NativeSubAgentVersionDetail?> GetNativeSubAgentVersionByHrefAsync(
193+
string href,
194+
CancellationToken ct = default)
195+
{
196+
return await _httpClient.GetFromJsonAsync(
197+
href,
198+
SkillServerClientJsonContext.Default.NativeSubAgentVersionDetail,
199+
ct);
200+
}
201+
}

0 commit comments

Comments
 (0)