@opensoha/contracts 0.1.20 → 0.1.21

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.
Files changed (32) hide show
  1. package/auth/catalog_generated.go +2 -2
  2. package/auth/permission-catalog.json +81 -1
  3. package/compat/json-schema-ecosystem-0.1.0.json +1 -1
  4. package/compat/openapi-loose-boundaries-0.1.0.json +1 -1
  5. package/fixtures/json-schema/network-ingest-event/invalid/proxy-runtime-negative-total.json +19 -0
  6. package/fixtures/json-schema/network-ingest-event/valid/proxy-runtime-sample.json +20 -0
  7. package/fixtures/json-schema/proxy-runtime/invalid/v2ray-connection-snapshot.json +10 -0
  8. package/fixtures/json-schema/proxy-runtime/valid/mihomo-observation.json +16 -0
  9. package/fixtures/openapi/KubernetesCustomResourceDefinition/invalid/empty-uid.json +1 -0
  10. package/fixtures/openapi/KubernetesCustomResourceDefinition/valid/deleting-definition.json +1 -0
  11. package/fixtures/openapi/KubernetesResourceUpdatePlanRequest/valid/range-kind.json +5 -0
  12. package/fixtures/openapi/KubernetesResourceYaml/valid/range-kind.json +5 -0
  13. package/fixtures/openapi/NetworkProxyConfigurationInput/invalid/empty-content.json +1 -0
  14. package/fixtures/openapi/NetworkProxyConfigurationInput/valid/enabled.json +1 -0
  15. package/fixtures/openapi/NetworkProxyInstanceInput/invalid/unknown-engine.json +1 -0
  16. package/fixtures/openapi/NetworkProxyInstanceInput/valid/mihomo.json +1 -0
  17. package/gen/go/sohaapi/client.go +1 -1
  18. package/gen/go/sohaapi/client_test.go +25 -0
  19. package/gen/go/sohaapi/types.go +40 -11
  20. package/gen/ts/sohaapi/index.ts +264 -156
  21. package/go.mod +4 -4
  22. package/go.sum +4 -4
  23. package/network/README.md +12 -0
  24. package/network/network-ingest-event.schema.json +21 -3
  25. package/network/network-runtime-protocol.schema.json +2 -2
  26. package/network/proxy-runtime.schema.json +113 -0
  27. package/network/schema.go +7 -0
  28. package/openapi/soha-api.json +412 -4
  29. package/openapi/soha-api.yaml +381 -251
  30. package/openapi/spec_generated.go +3 -3
  31. package/package.json +2 -1
  32. 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 = "5b4c9eed71c549d61a6fd538db542681cb2932619d66ab031c74fcbaaa0c9867"
