@opensoha/contracts 0.1.19 → 0.1.20

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 (39) hide show
  1. package/compat/json-schema-ecosystem-0.1.0.json +1 -1
  2. package/compat/openapi-loose-boundaries-0.1.0.json +1 -1
  3. package/fixtures/openapi/AgentPrometheusQueryRequest/invalid/basic.json +5 -0
  4. package/fixtures/openapi/AgentPrometheusQueryRequest/invalid/missing-range-fields.json +5 -0
  5. package/fixtures/openapi/AgentPrometheusQueryRequest/invalid/zero-start.json +8 -0
  6. package/fixtures/openapi/AgentPrometheusQueryRequest/valid/basic.json +8 -0
  7. package/fixtures/openapi/AgentPrometheusQueryRequest/valid/instant.json +5 -0
  8. package/fixtures/openapi/ClusterAgentUpgradeInput/invalid/image.json +1 -0
  9. package/fixtures/openapi/ClusterAgentUpgradeInput/invalid/missing.json +1 -0
  10. package/fixtures/openapi/ClusterAgentUpgradeInput/invalid/mutable-tag.json +1 -0
  11. package/fixtures/openapi/ClusterAgentUpgradeInput/valid/stable.json +1 -0
  12. package/fixtures/openapi/ClusterAgentUpgradeInput/valid/unprefixed.json +1 -0
  13. package/fixtures/openapi/KubernetesAgentCustomResourceRule/invalid/basic.json +9 -0
  14. package/fixtures/openapi/KubernetesAgentCustomResourceRule/valid/basic.json +14 -0
  15. package/fixtures/openapi/KubernetesAgentCustomResourceRule/valid/dns-names.json +1 -0
  16. package/fixtures/openapi/KubernetesClusterRegistrationRequest/invalid/basic.json +4 -0
  17. package/fixtures/openapi/KubernetesClusterRegistrationRequest/valid/basic.json +6 -0
  18. package/fixtures/openapi/KubernetesConfigMapDataInput/invalid/basic.json +5 -0
  19. package/fixtures/openapi/KubernetesConfigMapDataInput/valid/basic.json +8 -0
  20. package/fixtures/openapi/KubernetesCronJobSuspendInput/invalid/basic.json +3 -0
  21. package/fixtures/openapi/KubernetesCronJobSuspendInput/valid/basic.json +3 -0
  22. package/fixtures/openapi/KubernetesCustomResourceAccess/invalid/basic.json +5 -0
  23. package/fixtures/openapi/KubernetesCustomResourceAccess/valid/basic.json +6 -0
  24. package/fixtures/openapi/KubernetesNamespaceCreateInput/invalid/basic.json +1 -0
  25. package/fixtures/openapi/KubernetesNamespaceCreateInput/valid/basic.json +1 -0
  26. package/fixtures/openapi/KubernetesNodeDrainInput/invalid/basic.json +3 -0
  27. package/fixtures/openapi/KubernetesNodeDrainInput/valid/basic.json +3 -0
  28. package/fixtures/openapi/KubernetesNodeSchedulabilityInput/invalid/basic.json +1 -0
  29. package/fixtures/openapi/KubernetesNodeSchedulabilityInput/valid/basic.json +3 -0
  30. package/fixtures/openapi/KubernetesSecretDataInput/invalid/basic.json +5 -0
  31. package/fixtures/openapi/KubernetesSecretDataInput/valid/basic.json +5 -0
  32. package/gen/go/sohaapi/client.go +1 -1
  33. package/gen/go/sohaapi/types.go +82 -13
  34. package/gen/ts/sohaapi/index.ts +157 -0
  35. package/openapi/soha-api.json +528 -2
  36. package/openapi/soha-api.yaml +257 -1
  37. package/openapi/spec_generated.go +3 -3
  38. package/package.json +1 -1
  39. package/resource/agent_access.go +23 -0
@@ -1,7 +1,7 @@
1
1
  openapi: 3.1.0
2
2
  info:
3
3
  title: Soha API
4
- version: 0.1.19
4
+ version: 0.1.20
5
5
  description: >
6
6
  Public OpenSoha core API contract. This first contract focuses on stable
7
7
  cross-repository boundaries: auth, health, runner-facing control-plane
@@ -34594,6 +34594,11 @@ components:
34594
34594
  type: boolean
34595
34595
  usesInformerCache:
34596
34596
  type: boolean
