@opensoha/contracts 0.1.19 → 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 (62) 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/AgentPrometheusQueryRequest/invalid/basic.json +5 -0
  10. package/fixtures/openapi/AgentPrometheusQueryRequest/invalid/missing-range-fields.json +5 -0
  11. package/fixtures/openapi/AgentPrometheusQueryRequest/invalid/zero-start.json +8 -0
  12. package/fixtures/openapi/AgentPrometheusQueryRequest/valid/basic.json +8 -0
  13. package/fixtures/openapi/AgentPrometheusQueryRequest/valid/instant.json +5 -0
  14. package/fixtures/openapi/ClusterAgentUpgradeInput/invalid/image.json +1 -0
  15. package/fixtures/openapi/ClusterAgentUpgradeInput/invalid/missing.json +1 -0
  16. package/fixtures/openapi/ClusterAgentUpgradeInput/invalid/mutable-tag.json +1 -0
  17. package/fixtures/openapi/ClusterAgentUpgradeInput/valid/stable.json +1 -0
  18. package/fixtures/openapi/ClusterAgentUpgradeInput/valid/unprefixed.json +1 -0
  19. package/fixtures/openapi/KubernetesAgentCustomResourceRule/invalid/basic.json +9 -0
  20. package/fixtures/openapi/KubernetesAgentCustomResourceRule/valid/basic.json +14 -0
  21. package/fixtures/openapi/KubernetesAgentCustomResourceRule/valid/dns-names.json +1 -0
  22. package/fixtures/openapi/KubernetesClusterRegistrationRequest/invalid/basic.json +4 -0
  23. package/fixtures/openapi/KubernetesClusterRegistrationRequest/valid/basic.json +6 -0
  24. package/fixtures/openapi/KubernetesConfigMapDataInput/invalid/basic.json +5 -0
  25. package/fixtures/openapi/KubernetesConfigMapDataInput/valid/basic.json +8 -0
  26. package/fixtures/openapi/KubernetesCronJobSuspendInput/invalid/basic.json +3 -0
  27. package/fixtures/openapi/KubernetesCronJobSuspendInput/valid/basic.json +3 -0
  28. package/fixtures/openapi/KubernetesCustomResourceAccess/invalid/basic.json +5 -0
  29. package/fixtures/openapi/KubernetesCustomResourceAccess/valid/basic.json +6 -0
  30. package/fixtures/openapi/KubernetesCustomResourceDefinition/invalid/empty-uid.json +1 -0
  31. package/fixtures/openapi/KubernetesCustomResourceDefinition/valid/deleting-definition.json +1 -0
  32. package/fixtures/openapi/KubernetesNamespaceCreateInput/invalid/basic.json +1 -0
  33. package/fixtures/openapi/KubernetesNamespaceCreateInput/valid/basic.json +1 -0
  34. package/fixtures/openapi/KubernetesNodeDrainInput/invalid/basic.json +3 -0
  35. package/fixtures/openapi/KubernetesNodeDrainInput/valid/basic.json +3 -0
  36. package/fixtures/openapi/KubernetesNodeSchedulabilityInput/invalid/basic.json +1 -0
  37. package/fixtures/openapi/KubernetesNodeSchedulabilityInput/valid/basic.json +3 -0
  38. package/fixtures/openapi/KubernetesResourceUpdatePlanRequest/valid/range-kind.json +5 -0
  39. package/fixtures/openapi/KubernetesResourceYaml/valid/range-kind.json +5 -0
  40. package/fixtures/openapi/KubernetesSecretDataInput/invalid/basic.json +5 -0
  41. package/fixtures/openapi/KubernetesSecretDataInput/valid/basic.json +5 -0
  42. package/fixtures/openapi/NetworkProxyConfigurationInput/invalid/empty-content.json +1 -0
  43. package/fixtures/openapi/NetworkProxyConfigurationInput/valid/enabled.json +1 -0
  44. package/fixtures/openapi/NetworkProxyInstanceInput/invalid/unknown-engine.json +1 -0
  45. package/fixtures/openapi/NetworkProxyInstanceInput/valid/mihomo.json +1 -0
  46. package/gen/go/sohaapi/client.go +1 -1
  47. package/gen/go/sohaapi/client_test.go +25 -0
  48. package/gen/go/sohaapi/types.go +122 -24
  49. package/gen/ts/sohaapi/index.ts +266 -1
  50. package/go.mod +4 -4
  51. package/go.sum +4 -4
  52. package/network/README.md +12 -0
  53. package/network/network-ingest-event.schema.json +21 -3
  54. package/network/network-runtime-protocol.schema.json +2 -2
  55. package/network/proxy-runtime.schema.json +113 -0
  56. package/network/schema.go +7 -0
  57. package/openapi/soha-api.json +938 -4
  58. package/openapi/soha-api.yaml +389 -3
  59. package/openapi/spec_generated.go +3 -3
  60. package/package.json +2 -1
  61. package/resource/agent_access.go +23 -0
  62. 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.19",
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.19",
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,5 @@
1
+ {
2
+ "endpoint": "http://prometheus:9090",
3
+ "query": "",
4
+ "kind": "proxy"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "endpoint": "http://prometheus.monitoring.svc:9090",
3
+ "query": "up",
4
+ "kind": "range"
5
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "endpoint": "http://prometheus.monitoring.svc:9090",
3
+ "query": "up",
4
+ "kind": "range",
5
+ "start": 0,
6
+ "end": 100,
7
+ "step": 1
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "endpoint": "http://prometheus.monitoring:9090",
3
+ "query": "up",
4
+ "kind": "range",
5
+ "start": 1,
6
+ "end": 60,
7
+ "step": 10
8
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "endpoint": "http://prometheus.monitoring.svc:9090",
3
+ "query": "up",
4
+ "kind": "instant"
5
+ }
@@ -0,0 +1 @@
1
+ {"version":"other.example/agent:latest"}
@@ -0,0 +1 @@
1
+ {"version":"v0.1.7"}
@@ -0,0 +1 @@
1
+ {"version":"0.1.7"}
@@ -0,0 +1,9 @@
1
+ {
2
+ "apiGroup": "*",
3
+ "resources": [
4
+ "*"
5
+ ],
6
+ "verbs": [
7
+ "*"
8
+ ]
9
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "apiGroup": "example.io",
3
+ "resources": [
4
+ "widgets"
5
+ ],
6
+ "verbs": [
7
+ "get",
8
+ "list",
9
+ "update"
10
+ ],
11
+ "namespaces": [
12
+ "apps"
13
+ ]
14
+ }
@@ -0,0 +1 @@
1
+ {"apiGroup":"apps--demo.example.io","resources":["widget-sets"],"verbs":["get","list"],"namespaces":["apps"]}
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "private",
3
+ "prometheusTransport": "fallback"
4
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "private",
3
+ "connectionMode": "agent",
4
+ "prometheusTransport": "agent",
5
+ "agentCustomResourceRules": []
6
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "data": {
3
+ "key": 1
4
+ }
5
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "data": {
3
+ "key": "text"
4
+ },
5
+ "binaryData": {
6
+ "payload": "AAEC"
7
+ }
8
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "suspend": "yes"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "suspend": true
3
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "allowedActions": [
3
+ "*"
4
+ ]
5
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "allowedActions": [
3
+ "list",
4
+ "view"
5
+ ]
6
+ }
@@ -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
+ {"name":"team-a","labels":{"environment":"test"}}
@@ -0,0 +1,3 @@
1
+ {
2
+ "timeoutSeconds": 29
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "timeoutSeconds": 30
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "unschedulable": false
3
+ }
@@ -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,5 @@
1
+ {
2
+ "data": {
3
+ "example": true
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "data": {
3
+ "example": "example-value"
4
+ }
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.19"
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{