@opensoha/contracts 0.1.13 → 0.1.14

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.
@@ -6,8 +6,8 @@ import _ "embed"
6
6
 
7
7
  const (
8
8
  PermissionCatalogVersion = "2.0.0"
9
- PermissionCatalogContentSHA256 = "82626eb53d9cd6b53ee502ae32285392c672f7f186a7dbefb42bf1f700d67e98"
10
- PermissionCatalogSHA256 = "f563a9be8901002e790f271d589c9f4b8b05dcd8e9b4bba767b835b1cc606b76"
9
+ PermissionCatalogContentSHA256 = "0efe8f496fa0fb29703584586f9306d04fdb5b9a38eaea78532107698230f609"
10
+ PermissionCatalogSHA256 = "5f1d8b49fb4155473f61ff255002ec7a13e3f63d718d5f9fc592daa93da610df"
11
11
  )
12
12
 
13
13
  //go:embed permission-catalog.json
@@ -86,3 +86,43 @@ func TestPermissionCatalogIncludesIndependentResourceCreationEntry(t *testing.T)
86
86
  t.Fatal("platform.resource-creation.use is missing")
87
87
  }
88
88
  }
89
+
90
+ func TestPermissionCatalogIncludesIndependentWorkbenchEntries(t *testing.T) {
91
+ var catalog struct {
92
+ Permissions []struct {
93
+ Key string `json:"key"`
94
+ Domain string `json:"domain"`
95
+ Action string `json:"action"`
96
+ Status string `json:"status"`
97
+ Assignable bool `json:"assignable"`
98
+ } `json:"permissions"`
99
+ }
100
+ if err := json.Unmarshal(PermissionCatalogJSON(), &catalog); err != nil {
101
+ t.Fatalf("decode permission catalog: %v", err)
102
+ }
103
+
104
+ want := map[string]bool{
105
+ "workbench.ai.view": false,
106
+ "workbench.compute.view": false,
107
+ "workbench.delivery.view": false,
108
+ "workbench.home.view": false,
109
+ "workbench.monitoring.view": false,
110
+ "workbench.platform.view": false,
111
+ "workbench.security.view": false,
112
+ "workbench.settings.view": false,
113
+ }
114
+ for _, permission := range catalog.Permissions {
115
+ if _, ok := want[permission.Key]; !ok {
116
+ continue
117
+ }
118
+ if permission.Domain != "workbench" || permission.Action != "view" || permission.Status != "active" || !permission.Assignable {
119
+ t.Fatalf("workbench entry must be independently assignable: %#v", permission)
120
+ }
121
+ want[permission.Key] = true
122
+ }
123
+ for key, found := range want {
124
+ if !found {
125
+ t.Fatalf("%s is missing", key)
126
+ }
127
+ }
128
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "authorization.opensoha.io/v1",
3
3
  "catalogVersion": "2.0.0",
4
- "contentHash": "sha256:82626eb53d9cd6b53ee502ae32285392c672f7f186a7dbefb42bf1f700d67e98",
4
+ "contentHash": "sha256:0efe8f496fa0fb29703584586f9306d04fdb5b9a38eaea78532107698230f609",
5
5
  "permissions": [
6
6
  {
7
7
  "key": "access.directory.create",
@@ -10929,12 +10929,132 @@
10929
10929
  "status": "active",
10930
10930
  "assignable": true
10931
10931
  },
10932
+ {
10933
+ "key": "workbench.ai.view",
10934
+ "domain": "workbench",
10935
+ "resource": "ai",
10936
+ "action": "view",
10937
+ "displayName": "访问 AI 工作台",
10938
+ "riskLevel": "read",
10939
+ "scopeKinds": [
10940
+ "tenant",
10941
+ "workspace"
10942
+ ],
10943
+ "approvalPolicy": "never",
10944
+ "status": "active",
10945
+ "assignable": true
10946
+ },
10947
+ {
10948
+ "key": "workbench.compute.view",
10949
+ "domain": "workbench",
10950
+ "resource": "compute",
10951
+ "action": "view",
10952
+ "displayName": "访问计算资源工作台",
10953
+ "riskLevel": "read",
10954
+ "scopeKinds": [
10955
+ "tenant",
10956
+ "workspace"
10957
+ ],
10958
+ "approvalPolicy": "never",
10959
+ "status": "active",
10960
+ "assignable": true
10961
+ },
10962
+ {
10963
+ "key": "workbench.delivery.view",
10964
+ "domain": "workbench",
10965
+ "resource": "delivery",
10966
+ "action": "view",
10967
+ "displayName": "访问应用交付工作台",
10968
+ "riskLevel": "read",
10969
+ "scopeKinds": [
10970
+ "tenant",
10971
+ "workspace"
10972
+ ],
10973
+ "approvalPolicy": "never",
10974
+ "status": "active",
10975
+ "assignable": true
10976
+ },
10977
+ {
10978
+ "key": "workbench.home.view",
10979
+ "domain": "workbench",
10980
+ "resource": "home",
10981
+ "action": "view",
10982
+ "displayName": "访问应用门户",
10983
+ "riskLevel": "read",
10984
+ "scopeKinds": [
10985
+ "tenant",
10986
+ "workspace"
10987
+ ],
10988
+ "approvalPolicy": "never",
10989
+ "status": "active",
10990
+ "assignable": true
10991
+ },
10992
+ {
10993
+ "key": "workbench.monitoring.view",
10994
+ "domain": "workbench",
10995
+ "resource": "monitoring",
10996
+ "action": "view",
10997
+ "displayName": "访问可观测与值班工作台",
10998
+ "riskLevel": "read",
10999
+ "scopeKinds": [
11000
+ "tenant",
11001
+ "workspace"
11002
+ ],
11003
+ "approvalPolicy": "never",
11004
+ "status": "active",
11005
+ "assignable": true
11006
+ },
11007
+ {
11008
+ "key": "workbench.platform.view",
11009
+ "domain": "workbench",
11010
+ "resource": "platform",
11011
+ "action": "view",
11012
+ "displayName": "访问 k8s工作台",
11013
+ "riskLevel": "read",
11014
+ "scopeKinds": [
11015
+ "tenant",
11016
+ "workspace"
11017
+ ],
11018
+ "approvalPolicy": "never",
11019
+ "status": "active",
11020
+ "assignable": true
11021
+ },
11022
+ {
11023
+ "key": "workbench.security.view",
11024
+ "domain": "workbench",
11025
+ "resource": "security",
11026
+ "action": "view",
11027
+ "displayName": "访问身份与安全工作台",
11028
+ "riskLevel": "read",
11029
+ "scopeKinds": [
11030
+ "tenant",
11031
+ "workspace"
11032
+ ],
11033
+ "approvalPolicy": "never",
11034
+ "status": "active",
11035
+ "assignable": true
11036
+ },
11037
+ {
11038
+ "key": "workbench.settings.view",
11039
+ "domain": "workbench",
11040
+ "resource": "settings",
11041
+ "action": "view",
11042
+ "displayName": "访问设置中心",
11043
+ "riskLevel": "read",
11044
+ "scopeKinds": [
11045
+ "tenant",
11046
+ "workspace"
11047
+ ],
11048
+ "approvalPolicy": "never",
11049
+ "status": "active",
11050
+ "assignable": true
11051
+ },
10932
11052
  {
10933
11053
  "key": "workspace.application.view",
10934
11054
  "domain": "workspace",
10935
11055
  "resource": "application",
10936
11056
  "action": "view",
10937
- "displayName": "查看应用工作台",
11057
+ "displayName": "查看工作空间应用",
10938
11058
  "riskLevel": "read",
10939
11059
  "scopeKinds": [
10940
11060
  "tenant",
@@ -10950,7 +11070,7 @@
10950
11070
  "domain": "workspace",
10951
11071
  "resource": "resource",
10952
11072
  "action": "view",
10953
- "displayName": "查看 k8s工作台",
11073
+ "displayName": "查看工作空间资源",
10954
11074
  "riskLevel": "read",
10955
11075
  "scopeKinds": [
10956
11076
  "tenant",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.13",
2
+ "version": "0.1.14",
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.13",
2
+ "version": "0.1.14",
3
3
  "generatedFrom": "openapi/soha-api.yaml",
4
4
  "entries": [
5
5
  {
@@ -0,0 +1,9 @@
1
+ {
2
+ "namespace": "ops",
3
+ "sourceKind": "Deployment",
4
+ "sourceName": "api",
5
+ "targetKind": "Job",
6
+ "targetName": "report",
7
+ "inherit": ["everything"],
8
+ "restartPolicy": "Never"
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "namespace": "ops",
3
+ "sourceKind": "Deployment",
4
+ "sourceName": "api",
5
+ "targetKind": "Job",
6
+ "targetName": "report",
7
+ "inherit": ["environment", "storage", "resources", "securityContext", "scheduling"],
8
+ "restartPolicy": "Never"
9
+ }
@@ -14,7 +14,7 @@ import (
14
14
  "time"
15
15
  )
16
16
 
17
- const defaultUserAgent = "opensoha-contracts/0.1.13"
17
+ const defaultUserAgent = "opensoha-contracts/0.1.14"
18
18
 
19
19
  type Client struct {
20
20
  BaseURL string
@@ -2713,6 +2713,42 @@ func (e KubernetesWorkloadImportInputWorkloadKind) Valid() bool {
2713
2713
  }
2714
2714
  }
2715
2715
 
2716
+ // Defines values for KubernetesWorkloadSnapshotInheritance.
2717
+ const (
2718
+ KubernetesWorkloadSnapshotInheritanceEnvironment KubernetesWorkloadSnapshotInheritance = "environment"
2719
+ KubernetesWorkloadSnapshotInheritanceInitContainers KubernetesWorkloadSnapshotInheritance = "initContainers"
2720
+ KubernetesWorkloadSnapshotInheritanceResources KubernetesWorkloadSnapshotInheritance = "resources"
2721
+ KubernetesWorkloadSnapshotInheritanceScheduling KubernetesWorkloadSnapshotInheritance = "scheduling"
2722
+ KubernetesWorkloadSnapshotInheritanceSecurityContext KubernetesWorkloadSnapshotInheritance = "securityContext"
2723
+ KubernetesWorkloadSnapshotInheritanceServiceRuntime KubernetesWorkloadSnapshotInheritance = "serviceRuntime"
2724
+ KubernetesWorkloadSnapshotInheritanceStorage KubernetesWorkloadSnapshotInheritance = "storage"
2725
+ KubernetesWorkloadSnapshotInheritanceTemplateMetadata KubernetesWorkloadSnapshotInheritance = "templateMetadata"
2726
+ )
2727
+
2728
+ // Valid indicates whether the value is a known member of the KubernetesWorkloadSnapshotInheritance enum.
2729
+ func (e KubernetesWorkloadSnapshotInheritance) Valid() bool {
2730
+ switch e {
2731
+ case KubernetesWorkloadSnapshotInheritanceEnvironment:
2732
+ return true
2733
+ case KubernetesWorkloadSnapshotInheritanceInitContainers:
2734
+ return true
2735
+ case KubernetesWorkloadSnapshotInheritanceResources:
2736
+ return true
2737
+ case KubernetesWorkloadSnapshotInheritanceScheduling:
2738
+ return true
2739
+ case KubernetesWorkloadSnapshotInheritanceSecurityContext:
2740
+ return true
2741
+ case KubernetesWorkloadSnapshotInheritanceServiceRuntime:
2742
+ return true
2743
+ case KubernetesWorkloadSnapshotInheritanceStorage:
2744
+ return true
2745
+ case KubernetesWorkloadSnapshotInheritanceTemplateMetadata:
2746
+ return true
2747
+ default:
2748
+ return false
2749
+ }
2750
+ }
2751
+
2716
2752
  // Defines values for KubernetesWorkloadSnapshotRestartPolicy.
2717
2753
  const (
2718
2754
  KubernetesWorkloadSnapshotRestartPolicyNever KubernetesWorkloadSnapshotRestartPolicy = "Never"
@@ -14065,6 +14101,9 @@ type KubernetesWorkloadSnapshotEnvelope struct {
14065
14101
  Data KubernetesWorkloadSnapshot `json:"data"`
14066
14102
  }
14067
14103
 
14104
+ // KubernetesWorkloadSnapshotInheritance defines model for KubernetesWorkloadSnapshotInheritance.
14105
+ type KubernetesWorkloadSnapshotInheritance string
14106
+
14068
14107
  // KubernetesWorkloadSnapshotRequest defines model for KubernetesWorkloadSnapshotRequest.
14069
14108
  type KubernetesWorkloadSnapshotRequest struct {
14070
14109
  // ActiveDeadlineSeconds Zero leaves the Kubernetes default unchanged.
@@ -14075,9 +14114,12 @@ type KubernetesWorkloadSnapshotRequest struct {
14075
14114
  Command []string `json:"command,omitempty"`
14076
14115
 
14077
14116
  // Completions Zero leaves the Kubernetes default unchanged.
14078
- Completions int `json:"completions,omitempty"`
14079
- Description string `json:"description,omitempty"`
14080
- Labels map[string]string `json:"labels,omitempty"`
14117
+ Completions int `json:"completions,omitempty"`
14118
+ Description string `json:"description,omitempty"`
14119
+
14120
+ // Inherit Runtime modules copied from the source Pod template. Omitting this field preserves the legacy full-template snapshot; an explicit array copies only the selected modules while always retaining the selected container name, image, imagePullPolicy, command, args, and working directory.
14121
+ Inherit []KubernetesWorkloadSnapshotInheritance `json:"inherit,omitempty"`
14122
+ Labels map[string]string `json:"labels,omitempty"`
14081
14123
 
14082
14124
  // Namespace Namespace shared by the source workload and generated target because referenced Secrets, ConfigMaps, ServiceAccounts, and PVCs are namespace-scoped.
14083
14125
  Namespace string `json:"namespace"`
@@ -9,9 +9,10 @@ func TestKubernetesWorkloadSnapshotRequestGeneratedShape(t *testing.T) {
9
9
  SourceName: "reports",
10
10
  TargetKind: KubernetesWorkloadSnapshotTargetKindCronJob,
11
11
  TargetName: "reports-schedule",
12
+ Inherit: []KubernetesWorkloadSnapshotInheritance{KubernetesWorkloadSnapshotInheritanceEnvironment},
12
13
  RestartPolicy: KubernetesWorkloadSnapshotRestartPolicyNever,
13
14
  }
14
- if request.Namespace != "default" {
15
- t.Fatalf("namespace = %q, want default", request.Namespace)
15
+ if request.Namespace != "default" || len(request.Inherit) != 1 {
16
+ t.Fatalf("request = %#v", request)
16
17
  }
17
18
  }
@@ -15975,6 +15975,8 @@ export interface components {
15975
15975
  KubernetesWorkloadSnapshotTargetKind: "Job" | "CronJob" | "WorkloadCronJob";
15976
15976
  /** @enum {string} */
15977
15977
  KubernetesWorkloadSnapshotRestartPolicy: "Never" | "OnFailure";
15978
+ /** @enum {string} */
15979
+ KubernetesWorkloadSnapshotInheritance: "environment" | "storage" | "resources" | "securityContext" | "scheduling" | "initContainers" | "templateMetadata" | "serviceRuntime";
15978
15980
  KubernetesWorkloadSnapshotRequest: {
15979
15981
  /** @description Namespace shared by the source workload and generated target because referenced Secrets, ConfigMaps, ServiceAccounts, and PVCs are namespace-scoped. */
15980
15982
  namespace: string;
@@ -15993,6 +15995,8 @@ export interface components {
15993
15995
  };
15994
15996
  command?: string[];
15995
15997
  args?: string[];
15998
+ /** @description Runtime modules copied from the source Pod template. Omitting this field preserves the legacy full-template snapshot; an explicit array copies only the selected modules while always retaining the selected container name, image, imagePullPolicy, command, args, and working directory. */
15999
+ inherit?: components["schemas"]["KubernetesWorkloadSnapshotInheritance"][];
15996
16000
  restartPolicy: components["schemas"]["KubernetesWorkloadSnapshotRestartPolicy"];
15997
16001
  /** @description Zero leaves the Kubernetes default unchanged. */
15998
16002
  parallelism?: number;
@@ -19379,6 +19383,7 @@ export type LogStreamEvent = components['schemas']['LogStreamEvent'];
19379
19383
  export type KubernetesWorkloadSnapshotSourceKind = components['schemas']['KubernetesWorkloadSnapshotSourceKind'];
19380
19384
  export type KubernetesWorkloadSnapshotTargetKind = components['schemas']['KubernetesWorkloadSnapshotTargetKind'];
19381
19385
  export type KubernetesWorkloadSnapshotRestartPolicy = components['schemas']['KubernetesWorkloadSnapshotRestartPolicy'];
19386
+ export type KubernetesWorkloadSnapshotInheritance = components['schemas']['KubernetesWorkloadSnapshotInheritance'];
19382
19387
  export type KubernetesWorkloadSnapshotRequest = components['schemas']['KubernetesWorkloadSnapshotRequest'];
19383
19388
  export type KubernetesWorkloadSnapshotContainer = components['schemas']['KubernetesWorkloadSnapshotContainer'];
19384
19389
  export type KubernetesWorkloadSnapshot = components['schemas']['KubernetesWorkloadSnapshot'];
@@ -24126,6 +24126,29 @@
24126
24126
  ],
24127
24127
  "type": "object"
24128
24128
  },
24129
+ "KubernetesWorkloadSnapshotInheritance": {
24130
+ "enum": [
24131
+ "environment",
24132
+ "storage",
24133
+ "resources",
24134
+ "securityContext",
24135
+ "scheduling",
24136
+ "initContainers",
24137
+ "templateMetadata",
24138
+ "serviceRuntime"
24139
+ ],
24140
+ "type": "string",
24141
+ "x-enum-varnames": [
24142
+ "KubernetesWorkloadSnapshotInheritanceEnvironment",
24143
+ "KubernetesWorkloadSnapshotInheritanceStorage",
24144
+ "KubernetesWorkloadSnapshotInheritanceResources",
24145
+ "KubernetesWorkloadSnapshotInheritanceSecurityContext",
24146
+ "KubernetesWorkloadSnapshotInheritanceScheduling",
24147
+ "KubernetesWorkloadSnapshotInheritanceInitContainers",
24148
+ "KubernetesWorkloadSnapshotInheritanceTemplateMetadata",
24149
+ "KubernetesWorkloadSnapshotInheritanceServiceRuntime"
24150
+ ]
24151
+ },
24129
24152
  "KubernetesWorkloadSnapshotRequest": {
24130
24153
  "additionalProperties": false,
24131
24154
  "if": {
@@ -24183,6 +24206,15 @@
24183
24206
  "maxLength": 512,
24184
24207
  "type": "string"
24185
24208
  },
24209
+ "inherit": {
24210
+ "description": "Runtime modules copied from the source Pod template. Omitting this field preserves the legacy full-template snapshot; an explicit array copies only the selected modules while always retaining the selected container name, image, imagePullPolicy, command, args, and working directory.",
24211
+ "items": {
24212
+ "$ref": "#/components/schemas/KubernetesWorkloadSnapshotInheritance"
24213
+ },
24214
+ "maxItems": 8,
24215
+ "type": "array",
24216
+ "uniqueItems": true
24217
+ },
24186
24218
  "labels": {
24187
24219
  "additionalProperties": {
24188
24220
  "type": "string"
@@ -41393,7 +41425,7 @@
41393
41425
  "info": {
41394
41426
  "description": "Public OpenSoha core API contract. This first contract focuses on stable cross-repository boundaries: auth, health, runner-facing control-plane callbacks, AI Gateway, and MCP capability discovery.\n",
41395
41427
  "title": "Soha API",
41396
- "version": "0.1.13"
41428
+ "version": "0.1.14"
41397
41429
  },
41398
41430
  "openapi": "3.1.0",
41399
41431
  "paths": {
@@ -1,7 +1,7 @@
1
1
  openapi: 3.1.0
2
2
  info:
3
3
  title: Soha API
4
- version: 0.1.13
4
+ version: 0.1.14
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
@@ -27776,6 +27776,18 @@ components:
27776
27776
  x-enum-varnames:
27777
27777
  - KubernetesWorkloadSnapshotRestartPolicyNever
27778
27778
  - KubernetesWorkloadSnapshotRestartPolicyOnFailure
27779
+ KubernetesWorkloadSnapshotInheritance:
27780
+ type: string
27781
+ enum: [environment, storage, resources, securityContext, scheduling, initContainers, templateMetadata, serviceRuntime]
27782
+ x-enum-varnames:
27783
+ - KubernetesWorkloadSnapshotInheritanceEnvironment
27784
+ - KubernetesWorkloadSnapshotInheritanceStorage
27785
+ - KubernetesWorkloadSnapshotInheritanceResources
27786
+ - KubernetesWorkloadSnapshotInheritanceSecurityContext
27787
+ - KubernetesWorkloadSnapshotInheritanceScheduling
27788
+ - KubernetesWorkloadSnapshotInheritanceInitContainers
27789
+ - KubernetesWorkloadSnapshotInheritanceTemplateMetadata
27790
+ - KubernetesWorkloadSnapshotInheritanceServiceRuntime
27779
27791
  KubernetesWorkloadSnapshotRequest:
27780
27792
  type: object
27781
27793
  required: [namespace, sourceKind, sourceName, targetKind, targetName, restartPolicy]
@@ -27817,6 +27829,13 @@ components:
27817
27829
  type: array
27818
27830
  maxItems: 128
27819
27831
  items: { type: string, maxLength: 4096 }
27832
+ inherit:
27833
+ type: array
27834
+ maxItems: 8
27835
+ uniqueItems: true
27836
+ items:
27837
+ $ref: "#/components/schemas/KubernetesWorkloadSnapshotInheritance"
27838
+ description: Runtime modules copied from the source Pod template. Omitting this field preserves the legacy full-template snapshot; an explicit array copies only the selected modules while always retaining the selected container name, image, imagePullPolicy, command, args, and working directory.
27820
27839
  restartPolicy:
27821
27840
  $ref: "#/components/schemas/KubernetesWorkloadSnapshotRestartPolicy"
27822
27841
  parallelism:
@@ -5,9 +5,9 @@ package openapi
5
5
  import _ "embed"
6
6
 
7
7
  const (
8
- Version = "0.1.13"
9
- YAMLSHA256 = "480571290460492a4f422ecf2c2098720989c31a4413c1bf29fc45b1ecaa5c7b"
10
- JSONSHA256 = "8327233124b473bdfe2a57582eb66ed9c844630bedd0c947eefb707b71f7d3cf"
8
+ Version = "0.1.14"
9
+ YAMLSHA256 = "231a8b25b830df7c602c1356494502235ca8c00f23a4aea56c87c0fd79438663"
10
+ JSONSHA256 = "35983758f2bf5d2b4c2e918ee32f34f384218d882edf42d86c310f2820e2a82f"
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.13",
3
+ "version": "0.1.14",
4
4
  "private": false,
5
5
  "description": "Shared OpenSoha API, agent, MCP, skill, event, and auth contracts.",
6
6
  "license": "Apache-2.0",