34597
+ customResourceRules:
34598
+ type: array
34599
+ maxItems: 50
34600
+ items:
34601
+ $ref: "#/components/schemas/KubernetesAgentCustomResourceRule"
34597
34602
  additionalProperties: false
34598
34603
  KubernetesPrometheusDetail:
34599
34604
  type: object
@@ -34607,6 +34612,8 @@ components:
34607
34612
  type: string
34608
34613
  hasBearerToken:
34609
34614
  type: boolean
34615
+ transport:
34616
+ $ref: "#/components/schemas/KubernetesPrometheusTransport"
34610
34617
  additionalProperties: false
34611
34618
  KubernetesMonitoringDetail:
34612
34619
  type: object
@@ -40744,6 +40751,7 @@ components:
40744
40751
  action:
40745
40752
  type: string
40746
40753
  enum: [create]
40754
+ x-enum-varnames: [Create]
40747
40755
  additionalProperties: false
40748
40756
  KubernetesResourceCreateScopeDecision:
40749
40757
  type: object
@@ -46922,3 +46930,251 @@ components:
46922
46930
  properties:
46923
46931
  data: { $ref: "#/components/schemas/NetworkPolicyPreviewResult" }
46924
46932
  additionalProperties: false
46933
+ KubernetesCustomResourceAccess:
46934
+ type: object
46935
+ required: [allowedActions]
46936
+ properties:
46937
+ allowedActions:
46938
+ type: array
46939
+ items: { type: string, enum: [list, view, create, update, delete] }
46940
+ additionalProperties: false
46941
+ KubernetesCustomResourceAccessEnvelope:
46942
+ type: object
46943
+ required: [data]
46944
+ properties:
46945
+ data: { $ref: "#/components/schemas/KubernetesCustomResourceAccess" }
46946
+ additionalProperties: false
46947
+ KubernetesClusterRegistrationRequest:
46948
+ type: object
46949
+ properties:
46950
+ id: { type: string }
46951
+ name: { type: string }
46952
+ region: { type: string }
46953
+ environment: { type: string }
46954
+ labels: { type: object, additionalProperties: { type: string } }
46955
+ connectionMode: { $ref: "#/components/schemas/KubernetesConnectionMode" }
46956
+ kubeconfig: { type: string }
46957
+ context: { type: string }
46958
+ agentEndpoint: { type: string }
46959
+ agentToken: { type: string, writeOnly: true }
46960
+ prometheusBaseUrl: { type: string }
46961
+ prometheusBearerToken: { type: string, writeOnly: true }
46962
+ prometheusClusterLabel: { type: string }
46963
+ grafanaBaseUrl: { type: string }
46964
+ prometheusTransport: { $ref: "#/components/schemas/KubernetesPrometheusTransport" }
46965
+ agentCustomResourceRules:
46966
+ type: array
46967
+ maxItems: 50
46968
+ items: { $ref: "#/components/schemas/KubernetesAgentCustomResourceRule" }
46969
+ additionalProperties: false
46970
+ KubernetesAgentCustomResourceRule:
46971
+ type: object
46972
+ required: [apiGroup, resources, verbs]
46973
+ properties:
46974
+ apiGroup: { type: string, pattern: '^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$', maxLength: 253 }
46975
+ resources:
46976
+ type: array
46977
+ minItems: 1
46978
+ maxItems: 50
46979
+ uniqueItems: true
46980
+ items: { type: string, pattern: '^[a-z]([a-z0-9-]*[a-z0-9])?$', maxLength: 63 }
46981
+ verbs:
46982
+ type: array
46983
+ minItems: 1
46984
+ uniqueItems: true
46985
+ items:
46986
+ type: string
46987
+ enum: [get, list, watch, create, update, patch, delete]
46988
+ x-enum-varnames: [KubernetesAgentCustomResourceRuleVerbsGet, KubernetesAgentCustomResourceRuleVerbsList, KubernetesAgentCustomResourceRuleVerbsWatch, KubernetesAgentCustomResourceRuleVerbsCreate, KubernetesAgentCustomResourceRuleVerbsUpdate, KubernetesAgentCustomResourceRuleVerbsPatch, KubernetesAgentCustomResourceRuleVerbsDelete]
46989
+ namespaces:
46990
+ description: Explicit namespaces; omitted or empty grants cluster-wide access to the named resources only.
46991
+ type: array
46992
+ maxItems: 50
46993
+ uniqueItems: true
46994
+ items: { type: string, pattern: '^[a-z0-9]([a-z0-9-]*[a-z0-9])?$', maxLength: 63 }
46995
+ additionalProperties: false
46996
+ KubernetesPrometheusTransport:
46997
+ type: string
46998
+ enum: [direct, agent]
46999
+ default: direct
47000
+ AgentPrometheusQueryRequest:
47001
+ type: object
47002
+ required: [endpoint, query, kind]
47003
+ properties:
47004
+ endpoint: { type: string, maxLength: 2048 }
47005
+ query: { type: string, minLength: 1, maxLength: 16384 }
47006
+ kind: { type: string, enum: [instant, range] }
47007
+ start: { type: integer, format: int64, minimum: 1 }
47008
+ end: { type: integer, format: int64, minimum: 1 }
47009
+ step: { type: integer, minimum: 1 }
47010
+ if:
47011
+ properties:
47012
+ kind: { const: range }
47013
+ required: [kind]
47014
+ then:
47015
+ required: [start, end, step]
47016
+ description: Range queries require start, end and step. The runtime also enforces end greater than start, a maximum 24-hour range and at most 11000 intervals.
47017
+ additionalProperties: false
47018
+ KubernetesNamespaceInput:
47019
+ type: object
47020
+ properties:
47021
+ name: &a2
47022
+ type: string
47023
+ labels: &a1
47024
+ $ref: "#/components/schemas/KubernetesStringMap"
47025
+ annotations: *a1
47026
+ additionalProperties: false
47027
+ KubernetesNamespaceCreateInput:
47028
+ type: object
47029
+ required: [name]
47030
+ properties:
47031
+ name:
47032
+ type: string
47033
+ minLength: 1
47034
+ pattern: "\\S"
47035
+ labels: *a1
47036
+ annotations: *a1
47037
+ additionalProperties: false
47038
+ KubernetesNamespaceEnvelope:
47039
+ type: object
47040
+ required:
47041
+ - data
47042
+ properties:
47043
+ data:
47044
+ $ref: "#/components/schemas/KubernetesNamespace"
47045
+ additionalProperties: false
47046
+ KubernetesNodeUpdateInput:
47047
+ type: object
47048
+ properties:
47049
+ labels: *a1
47050
+ taints:
47051
+ type: array
47052
+ items:
47053
+ $ref: "#/components/schemas/KubernetesNodeTaint"
47054
+ additionalProperties: false
47055
+ KubernetesNodeSchedulabilityInput:
47056
+ type: object
47057
+ required:
47058
+ - unschedulable
47059
+ properties:
47060
+ unschedulable:
47061
+ type: boolean
47062
+ additionalProperties: false
47063
+ KubernetesNodeDrainInput:
47064
+ type: object
47065
+ properties:
47066
+ force:
47067
+ type: boolean
47068
+ deleteEmptyDirData:
47069
+ type: boolean
47070
+ timeoutSeconds:
47071
+ type: integer
47072
+ minimum: 30
47073
+ maximum: 1800
47074
+ default: 300
47075
+ additionalProperties: false
47076
+ KubernetesResourceYamlInput:
47077
+ type: object
47078
+ required: [content]
47079
+ properties:
47080
+ content: {type: string, minLength: 1}
47081
+ additionalProperties: false
47082
+ KubernetesConfigMapDataInput:
47083
+ type: object
47084
+ properties:
47085
+ data: *a1
47086
+ binaryData: *a1
47087
+ additionalProperties: false
47088
+ KubernetesSecretDataInput:
47089
+ description: Data values are plain text. The response detail returns Kubernetes Base64-encoded values.
47090
+ type: object
47091
+ properties:
47092
+ data: *a1
47093
+ additionalProperties: false
47094
+ KubernetesCronJobSuspendInput:
47095
+ type: object
47096
+ required:
47097
+ - suspend
47098
+ properties:
47099
+ suspend:
47100
+ type: boolean
47101
+ additionalProperties: false
47102
+ KubernetesSecretDetail:
47103
+ type: object
47104
+ required:
47105
+ - name
47106
+ - namespace
47107
+ - immutable
47108
+ - ageSeconds
47109
+ - type
47110
+ properties:
47111
+ name:
47112
+ type: string
47113
+ namespace:
47114
+ type: string
47115
+ labels:
47116
+ $ref: "#/components/schemas/KubernetesStringMap"
47117
+ annotations:
47118
+ $ref: "#/components/schemas/KubernetesStringMap"
47119
+ data:
47120
+ $ref: "#/components/schemas/KubernetesStringMap"
47121
+ description: Secret data values encoded with standard Base64. Requires secret-data.view.
47122
+ immutable:
47123
+ type: boolean
47124
+ createdAt:
47125
+ type: string
47126
+ ageSeconds:
47127
+ type: integer
47128
+ format: int64
47129
+ minimum: 0
47130
+ type: *a2
47131
+ additionalProperties: false
47132
+ KubernetesSecretDetailEnvelope:
47133
+ type: object
47134
+ required:
47135
+ - data
47136
+ properties:
47137
+ data:
47138
+ $ref: "#/components/schemas/KubernetesSecretDetail"
47139
+ additionalProperties: false
47140
+ ClusterAgentUpgradeInput:
47141
+ type: object
47142
+ additionalProperties: false
47143
+ required: [version]
47144
+ properties:
47145
+ version:
47146
+ type: string
47147
+ maxLength: 64
47148
+ pattern: '^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
47149
+ description: Explicit stable official Agent version, such as v0.1.7. Registry and container identity cannot be overridden.
47150
+ ClusterAgentUpgradeStatus:
47151
+ type: object
47152
+ additionalProperties: false
47153
+ required: [version, image, recommendedVersion, rolloutStatus, message, canUpgrade]
47154
+ properties:
47155
+ version: {type: string, description: Version reported by the currently connected Agent process.}
47156
+ image: {type: string, description: Desired image of the standard Agent Deployment.}
47157
+ recommendedVersion: {type: string, description: Agent version bundled with this Core release.}
47158
+ rolloutStatus: {type: string}
47159
+ message: {type: string}
47160
+ canUpgrade: {type: boolean}
47161
+ upgradeDisabledReason: {type: string}
47162
+ ClusterAgentUpgradeStatusEnvelope:
47163
+ type: object
47164
+ required: [data]
47165
+ properties:
47166
+ data:
47167
+ $ref: "#/components/schemas/ClusterAgentUpgradeStatus"
47168
+ ClusterAgentUpgradeResult:
47169
+ type: object
47170
+ additionalProperties: false
47171
+ required: [previousImage, targetImage]
47172
+ properties:
47173
+ previousImage: {type: string}
47174
+ targetImage: {type: string}
47175
+ ClusterAgentUpgradeResultEnvelope:
47176
+ type: object
47177
+ required: [data]
47178
+ properties:
47179
+ data:
47180
+ $ref: "#/components/schemas/ClusterAgentUpgradeResult"
@@ -5,9 +5,9 @@ package openapi
5
5
  import _ "embed"
