@opensoha/contracts 0.1.20 → 0.1.22
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/auth/catalog_generated.go +2 -2
- package/auth/permission-catalog.json +81 -1
- package/compat/json-schema-ecosystem-0.1.0.json +1 -1
- package/compat/openapi-loose-boundaries-0.1.0.json +1 -1
- package/fixtures/json-schema/network-ingest-event/invalid/proxy-runtime-negative-total.json +19 -0
- package/fixtures/json-schema/network-ingest-event/valid/proxy-runtime-sample.json +20 -0
- package/fixtures/json-schema/proxy-runtime/invalid/v2ray-connection-snapshot.json +10 -0
- package/fixtures/json-schema/proxy-runtime/valid/mihomo-observation.json +16 -0
- package/fixtures/openapi/KubernetesCustomResourceDefinition/invalid/empty-uid.json +1 -0
- package/fixtures/openapi/KubernetesCustomResourceDefinition/valid/deleting-definition.json +1 -0
- package/fixtures/openapi/KubernetesResourceUpdatePlanRequest/valid/range-kind.json +5 -0
- package/fixtures/openapi/KubernetesResourceYaml/valid/range-kind.json +5 -0
- package/fixtures/openapi/NetworkProxyConfigurationInput/invalid/empty-content.json +1 -0
- package/fixtures/openapi/NetworkProxyConfigurationInput/valid/enabled.json +1 -0
- package/fixtures/openapi/NetworkProxyInstanceInput/invalid/unknown-engine.json +1 -0
- package/fixtures/openapi/NetworkProxyInstanceInput/valid/mihomo.json +1 -0
- package/gen/go/sohaapi/client.go +1 -1
- package/gen/go/sohaapi/client_test.go +25 -0
- package/gen/go/sohaapi/types.go +79 -11
- package/gen/go/sohaapi/types_test.go +30 -0
- package/gen/ts/sohaapi/index.ts +264 -156
- package/go.mod +4 -4
- package/go.sum +4 -4
- package/network/README.md +12 -0
- package/network/network-ingest-event.schema.json +21 -3
- package/network/network-runtime-protocol.schema.json +2 -2
- package/network/proxy-runtime.schema.json +113 -0
- package/network/schema.go +7 -0
- package/openapi/soha-api.json +412 -4
- package/openapi/soha-api.yaml +381 -251
- package/openapi/spec_generated.go +3 -3
- package/package.json +2 -1
- package/resource/models.go +2 -0
|
@@ -6,8 +6,8 @@ import _ "embed"
|
|
|
6
6
|
|
|
7
7
|
const (
|
|
8
8
|
PermissionCatalogVersion = "2.0.0"
|
|
9
|
-
PermissionCatalogContentSHA256 = "
|
|
10
|
-
PermissionCatalogSHA256 = "
|
|
9
|
+
PermissionCatalogContentSHA256 = "be2c1caf05e680f75b40e6ce017e55f1c35f7977cf045ca3ec562adbd6cb37dc"
|
|
10
|
+
PermissionCatalogSHA256 = "2822fab5a3963270e806884ce46402bb42f3384d5530e6ae0acc8bf253811de5"
|
|
11
11
|
)
|
|
12
12
|
|
|
13
13
|
//go:embed permission-catalog.json
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "authorization.opensoha.io/v1",
|
|
3
3
|
"catalogVersion": "2.0.0",
|
|
4
|
-
"contentHash": "sha256:
|
|
4
|
+
"contentHash": "sha256:be2c1caf05e680f75b40e6ce017e55f1c35f7977cf045ca3ec562adbd6cb37dc",
|
|
5
5
|
"permissions": [
|
|
6
6
|
{
|
|
7
7
|
"key": "access.directory.create",
|
|
@@ -4998,6 +4998,86 @@
|
|
|
4998
4998
|
"status": "active",
|
|
4999
4999
|
"assignable": true
|
|
5000
5000
|
},
|
|
5001
|
+
{
|
|
5002
|
+
"key": "network_access.proxy_connections.close",
|
|
5003
|
+
"domain": "network_access",
|
|
5004
|
+
"resource": "proxy_connections",
|
|
5005
|
+
"action": "close",
|
|
5006
|
+
"displayName": "断开代理连接",
|
|
5007
|
+
"riskLevel": "high",
|
|
5008
|
+
"scopeKinds": [
|
|
5009
|
+
"tenant",
|
|
5010
|
+
"workspace",
|
|
5011
|
+
"resource"
|
|
5012
|
+
],
|
|
5013
|
+
"approvalPolicy": "eligible",
|
|
5014
|
+
"status": "active",
|
|
5015
|
+
"assignable": true
|
|
5016
|
+
},
|
|
5017
|
+
{
|
|
5018
|
+
"key": "network_access.proxy_connections.view",
|
|
5019
|
+
"domain": "network_access",
|
|
5020
|
+
"resource": "proxy_connections",
|
|
5021
|
+
"action": "view",
|
|
5022
|
+
"displayName": "查看代理连接详情",
|
|
5023
|
+
"riskLevel": "read",
|
|
5024
|
+
"scopeKinds": [
|
|
5025
|
+
"tenant",
|
|
5026
|
+
"workspace",
|
|
5027
|
+
"resource"
|
|
5028
|
+
],
|
|
5029
|
+
"approvalPolicy": "never",
|
|
5030
|
+
"status": "active",
|
|
5031
|
+
"assignable": true
|
|
5032
|
+
},
|
|
5033
|
+
{
|
|
5034
|
+
"key": "network_access.proxy_instances.create",
|
|
5035
|
+
"domain": "network_access",
|
|
5036
|
+
"resource": "proxy_instances",
|
|
5037
|
+
"action": "create",
|
|
5038
|
+
"displayName": "创建代理实例",
|
|
5039
|
+
"riskLevel": "high",
|
|
5040
|
+
"scopeKinds": [
|
|
5041
|
+
"tenant",
|
|
5042
|
+
"workspace",
|
|
5043
|
+
"resource"
|
|
5044
|
+
],
|
|
5045
|
+
"approvalPolicy": "eligible",
|
|
5046
|
+
"status": "active",
|
|
5047
|
+
"assignable": true
|
|
5048
|
+
},
|
|
5049
|
+
{
|
|
5050
|
+
"key": "network_access.proxy_instances.update",
|
|
5051
|
+
"domain": "network_access",
|
|
5052
|
+
"resource": "proxy_instances",
|
|
5053
|
+
"action": "update",
|
|
5054
|
+
"displayName": "更新代理实例配置",
|
|
5055
|
+
"riskLevel": "high",
|
|
5056
|
+
"scopeKinds": [
|
|
5057
|
+
"tenant",
|
|
5058
|
+
"workspace",
|
|
5059
|
+
"resource"
|
|
5060
|
+
],
|
|
5061
|
+
"approvalPolicy": "eligible",
|
|
5062
|
+
"status": "active",
|
|
5063
|
+
"assignable": true
|
|
5064
|
+
},
|
|
5065
|
+
{
|
|
5066
|
+
"key": "network_access.proxy_instances.view",
|
|
5067
|
+
"domain": "network_access",
|
|
5068
|
+
"resource": "proxy_instances",
|
|
5069
|
+
"action": "view",
|
|
5070
|
+
"displayName": "查看代理实例",
|
|
5071
|
+
"riskLevel": "read",
|
|
5072
|
+
"scopeKinds": [
|
|
5073
|
+
"tenant",
|
|
5074
|
+
"workspace",
|
|
5075
|
+
"resource"
|
|
5076
|
+
],
|
|
5077
|
+
"approvalPolicy": "never",
|
|
5078
|
+
"status": "active",
|
|
5079
|
+
"assignable": true
|
|
5080
|
+
},
|
|
5001
5081
|
{
|
|
5002
5082
|
"key": "network_access.resources.create",
|
|
5003
5083
|
"domain": "network_access",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "network-ingest/v1alpha1",
|
|
3
|
+
"batchId": "proxy-sample-batch-invalid",
|
|
4
|
+
"producerId": "proxy-mihomo",
|
|
5
|
+
"producerKind": "proxy",
|
|
6
|
+
"sentAt": "2026-09-27T08:00:00Z",
|
|
7
|
+
"events": [{
|
|
8
|
+
"id": "proxy-sample-invalid",
|
|
9
|
+
"type": "proxy.runtime.sample",
|
|
10
|
+
"sequence": 1,
|
|
11
|
+
"occurredAt": "2026-09-27T08:00:00Z",
|
|
12
|
+
"payload": {
|
|
13
|
+
"engine": "mihomo",
|
|
14
|
+
"uptimeSeconds": 60,
|
|
15
|
+
"uploadTotal": -1,
|
|
16
|
+
"downloadTotal": 4096
|
|
17
|
+
}
|
|
18
|
+
}]
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "network-ingest/v1alpha1",
|
|
3
|
+
"batchId": "proxy-sample-batch-1",
|
|
4
|
+
"producerId": "proxy-mihomo",
|
|
5
|
+
"producerKind": "proxy",
|
|
6
|
+
"sentAt": "2026-09-27T08:00:00Z",
|
|
7
|
+
"events": [{
|
|
8
|
+
"id": "proxy-sample-1",
|
|
9
|
+
"type": "proxy.runtime.sample",
|
|
10
|
+
"sequence": 1,
|
|
11
|
+
"occurredAt": "2026-09-27T08:00:00Z",
|
|
12
|
+
"payload": {
|
|
13
|
+
"engine": "mihomo",
|
|
14
|
+
"uptimeSeconds": 60,
|
|
15
|
+
"uploadTotal": 1024,
|
|
16
|
+
"downloadTotal": 4096,
|
|
17
|
+
"activeConnections": 2
|
|
18
|
+
}
|
|
19
|
+
}]
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "proxy-runtime/v1alpha1",
|
|
3
|
+
"runtimeId": "proxy-lab-mihomo",
|
|
4
|
+
"messageType": "observation",
|
|
5
|
+
"occurredAt": "2026-09-27T00:00:00Z",
|
|
6
|
+
"payload": {
|
|
7
|
+
"engine": "mihomo",
|
|
8
|
+
"engineVersion": "v1.19.30",
|
|
9
|
+
"health": "healthy",
|
|
10
|
+
"capabilities": ["traffic", "connections", "close_connection"],
|
|
11
|
+
"uptimeSeconds": 60,
|
|
12
|
+
"uploadTotal": 2048,
|
|
13
|
+
"downloadTotal": 4096,
|
|
14
|
+
"activeConnections": 1
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"uid":"","name":"widgets.example.com","group":"example.com","scope":"Namespaced","kind":"Widget","plural":"widgets","ageSeconds":42}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"uid":"crd-uid-1","name":"widgets.example.com","group":"example.com","scope":"Namespaced","kind":"Widget","plural":"widgets","version":"v1","ageSeconds":42,"deletingAt":"2026-09-29T02:00:00Z","allowedActions":["list","delete"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"expectedRevision":0,"enabled":true,"content":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"expectedRevision":0,"enabled":true,"content":"mixed-port: 7890\nsecret: example-test-secret\n"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"proxy-lab","name":"Proxy Lab","engine":"clash"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"proxy-lab-mihomo","name":"middleware Mihomo","engine":"mihomo","host":"middleware"}
|
package/gen/go/sohaapi/client.go
CHANGED
|
@@ -25,6 +25,31 @@ func TestDeliveryPlanStatusLegacyConstants(t *testing.T) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
func TestRuntimeAndWorkbenchLegacyEnumConstants(t *testing.T) {
|
|
29
|
+
scopes := map[RuntimeNetworkUsageScope]string{
|
|
30
|
+
NetworkNamespace: "network_namespace",
|
|
31
|
+
Process: "process",
|
|
32
|
+
Unavailable: "unavailable",
|
|
33
|
+
}
|
|
34
|
+
for scope, want := range scopes {
|
|
35
|
+
if string(scope) != want || !scope.Valid() {
|
|
36
|
+
t.Fatalf("RuntimeNetworkUsageScope %q is not the compatible value %q", scope, want)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
statuses := map[WorkbenchAgentStatusEventStatus]string{
|
|
40
|
+
Cancelled: "cancelled",
|
|
41
|
+
Failed: "failed",
|
|
42
|
+
Queued: "queued",
|
|
43
|
+
Running: "running",
|
|
44
|
+
Succeeded: "succeeded",
|
|
45
|
+
}
|
|
46
|
+
for status, want := range statuses {
|
|
47
|
+
if string(status) != want || !status.Valid() {
|
|
48
|
+
t.Fatalf("WorkbenchAgentStatusEventStatus %q is not the compatible value %q", status, want)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
28
53
|
func TestObservabilityCredentialKeyLegacyTypes(t *testing.T) {
|
|
29
54
|
dataSource := ObservabilityDataSource{
|
|
30
55
|
CredentialKeys: []ObservabilityDataSourceCredentialKeys{
|
package/gen/go/sohaapi/types.go
CHANGED
|
@@ -6749,6 +6749,27 @@ func (e NetworkPolicyPath) Valid() bool {
|
|
|
6749
6749
|
}
|
|
6750
6750
|
}
|
|
6751
6751
|
|
|
6752
|
+
// Defines values for NetworkProxyEngine.
|
|
6753
|
+
const (
|
|
6754
|
+
NetworkProxyEngineMihomo NetworkProxyEngine = "mihomo"
|
|
6755
|
+
NetworkProxyEngineSingBox NetworkProxyEngine = "sing-box"
|
|
6756
|
+
NetworkProxyEngineV2Ray NetworkProxyEngine = "v2ray"
|
|
6757
|
+
)
|
|
6758
|
+
|
|
6759
|
+
// Valid indicates whether the value is a known member of the NetworkProxyEngine enum.
|
|
6760
|
+
func (e NetworkProxyEngine) Valid() bool {
|
|
6761
|
+
switch e {
|
|
6762
|
+
case NetworkProxyEngineMihomo:
|
|
6763
|
+
return true
|
|
6764
|
+
case NetworkProxyEngineSingBox:
|
|
6765
|
+
return true
|
|
6766
|
+
case NetworkProxyEngineV2Ray:
|
|
6767
|
+
return true
|
|
6768
|
+
default:
|
|
6769
|
+
return false
|
|
6770
|
+
}
|
|
6771
|
+
}
|
|
6772
|
+
|
|
6752
6773
|
// Defines values for NetworkResourceKind.
|
|
6753
6774
|
const (
|
|
6754
6775
|
NetworkResourceKindCIDR NetworkResourceKind = "cidr"
|
|
@@ -6820,6 +6841,7 @@ const (
|
|
|
6820
6841
|
NetworkRuntimeKindEndpoint NetworkRuntimeKind = "endpoint"
|
|
6821
6842
|
NetworkRuntimeKindGateway NetworkRuntimeKind = "gateway"
|
|
6822
6843
|
NetworkRuntimeKindNAS NetworkRuntimeKind = "nas"
|
|
6844
|
+
NetworkRuntimeKindProxy NetworkRuntimeKind = "proxy"
|
|
6823
6845
|
)
|
|
6824
6846
|
|
|
6825
6847
|
// Valid indicates whether the value is a known member of the NetworkRuntimeKind enum.
|
|
@@ -6831,6 +6853,8 @@ func (e NetworkRuntimeKind) Valid() bool {
|
|
|
6831
6853
|
return true
|
|
6832
6854
|
case NetworkRuntimeKindNAS:
|
|
6833
6855
|
return true
|
|
6856
|
+
case NetworkRuntimeKindProxy:
|
|
6857
|
+
return true
|
|
6834
6858
|
default:
|
|
6835
6859
|
return false
|
|
6836
6860
|
}
|
|
@@ -18305,16 +18329,18 @@ type KubernetesCustomResource struct {
|
|
|
18305
18329
|
|
|
18306
18330
|
// KubernetesCustomResourceDefinition defines model for KubernetesCustomResourceDefinition.
|
|
18307
18331
|
type KubernetesCustomResourceDefinition struct {
|
|
18308
|
-
AgeSeconds int64
|
|
18309
|
-
AllowedActions []string
|
|
18310
|
-
CreatedAt string
|
|
18311
|
-
|
|
18312
|
-
|
|
18313
|
-
|
|
18314
|
-
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
|
|
18332
|
+
AgeSeconds int64 `json:"ageSeconds"`
|
|
18333
|
+
AllowedActions []string `json:"allowedActions,omitempty"`
|
|
18334
|
+
CreatedAt string `json:"createdAt,omitempty"`
|
|
18335
|
+
DeletingAt *time.Time `json:"deletingAt,omitempty"`
|
|
18336
|
+
Group string `json:"group"`
|
|
18337
|
+
Kind string `json:"kind"`
|
|
18338
|
+
Name string `json:"name"`
|
|
18339
|
+
Plural string `json:"plural"`
|
|
18340
|
+
Scope string `json:"scope"`
|
|
18341
|
+
UID string `json:"uid,omitempty"`
|
|
18342
|
+
Version string `json:"version,omitempty"`
|
|
18343
|
+
Versions []string `json:"versions,omitempty"`
|
|
18318
18344
|
}
|
|
18319
18345
|
|
|
18320
18346
|
// KubernetesCustomResourceDefinitionListEnvelope defines model for KubernetesCustomResourceDefinitionListEnvelope.
|
|
@@ -23022,6 +23048,16 @@ type NetworkPolicySubjects struct {
|
|
|
23022
23048
|
Users []string `json:"users"`
|
|
23023
23049
|
}
|
|
23024
23050
|
|
|
23051
|
+
// NetworkProxyConfigurationInput defines model for NetworkProxyConfigurationInput.
|
|
23052
|
+
type NetworkProxyConfigurationInput struct {
|
|
23053
|
+
Content string `json:"content,omitempty"`
|
|
23054
|
+
Enabled bool `json:"enabled"`
|
|
23055
|
+
ExpectedRevision int64 `json:"expectedRevision"`
|
|
23056
|
+
}
|
|
23057
|
+
|
|
23058
|
+
// NetworkProxyEngine defines model for NetworkProxyEngine.
|
|
23059
|
+
type NetworkProxyEngine string
|
|
23060
|
+
|
|
23025
23061
|
// NetworkProxyFlowSummary defines model for NetworkProxyFlowSummary.
|
|
23026
23062
|
type NetworkProxyFlowSummary struct {
|
|
23027
23063
|
ActiveConnections int64 `json:"activeConnections"`
|
|
@@ -23036,6 +23072,14 @@ type NetworkProxyFlowSummary struct {
|
|
|
23036
23072
|
UploadBytes int64 `json:"uploadBytes"`
|
|
23037
23073
|
}
|
|
23038
23074
|
|
|
23075
|
+
// NetworkProxyInstanceInput defines model for NetworkProxyInstanceInput.
|
|
23076
|
+
type NetworkProxyInstanceInput struct {
|
|
23077
|
+
Engine NetworkProxyEngine `json:"engine"`
|
|
23078
|
+
Host string `json:"host,omitempty"`
|
|
23079
|
+
ID string `json:"id"`
|
|
23080
|
+
Name string `json:"name"`
|
|
23081
|
+
}
|
|
23082
|
+
|
|
23039
23083
|
// NetworkResource defines model for NetworkResource.
|
|
23040
23084
|
type NetworkResource struct {
|
|
23041
23085
|
CreatedAt time.Time `json:"createdAt"`
|
|
@@ -23100,7 +23144,7 @@ type NetworkRuntimeEnrollmentEnvelope struct {
|
|
|
23100
23144
|
Data NetworkRuntimeEnrollment `json:"data"`
|
|
23101
23145
|
}
|
|
23102
23146
|
|
|
23103
|
-
// NetworkRuntimeEnrollmentInput
|
|
23147
|
+
// NetworkRuntimeEnrollmentInput For proxy runtimes, runtimeId identifies an existing proxy instance and deviceId and subjectId must equal runtimeId.
|
|
23104
23148
|
type NetworkRuntimeEnrollmentInput struct {
|
|
23105
23149
|
DeviceID string `json:"deviceId"`
|
|
23106
23150
|
RuntimeID string `json:"runtimeId"`
|
|
@@ -39985,3 +40029,27 @@ const ListAIGatewayRelayUpstreamsParamsStatusDegraded ListAIGatewayRelayUpstream
|
|
|
39985
40029
|
|
|
39986
40030
|
// Deprecated: retained for Go SDK source compatibility.
|
|
39987
40031
|
const ListAIGatewayRelayUpstreamsParamsStatusDisabled ListAIGatewayRelayUpstreamsParamsStatus = "disabled"
|
|
40032
|
+
|
|
40033
|
+
// Deprecated: retained for Go SDK source compatibility.
|
|
40034
|
+
const RuntimeNetworkUsageScopeNetworkNamespace RuntimeNetworkUsageScope = "network_namespace"
|
|
40035
|
+
|
|
40036
|
+
// Deprecated: retained for Go SDK source compatibility.
|
|
40037
|
+
const RuntimeNetworkUsageScopeProcess RuntimeNetworkUsageScope = "process"
|
|
40038
|
+
|
|
40039
|
+
// Deprecated: retained for Go SDK source compatibility.
|
|
40040
|
+
const RuntimeNetworkUsageScopeUnavailable RuntimeNetworkUsageScope = "unavailable"
|
|
40041
|
+
|
|
40042
|
+
// Deprecated: retained for Go SDK source compatibility.
|
|
40043
|
+
const WorkbenchAgentStatusEventStatusCancelled WorkbenchAgentStatusEventStatus = "cancelled"
|
|
40044
|
+
|
|
40045
|
+
// Deprecated: retained for Go SDK source compatibility.
|
|
40046
|
+
const WorkbenchAgentStatusEventStatusFailed WorkbenchAgentStatusEventStatus = "failed"
|
|
40047
|
+
|
|
40048
|
+
// Deprecated: retained for Go SDK source compatibility.
|
|
40049
|
+
const WorkbenchAgentStatusEventStatusQueued WorkbenchAgentStatusEventStatus = "queued"
|
|
40050
|
+
|
|
40051
|
+
// Deprecated: retained for Go SDK source compatibility.
|
|
40052
|
+
const WorkbenchAgentStatusEventStatusRunning WorkbenchAgentStatusEventStatus = "running"
|
|
40053
|
+
|
|
40054
|
+
// Deprecated: retained for Go SDK source compatibility.
|
|
40055
|
+
const WorkbenchAgentStatusEventStatusSucceeded WorkbenchAgentStatusEventStatus = "succeeded"
|
|
@@ -5,6 +5,36 @@ import (
|
|
|
5
5
|
"testing"
|
|
6
6
|
)
|
|
7
7
|
|
|
8
|
+
func TestNetworkProxyInputsRemainInGoSDK(t *testing.T) {
|
|
9
|
+
for _, input := range []struct {
|
|
10
|
+
raw string
|
|
11
|
+
value any
|
|
12
|
+
}{
|
|
13
|
+
{`{"id":"proxy-a","name":"Proxy A","engine":"mihomo","host":"host-a"}`, &NetworkProxyInstanceInput{}},
|
|
14
|
+
{`{"expectedRevision":3,"enabled":false,"content":"mode: rule"}`, &NetworkProxyConfigurationInput{}},
|
|
15
|
+
} {
|
|
16
|
+
if err := json.Unmarshal([]byte(input.raw), input.value); err != nil {
|
|
17
|
+
t.Fatal(err)
|
|
18
|
+
}
|
|
19
|
+
encoded, err := json.Marshal(input.value)
|
|
20
|
+
if err != nil {
|
|
21
|
+
t.Fatal(err)
|
|
22
|
+
}
|
|
23
|
+
var before, after map[string]any
|
|
24
|
+
if err := json.Unmarshal([]byte(input.raw), &before); err != nil {
|
|
25
|
+
t.Fatal(err)
|
|
26
|
+
}
|
|
27
|
+
if err := json.Unmarshal(encoded, &after); err != nil {
|
|
28
|
+
t.Fatal(err)
|
|
29
|
+
}
|
|
30
|
+
for name, value := range before {
|
|
31
|
+
if after[name] != value {
|
|
32
|
+
t.Fatalf("%s changed during round trip: %s", name, encoded)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
8
38
|
func TestToolInvocationResultPreservesAbsentVersion(t *testing.T) {
|
|
9
39
|
for _, input := range []string{
|
|
10
40
|
`{"toolName":"legacy","riskLevel":"read","requiresApproval":false,"result":"success"}`,
|