10
- PermissionCatalogSHA256 = "e1e4bab807f64894c9bbde245394902fb1e82253d5847585102560ea6f853894"
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:5b4c9eed71c549d61a6fd538db542681cb2932619d66ab031c74fcbaaa0c9867",
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",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.20",
2
+ "version": "0.1.21",
3
3
  "schemas": {
4
4
  "plugins/plugin-manifest.schema.json": {
5
5
  "rootRequired": ["id", "name", "publisher", "type", "version"],
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.20",
2
+ "version": "0.1.21",
3
3
  "generatedFrom": "openapi/soha-api.yaml",
4
4
  "entries": [
5
5
  {
@@ -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,10 @@
1
+ {
2
+ "schemaVersion": "proxy-runtime/v1alpha1",
3
+ "runtimeId": "proxy-lab-v2ray",
4
+ "messageType": "connections.snapshot",
5
+ "occurredAt": "2026-09-27T00:00:00Z",
6
+ "payload": {
7
+ "engine": "v2ray",
8
+ "connections": []
9
+ }
10
+ }
@@ -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,5 @@
1
+ {
2
+ "kind": "range",
3
+ "name": "example",
4
+ "content": "apiVersion: example.io/v1\nkind: range\nmetadata:\n name: example\n"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "kind": "range",
3
+ "name": "example",
4
+ "content": "apiVersion: example.io/v1\nkind: range\nmetadata:\n name: example\n"
5
+ }
@@ -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"}
@@ -16,7 +16,7 @@ import (
16
16
  "time"
17
17
  )
18
18
 
19
- const defaultUserAgent = "opensoha-contracts/0.1.20"
19
+ const defaultUserAgent = "opensoha-contracts/0.1.21"
20
20
 
21
21
  type Client struct {
22
22
  BaseURL string
@@ -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{
@@ -6820,6 +6820,7 @@ const (
6820
6820
  NetworkRuntimeKindEndpoint NetworkRuntimeKind = "endpoint"
6821
6821
  NetworkRuntimeKindGateway NetworkRuntimeKind = "gateway"
6822
6822
  NetworkRuntimeKindNAS NetworkRuntimeKind = "nas"
6823
+ NetworkRuntimeKindProxy NetworkRuntimeKind = "proxy"
6823
6824
  )
6824
6825
 
6825
6826
  // Valid indicates whether the value is a known member of the NetworkRuntimeKind enum.
@@ -6831,6 +6832,8 @@ func (e NetworkRuntimeKind) Valid() bool {
6831
6832
  return true
6832
6833
  case NetworkRuntimeKindNAS:
6833
6834
  return true
6835
+ case NetworkRuntimeKindProxy:
6836
+ return true
6834
6837
  default:
6835
6838
  return false
6836
6839
  }
@@ -18305,16 +18308,18 @@ type KubernetesCustomResource struct {
18305
18308
 
18306
18309
  // KubernetesCustomResourceDefinition defines model for KubernetesCustomResourceDefinition.
18307
18310
  type KubernetesCustomResourceDefinition struct {
18308
- AgeSeconds int64 `json:"ageSeconds"`
18309
- AllowedActions []string `json:"allowedActions,omitempty"`
18310
- CreatedAt string `json:"createdAt,omitempty"`
18311
- Group string `json:"group"`
18312
- Kind string `json:"kind"`
18313
- Name string `json:"name"`
18314
- Plural string `json:"plural"`
18315
- Scope string `json:"scope"`
18316
- Version string `json:"version,omitempty"`
18317
- Versions []string `json:"versions,omitempty"`
18311
+ AgeSeconds int64 `json:"ageSeconds"`
18312
+ AllowedActions []string `json:"allowedActions,omitempty"`
18313
+ CreatedAt string `json:"createdAt,omitempty"`
18314
+ DeletingAt *time.Time `json:"deletingAt,omitempty"`
18315
+ Group string `json:"group"`
18316
+ Kind string `json:"kind"`
18317
+ Name string `json:"name"`
18318
+ Plural string `json:"plural"`
18319
+ Scope string `json:"scope"`
18320
+ UID string `json:"uid,omitempty"`
18321
+ Version string `json:"version,omitempty"`
18322
+ Versions []string `json:"versions,omitempty"`
18318
18323
  }
18319
18324
 
18320
18325
  // KubernetesCustomResourceDefinitionListEnvelope defines model for KubernetesCustomResourceDefinitionListEnvelope.
@@ -23100,7 +23105,7 @@ type NetworkRuntimeEnrollmentEnvelope struct {
23100
23105
  Data NetworkRuntimeEnrollment `json:"data"`
23101
23106
  }
23102
23107
 
23103
- // NetworkRuntimeEnrollmentInput defines model for NetworkRuntimeEnrollmentInput.
23108
+ // NetworkRuntimeEnrollmentInput For proxy runtimes, runtimeId identifies an existing proxy instance and deviceId and subjectId must equal runtimeId.
23104
23109
  type NetworkRuntimeEnrollmentInput struct {
23105
23110
  DeviceID string `json:"deviceId"`
23106
23111
  RuntimeID string `json:"runtimeId"`
@@ -39985,3 +39990,27 @@ const ListAIGatewayRelayUpstreamsParamsStatusDegraded ListAIGatewayRelayUpstream
39985
39990
 
39986
39991
  // Deprecated: retained for Go SDK source compatibility.
39987
39992
  const ListAIGatewayRelayUpstreamsParamsStatusDisabled ListAIGatewayRelayUpstreamsParamsStatus = "disabled"
39993
+
39994
+ // Deprecated: retained for Go SDK source compatibility.
39995
+ const RuntimeNetworkUsageScopeNetworkNamespace RuntimeNetworkUsageScope = "network_namespace"
39996
+
39997
+ // Deprecated: retained for Go SDK source compatibility.
39998
+ const RuntimeNetworkUsageScopeProcess RuntimeNetworkUsageScope = "process"
39999
+
40000
+ // Deprecated: retained for Go SDK source compatibility.
40001
+ const RuntimeNetworkUsageScopeUnavailable RuntimeNetworkUsageScope = "unavailable"
40002
+
40003
+ // Deprecated: retained for Go SDK source compatibility.
40004
+ const WorkbenchAgentStatusEventStatusCancelled WorkbenchAgentStatusEventStatus = "cancelled"
40005
+
40006
+ // Deprecated: retained for Go SDK source compatibility.
40007
+ const WorkbenchAgentStatusEventStatusFailed WorkbenchAgentStatusEventStatus = "failed"
40008
+
40009
+ // Deprecated: retained for Go SDK source compatibility.
40010
+ const WorkbenchAgentStatusEventStatusQueued WorkbenchAgentStatusEventStatus = "queued"
40011
+
40012
+ // Deprecated: retained for Go SDK source compatibility.
40013
+ const WorkbenchAgentStatusEventStatusRunning WorkbenchAgentStatusEventStatus = "running"
40014
+
40015
+ // Deprecated: retained for Go SDK source compatibility.
40016
+ const WorkbenchAgentStatusEventStatusSucceeded WorkbenchAgentStatusEventStatus = "succeeded"