@opensoha/contracts 0.1.4
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 +306 -0
- package/LICENSE +201 -0
- package/README.md +224 -0
- package/agent/agent-checkpoint.schema.json +19 -0
- package/agent/agent-observation.schema.json +20 -0
- package/agent/agent-protocol.schema.json +717 -0
- package/agent/agent-provider-definition.schema.json +44 -0
- package/agent/agent-provider-registry.schema.json +25 -0
- package/agent/agent-provider-runtime-event.schema.json +26 -0
- package/agent/agent-run-step.schema.json +24 -0
- package/agent/conformance-run.schema.json +19 -0
- package/agent/environment-lease.schema.json +31 -0
- package/agent/environment-snapshot.schema.json +26 -0
- package/agent/environment-template.schema.json +19 -0
- package/agent/fleet-target.schema.json +15 -0
- package/agent/multi-agent-plan.schema.json +18 -0
- package/agent/provider-rollout.schema.json +19 -0
- package/apiresponse/response.go +25 -0
- package/apiresponse/response_test.go +27 -0
- package/auth/token-claims.schema.json +78 -0
- package/capabilities/cluster-capability-matrix.schema.json +87 -0
- package/compat/json-schema-ecosystem-0.1.0.json +59 -0
- package/compat/openapi-0.1.0.snapshot.json +5076 -0
- package/compat/openapi-loose-boundaries-0.1.0.json +769 -0
- package/connectors/connector-event-envelope.schema.json +64 -0
- package/evaluation/evaluation-dataset.schema.json +28 -0
- package/evaluation/evaluation-result.schema.json +18 -0
- package/evaluation/evaluation-run.schema.json +19 -0
- package/evaluation/executor-profile.schema.json +18 -0
- package/evaluation/feedback-sample.schema.json +20 -0
- package/evaluation/gate-decision.schema.json +20 -0
- package/evaluation/gate-policy.schema.json +18 -0
- package/evaluation/replay-plan.schema.json +17 -0
- package/evaluation/sample-attempt.schema.json +22 -0
- package/events/event-envelope.schema.json +58 -0
- package/examples/agent-profile/k8s-sre-readonly.json +16 -0
- package/examples/cluster-capability-matrix/runtime-parity.json +40 -0
- package/examples/connector-event-envelope/feishu-message.json +19 -0
- package/examples/gateway-capability-baseline/minimal.json +61 -0
- package/examples/gateway-manifest/minimal.json +72 -0
- package/examples/governance/approval-request.json +35 -0
- package/examples/governance/audit-log.json +14 -0
- package/examples/marketplace-catalog/default.json +75 -0
- package/examples/mcp-preset/k8s-readonly.json +20 -0
- package/examples/openapi/agent-run-tool-call-request.json +11 -0
- package/examples/openapi/agent-tool-call-result-envelope.json +19 -0
- package/examples/openapi/cloud-extension-point-list-envelope.json +15 -0
- package/examples/openapi/directory-runtime-status-envelope.json +31 -0
- package/examples/openapi/gateway-manifest-envelope.json +53 -0
- package/examples/openapi/tool-invocation-request.json +14 -0
- package/examples/openapi/tool-invocation-result-envelope.json +23 -0
- package/examples/plugin-manifest/compute-provider.json +27 -0
- package/examples/plugin-manifest/connector.json +76 -0
- package/examples/plugin-manifest/skill-pack.json +47 -0
- package/examples/runner-operation-lifecycle/late-callback.json +27 -0
- package/examples/skill-manifest/k8s-sre.json +22 -0
- package/examples/token-claims/service-account.json +15 -0
- package/fixtures/json-schema/agent-checkpoint/invalid/raw-state.json +1 -0
- package/fixtures/json-schema/agent-checkpoint/valid/minimal.json +1 -0
- package/fixtures/json-schema/agent-observation/invalid/extra-secret.json +1 -0
- package/fixtures/json-schema/agent-observation/valid/tool.json +1 -0
- package/fixtures/json-schema/agent-profile/invalid/missing-scope.json +15 -0
- package/fixtures/json-schema/agent-profile/valid/k8s-sre-readonly.json +35 -0
- package/fixtures/json-schema/agent-protocol/invalid/missing-agent-id.json +3 -0
- package/fixtures/json-schema/agent-protocol/valid/agent-run-callback-legacy.json +9 -0
- package/fixtures/json-schema/agent-protocol/valid/agent-run-callback-with-events.json +39 -0
- package/fixtures/json-schema/agent-protocol/valid/execution-task-claim.json +5 -0
- package/fixtures/json-schema/agent-provider-definition/invalid/missing-command.json +1 -0
- package/fixtures/json-schema/agent-provider-definition/valid/cli.json +1 -0
- package/fixtures/json-schema/agent-provider-registry/invalid/zero-revision.json +1 -0
- package/fixtures/json-schema/agent-provider-registry/valid/minimal.json +1 -0
- package/fixtures/json-schema/agent-provider-runtime-event/invalid/health-without-provider.json +1 -0
- package/fixtures/json-schema/agent-provider-runtime-event/valid/ack.json +1 -0
- package/fixtures/json-schema/agent-run-step/invalid/unknown-state.json +1 -0
- package/fixtures/json-schema/agent-run-step/valid/running.json +1 -0
- package/fixtures/json-schema/approval-request/invalid/missing-status.json +12 -0
- package/fixtures/json-schema/approval-request/valid/high-risk-tool.json +56 -0
- package/fixtures/json-schema/audit-log/invalid/extra-field.json +10 -0
- package/fixtures/json-schema/audit-log/valid/tool-denied.json +23 -0
- package/fixtures/json-schema/cluster-capability-matrix/invalid/missing-agent-support.json +16 -0
- package/fixtures/json-schema/cluster-capability-matrix/invalid/partial-without-reason.json +18 -0
- package/fixtures/json-schema/cluster-capability-matrix/valid/runtime-parity.json +59 -0
- package/fixtures/json-schema/conformance-run/invalid/missing.json +1 -0
- package/fixtures/json-schema/conformance-run/valid/passed.json +1 -0
- package/fixtures/json-schema/connector-checkpoint/invalid/missing.json +1 -0
- package/fixtures/json-schema/connector-checkpoint/valid/http.json +1 -0
- package/fixtures/json-schema/connector-definition/invalid/missing.json +1 -0
- package/fixtures/json-schema/connector-definition/valid/http.json +1 -0
- package/fixtures/json-schema/connector-event-envelope/invalid/missing-payload.json +11 -0
- package/fixtures/json-schema/connector-event-envelope/invalid/unknown-top-level-field.json +13 -0
- package/fixtures/json-schema/connector-event-envelope/valid/feishu-message.json +19 -0
- package/fixtures/json-schema/context-envelope/invalid/envelope.json +1 -0
- package/fixtures/json-schema/context-envelope/valid/envelope.json +1 -0
- package/fixtures/json-schema/environment-lease/invalid/unbounded.json +1 -0
- package/fixtures/json-schema/environment-lease/valid/observe.json +1 -0
- package/fixtures/json-schema/environment-snapshot/invalid/negative-usage.json +1 -0
- package/fixtures/json-schema/environment-snapshot/valid/active.json +1 -0
- package/fixtures/json-schema/environment-template/invalid/missing.json +1 -0
- package/fixtures/json-schema/environment-template/valid/container.json +1 -0
- package/fixtures/json-schema/evaluation-dataset/invalid/no-samples.json +1 -0
- package/fixtures/json-schema/evaluation-dataset/valid/minimal.json +1 -0
- package/fixtures/json-schema/evaluation-result/invalid/bad-score.json +1 -0
- package/fixtures/json-schema/evaluation-result/valid/passed.json +1 -0
- package/fixtures/json-schema/evaluation-run/invalid/no-candidate.json +1 -0
- package/fixtures/json-schema/evaluation-run/valid/running.json +1 -0
- package/fixtures/json-schema/event-envelope/invalid/bad-severity.json +7 -0
- package/fixtures/json-schema/event-envelope/valid/minimal.json +14 -0
- package/fixtures/json-schema/executor-profile/invalid/missing.json +1 -0
- package/fixtures/json-schema/executor-profile/valid/readonly.json +1 -0
- package/fixtures/json-schema/feedback-sample/invalid/missing.json +1 -0
- package/fixtures/json-schema/feedback-sample/valid/pending.json +1 -0
- package/fixtures/json-schema/fleet-target/invalid/missing.json +1 -0
- package/fixtures/json-schema/fleet-target/valid/linux.json +1 -0
- package/fixtures/json-schema/gate-decision/invalid/missing.json +1 -0
- package/fixtures/json-schema/gate-decision/valid/pass.json +1 -0
- package/fixtures/json-schema/gate-policy/invalid/missing.json +1 -0
- package/fixtures/json-schema/gate-policy/valid/release.json +1 -0
- package/fixtures/json-schema/gateway-capability-baseline/invalid/missing-owner.json +32 -0
- package/fixtures/json-schema/gateway-capability-baseline/valid/minimal.json +61 -0
- package/fixtures/json-schema/gateway-manifest/invalid/bad-risk-level.json +37 -0
- package/fixtures/json-schema/gateway-manifest/valid/minimal.json +48 -0
- package/fixtures/json-schema/graph-revision/invalid/missing.json +1 -0
- package/fixtures/json-schema/graph-revision/valid/active.json +1 -0
- package/fixtures/json-schema/index-publish/invalid/missing.json +1 -0
- package/fixtures/json-schema/index-publish/valid/publish.json +1 -0
- package/fixtures/json-schema/ingestion-job/invalid/missing.json +1 -0
- package/fixtures/json-schema/ingestion-job/valid/queued.json +1 -0
- package/fixtures/json-schema/ingestion-stage/invalid/missing.json +1 -0
- package/fixtures/json-schema/ingestion-stage/valid/succeeded.json +1 -0
- package/fixtures/json-schema/knowledge-base/invalid/base.json +1 -0
- package/fixtures/json-schema/knowledge-base/valid/base.json +1 -0
- package/fixtures/json-schema/knowledge-search/invalid/search.json +1 -0
- package/fixtures/json-schema/knowledge-search/valid/search.json +1 -0
- package/fixtures/json-schema/knowledge-source/invalid/source.json +1 -0
- package/fixtures/json-schema/knowledge-source/valid/source.json +1 -0
- package/fixtures/json-schema/marketplace-catalog/invalid/missing-source.json +5 -0
- package/fixtures/json-schema/marketplace-catalog/valid/minimal.json +44 -0
- package/fixtures/json-schema/mcp-preset/invalid/bad-risk-level.json +20 -0
- package/fixtures/json-schema/mcp-preset/valid/k8s-readonly.json +40 -0
- package/fixtures/json-schema/memory-policy/invalid/missing.json +1 -0
- package/fixtures/json-schema/memory-policy/valid/explicit.json +1 -0
- package/fixtures/json-schema/memory-record/invalid/missing.json +1 -0
- package/fixtures/json-schema/memory-record/valid/explicit.json +1 -0
- package/fixtures/json-schema/multi-agent-plan/invalid/missing.json +1 -0
- package/fixtures/json-schema/multi-agent-plan/valid/running.json +1 -0
- package/fixtures/json-schema/observability-log-query-v1/invalid/missing-query.json +6 -0
- package/fixtures/json-schema/observability-log-query-v1/valid/request.json +15 -0
- package/fixtures/json-schema/observability-log-query-v1/valid/response.json +13 -0
- package/fixtures/json-schema/plugin-manifest/invalid/bad-type.json +7 -0
- package/fixtures/json-schema/plugin-manifest/invalid/logs-query-without-action.json +28 -0
- package/fixtures/json-schema/plugin-manifest/invalid/manifest-only-observability-provider.json +26 -0
- package/fixtures/json-schema/plugin-manifest/invalid/manifest-only-read-provider.json +23 -0
- package/fixtures/json-schema/plugin-manifest/invalid/write-provider-without-actions.json +23 -0
- package/fixtures/json-schema/plugin-manifest/valid/compute-provider.json +25 -0
- package/fixtures/json-schema/plugin-manifest/valid/minimal.json +14 -0
- package/fixtures/json-schema/plugin-manifest/valid/observability-provider.json +29 -0
- package/fixtures/json-schema/project-manifest/invalid/inline-secret.json +14 -0
- package/fixtures/json-schema/project-manifest/valid/demo.json +21 -0
- package/fixtures/json-schema/provider-rollout/invalid/missing.json +1 -0
- package/fixtures/json-schema/provider-rollout/valid/canary.json +1 -0
- package/fixtures/json-schema/replay-plan/invalid/missing.json +1 -0
- package/fixtures/json-schema/replay-plan/valid/readonly.json +1 -0
- package/fixtures/json-schema/retrieval-trace/invalid/missing.json +1 -0
- package/fixtures/json-schema/retrieval-trace/valid/grounded.json +1 -0
- package/fixtures/json-schema/runner-operation-lifecycle/invalid/bad-state.json +7 -0
- package/fixtures/json-schema/runner-operation-lifecycle/invalid/missing-runner-id.json +6 -0
- package/fixtures/json-schema/runner-operation-lifecycle/valid/final-failed.json +27 -0
- package/fixtures/json-schema/runner-operation-lifecycle/valid/heartbeat.json +19 -0
- package/fixtures/json-schema/sample-attempt/invalid/missing.json +1 -0
- package/fixtures/json-schema/sample-attempt/valid/completed.json +1 -0
- package/fixtures/json-schema/skill-manifest/invalid/bad-id.json +5 -0
- package/fixtures/json-schema/skill-manifest/valid/minimal.json +8 -0
- package/fixtures/json-schema/token-claims/invalid/bad-token-kind.json +9 -0
- package/fixtures/json-schema/token-claims/valid/service-account.json +15 -0
- package/fixtures/openapi/AIGatewayManifestEnvelope/invalid/bad-date.json +28 -0
- package/fixtures/openapi/AIGatewayManifestEnvelope/valid/minimal.json +31 -0
- package/fixtures/openapi/AgentProviderRegistryAcknowledgement/invalid/missing-targeted.json +7 -0
- package/fixtures/openapi/AgentProviderRegistryAcknowledgement/valid/rollout.json +17 -0
- package/fixtures/openapi/AgentRunCallbackRequest/invalid/missing-agent-id.json +6 -0
- package/fixtures/openapi/AgentRunCallbackRequest/valid/succeeded.json +10 -0
- package/fixtures/openapi/AgentRunCallbackRequest/valid/with-events.json +39 -0
- package/fixtures/openapi/AuthResultEnvelope/invalid/missing-tokens.json +13 -0
- package/fixtures/openapi/AuthResultEnvelope/valid/session.json +20 -0
- package/fixtures/openapi/CloudExtensionPointListEnvelope/invalid/missing-exclusions.json +11 -0
- package/fixtures/openapi/CloudExtensionPointListEnvelope/valid/managed-fleet.json +19 -0
- package/fixtures/openapi/ComputeAccessSourceListEnvelope/invalid/bad-source-type.json +15 -0
- package/fixtures/openapi/ComputeAccessSourceListEnvelope/valid/mixed.json +19 -0
- package/fixtures/openapi/ComputeOverviewEnvelope/invalid/bad-section-status.json +9 -0
- package/fixtures/openapi/ComputeOverviewEnvelope/valid/partial.json +33 -0
- package/fixtures/openapi/ComputeProviderListEnvelope/invalid/bad-domain.json +23 -0
- package/fixtures/openapi/ComputeProviderListEnvelope/valid/builtin.json +30 -0
- package/fixtures/openapi/ComputeResourceRelationListEnvelope/invalid/bad-relation.json +29 -0
- package/fixtures/openapi/ComputeResourceRelationListEnvelope/valid/vm-runtime.json +33 -0
- package/fixtures/openapi/ComputeTaskListEnvelope/invalid/missing-source-id.json +19 -0
- package/fixtures/openapi/ComputeTaskListEnvelope/valid/running.json +30 -0
- package/fixtures/openapi/DeliveryDraftInput/invalid/missing-application-key.json +9 -0
- package/fixtures/openapi/DeliveryDraftInput/valid/ai-service.json +25 -0
- package/fixtures/openapi/DirectoryEventListEnvelope/invalid/unknown-status.json +13 -0
- package/fixtures/openapi/DirectoryEventListEnvelope/valid/failed.json +16 -0
- package/fixtures/openapi/DirectoryPersonLifecycle/invalid/unknown-employment-status.json +5 -0
- package/fixtures/openapi/DirectoryPersonLifecycle/valid/departed.json +6 -0
- package/fixtures/openapi/DirectoryRuntimeStatusEnvelope/invalid/negative-event-count.json +11 -0
- package/fixtures/openapi/DirectoryRuntimeStatusEnvelope/valid/verified.json +14 -0
- package/fixtures/openapi/DockerContainerStartInput/invalid/missing-image.json +8 -0
- package/fixtures/openapi/DockerContainerStartInput/valid/git-dockerfile.json +22 -0
- package/fixtures/openapi/DockerOperationCallbackRequest/invalid/logs-not-array.json +7 -0
- package/fixtures/openapi/DockerOperationCallbackRequest/valid/succeeded.json +9 -0
- package/fixtures/openapi/ErrorEnvelope/invalid/extra-field.json +7 -0
- package/fixtures/openapi/ErrorEnvelope/valid/error.json +7 -0
- package/fixtures/openapi/EvaluationGateRequest/invalid/missing-candidate.json +4 -0
- package/fixtures/openapi/EvaluationGateRequest/valid/candidate.json +5 -0
- package/fixtures/openapi/ExecutionCallbackRequest/invalid/extra-field.json +6 -0
- package/fixtures/openapi/ExecutionCallbackRequest/valid/succeeded.json +7 -0
- package/fixtures/openapi/GovernanceStatusEnvelope/invalid/window-hours-string.json +81 -0
- package/fixtures/openapi/GovernanceStatusEnvelope/valid/minimal.json +81 -0
- package/fixtures/openapi/IdentityErrorEnvelope/invalid/raw-assertion.json +7 -0
- package/fixtures/openapi/IdentityErrorEnvelope/valid/invalid-signature.json +7 -0
- package/fixtures/openapi/IdentityOutpostClaimRequest/invalid/missing-protocol-version.json +4 -0
- package/fixtures/openapi/IdentityOutpostClaimRequest/valid/current-version.json +5 -0
- package/fixtures/openapi/IdentityRuntimeCapabilityEnvelope/invalid/missing-runtime-state.json +17 -0
- package/fixtures/openapi/IdentityRuntimeCapabilityEnvelope/valid/available.json +17 -0
- package/fixtures/openapi/KnowledgeIngestionJobInput/invalid/missing-source.json +1 -0
- package/fixtures/openapi/KnowledgeIngestionJobInput/valid/source.json +3 -0
- package/fixtures/openapi/KubernetesResourceAgentCreateRequest/invalid/unresolved-target.json +18 -0
- package/fixtures/openapi/KubernetesResourceAgentCreateRequest/valid/resolved-target.json +25 -0
- package/fixtures/openapi/KubernetesResourceCreateRequest/invalid/unknown-source.json +5 -0
- package/fixtures/openapi/KubernetesResourceCreateRequest/valid/global-multi-document.json +5 -0
- package/fixtures/openapi/KubernetesResourceCreateResultEnvelope/invalid/bad-document-index.json +21 -0
- package/fixtures/openapi/KubernetesResourceCreateResultEnvelope/valid/partial.json +62 -0
- package/fixtures/openapi/KubernetesResourceCreateScopeDecisionEnvelope/invalid/missing-capability.json +12 -0
- package/fixtures/openapi/KubernetesResourceCreateScopeDecisionEnvelope/valid/allowed.json +17 -0
- package/fixtures/openapi/KubernetesResourcePreflightEnvelope/invalid/warning-without-message.json +32 -0
- package/fixtures/openapi/KubernetesResourcePreflightEnvelope/valid/mixed-diagnostics.json +83 -0
- package/fixtures/openapi/LogPage/invalid/missing-entry-source.json +12 -0
- package/fixtures/openapi/LogPage/valid/partial-runtime.json +42 -0
- package/fixtures/openapi/LogQuery/invalid/missing-selector.json +3 -0
- package/fixtures/openapi/LogQuery/invalid/unknown-source-mode.json +6 -0
- package/fixtures/openapi/LogQuery/valid/docker-project.json +12 -0
- package/fixtures/openapi/LogQuery/valid/runtime-workload.json +21 -0
- package/fixtures/openapi/LogStreamEvent/invalid/missing-entry.json +3 -0
- package/fixtures/openapi/LogStreamEvent/invalid/unknown-event-type.json +3 -0
- package/fixtures/openapi/LogStreamEvent/valid/live-entry.json +16 -0
- package/fixtures/openapi/MCPCapabilityListEnvelope/invalid/missing-scopes.json +9 -0
- package/fixtures/openapi/MCPCapabilityListEnvelope/valid/minimal.json +10 -0
- package/fixtures/openapi/MFAAdminResetRequest/invalid/missing-reason.json +3 -0
- package/fixtures/openapi/MFAAdminResetRequest/valid/security-incident.json +4 -0
- package/fixtures/openapi/MFAWebAuthnRequestOptionsEnvelope/invalid/missing-challenge-id.json +9 -0
- package/fixtures/openapi/MFAWebAuthnRequestOptionsEnvelope/valid/step-up.json +11 -0
- package/fixtures/openapi/ManifestDeploymentEnvelope/invalid/bad-condition-status.json +33 -0
- package/fixtures/openapi/ManifestDeploymentEnvelope/valid/converged.json +36 -0
- package/fixtures/openapi/ManifestSourceUpdateInput/invalid/unknown-mode.json +6 -0
- package/fixtures/openapi/ManifestSourceUpdateInput/valid/soha-managed.json +6 -0
- package/fixtures/openapi/ObservabilityDataSource/valid/healthy.json +33 -0
- package/fixtures/openapi/ObservabilityDataSourceInput/invalid/secret-in-config.json +9 -0
- package/fixtures/openapi/ObservabilityDataSourceInput/valid/loki.json +33 -0
- package/fixtures/openapi/ObservabilityDataSourceInput/valid/provider.json +21 -0
- package/fixtures/openapi/PasswordLoginRequest/invalid/extra-field.json +5 -0
- package/fixtures/openapi/PasswordLoginRequest/valid/password-login.json +4 -0
- package/fixtures/openapi/PersonalAccessTokenInput/invalid/extra-field.json +6 -0
- package/fixtures/openapi/PersonalAccessTokenInput/valid/create.json +9 -0
- package/fixtures/openapi/PluginManifest/invalid/bad-type.json +7 -0
- package/fixtures/openapi/PluginManifest/valid/skill-pack.json +12 -0
- package/fixtures/openapi/RepositoryInput/invalid/embedded-token.json +8 -0
- package/fixtures/openapi/RepositoryInput/valid/gitlab.json +11 -0
- package/fixtures/openapi/RuntimeConfigChangeRequest/invalid/missing-version.json +8 -0
- package/fixtures/openapi/RuntimeConfigChangeRequest/valid/feature-flags.json +14 -0
- package/fixtures/openapi/RuntimeConfigSnapshotEnvelope/invalid/editable-secret.json +17 -0
- package/fixtures/openapi/RuntimeConfigSnapshotEnvelope/invalid/exposed-default-secret.json +18 -0
- package/fixtures/openapi/RuntimeConfigSnapshotEnvelope/invalid/exposed-effective-secret.json +18 -0
- package/fixtures/openapi/RuntimeConfigSnapshotEnvelope/valid/effective.json +34 -0
- package/fixtures/openapi/SAMLMetadataInput/invalid/unknown-source.json +4 -0
- package/fixtures/openapi/SAMLMetadataInput/valid/xml.json +4 -0
- package/fixtures/openapi/SecretCreateRequest/invalid/missing-value.json +5 -0
- package/fixtures/openapi/SecretCreateRequest/valid/create.json +13 -0
- package/fixtures/openapi/SecretLeaseRedemptionEnvelope/invalid/invalid-alias.json +9 -0
- package/fixtures/openapi/SecretLeaseRedemptionEnvelope/valid/redeem.json +9 -0
- package/fixtures/openapi/SecretMetadataEnvelope/invalid/plaintext-value.json +15 -0
- package/fixtures/openapi/SecretMetadataEnvelope/valid/metadata.json +20 -0
- package/fixtures/openapi/SecretRotateRequest/invalid/empty-value.json +3 -0
- package/fixtures/openapi/SecretRotateRequest/valid/rotate.json +3 -0
- package/fixtures/openapi/ServiceAccountInput/invalid/missing-status.json +4 -0
- package/fixtures/openapi/ServiceAccountInput/valid/create.json +8 -0
- package/fixtures/openapi/WorkbenchStreamEvent/invalid/extra-field.json +11 -0
- package/fixtures/openapi/WorkbenchStreamEvent/invalid/missing-server-fields.json +5 -0
- package/fixtures/openapi/WorkbenchStreamEvent/valid/message-done.json +13 -0
- package/gen/go/sohaapi/client.go +989 -0
- package/gen/go/sohaapi/client_test.go +2127 -0
- package/gen/go/sohaapi/types.go +21450 -0
- package/gen/ts/sohaapi/index.ts +22869 -0
- package/go.mod +18 -0
- package/go.sum +46 -0
- package/governance/approval-request.schema.json +187 -0
- package/governance/audit-log.schema.json +37 -0
- package/helmrelease/release.go +108 -0
- package/helmrelease/release_test.go +9 -0
- package/knowledge/connector-checkpoint.schema.json +16 -0
- package/knowledge/connector-definition.schema.json +18 -0
- package/knowledge/context-envelope.schema.json +32 -0
- package/knowledge/graph-revision.schema.json +21 -0
- package/knowledge/index-publish.schema.json +17 -0
- package/knowledge/ingestion-job.schema.json +22 -0
- package/knowledge/ingestion-stage.schema.json +19 -0
- package/knowledge/knowledge-base.schema.json +48 -0
- package/knowledge/knowledge-search.schema.json +21 -0
- package/knowledge/knowledge-source.schema.json +28 -0
- package/knowledge/retrieval-trace.schema.json +21 -0
- package/mcp/gateway-capability-baseline.schema.json +290 -0
- package/mcp/gateway-manifest.schema.json +210 -0
- package/memory/memory-policy.schema.json +19 -0
- package/memory/memory-record.schema.json +25 -0
- package/openapi/soha-api.json +42282 -0
- package/openapi/soha-api.yaml +21748 -0
- package/openapi/spec_generated.go +23 -0
- package/openapi/spec_test.go +38 -0
- package/package.json +122 -0
- package/plugins/marketplace-catalog.schema.json +120 -0
- package/plugins/observability-log-query-v1.schema.json +88 -0
- package/plugins/plugin-manifest.schema.json +498 -0
- package/presets/mcp-preset.schema.json +142 -0
- package/profiles/agent-profile.schema.json +154 -0
- package/resource/crd_definition.go +10 -0
- package/resource/gateway_details_test.go +55 -0
- package/resource/models.go +1587 -0
- package/resource/models_test.go +72 -0
- package/runner/operation-lifecycle.schema.json +112 -0
- package/skills/skill-manifest.schema.json +64 -0
- package/streamlimit/limited_buffer.go +58 -0
- package/streamlimit/limited_buffer_test.go +38 -0
|
@@ -0,0 +1,989 @@
|
|
|
1
|
+
// Code generated from OpenSoha contracts. DO NOT EDIT.
|
|
2
|
+
package sohaapi
|
|
3
|
+
|
|
4
|
+
import (
|
|
5
|
+
"bytes"
|
|
6
|
+
"context"
|
|
7
|
+
"encoding/json"
|
|
8
|
+
"fmt"
|
|
9
|
+
"io"
|
|
10
|
+
"net/http"
|
|
11
|
+
"net/url"
|
|
12
|
+
"strconv"
|
|
13
|
+
"strings"
|
|
14
|
+
"time"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
const defaultUserAgent = "opensoha-contracts/0.1.4"
|
|
18
|
+
|
|
19
|
+
type Client struct {
|
|
20
|
+
BaseURL string
|
|
21
|
+
Token string
|
|
22
|
+
HTTPClient *http.Client
|
|
23
|
+
UserAgent string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type ClientOption func(*Client)
|
|
27
|
+
|
|
28
|
+
func WithBearerToken(token string) ClientOption {
|
|
29
|
+
return func(c *Client) {
|
|
30
|
+
c.Token = strings.TrimSpace(token)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
func WithHTTPClient(client *http.Client) ClientOption {
|
|
35
|
+
return func(c *Client) {
|
|
36
|
+
c.HTTPClient = client
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
func WithUserAgent(userAgent string) ClientOption {
|
|
41
|
+
return func(c *Client) {
|
|
42
|
+
c.UserAgent = strings.TrimSpace(userAgent)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
func NewClient(baseURL string, opts ...ClientOption) *Client {
|
|
47
|
+
c := &Client{
|
|
48
|
+
BaseURL: strings.TrimSpace(baseURL),
|
|
49
|
+
UserAgent: defaultUserAgent,
|
|
50
|
+
}
|
|
51
|
+
for _, opt := range opts {
|
|
52
|
+
if opt != nil {
|
|
53
|
+
opt(c)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return c
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
func (c *Client) GetHealthz(ctx context.Context) (GenericObject, error) {
|
|
60
|
+
var out GenericObject
|
|
61
|
+
if err := c.doJSON(ctx, http.MethodGet, "/healthz", false, nil, &out); err != nil {
|
|
62
|
+
return nil, err
|
|
63
|
+
}
|
|
64
|
+
return out, nil
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
func (c *Client) GetReadyz(ctx context.Context) (GenericObject, error) {
|
|
68
|
+
var out GenericObject
|
|
69
|
+
if err := c.doJSON(ctx, http.MethodGet, "/readyz", false, nil, &out); err != nil {
|
|
70
|
+
return nil, err
|
|
71
|
+
}
|
|
72
|
+
return out, nil
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
func (c *Client) GetAgentProviderCatalog(ctx context.Context) (AgentProviderCatalog, error) {
|
|
76
|
+
var out AgentProviderCatalogEnvelope
|
|
77
|
+
if err := c.doJSON(ctx, http.MethodGet, "/ai/agent-providers/catalog", true, nil, &out); err != nil {
|
|
78
|
+
return AgentProviderCatalog{}, err
|
|
79
|
+
}
|
|
80
|
+
return out.Data, nil
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
func (c *Client) GetAgentProviderRuntimeStatus(ctx context.Context) (AgentProviderRuntimeStatus, error) {
|
|
84
|
+
var out AgentProviderRuntimeStatusEnvelope
|
|
85
|
+
if err := c.doJSON(ctx, http.MethodGet, "/ai/agent-providers/runtime-status", true, nil, &out); err != nil {
|
|
86
|
+
return AgentProviderRuntimeStatus{}, err
|
|
87
|
+
}
|
|
88
|
+
return out.Data, nil
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
func (c *Client) GetAgentProviderRegistrySnapshot(ctx context.Context, runnerID string) (AgentProviderRegistrySnapshot, error) {
|
|
92
|
+
var out AgentProviderRegistrySnapshotEnvelope
|
|
93
|
+
query := url.Values{"runnerId": []string{strings.TrimSpace(runnerID)}}
|
|
94
|
+
path := "/ai/agent-providers/registry-snapshot?" + query.Encode()
|
|
95
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
96
|
+
return AgentProviderRegistrySnapshot{}, err
|
|
97
|
+
}
|
|
98
|
+
return out.Data, nil
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
func (c *Client) AcknowledgeAgentProviderRegistry(ctx context.Context, req AgentProviderRegistryAcknowledgement) (AgentProviderRegistryAcknowledgement, error) {
|
|
102
|
+
var out AgentProviderRegistryAcknowledgementEnvelope
|
|
103
|
+
if err := c.doJSON(ctx, http.MethodPost, "/ai/agent-providers/registry-acks", true, req, &out); err != nil {
|
|
104
|
+
return AgentProviderRegistryAcknowledgement{}, err
|
|
105
|
+
}
|
|
106
|
+
return out.Data, nil
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
func (c *Client) ListKnowledgeBases(ctx context.Context) ([]KnowledgeBase, error) {
|
|
110
|
+
var out KnowledgeBaseListEnvelope
|
|
111
|
+
if err := c.doJSON(ctx, http.MethodGet, "/ai/knowledge-bases", true, nil, &out); err != nil {
|
|
112
|
+
return nil, err
|
|
113
|
+
}
|
|
114
|
+
return out.Items, nil
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
func (c *Client) GetKnowledgeBase(ctx context.Context, baseID string) (KnowledgeBase, error) {
|
|
118
|
+
var out KnowledgeBaseEnvelope
|
|
119
|
+
path := "/ai/knowledge-bases/" + url.PathEscape(strings.TrimSpace(baseID))
|
|
120
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
121
|
+
return KnowledgeBase{}, err
|
|
122
|
+
}
|
|
123
|
+
return out.Data, nil
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
func (c *Client) CreateKnowledgeBase(ctx context.Context, req KnowledgeBaseInput) (KnowledgeBase, error) {
|
|
127
|
+
var out KnowledgeBaseEnvelope
|
|
128
|
+
if err := c.doJSON(ctx, http.MethodPost, "/ai/knowledge-bases", true, req, &out); err != nil {
|
|
129
|
+
return KnowledgeBase{}, err
|
|
130
|
+
}
|
|
131
|
+
return out.Data, nil
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
func (c *Client) UpdateKnowledgeBase(ctx context.Context, baseID string, req KnowledgeBaseInput) (KnowledgeBase, error) {
|
|
135
|
+
var out KnowledgeBaseEnvelope
|
|
136
|
+
path := "/ai/knowledge-bases/" + url.PathEscape(strings.TrimSpace(baseID))
|
|
137
|
+
if err := c.doJSON(ctx, http.MethodPatch, path, true, req, &out); err != nil {
|
|
138
|
+
return KnowledgeBase{}, err
|
|
139
|
+
}
|
|
140
|
+
return out.Data, nil
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
func (c *Client) DeleteKnowledgeBase(ctx context.Context, baseID string) error {
|
|
144
|
+
path := "/ai/knowledge-bases/" + url.PathEscape(strings.TrimSpace(baseID))
|
|
145
|
+
return c.doJSON(ctx, http.MethodDelete, path, true, nil, nil)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
func (c *Client) ListKnowledgeSources(ctx context.Context, baseID string) ([]KnowledgeSource, error) {
|
|
149
|
+
var out KnowledgeSourceListEnvelope
|
|
150
|
+
path := "/ai/knowledge-bases/" + url.PathEscape(strings.TrimSpace(baseID)) + "/sources"
|
|
151
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
152
|
+
return nil, err
|
|
153
|
+
}
|
|
154
|
+
return out.Items, nil
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
func (c *Client) CreateKnowledgeSource(ctx context.Context, baseID string, req KnowledgeSourceInput) (KnowledgeSource, error) {
|
|
158
|
+
var out KnowledgeSourceEnvelope
|
|
159
|
+
path := "/ai/knowledge-bases/" + url.PathEscape(strings.TrimSpace(baseID)) + "/sources"
|
|
160
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, req, &out); err != nil {
|
|
161
|
+
return KnowledgeSource{}, err
|
|
162
|
+
}
|
|
163
|
+
return out.Data, nil
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
func (c *Client) SyncKnowledgeSource(ctx context.Context, baseID, sourceID string) (KnowledgeSyncRun, error) {
|
|
167
|
+
var out KnowledgeSyncRunEnvelope
|
|
168
|
+
path := "/ai/knowledge-bases/" + url.PathEscape(strings.TrimSpace(baseID)) + "/sources/" + url.PathEscape(strings.TrimSpace(sourceID)) + "/sync"
|
|
169
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, nil, &out); err != nil {
|
|
170
|
+
return KnowledgeSyncRun{}, err
|
|
171
|
+
}
|
|
172
|
+
return out.Data, nil
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
func (c *Client) ListKnowledgeDocuments(ctx context.Context, baseID string, limit int) ([]KnowledgeDocument, error) {
|
|
176
|
+
var out KnowledgeDocumentListEnvelope
|
|
177
|
+
path := knowledgeListPath(baseID, "documents", limit)
|
|
178
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
179
|
+
return nil, err
|
|
180
|
+
}
|
|
181
|
+
return out.Items, nil
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
func (c *Client) ListKnowledgeSyncRuns(ctx context.Context, baseID string, limit int) ([]KnowledgeSyncRun, error) {
|
|
185
|
+
var out KnowledgeSyncRunListEnvelope
|
|
186
|
+
path := knowledgeListPath(baseID, "sync-runs", limit)
|
|
187
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
188
|
+
return nil, err
|
|
189
|
+
}
|
|
190
|
+
return out.Items, nil
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
func (c *Client) ListKnowledgeIndexRevisions(ctx context.Context, baseID string, limit int) ([]KnowledgeIndexRevision, error) {
|
|
194
|
+
var out KnowledgeIndexRevisionListEnvelope
|
|
195
|
+
path := knowledgeListPath(baseID, "index-revisions", limit)
|
|
196
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
197
|
+
return nil, err
|
|
198
|
+
}
|
|
199
|
+
return out.Items, nil
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
func (c *Client) SearchKnowledge(ctx context.Context, req KnowledgeSearchRequest) (KnowledgeSearchResult, error) {
|
|
203
|
+
var out KnowledgeSearchResultEnvelope
|
|
204
|
+
if err := c.doJSON(ctx, http.MethodPost, "/ai/knowledge/search", true, req, &out); err != nil {
|
|
205
|
+
return KnowledgeSearchResult{}, err
|
|
206
|
+
}
|
|
207
|
+
return out.Data, nil
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
func (c *Client) InspectAIContext(ctx context.Context, req AIContextBuildInput) (AIContextInspection, error) {
|
|
211
|
+
var out AIContextInspectionEnvelope
|
|
212
|
+
if err := c.doJSON(ctx, http.MethodPost, "/ai/context/inspect", true, req, &out); err != nil {
|
|
213
|
+
return AIContextInspection{}, err
|
|
214
|
+
}
|
|
215
|
+
return out.Data, nil
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
func (c *Client) ListEvaluationDatasets(ctx context.Context) ([]EvaluationDataset, error) {
|
|
219
|
+
var out EvaluationDatasetListEnvelope
|
|
220
|
+
if err := c.doJSON(ctx, http.MethodGet, "/ai/evaluations/datasets", true, nil, &out); err != nil {
|
|
221
|
+
return nil, err
|
|
222
|
+
}
|
|
223
|
+
return out.Items, nil
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
func (c *Client) CreateEvaluationDataset(ctx context.Context, req EvaluationDataset) (EvaluationDataset, error) {
|
|
227
|
+
var out EvaluationDatasetEnvelope
|
|
228
|
+
if err := c.doJSON(ctx, http.MethodPost, "/ai/evaluations/datasets", true, req, &out); err != nil {
|
|
229
|
+
return EvaluationDataset{}, err
|
|
230
|
+
}
|
|
231
|
+
return out.Data, nil
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
func (c *Client) ListEvaluationRuns(ctx context.Context) ([]EvaluationRun, error) {
|
|
235
|
+
var out EvaluationRunListEnvelope
|
|
236
|
+
if err := c.doJSON(ctx, http.MethodGet, "/ai/evaluations/runs", true, nil, &out); err != nil {
|
|
237
|
+
return nil, err
|
|
238
|
+
}
|
|
239
|
+
return out.Items, nil
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
func (c *Client) StartEvaluationRun(ctx context.Context, req EvaluationRun) (EvaluationRun, error) {
|
|
243
|
+
var out EvaluationRunEnvelope
|
|
244
|
+
if err := c.doJSON(ctx, http.MethodPost, "/ai/evaluations/runs", true, req, &out); err != nil {
|
|
245
|
+
return EvaluationRun{}, err
|
|
246
|
+
}
|
|
247
|
+
return out.Data, nil
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
func (c *Client) GetEvaluationRun(ctx context.Context, runID string) (EvaluationRun, error) {
|
|
251
|
+
var out EvaluationRunEnvelope
|
|
252
|
+
path := "/ai/evaluations/runs/" + url.PathEscape(strings.TrimSpace(runID))
|
|
253
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
254
|
+
return EvaluationRun{}, err
|
|
255
|
+
}
|
|
256
|
+
return out.Data, nil
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
func (c *Client) ListEvaluationRunResults(ctx context.Context, runID string) ([]EvaluationResult, error) {
|
|
260
|
+
var out EvaluationResultListEnvelope
|
|
261
|
+
path := "/ai/evaluations/runs/" + url.PathEscape(strings.TrimSpace(runID)) + "/results"
|
|
262
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
263
|
+
return nil, err
|
|
264
|
+
}
|
|
265
|
+
return out.Items, nil
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
func (c *Client) CompleteEvaluationRun(ctx context.Context, runID string, req EvaluationCompleteRunInput) (EvaluationRun, error) {
|
|
269
|
+
var out EvaluationRunEnvelope
|
|
270
|
+
path := "/ai/evaluations/runs/" + url.PathEscape(strings.TrimSpace(runID)) + "/complete"
|
|
271
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, req, &out); err != nil {
|
|
272
|
+
return EvaluationRun{}, err
|
|
273
|
+
}
|
|
274
|
+
return out.Data, nil
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
func knowledgeListPath(baseID, collection string, limit int) string {
|
|
278
|
+
path := "/ai/knowledge-bases/" + url.PathEscape(strings.TrimSpace(baseID)) + "/" + collection
|
|
279
|
+
if limit > 0 {
|
|
280
|
+
path += "?limit=" + strconv.Itoa(limit)
|
|
281
|
+
}
|
|
282
|
+
return path
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
func (c *Client) ListAuthProviders(ctx context.Context) ([]AuthProvider, error) {
|
|
286
|
+
var out AuthProviderListEnvelope
|
|
287
|
+
if err := c.doJSON(ctx, http.MethodGet, "/auth/providers", false, nil, &out); err != nil {
|
|
288
|
+
return nil, err
|
|
289
|
+
}
|
|
290
|
+
return out.Items, nil
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
func (c *Client) GetAuthLoginOptions(ctx context.Context) (LoginOptions, error) {
|
|
294
|
+
var out LoginOptionsEnvelope
|
|
295
|
+
if err := c.doJSON(ctx, http.MethodGet, "/auth/login-options", false, nil, &out); err != nil {
|
|
296
|
+
return LoginOptions{}, err
|
|
297
|
+
}
|
|
298
|
+
return out.Data, nil
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
func (c *Client) PasswordLogin(ctx context.Context, req PasswordLoginRequest) (AuthResult, error) {
|
|
302
|
+
var out AuthResultEnvelope
|
|
303
|
+
if err := c.doJSON(ctx, http.MethodPost, "/auth/login", false, req, &out); err != nil {
|
|
304
|
+
return AuthResult{}, err
|
|
305
|
+
}
|
|
306
|
+
return out.Data, nil
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
func (c *Client) RefreshAuthSession(ctx context.Context, req *RefreshRequest) (AuthResult, error) {
|
|
310
|
+
var out AuthResultEnvelope
|
|
311
|
+
if err := c.doJSON(ctx, http.MethodPost, "/auth/refresh", false, req, &out); err != nil {
|
|
312
|
+
return AuthResult{}, err
|
|
313
|
+
}
|
|
314
|
+
return out.Data, nil
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
func (c *Client) ExchangeOIDCCode(ctx context.Context, req OIDCExchangeRequest) (AuthResult, error) {
|
|
318
|
+
var out AuthResultEnvelope
|
|
319
|
+
if err := c.doJSON(ctx, http.MethodPost, "/auth/oidc/exchange", false, req, &out); err != nil {
|
|
320
|
+
return AuthResult{}, err
|
|
321
|
+
}
|
|
322
|
+
return out.Data, nil
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
func (c *Client) GetCurrentPrincipal(ctx context.Context) (Principal, error) {
|
|
326
|
+
var out PrincipalEnvelope
|
|
327
|
+
if err := c.doJSON(ctx, http.MethodGet, "/auth/me", true, nil, &out); err != nil {
|
|
328
|
+
return Principal{}, err
|
|
329
|
+
}
|
|
330
|
+
return out.Data, nil
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
func (c *Client) GetCurrentUserProfile(ctx context.Context) (UserProfile, error) {
|
|
334
|
+
var out UserProfileEnvelope
|
|
335
|
+
if err := c.doJSON(ctx, http.MethodGet, "/auth/profile", true, nil, &out); err != nil {
|
|
336
|
+
return UserProfile{}, err
|
|
337
|
+
}
|
|
338
|
+
return out.Data, nil
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
func (c *Client) GetAuthBootstrap(ctx context.Context) (AuthBootstrapEnvelope_Data, error) {
|
|
342
|
+
var out AuthBootstrapEnvelope
|
|
343
|
+
if err := c.doJSON(ctx, http.MethodGet, "/auth/bootstrap", true, nil, &out); err != nil {
|
|
344
|
+
return AuthBootstrapEnvelope_Data{}, err
|
|
345
|
+
}
|
|
346
|
+
return out.Data, nil
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
func (c *Client) LogoutAuthSession(ctx context.Context, req *RefreshRequest) error {
|
|
350
|
+
return c.doJSON(ctx, http.MethodPost, "/auth/logout", true, req, nil)
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
func (c *Client) IssueStreamTicket(ctx context.Context, req StreamTicketRequest) (StreamTicket, error) {
|
|
354
|
+
var out StreamTicketEnvelope
|
|
355
|
+
if err := c.doJSON(ctx, http.MethodPost, "/auth/stream-ticket", true, req, &out); err != nil {
|
|
356
|
+
return StreamTicket{}, err
|
|
357
|
+
}
|
|
358
|
+
return out.Data, nil
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
func (c *Client) ClaimExecutionTask(ctx context.Context, req ExecutionTaskClaimRequest) (ExecutionTask, error) {
|
|
362
|
+
var out ExecutionTaskEnvelope
|
|
363
|
+
if err := c.doJSON(ctx, http.MethodPost, "/delivery/execution-tasks/claim", true, req, &out); err != nil {
|
|
364
|
+
return ExecutionTask{}, err
|
|
365
|
+
}
|
|
366
|
+
return out.Data, nil
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
func (c *Client) GetExecutionTaskRunnerStatus(ctx context.Context, taskID string) (ExecutionTask, error) {
|
|
370
|
+
var out ExecutionTaskEnvelope
|
|
371
|
+
path := "/delivery/execution-tasks/" + url.PathEscape(strings.TrimSpace(taskID)) + "/runner-status"
|
|
372
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
373
|
+
return ExecutionTask{}, err
|
|
374
|
+
}
|
|
375
|
+
return out.Data, nil
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
func (c *Client) RecordExecutionCallback(ctx context.Context, req ExecutionCallbackRequest) (ExecutionTask, error) {
|
|
379
|
+
var out ExecutionTaskEnvelope
|
|
380
|
+
if err := c.doJSON(ctx, http.MethodPost, "/delivery/execution-callbacks", false, req, &out); err != nil {
|
|
381
|
+
return ExecutionTask{}, err
|
|
382
|
+
}
|
|
383
|
+
return out.Data, nil
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
func (c *Client) RedeemSecretLease(ctx context.Context, leaseID string, params RedeemSecretLeaseParams) (SecretLeaseRedemption, error) {
|
|
387
|
+
var out SecretLeaseRedemptionEnvelope
|
|
388
|
+
path := "/runner/secret-leases/" + url.PathEscape(strings.TrimSpace(leaseID)) + "/redeem"
|
|
389
|
+
headers := http.Header{
|
|
390
|
+
"X-Soha-Secret-Lease-Token": []string{string(params.XSohaSecretLeaseToken)},
|
|
391
|
+
"X-Soha-Agent-ID": []string{string(params.XSohaAgentID)},
|
|
392
|
+
}
|
|
393
|
+
if err := c.doJSONWithHeaders(ctx, http.MethodPost, path, true, nil, &out, headers); err != nil {
|
|
394
|
+
return SecretLeaseRedemption{}, err
|
|
395
|
+
}
|
|
396
|
+
return out.Data, nil
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
func (c *Client) ClaimDockerOperation(ctx context.Context, req DockerOperationClaimRequest) (DockerOperation, error) {
|
|
400
|
+
var out DockerOperationEnvelope
|
|
401
|
+
if err := c.doJSON(ctx, http.MethodPost, "/docker/operations/claim", true, req, &out); err != nil {
|
|
402
|
+
return DockerOperation{}, err
|
|
403
|
+
}
|
|
404
|
+
return out.Data, nil
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
func (c *Client) GetDockerOperationRunnerStatus(ctx context.Context, operationID string) (DockerOperation, error) {
|
|
408
|
+
var out DockerOperationEnvelope
|
|
409
|
+
path := "/docker/operations/" + url.PathEscape(strings.TrimSpace(operationID)) + "/runner-status"
|
|
410
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
411
|
+
return DockerOperation{}, err
|
|
412
|
+
}
|
|
413
|
+
return out.Data, nil
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
func (c *Client) RecordDockerOperationCallback(ctx context.Context, req DockerOperationCallbackRequest) (DockerOperation, error) {
|
|
417
|
+
var out DockerOperationEnvelope
|
|
418
|
+
if err := c.doJSON(ctx, http.MethodPost, "/docker/operation-callbacks", true, req, &out); err != nil {
|
|
419
|
+
return DockerOperation{}, err
|
|
420
|
+
}
|
|
421
|
+
return out.Data, nil
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
func (c *Client) ClaimAgentRun(ctx context.Context, req AgentRunClaimRequest) (AgentRun, error) {
|
|
425
|
+
var out AgentRunEnvelope
|
|
426
|
+
if err := c.doJSON(ctx, http.MethodPost, "/copilot/agent-runs/claim", true, req, &out); err != nil {
|
|
427
|
+
return AgentRun{}, err
|
|
428
|
+
}
|
|
429
|
+
return out.Data, nil
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
func (c *Client) RecordAgentRunCallback(ctx context.Context, req AgentRunCallbackRequest) (AgentRun, error) {
|
|
433
|
+
var out AgentRunEnvelope
|
|
434
|
+
if err := c.doJSON(ctx, http.MethodPost, "/copilot/agent-runs/callback", true, req, &out); err != nil {
|
|
435
|
+
return AgentRun{}, err
|
|
436
|
+
}
|
|
437
|
+
return out.Data, nil
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
func (c *Client) RecordAgentRunToolCall(ctx context.Context, req AgentRunToolCallRequest) (AgentToolCallResult, error) {
|
|
441
|
+
var out AgentToolCallResultEnvelope
|
|
442
|
+
if err := c.doJSON(ctx, http.MethodPost, "/copilot/agent-runs/tool-call", true, req, &out); err != nil {
|
|
443
|
+
return AgentToolCallResult{}, err
|
|
444
|
+
}
|
|
445
|
+
return out.Data, nil
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
func (c *Client) ClaimIdentityOutpostConfig(ctx context.Context, req IdentityOutpostClaimRequest) (*IdentityOutpostRuntimeConfig, error) {
|
|
449
|
+
var out IdentityOutpostRuntimeConfigEnvelope
|
|
450
|
+
if err := c.doJSON(ctx, http.MethodPost, "/identity/outposts/runtime/claim", true, req, &out); err != nil {
|
|
451
|
+
return nil, err
|
|
452
|
+
}
|
|
453
|
+
return out.Data, nil
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
func (c *Client) HeartbeatIdentityOutpost(ctx context.Context, outpostID string, req IdentityOutpostHeartbeatRequest) (IdentityOutpostHeartbeat, error) {
|
|
457
|
+
var out IdentityOutpostHeartbeatEnvelope
|
|
458
|
+
path := identityOutpostRuntimePath(outpostID, "heartbeat")
|
|
459
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, req, &out); err != nil {
|
|
460
|
+
return IdentityOutpostHeartbeat{}, err
|
|
461
|
+
}
|
|
462
|
+
return out.Data, nil
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
func (c *Client) CheckIdentityOutpostAccess(ctx context.Context, outpostID string, req IdentityOutpostAccessCheckRequest) (IdentityOutpostAccessCheck, error) {
|
|
466
|
+
var out IdentityOutpostAccessCheckEnvelope
|
|
467
|
+
if err := c.doJSON(ctx, http.MethodPost, identityOutpostRuntimePath(outpostID, "check"), true, req, &out); err != nil {
|
|
468
|
+
return IdentityOutpostAccessCheck{}, err
|
|
469
|
+
}
|
|
470
|
+
return out.Data, nil
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
func (c *Client) AppendIdentityOutpostEvents(ctx context.Context, outpostID string, req IdentityOutpostEventBatchRequest) (OperationStatus, error) {
|
|
474
|
+
var out OperationStatus
|
|
475
|
+
if err := c.doJSON(ctx, http.MethodPost, identityOutpostRuntimePath(outpostID, "events"), true, req, &out); err != nil {
|
|
476
|
+
return OperationStatus{}, err
|
|
477
|
+
}
|
|
478
|
+
return out, nil
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
func identityOutpostRuntimePath(outpostID, action string) string {
|
|
482
|
+
return "/identity/outposts/" + url.PathEscape(strings.TrimSpace(outpostID)) + "/" + action
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
func (c *Client) BeginWebAuthnAuthentication(ctx context.Context, req MFAWebAuthnAuthenticationRequest) (MFAWebAuthnRequestOptions, error) {
|
|
486
|
+
var out MFAWebAuthnRequestOptionsEnvelope
|
|
487
|
+
if err := c.doJSON(ctx, http.MethodPost, "/identity/mfa/webauthn/authenticate", true, req, &out); err != nil {
|
|
488
|
+
return MFAWebAuthnRequestOptions{}, err
|
|
489
|
+
}
|
|
490
|
+
return out.Data, nil
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
func (c *Client) AdminRevokeUserMFACredential(ctx context.Context, userID, credentialID string) (OperationStatus, error) {
|
|
494
|
+
var out OperationStatus
|
|
495
|
+
path := identityUserMFAPath(userID, "credentials/"+url.PathEscape(strings.TrimSpace(credentialID))+"/revoke")
|
|
496
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, nil, &out); err != nil {
|
|
497
|
+
return OperationStatus{}, err
|
|
498
|
+
}
|
|
499
|
+
return out, nil
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
func (c *Client) AdminResetUserMFA(ctx context.Context, userID string, req MFAAdminResetRequest) (MFAAdminResetResult, error) {
|
|
503
|
+
var out MFAAdminResetResultEnvelope
|
|
504
|
+
if err := c.doJSON(ctx, http.MethodPost, identityUserMFAPath(userID, "reset"), true, req, &out); err != nil {
|
|
505
|
+
return MFAAdminResetResult{}, err
|
|
506
|
+
}
|
|
507
|
+
return out.Data, nil
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
func identityUserMFAPath(userID, suffix string) string {
|
|
511
|
+
return "/identity/users/" + url.PathEscape(strings.TrimSpace(userID)) + "/mfa/" + suffix
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
func (c *Client) QueryClusterLogs(ctx context.Context, clusterID string, query LogQuery) (LogPage, error) {
|
|
515
|
+
path := "/clusters/" + url.PathEscape(strings.TrimSpace(clusterID)) + "/logs/query"
|
|
516
|
+
return c.queryLogs(ctx, path, query)
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
func (c *Client) QueryDockerProjectLogs(ctx context.Context, projectID string, query LogQuery) (LogPage, error) {
|
|
520
|
+
path := "/docker/projects/" + url.PathEscape(strings.TrimSpace(projectID)) + "/logs/query"
|
|
521
|
+
return c.queryLogs(ctx, path, query)
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
func (c *Client) QueryDeliveryEnvironmentLogs(ctx context.Context, applicationID, environmentID string, query LogQuery) (LogPage, error) {
|
|
525
|
+
path := "/delivery/applications/" + url.PathEscape(strings.TrimSpace(applicationID)) +
|
|
526
|
+
"/environments/" + url.PathEscape(strings.TrimSpace(environmentID)) + "/logs/query"
|
|
527
|
+
return c.queryLogs(ctx, path, query)
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
func (c *Client) queryLogs(ctx context.Context, path string, query LogQuery) (LogPage, error) {
|
|
531
|
+
var out LogPageEnvelope
|
|
532
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, query, &out); err != nil {
|
|
533
|
+
return LogPage{}, err
|
|
534
|
+
}
|
|
535
|
+
return out.Data, nil
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
func (c *Client) ListComputeTasks(ctx context.Context, params ListComputeTasksParams) (ComputeTaskListEnvelope, error) {
|
|
539
|
+
var out ComputeTaskListEnvelope
|
|
540
|
+
if err := c.doJSON(ctx, http.MethodGet, "/compute/tasks"+computeTaskQuery(params), true, nil, &out); err != nil {
|
|
541
|
+
return ComputeTaskListEnvelope{}, err
|
|
542
|
+
}
|
|
543
|
+
return out, nil
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
func (c *Client) GetComputeTask(ctx context.Context, domain ComputeTaskDomain, taskID string) (ComputeTaskView, error) {
|
|
547
|
+
var out ComputeTaskEnvelope
|
|
548
|
+
if err := c.doJSON(ctx, http.MethodGet, computeTaskPath(domain, taskID), true, nil, &out); err != nil {
|
|
549
|
+
return ComputeTaskView{}, err
|
|
550
|
+
}
|
|
551
|
+
return out.Data, nil
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
func (c *Client) ListComputeTaskLogs(ctx context.Context, domain ComputeTaskDomain, taskID string) ([]ComputeTaskLog, error) {
|
|
555
|
+
var out ComputeTaskLogListEnvelope
|
|
556
|
+
if err := c.doJSON(ctx, http.MethodGet, computeTaskPath(domain, taskID)+"/logs", true, nil, &out); err != nil {
|
|
557
|
+
return nil, err
|
|
558
|
+
}
|
|
559
|
+
return out.Items, nil
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
func (c *Client) CancelComputeTask(ctx context.Context, domain ComputeTaskDomain, taskID string, req ComputeTaskMutationRequest) (ComputeTaskView, error) {
|
|
563
|
+
return c.mutateComputeTask(ctx, domain, taskID, "cancel", req)
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
func (c *Client) RetryComputeTask(ctx context.Context, domain ComputeTaskDomain, taskID string, req ComputeTaskMutationRequest) (ComputeTaskView, error) {
|
|
567
|
+
return c.mutateComputeTask(ctx, domain, taskID, "retry", req)
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
func (c *Client) mutateComputeTask(ctx context.Context, domain ComputeTaskDomain, taskID, action string, req ComputeTaskMutationRequest) (ComputeTaskView, error) {
|
|
571
|
+
var out ComputeTaskEnvelope
|
|
572
|
+
path := computeTaskPath(domain, taskID) + "/" + action
|
|
573
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, req, &out); err != nil {
|
|
574
|
+
return ComputeTaskView{}, err
|
|
575
|
+
}
|
|
576
|
+
return out.Data, nil
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
func (c *Client) ListAIGatewayAuditLogs(ctx context.Context, params ListAIGatewayAuditLogsParams) ([]AuditLog, error) {
|
|
580
|
+
var out AuditLogListEnvelope
|
|
581
|
+
if err := c.doJSON(ctx, http.MethodGet, "/ai-gateway/audit-logs"+auditLogQuery(params), true, nil, &out); err != nil {
|
|
582
|
+
return nil, err
|
|
583
|
+
}
|
|
584
|
+
return out.Items, nil
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
func (c *Client) ListAIGatewayApprovalRequests(ctx context.Context, params ListAIGatewayApprovalRequestsParams) ([]ApprovalRequest, error) {
|
|
588
|
+
var out ApprovalRequestListEnvelope
|
|
589
|
+
if err := c.doJSON(ctx, http.MethodGet, "/ai-gateway/approval-requests"+approvalRequestQuery(params), true, nil, &out); err != nil {
|
|
590
|
+
return nil, err
|
|
591
|
+
}
|
|
592
|
+
return out.Items, nil
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
func (c *Client) GetAIGatewayApprovalTimeline(ctx context.Context, requestID string) (ApprovalTimeline, error) {
|
|
596
|
+
var out ApprovalTimelineEnvelope
|
|
597
|
+
path := "/ai-gateway/approval-requests/" + url.PathEscape(strings.TrimSpace(requestID)) + "/timeline"
|
|
598
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
599
|
+
return ApprovalTimeline{}, err
|
|
600
|
+
}
|
|
601
|
+
return out.Data, nil
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
func (c *Client) DecideAIGatewayApprovalRequest(ctx context.Context, requestID string, action DecideAIGatewayApprovalRequestParamsAction, input *ApprovalDecisionInput) (ApprovalDecisionResult, error) {
|
|
605
|
+
var out ApprovalDecisionResultEnvelope
|
|
606
|
+
path := "/ai-gateway/approval-requests/" + url.PathEscape(strings.TrimSpace(requestID)) + "/" + url.PathEscape(string(action))
|
|
607
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, input, &out); err != nil {
|
|
608
|
+
return ApprovalDecisionResult{}, err
|
|
609
|
+
}
|
|
610
|
+
return out.Data, nil
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
func (c *Client) GetAIGatewayGovernanceStatus(ctx context.Context, params GetAIGatewayGovernanceStatusParams) (GovernanceStatus, error) {
|
|
614
|
+
var out GovernanceStatusEnvelope
|
|
615
|
+
if err := c.doJSON(ctx, http.MethodGet, "/ai-gateway/governance/status"+governanceStatusQuery(params), true, nil, &out); err != nil {
|
|
616
|
+
return GovernanceStatus{}, err
|
|
617
|
+
}
|
|
618
|
+
return out.Data, nil
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
func (c *Client) ListPersonalAccessTokens(ctx context.Context, params ListPersonalAccessTokensParams) ([]PersonalAccessToken, error) {
|
|
622
|
+
var out PersonalAccessTokenListEnvelope
|
|
623
|
+
if err := c.doJSON(ctx, http.MethodGet, "/ai-gateway/personal-access-tokens"+personalAccessTokenQuery(params), true, nil, &out); err != nil {
|
|
624
|
+
return nil, err
|
|
625
|
+
}
|
|
626
|
+
return out.Items, nil
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
func (c *Client) CreatePersonalAccessToken(ctx context.Context, input PersonalAccessTokenInput) (CreatedPersonalAccessToken, error) {
|
|
630
|
+
var out CreatedPersonalAccessTokenEnvelope
|
|
631
|
+
if err := c.doJSON(ctx, http.MethodPost, "/ai-gateway/personal-access-tokens", true, input, &out); err != nil {
|
|
632
|
+
return CreatedPersonalAccessToken{}, err
|
|
633
|
+
}
|
|
634
|
+
return out.Data, nil
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
func (c *Client) RevokePersonalAccessToken(ctx context.Context, tokenID string) (OperationStatus, error) {
|
|
638
|
+
var out OperationStatus
|
|
639
|
+
path := "/ai-gateway/personal-access-tokens/" + url.PathEscape(strings.TrimSpace(tokenID)) + "/revoke"
|
|
640
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, nil, &out); err != nil {
|
|
641
|
+
return OperationStatus{}, err
|
|
642
|
+
}
|
|
643
|
+
return out, nil
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
func (c *Client) RotatePersonalAccessToken(ctx context.Context, tokenID string, input *TokenRotationInput) (CreatedPersonalAccessToken, error) {
|
|
647
|
+
var out CreatedPersonalAccessTokenEnvelope
|
|
648
|
+
path := "/ai-gateway/personal-access-tokens/" + url.PathEscape(strings.TrimSpace(tokenID)) + "/rotate"
|
|
649
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, input, &out); err != nil {
|
|
650
|
+
return CreatedPersonalAccessToken{}, err
|
|
651
|
+
}
|
|
652
|
+
return out.Data, nil
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
func (c *Client) ListServiceAccounts(ctx context.Context) ([]ServiceAccount, error) {
|
|
656
|
+
var out ServiceAccountListEnvelope
|
|
657
|
+
if err := c.doJSON(ctx, http.MethodGet, "/ai-gateway/service-accounts", true, nil, &out); err != nil {
|
|
658
|
+
return nil, err
|
|
659
|
+
}
|
|
660
|
+
return out.Items, nil
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
func (c *Client) CreateServiceAccount(ctx context.Context, input ServiceAccountInput) (ServiceAccount, error) {
|
|
664
|
+
var out ServiceAccountEnvelope
|
|
665
|
+
if err := c.doJSON(ctx, http.MethodPost, "/ai-gateway/service-accounts", true, input, &out); err != nil {
|
|
666
|
+
return ServiceAccount{}, err
|
|
667
|
+
}
|
|
668
|
+
return out.Data, nil
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
func (c *Client) ListServiceAccountTokens(ctx context.Context) ([]ServiceAccountToken, error) {
|
|
672
|
+
var out ServiceAccountTokenListEnvelope
|
|
673
|
+
if err := c.doJSON(ctx, http.MethodGet, "/ai-gateway/service-account-tokens", true, nil, &out); err != nil {
|
|
674
|
+
return nil, err
|
|
675
|
+
}
|
|
676
|
+
return out.Items, nil
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
func (c *Client) CreateServiceAccountToken(ctx context.Context, serviceAccountID string, input ServiceAccountTokenInput) (CreatedServiceAccountToken, error) {
|
|
680
|
+
var out CreatedServiceAccountTokenEnvelope
|
|
681
|
+
path := "/ai-gateway/service-accounts/" + url.PathEscape(strings.TrimSpace(serviceAccountID)) + "/tokens"
|
|
682
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, input, &out); err != nil {
|
|
683
|
+
return CreatedServiceAccountToken{}, err
|
|
684
|
+
}
|
|
685
|
+
return out.Data, nil
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
func (c *Client) RevokeServiceAccountToken(ctx context.Context, tokenID string) (OperationStatus, error) {
|
|
689
|
+
var out OperationStatus
|
|
690
|
+
path := "/ai-gateway/service-account-tokens/" + url.PathEscape(strings.TrimSpace(tokenID)) + "/revoke"
|
|
691
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, nil, &out); err != nil {
|
|
692
|
+
return OperationStatus{}, err
|
|
693
|
+
}
|
|
694
|
+
return out, nil
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
func (c *Client) RotateServiceAccountToken(ctx context.Context, tokenID string, input *TokenRotationInput) (CreatedServiceAccountToken, error) {
|
|
698
|
+
var out CreatedServiceAccountTokenEnvelope
|
|
699
|
+
path := "/ai-gateway/service-account-tokens/" + url.PathEscape(strings.TrimSpace(tokenID)) + "/rotate"
|
|
700
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, input, &out); err != nil {
|
|
701
|
+
return CreatedServiceAccountToken{}, err
|
|
702
|
+
}
|
|
703
|
+
return out.Data, nil
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
func (c *Client) ListMCPCapabilities(ctx context.Context) ([]MCPCapability, error) {
|
|
707
|
+
var out MCPCapabilityListEnvelope
|
|
708
|
+
if err := c.doJSON(ctx, http.MethodGet, "/mcp/capabilities", true, nil, &out); err != nil {
|
|
709
|
+
return nil, err
|
|
710
|
+
}
|
|
711
|
+
return out.Items, nil
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
func (c *Client) ListMarketplacePlugins(ctx context.Context, params ListMarketplacePluginsParams) ([]MarketplacePlugin, error) {
|
|
715
|
+
var out MarketplacePluginListEnvelope
|
|
716
|
+
if err := c.doJSON(ctx, http.MethodGet, "/plugins/marketplace"+marketplacePluginQuery(params), true, nil, &out); err != nil {
|
|
717
|
+
return nil, err
|
|
718
|
+
}
|
|
719
|
+
return out.Items, nil
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
func (c *Client) GetMarketplacePlugin(ctx context.Context, pluginID string) (MarketplacePlugin, error) {
|
|
723
|
+
var out MarketplacePluginEnvelope
|
|
724
|
+
path := "/plugins/marketplace/" + url.PathEscape(strings.TrimSpace(pluginID))
|
|
725
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
726
|
+
return MarketplacePlugin{}, err
|
|
727
|
+
}
|
|
728
|
+
return out.Data, nil
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
func (c *Client) ListInstalledPlugins(ctx context.Context) ([]InstalledPlugin, error) {
|
|
732
|
+
var out InstalledPluginListEnvelope
|
|
733
|
+
if err := c.doJSON(ctx, http.MethodGet, "/plugins/installed", true, nil, &out); err != nil {
|
|
734
|
+
return nil, err
|
|
735
|
+
}
|
|
736
|
+
return out.Items, nil
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
func (c *Client) InstallPlugin(ctx context.Context, input PluginInstallRequest) (InstalledPlugin, error) {
|
|
740
|
+
var out InstalledPluginEnvelope
|
|
741
|
+
if err := c.doJSON(ctx, http.MethodPost, "/plugins/install", true, input, &out); err != nil {
|
|
742
|
+
return InstalledPlugin{}, err
|
|
743
|
+
}
|
|
744
|
+
return out.Data, nil
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
func (c *Client) GetInstalledPlugin(ctx context.Context, pluginID string) (InstalledPlugin, error) {
|
|
748
|
+
var out InstalledPluginEnvelope
|
|
749
|
+
path := "/plugins/" + url.PathEscape(strings.TrimSpace(pluginID))
|
|
750
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
751
|
+
return InstalledPlugin{}, err
|
|
752
|
+
}
|
|
753
|
+
return out.Data, nil
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
func (c *Client) RemoveInstalledPlugin(ctx context.Context, pluginID string) (OperationStatus, error) {
|
|
757
|
+
var out OperationStatus
|
|
758
|
+
path := "/plugins/" + url.PathEscape(strings.TrimSpace(pluginID))
|
|
759
|
+
if err := c.doJSON(ctx, http.MethodDelete, path, true, nil, &out); err != nil {
|
|
760
|
+
return OperationStatus{}, err
|
|
761
|
+
}
|
|
762
|
+
return out, nil
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
func (c *Client) GetInstalledPluginManifest(ctx context.Context, pluginID string) (PluginManifest, error) {
|
|
766
|
+
var out PluginManifestEnvelope
|
|
767
|
+
path := "/plugins/" + url.PathEscape(strings.TrimSpace(pluginID)) + "/manifest"
|
|
768
|
+
if err := c.doJSON(ctx, http.MethodGet, path, true, nil, &out); err != nil {
|
|
769
|
+
return PluginManifest{}, err
|
|
770
|
+
}
|
|
771
|
+
return out.Data, nil
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
func (c *Client) EnableInstalledPlugin(ctx context.Context, pluginID string) (InstalledPlugin, error) {
|
|
775
|
+
var out InstalledPluginEnvelope
|
|
776
|
+
path := "/plugins/" + url.PathEscape(strings.TrimSpace(pluginID)) + "/enable"
|
|
777
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, nil, &out); err != nil {
|
|
778
|
+
return InstalledPlugin{}, err
|
|
779
|
+
}
|
|
780
|
+
return out.Data, nil
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
func (c *Client) DisableInstalledPlugin(ctx context.Context, pluginID string) (InstalledPlugin, error) {
|
|
784
|
+
var out InstalledPluginEnvelope
|
|
785
|
+
path := "/plugins/" + url.PathEscape(strings.TrimSpace(pluginID)) + "/disable"
|
|
786
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, nil, &out); err != nil {
|
|
787
|
+
return InstalledPlugin{}, err
|
|
788
|
+
}
|
|
789
|
+
return out.Data, nil
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
func (c *Client) UpgradeInstalledPlugin(ctx context.Context, pluginID string, input *PluginInstallRequest) (InstalledPlugin, error) {
|
|
793
|
+
var out InstalledPluginEnvelope
|
|
794
|
+
path := "/plugins/" + url.PathEscape(strings.TrimSpace(pluginID)) + "/upgrade"
|
|
795
|
+
if err := c.doJSON(ctx, http.MethodPost, path, true, input, &out); err != nil {
|
|
796
|
+
return InstalledPlugin{}, err
|
|
797
|
+
}
|
|
798
|
+
return out.Data, nil
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
func (c *Client) ConfigureInstalledPlugin(ctx context.Context, pluginID string, input PluginConfigRequest) (InstalledPlugin, error) {
|
|
802
|
+
var out InstalledPluginEnvelope
|
|
803
|
+
path := "/plugins/" + url.PathEscape(strings.TrimSpace(pluginID)) + "/config"
|
|
804
|
+
if err := c.doJSON(ctx, http.MethodPut, path, true, input, &out); err != nil {
|
|
805
|
+
return InstalledPlugin{}, err
|
|
806
|
+
}
|
|
807
|
+
return out.Data, nil
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
func (c *Client) doJSON(ctx context.Context, method, path string, useToken bool, body any, out any) error {
|
|
811
|
+
return c.doJSONWithHeaders(ctx, method, path, useToken, body, out, nil)
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
func (c *Client) doJSONWithHeaders(ctx context.Context, method, path string, useToken bool, body any, out any, headers http.Header) error {
|
|
815
|
+
endpoint, err := c.endpoint(path)
|
|
816
|
+
if err != nil {
|
|
817
|
+
return err
|
|
818
|
+
}
|
|
819
|
+
var reader io.Reader
|
|
820
|
+
if body != nil {
|
|
821
|
+
raw, err := json.Marshal(body)
|
|
822
|
+
if err != nil {
|
|
823
|
+
return err
|
|
824
|
+
}
|
|
825
|
+
reader = bytes.NewReader(raw)
|
|
826
|
+
}
|
|
827
|
+
req, err := http.NewRequestWithContext(ctx, method, endpoint, reader)
|
|
828
|
+
if err != nil {
|
|
829
|
+
return err
|
|
830
|
+
}
|
|
831
|
+
req.Header.Set("Accept", "application/json")
|
|
832
|
+
if c.UserAgent != "" {
|
|
833
|
+
req.Header.Set("User-Agent", c.UserAgent)
|
|
834
|
+
}
|
|
835
|
+
if body != nil {
|
|
836
|
+
req.Header.Set("Content-Type", "application/json")
|
|
837
|
+
}
|
|
838
|
+
if useToken && strings.TrimSpace(c.Token) != "" {
|
|
839
|
+
req.Header.Set("Authorization", "Bearer "+strings.TrimSpace(c.Token))
|
|
840
|
+
}
|
|
841
|
+
for name, values := range headers {
|
|
842
|
+
for _, value := range values {
|
|
843
|
+
req.Header.Add(name, value)
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
client := c.HTTPClient
|
|
847
|
+
if client == nil {
|
|
848
|
+
client = http.DefaultClient
|
|
849
|
+
}
|
|
850
|
+
resp, err := client.Do(req)
|
|
851
|
+
if err != nil {
|
|
852
|
+
return err
|
|
853
|
+
}
|
|
854
|
+
defer resp.Body.Close()
|
|
855
|
+
raw, err := io.ReadAll(io.LimitReader(resp.Body, 10<<20))
|
|
856
|
+
if err != nil {
|
|
857
|
+
return err
|
|
858
|
+
}
|
|
859
|
+
if resp.StatusCode >= 400 {
|
|
860
|
+
return fmt.Errorf("%s %s failed: %s: %s", method, path, resp.Status, responseErrorMessage(raw))
|
|
861
|
+
}
|
|
862
|
+
if out == nil || len(raw) == 0 {
|
|
863
|
+
return nil
|
|
864
|
+
}
|
|
865
|
+
if err := json.Unmarshal(raw, out); err != nil {
|
|
866
|
+
return fmt.Errorf("decode response: %w", err)
|
|
867
|
+
}
|
|
868
|
+
return nil
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
func (c *Client) endpoint(path string) (string, error) {
|
|
872
|
+
base := strings.TrimRight(strings.TrimSpace(c.BaseURL), "/")
|
|
873
|
+
if base == "" {
|
|
874
|
+
return "", fmt.Errorf("base URL is required")
|
|
875
|
+
}
|
|
876
|
+
if strings.HasSuffix(base, "/api/v1") {
|
|
877
|
+
base = strings.TrimSuffix(base, "/api/v1")
|
|
878
|
+
}
|
|
879
|
+
path = "/" + strings.TrimLeft(path, "/")
|
|
880
|
+
return base + "/api/v1" + path, nil
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
func responseErrorMessage(raw []byte) string {
|
|
884
|
+
var wrapped ErrorEnvelope
|
|
885
|
+
if json.Unmarshal(raw, &wrapped) == nil && wrapped.Error.Message != "" {
|
|
886
|
+
if wrapped.Error.Code != "" {
|
|
887
|
+
return wrapped.Error.Code + ": " + wrapped.Error.Message
|
|
888
|
+
}
|
|
889
|
+
return wrapped.Error.Message
|
|
890
|
+
}
|
|
891
|
+
return strings.TrimSpace(string(raw))
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
func auditLogQuery(params ListAIGatewayAuditLogsParams) string {
|
|
895
|
+
values := url.Values{}
|
|
896
|
+
addQueryString(values, "actorType", params.ActorType)
|
|
897
|
+
addQueryString(values, "actorId", params.ActorID)
|
|
898
|
+
addQueryString(values, "aiClientId", params.AIClientID)
|
|
899
|
+
addQueryString(values, "skillId", params.SkillID)
|
|
900
|
+
addQueryString(values, "toolName", params.ToolName)
|
|
901
|
+
addQueryString(values, "approvalRequestId", params.ApprovalRequestID)
|
|
902
|
+
addQueryString(values, "riskLevel", string(params.RiskLevel))
|
|
903
|
+
addQueryString(values, "result", params.Result)
|
|
904
|
+
addQueryString(values, "action", params.Action)
|
|
905
|
+
addQueryTime(values, "from", params.From)
|
|
906
|
+
addQueryTime(values, "to", params.To)
|
|
907
|
+
addQueryInt(values, "limit", params.Limit)
|
|
908
|
+
return encodeQuery(values)
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
func approvalRequestQuery(params ListAIGatewayApprovalRequestsParams) string {
|
|
912
|
+
values := url.Values{}
|
|
913
|
+
addQueryString(values, "id", params.ID)
|
|
914
|
+
addQueryString(values, "status", params.Status)
|
|
915
|
+
addQueryString(values, "actorType", params.ActorType)
|
|
916
|
+
addQueryString(values, "actorId", params.ActorID)
|
|
917
|
+
addQueryString(values, "aiClientId", params.AIClientID)
|
|
918
|
+
addQueryString(values, "skillId", params.SkillID)
|
|
919
|
+
addQueryString(values, "toolName", params.ToolName)
|
|
920
|
+
addQueryString(values, "riskLevel", string(params.RiskLevel))
|
|
921
|
+
addQueryString(values, "strategy", params.Strategy)
|
|
922
|
+
addQueryTime(values, "from", params.From)
|
|
923
|
+
addQueryTime(values, "to", params.To)
|
|
924
|
+
addQueryInt(values, "limit", params.Limit)
|
|
925
|
+
return encodeQuery(values)
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
func governanceStatusQuery(params GetAIGatewayGovernanceStatusParams) string {
|
|
929
|
+
values := url.Values{}
|
|
930
|
+
addQueryInt(values, "windowHours", params.WindowHours)
|
|
931
|
+
return encodeQuery(values)
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
func personalAccessTokenQuery(params ListPersonalAccessTokensParams) string {
|
|
935
|
+
values := url.Values{}
|
|
936
|
+
addQueryString(values, "scope", params.Scope)
|
|
937
|
+
addQueryString(values, "userId", params.UserID)
|
|
938
|
+
return encodeQuery(values)
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
func marketplacePluginQuery(params ListMarketplacePluginsParams) string {
|
|
942
|
+
values := url.Values{}
|
|
943
|
+
addQueryString(values, "q", params.Q)
|
|
944
|
+
addQueryString(values, "type", params.Type)
|
|
945
|
+
addQueryString(values, "publisher", params.Publisher)
|
|
946
|
+
return encodeQuery(values)
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
func computeTaskPath(domain ComputeTaskDomain, taskID string) string {
|
|
950
|
+
return "/compute/tasks/" + url.PathEscape(string(domain)) + "/" + url.PathEscape(strings.TrimSpace(taskID))
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
func computeTaskQuery(params ListComputeTasksParams) string {
|
|
954
|
+
values := url.Values{}
|
|
955
|
+
addQueryString(values, "domain", string(params.Domain))
|
|
956
|
+
addQueryString(values, "providerKey", params.ProviderKey)
|
|
957
|
+
addQueryString(values, "status", string(params.Status))
|
|
958
|
+
addQueryString(values, "category", string(params.Category))
|
|
959
|
+
addQueryString(values, "resourceKind", params.ResourceKind)
|
|
960
|
+
addQueryString(values, "resourceId", params.ResourceID)
|
|
961
|
+
addQueryString(values, "cursor", string(params.Cursor))
|
|
962
|
+
addQueryInt(values, "limit", int(params.Limit))
|
|
963
|
+
return encodeQuery(values)
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
func addQueryString(values url.Values, key, value string) {
|
|
967
|
+
if value != "" {
|
|
968
|
+
values.Set(key, value)
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
func addQueryInt(values url.Values, key string, value int) {
|
|
973
|
+
if value != 0 {
|
|
974
|
+
values.Set(key, strconv.Itoa(value))
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
func addQueryTime(values url.Values, key string, value time.Time) {
|
|
979
|
+
if !value.IsZero() {
|
|
980
|
+
values.Set(key, value.Format(time.RFC3339Nano))
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
func encodeQuery(values url.Values) string {
|
|
985
|
+
if len(values) == 0 {
|
|
986
|
+
return ""
|
|
987
|
+
}
|
|
988
|
+
return "?" + values.Encode()
|
|
989
|
+
}
|