6
6
 
7
7
  const (
8
- Version = "0.1.19"
9
- YAMLSHA256 = "a1edda91ecc623423ca1875777dd500f12f239ca1571d7276a23d5e6c00c4c40"
10
- JSONSHA256 = "40f61307c9379b1496b43ff31fe8aebd82f1353100fe799f6d1ebbaefb1c3cd3"
8
+ Version = "0.1.20"
9
+ YAMLSHA256 = "cbf0b3c1f47da982289c43ccdc76c5eb9e2c8d064aebfe92aa23e4b179ea136b"
10
+ JSONSHA256 = "6862030a09d680756adc6bff8cc1e6bf81318704bf957027f22e1b7655bb471e"
11
11
  )
12
12
 
13
13
  //go:embed soha-api.yaml
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensoha/contracts",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "private": false,
5
5
  "description": "Shared OpenSoha API, agent, MCP, skill, event, and auth contracts.",
6
6
  "license": "Apache-2.0",
@@ -0,0 +1,23 @@
1
+ package resource
2
+
3
+ // CustomResourceAccessRequest checks the Agent's own Kubernetes identity.
4
+ type CustomResourceAccessRequest struct {
5
+ Definition CRDResourceDefinition `json:"definition"`
6
+ Namespace string `json:"namespace"`
7
+ Name string `json:"name,omitempty"`
8
+ }
9
+
10
+ type CustomResourceAccess struct {
11
+ AllowedActions []string `json:"allowedActions"`
12
+ }
13
+
14
+ // PrometheusQuery carries a bounded query for an already configured endpoint.
15
+ // Endpoint must match the Agent configuration; it is never a proxy destination.
16
+ type PrometheusQuery struct {
17
+ Endpoint string `json:"endpoint"`
18
+ Query string `json:"query"`
19
+ Kind string `json:"kind"`
20
+ Start int64 `json:"start,omitempty"`
21
+ End int64 `json:"end,omitempty"`
22
+ Step int64 `json:"step,omitempty"`
23
+ }