@opensoha/contracts 0.1.5 → 0.1.6
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/COMPATIBILITY.md +13 -0
- package/README.md +6 -0
- package/auth/catalog_generated.go +17 -0
- package/auth/catalog_test.go +53 -0
- package/auth/permission-catalog.json +10991 -0
- package/auth/permission-catalog.schema.json +74 -0
- 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/permission-catalog/invalid/missing-action.json +18 -0
- package/fixtures/json-schema/permission-catalog/valid/minimal.json +19 -0
- package/fixtures/openapi/AccessRoleInput/invalid/missing-permissions.json +4 -0
- package/fixtures/openapi/AccessRoleInput/valid/granular-vm-operator.json +10 -0
- package/fixtures/openapi/AuthorizationDecision/invalid/missing-reason.json +7 -0
- package/fixtures/openapi/AuthorizationDecision/valid/deny-vm-delete.json +16 -0
- package/fixtures/openapi/PermissionCatalogEnvelope/invalid/invalid-hash.json +8 -0
- package/fixtures/openapi/PermissionCatalogEnvelope/valid/minimal.json +22 -0
- package/gen/go/sohaapi/client.go +1 -1
- package/gen/go/sohaapi/types.go +187 -0
- package/gen/ts/sohaapi/index.ts +320 -0
- package/openapi/soha-api.json +670 -1
- package/openapi/soha-api.yaml +253 -1
- package/openapi/spec_generated.go +3 -3
- package/package.json +7 -3
package/openapi/soha-api.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
openapi: 3.1.0
|
|
2
2
|
info:
|
|
3
3
|
title: Soha API
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
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
|
|
@@ -34,6 +34,7 @@ tags:
|
|
|
34
34
|
- name: Compute
|
|
35
35
|
- name: MCP
|
|
36
36
|
- name: Plugins
|
|
37
|
+
- name: Access
|
|
37
38
|
- name: Identity
|
|
38
39
|
- name: Directory
|
|
39
40
|
paths:
|
|
@@ -7420,6 +7421,92 @@ paths:
|
|
|
7420
7421
|
"400": { $ref: "#/components/responses/Error" }
|
|
7421
7422
|
"401": { $ref: "#/components/responses/Error" }
|
|
7422
7423
|
"403": { $ref: "#/components/responses/Error" }
|
|
7424
|
+
/access/permissions:
|
|
7425
|
+
get:
|
|
7426
|
+
tags: [Access]
|
|
7427
|
+
operationId: getPermissionCatalog
|
|
7428
|
+
responses:
|
|
7429
|
+
"200":
|
|
7430
|
+
description: Canonical permission definitions and compatibility metadata.
|
|
7431
|
+
content:
|
|
7432
|
+
application/json:
|
|
7433
|
+
schema: { $ref: "#/components/schemas/PermissionCatalogEnvelope" }
|
|
7434
|
+
"401": { $ref: "#/components/responses/Error" }
|
|
7435
|
+
"403": { $ref: "#/components/responses/Error" }
|
|
7436
|
+
/access/roles:
|
|
7437
|
+
get:
|
|
7438
|
+
tags: [Access]
|
|
7439
|
+
operationId: listAccessRoles
|
|
7440
|
+
responses:
|
|
7441
|
+
"200":
|
|
7442
|
+
description: Access roles.
|
|
7443
|
+
content:
|
|
7444
|
+
application/json:
|
|
7445
|
+
schema: { $ref: "#/components/schemas/AccessRoleListEnvelope" }
|
|
7446
|
+
"401": { $ref: "#/components/responses/Error" }
|
|
7447
|
+
"403": { $ref: "#/components/responses/Error" }
|
|
7448
|
+
post:
|
|
7449
|
+
tags: [Access]
|
|
7450
|
+
operationId: createAccessRole
|
|
7451
|
+
requestBody:
|
|
7452
|
+
required: true
|
|
7453
|
+
content:
|
|
7454
|
+
application/json:
|
|
7455
|
+
schema: { $ref: "#/components/schemas/AccessRoleInput" }
|
|
7456
|
+
responses:
|
|
7457
|
+
"201":
|
|
7458
|
+
description: Created access role.
|
|
7459
|
+
content:
|
|
7460
|
+
application/json:
|
|
7461
|
+
schema: { $ref: "#/components/schemas/AccessRoleEnvelope" }
|
|
7462
|
+
"400": { $ref: "#/components/responses/Error" }
|
|
7463
|
+
"401": { $ref: "#/components/responses/Error" }
|
|
7464
|
+
"403": { $ref: "#/components/responses/Error" }
|
|
7465
|
+
/access/roles/{accessRoleID}:
|
|
7466
|
+
parameters:
|
|
7467
|
+
- $ref: "#/components/parameters/AccessRoleID"
|
|
7468
|
+
get:
|
|
7469
|
+
tags: [Access]
|
|
7470
|
+
operationId: getAccessRole
|
|
7471
|
+
responses:
|
|
7472
|
+
"200":
|
|
7473
|
+
description: Access role detail.
|
|
7474
|
+
content:
|
|
7475
|
+
application/json:
|
|
7476
|
+
schema: { $ref: "#/components/schemas/AccessRoleEnvelope" }
|
|
7477
|
+
"401": { $ref: "#/components/responses/Error" }
|
|
7478
|
+
"403": { $ref: "#/components/responses/Error" }
|
|
7479
|
+
"404": { $ref: "#/components/responses/Error" }
|
|
7480
|
+
put:
|
|
7481
|
+
tags: [Access]
|
|
7482
|
+
operationId: updateAccessRole
|
|
7483
|
+
requestBody:
|
|
7484
|
+
required: true
|
|
7485
|
+
content:
|
|
7486
|
+
application/json:
|
|
7487
|
+
schema: { $ref: "#/components/schemas/AccessRoleInput" }
|
|
7488
|
+
responses:
|
|
7489
|
+
"200":
|
|
7490
|
+
description: Updated access role.
|
|
7491
|
+
content:
|
|
7492
|
+
application/json:
|
|
7493
|
+
schema: { $ref: "#/components/schemas/AccessRoleEnvelope" }
|
|
7494
|
+
"400": { $ref: "#/components/responses/Error" }
|
|
7495
|
+
"401": { $ref: "#/components/responses/Error" }
|
|
7496
|
+
"403": { $ref: "#/components/responses/Error" }
|
|
7497
|
+
"404": { $ref: "#/components/responses/Error" }
|
|
7498
|
+
delete:
|
|
7499
|
+
tags: [Access]
|
|
7500
|
+
operationId: deleteAccessRole
|
|
7501
|
+
responses:
|
|
7502
|
+
"200":
|
|
7503
|
+
description: Access role deleted.
|
|
7504
|
+
content:
|
|
7505
|
+
application/json:
|
|
7506
|
+
schema: { $ref: "#/components/schemas/AccessRoleDeleteResult" }
|
|
7507
|
+
"401": { $ref: "#/components/responses/Error" }
|
|
7508
|
+
"403": { $ref: "#/components/responses/Error" }
|
|
7509
|
+
"404": { $ref: "#/components/responses/Error" }
|
|
7423
7510
|
/identity/capabilities:
|
|
7424
7511
|
get:
|
|
7425
7512
|
tags: [Identity]
|
|
@@ -8220,6 +8307,11 @@ components:
|
|
|
8220
8307
|
name: x-api-key
|
|
8221
8308
|
description: Anthropic-style Soha PAT/SAT credential header for native relay endpoints.
|
|
8222
8309
|
parameters:
|
|
8310
|
+
AccessRoleID:
|
|
8311
|
+
name: accessRoleID
|
|
8312
|
+
in: path
|
|
8313
|
+
required: true
|
|
8314
|
+
schema: { type: string, minLength: 1, maxLength: 128 }
|
|
8223
8315
|
IdentityApplicationID:
|
|
8224
8316
|
name: identityApplicationID
|
|
8225
8317
|
in: path
|
|
@@ -10425,6 +10517,166 @@ components:
|
|
|
10425
10517
|
items:
|
|
10426
10518
|
$ref: "#/components/schemas/AnyValue"
|
|
10427
10519
|
additionalProperties: false
|
|
10520
|
+
PermissionRiskLevel:
|
|
10521
|
+
type: string
|
|
10522
|
+
enum: [read, mutate, execute, high]
|
|
10523
|
+
x-enum-varnames: [PermissionRiskLevelRead, PermissionRiskLevelMutate, PermissionRiskLevelExecute, PermissionRiskLevelHigh]
|
|
10524
|
+
PermissionApprovalPolicy:
|
|
10525
|
+
type: string
|
|
10526
|
+
enum: [never, eligible, required]
|
|
10527
|
+
x-enum-varnames: [PermissionApprovalPolicyNever, PermissionApprovalPolicyEligible, PermissionApprovalPolicyRequired]
|
|
10528
|
+
PermissionStatus:
|
|
10529
|
+
type: string
|
|
10530
|
+
enum: [active, legacy]
|
|
10531
|
+
x-enum-varnames: [PermissionStatusActive, PermissionStatusLegacy]
|
|
10532
|
+
PermissionScopeKind:
|
|
10533
|
+
type: string
|
|
10534
|
+
enum: [tenant, workspace, cluster, namespace, project, resource, owner]
|
|
10535
|
+
x-enum-varnames: [PermissionScopeKindTenant, PermissionScopeKindWorkspace, PermissionScopeKindCluster, PermissionScopeKindNamespace, PermissionScopeKindProject, PermissionScopeKindResource, PermissionScopeKindOwner]
|
|
10536
|
+
PermissionDefinition:
|
|
10537
|
+
type: object
|
|
10538
|
+
required: [key, domain, resource, action, displayName, riskLevel, scopeKinds, approvalPolicy, status, assignable]
|
|
10539
|
+
properties:
|
|
10540
|
+
key: { type: string, pattern: "^[a-z][a-z0-9_-]*(?:\\.[a-z][a-z0-9_-]*)+$" }
|
|
10541
|
+
domain: { type: string, pattern: "^[a-z][a-z0-9_-]*$" }
|
|
10542
|
+
resource: { type: string, pattern: "^[a-z][a-z0-9_.-]*$" }
|
|
10543
|
+
action: { type: string, pattern: "^[a-z][a-z0-9_-]*$" }
|
|
10544
|
+
displayName: { type: string, minLength: 1 }
|
|
10545
|
+
riskLevel: { $ref: "#/components/schemas/PermissionRiskLevel" }
|
|
10546
|
+
scopeKinds:
|
|
10547
|
+
type: array
|
|
10548
|
+
minItems: 1
|
|
10549
|
+
uniqueItems: true
|
|
10550
|
+
items: { $ref: "#/components/schemas/PermissionScopeKind" }
|
|
10551
|
+
approvalPolicy: { $ref: "#/components/schemas/PermissionApprovalPolicy" }
|
|
10552
|
+
status: { $ref: "#/components/schemas/PermissionStatus" }
|
|
10553
|
+
assignable: { type: boolean }
|
|
10554
|
+
legacyAliases: { type: array, uniqueItems: true, items: { type: string, minLength: 1 } }
|
|
10555
|
+
legacyCapabilities:
|
|
10556
|
+
type: array
|
|
10557
|
+
uniqueItems: true
|
|
10558
|
+
description: Migration-only role-global action aliases accepted by this exact permission.
|
|
10559
|
+
items: { type: string, pattern: "^[a-z][a-z0-9_-]*$" }
|
|
10560
|
+
replacedBy: { type: array, uniqueItems: true, items: { type: string, minLength: 1 } }
|
|
10561
|
+
additionalProperties: false
|
|
10562
|
+
PermissionCatalog:
|
|
10563
|
+
type: object
|
|
10564
|
+
required: [schemaVersion, catalogVersion, contentHash, permissions]
|
|
10565
|
+
properties:
|
|
10566
|
+
schemaVersion: { type: string, const: authorization.opensoha.io/v1 }
|
|
10567
|
+
catalogVersion: { type: string, pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$" }
|
|
10568
|
+
contentHash: { type: string, pattern: "^sha256:[a-f0-9]{64}$" }
|
|
10569
|
+
permissions:
|
|
10570
|
+
type: array
|
|
10571
|
+
minItems: 1
|
|
10572
|
+
items: { $ref: "#/components/schemas/PermissionDefinition" }
|
|
10573
|
+
additionalProperties: false
|
|
10574
|
+
PermissionCatalogEnvelope:
|
|
10575
|
+
type: object
|
|
10576
|
+
required: [data]
|
|
10577
|
+
properties:
|
|
10578
|
+
data: { $ref: "#/components/schemas/PermissionCatalog" }
|
|
10579
|
+
additionalProperties: false
|
|
10580
|
+
AccessRole:
|
|
10581
|
+
type: object
|
|
10582
|
+
required: [id, name, scope, capabilities, permissionKeys, userCount]
|
|
10583
|
+
properties:
|
|
10584
|
+
id: { type: string, minLength: 1 }
|
|
10585
|
+
name: { type: string, minLength: 1 }
|
|
10586
|
+
scope: { type: string, minLength: 1 }
|
|
10587
|
+
capabilities:
|
|
10588
|
+
type: array
|
|
10589
|
+
uniqueItems: true
|
|
10590
|
+
deprecated: true
|
|
10591
|
+
description: Legacy role-global action aliases retained only for migration.
|
|
10592
|
+
items: { type: string, minLength: 1 }
|
|
10593
|
+
permissionKeys:
|
|
10594
|
+
type: array
|
|
10595
|
+
uniqueItems: true
|
|
10596
|
+
items: { type: string, minLength: 1 }
|
|
10597
|
+
userCount: { type: integer, minimum: 0 }
|
|
10598
|
+
additionalProperties: false
|
|
10599
|
+
AccessRoleInput:
|
|
10600
|
+
type: object
|
|
10601
|
+
required: [name, scope, permissionKeys]
|
|
10602
|
+
properties:
|
|
10603
|
+
id: { type: string, minLength: 1 }
|
|
10604
|
+
name: { type: string, minLength: 1 }
|
|
10605
|
+
scope: { type: string, minLength: 1 }
|
|
10606
|
+
capabilities:
|
|
10607
|
+
type: array
|
|
10608
|
+
uniqueItems: true
|
|
10609
|
+
deprecated: true
|
|
10610
|
+
description: Legacy role-global action aliases; new role editors must send an empty array.
|
|
10611
|
+
items: { type: string, minLength: 1 }
|
|
10612
|
+
permissionKeys:
|
|
10613
|
+
type: array
|
|
10614
|
+
uniqueItems: true
|
|
10615
|
+
items: { type: string, minLength: 1 }
|
|
10616
|
+
additionalProperties: false
|
|
10617
|
+
AccessRoleEnvelope:
|
|
10618
|
+
type: object
|
|
10619
|
+
required: [data]
|
|
10620
|
+
properties:
|
|
10621
|
+
data: { $ref: "#/components/schemas/AccessRole" }
|
|
10622
|
+
additionalProperties: false
|
|
10623
|
+
AccessRoleListEnvelope:
|
|
10624
|
+
type: object
|
|
10625
|
+
required: [items]
|
|
10626
|
+
properties:
|
|
10627
|
+
items: { type: array, items: { $ref: "#/components/schemas/AccessRole" } }
|
|
10628
|
+
additionalProperties: false
|
|
10629
|
+
AccessRoleDeleteResult:
|
|
10630
|
+
type: object
|
|
10631
|
+
required: [status]
|
|
10632
|
+
properties:
|
|
10633
|
+
status: { type: string, const: ok }
|
|
10634
|
+
additionalProperties: false
|
|
10635
|
+
AuthorizationDecisionStatus:
|
|
10636
|
+
type: string
|
|
10637
|
+
enum: [allow, deny, approval_required]
|
|
10638
|
+
x-enum-varnames: [AuthorizationDecisionStatusAllow, AuthorizationDecisionStatusDeny, AuthorizationDecisionStatusApprovalRequired]
|
|
10639
|
+
AuthorizationResource:
|
|
10640
|
+
type: object
|
|
10641
|
+
required: [type]
|
|
10642
|
+
properties:
|
|
10643
|
+
type: { type: string, minLength: 1 }
|
|
10644
|
+
id: { type: string }
|
|
10645
|
+
tenantId: { type: string }
|
|
10646
|
+
workspaceId: { type: string }
|
|
10647
|
+
clusterId: { type: string }
|
|
10648
|
+
namespace: { type: string }
|
|
10649
|
+
projectId: { type: string }
|
|
10650
|
+
owner: { type: string }
|
|
10651
|
+
labels: { type: object, additionalProperties: { type: string } }
|
|
10652
|
+
additionalProperties: false
|
|
10653
|
+
AuthorizationEffectiveScope:
|
|
10654
|
+
type: object
|
|
10655
|
+
properties:
|
|
10656
|
+
tenantIds: { type: array, uniqueItems: true, items: { type: string } }
|
|
10657
|
+
workspaceIds: { type: array, uniqueItems: true, items: { type: string } }
|
|
10658
|
+
clusterIds: { type: array, uniqueItems: true, items: { type: string } }
|
|
10659
|
+
namespaces: { type: array, uniqueItems: true, items: { type: string } }
|
|
10660
|
+
projectIds: { type: array, uniqueItems: true, items: { type: string } }
|
|
10661
|
+
resourceKinds: { type: array, uniqueItems: true, items: { type: string } }
|
|
10662
|
+
labelSelector: { type: string }
|
|
10663
|
+
additionalProperties: false
|
|
10664
|
+
AuthorizationDecision:
|
|
10665
|
+
type: object
|
|
10666
|
+
required: [status, permissionKey, action, resource, reasonCode, policyVersion]
|
|
10667
|
+
properties:
|
|
10668
|
+
status: { $ref: "#/components/schemas/AuthorizationDecisionStatus" }
|
|
10669
|
+
permissionKey: { type: string, minLength: 1 }
|
|
10670
|
+
action: { type: string, minLength: 1 }
|
|
10671
|
+
resource: { $ref: "#/components/schemas/AuthorizationResource" }
|
|
10672
|
+
effectiveScope: { $ref: "#/components/schemas/AuthorizationEffectiveScope" }
|
|
10673
|
+
reasonCode: { type: string, minLength: 1 }
|
|
10674
|
+
policyVersion: { type: string, minLength: 1 }
|
|
10675
|
+
allowedActions:
|
|
10676
|
+
type: array
|
|
10677
|
+
uniqueItems: true
|
|
10678
|
+
items: { type: string, minLength: 1 }
|
|
10679
|
+
additionalProperties: false
|
|
10428
10680
|
ComputeDomain:
|
|
10429
10681
|
type: string
|
|
10430
10682
|
enum: [virtualization, container_runtime, agent]
|
|
@@ -5,9 +5,9 @@ package openapi
|
|
|
5
5
|
import _ "embed"
|
|
6
6
|
|
|
7
7
|
const (
|
|
8
|
-
Version = "0.1.
|
|
9
|
-
YAMLSHA256 = "
|
|
10
|
-
JSONSHA256 = "
|
|
8
|
+
Version = "0.1.6"
|
|
9
|
+
YAMLSHA256 = "b6388f34cd559f508a70ccdfdc3a01bb33b62c1b5c4631ec8339770a9b1c338a"
|
|
10
|
+
JSONSHA256 = "bff1d46d3f3a083c7a2de06c916b2dc42e5699eeaf4fed2c3e560bf345427985"
|
|
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.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared OpenSoha API, agent, MCP, skill, event, and auth contracts.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
12
|
"scripts": {
|
|
13
|
-
"generate": "node scripts/generate-sdk.mjs",
|
|
14
|
-
"
|
|
13
|
+
"generate": "npm run generate:permissions && node scripts/generate-sdk.mjs",
|
|
14
|
+
"generate:permissions": "node scripts/generate-permission-catalog.mjs",
|
|
15
|
+
"check:generated": "npm run check:permissions && node scripts/generate-sdk.mjs --check",
|
|
16
|
+
"check:permissions": "node scripts/generate-permission-catalog.mjs --check",
|
|
15
17
|
"check:version-sync": "node scripts/check-version-sync.mjs",
|
|
16
18
|
"check:consumers": "node scripts/check-consumers.mjs",
|
|
17
19
|
"validate": "node scripts/validate.mjs",
|
|
@@ -54,6 +56,8 @@
|
|
|
54
56
|
"./plugins/marketplace-catalog.schema.json": "./plugins/marketplace-catalog.schema.json",
|
|
55
57
|
"./events/event-envelope.schema.json": "./events/event-envelope.schema.json",
|
|
56
58
|
"./auth/token-claims.schema.json": "./auth/token-claims.schema.json",
|
|
59
|
+
"./auth/permission-catalog.json": "./auth/permission-catalog.json",
|
|
60
|
+
"./auth/permission-catalog.schema.json": "./auth/permission-catalog.schema.json",
|
|
57
61
|
"./connectors/connector-event-envelope.schema.json": "./connectors/connector-event-envelope.schema.json",
|
|
58
62
|
"./knowledge/knowledge-base.schema.json": "./knowledge/knowledge-base.schema.json",
|
|
59
63
|
"./knowledge/knowledge-source.schema.json": "./knowledge/knowledge-source.schema.json",
|