@xpert-ai/plugin-sdk 3.23.1 → 3.26.0
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/docs/README.md +8 -0
- package/docs/analytics.md +42 -0
- package/docs/artifact-presentations.md +43 -0
- package/docs/mcp-client.md +63 -0
- package/docs/provider-credential-validation.md +34 -0
- package/docs/rest-client.md +24 -0
- package/docs/workspace-file-tools.md +6 -0
- package/index.cjs.js +471 -89
- package/index.esm.js +448 -92
- package/model-provider.cjs.js +10 -0
- package/model-provider.esm.js +9 -1
- package/package.json +2 -2
- package/src/index.d.ts +2 -0
- package/src/lib/agent/handoff/agent-runtime-message.contract.d.ts +76 -76
- package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +36 -1
- package/src/lib/agent/runtime/dispatch.d.ts +284 -284
- package/src/lib/agent/runtime/index.d.ts +1 -0
- package/src/lib/agent/runtime/pipeline-scope.d.ts +110 -0
- package/src/lib/agent/runtime/types.d.ts +4 -2
- package/src/lib/ai-model/ai-model-provider.interface.d.ts +3 -1
- package/src/lib/ai-model/utils/limits.d.ts +4 -2
- package/src/lib/artifact-presentation/index.d.ts +35 -0
- package/src/lib/data/analytics/analytics-payload.d.ts +3 -0
- package/src/lib/data/analytics/index.d.ts +1 -0
- package/src/lib/data/datasource/types.d.ts +1 -1
- package/src/lib/project-pipeline/adapters.d.ts +87 -0
- package/src/lib/project-pipeline/capability.d.ts +100 -0
- package/src/lib/project-pipeline/index.d.ts +5 -0
- package/src/lib/project-pipeline/projection.d.ts +71 -0
- package/src/lib/project-pipeline/registry.d.ts +509 -0
- package/src/lib/project-pipeline/runtime-registry.d.ts +45 -0
- package/src/lib/project-pipeline/scoped-registry.d.ts +10 -0
- package/src/lib/project-task/index.d.ts +6 -0
- package/src/lib/project-type/index.d.ts +17 -1
- package/src/lib/rag/types.d.ts +1 -1
- package/src/lib/runtime/capabilities/artifacts.d.ts +2 -0
- package/src/lib/runtime/capabilities/index.d.ts +2 -0
- package/src/lib/runtime/capabilities/mcp-client-runtime.d.ts +41 -0
- package/src/lib/runtime/capabilities/rest-client-runtime.d.ts +34 -0
- package/src/lib/sandbox/file-edits.d.ts +4 -0
- package/src/lib/sandbox/protocol.d.ts +7 -1
- package/src/lib/sandbox/sandbox.d.ts +2 -8
- package/src/lib/tool-provider/adapters.d.ts +1 -1
- package/src/lib/tool-provider/types.d.ts +2 -0
package/docs/README.md
CHANGED
|
@@ -69,6 +69,14 @@ export class OrderOperationsTools {
|
|
|
69
69
|
|
|
70
70
|
MCP exposure is explicit. Provide strict Zod input/output schemas and return an allowlisted DTO; the host validates the output and maps it to `structuredContent` and a JSON `TextContent` block so clients that only expose text can still read the result. With `resultFormat: 'tool_result'`, image and other content blocks are preserved and the validated structured metadata also receives a JSON text fallback. Invocation context is constructed for every call and must never be cached on the Provider singleton. `getMiddlewareExtensions()` may add Agent-only hooks such as `wrapToolCall`, but business-critical behavior belongs in the method or shared service.
|
|
71
71
|
|
|
72
|
+
For connection configuration, declare the form in `configSchema` and optionally implement
|
|
73
|
+
`validateConfig(config: unknown): void | Promise<void>` on the Provider. The native Toolset
|
|
74
|
+
adapter awaits this hook when a host configuration-save path invokes `validateConfig`,
|
|
75
|
+
including MCP service configuration tabs. Reuse invocation validation rules and reject
|
|
76
|
+
invalid values with a sanitized error; never include credentials in the error message.
|
|
77
|
+
The hook validates values only: it does not persist or normalize them, and does not replace
|
|
78
|
+
per-invocation authorization. Providers without the hook retain their existing behavior.
|
|
79
|
+
|
|
72
80
|
Use the same `@XpertToolProvider` class for every capability:
|
|
73
81
|
|
|
74
82
|
| Decorator | Method signature | Result |
|
package/docs/analytics.md
CHANGED
|
@@ -28,6 +28,28 @@ Optional `provider.discover(request, context)` returns a versioned `AnalyticsDis
|
|
|
28
28
|
|
|
29
29
|
PostgreSQL discovery uses the platform Workbench adapter's comments, types and keys. data-xpert discovery uses Assistant resource bindings, current actor policies, published entity analysis contracts and permitted Action input schemas. These implementations stay in their source plugins.
|
|
30
30
|
|
|
31
|
+
## Existing MCP connections
|
|
32
|
+
|
|
33
|
+
The generic [MCP Client Runtime](./mcp-client.md) exposes
|
|
34
|
+
`McpClientRuntimeCapability` (`platform.mcp.client`). Analytics plugins use
|
|
35
|
+
`client.tools.list(scope)` and `client.tools.call(scope, { toolName, contractHash, arguments })`.
|
|
36
|
+
The initial tools API enforces read-only selection and current-viewer authorization on the host.
|
|
37
|
+
|
|
38
|
+
`@xpert-ai/plugin-analytics-mcp` implements the `mcp.tool` provider. Its dataset catalog,
|
|
39
|
+
parameter paths, JSON projection and completeness rules remain plugin-owned; it does not add
|
|
40
|
+
MCP branches to Dataset normalization or the dashboard renderer. Build and deploy the matching
|
|
41
|
+
SDK/host capability before using the plugin; an older published SDK is insufficient.
|
|
42
|
+
|
|
43
|
+
## Existing REST/OpenAPI connections
|
|
44
|
+
|
|
45
|
+
The generic [REST Client Runtime](./rest-client.md) exposes
|
|
46
|
+
`RestClientRuntimeCapability` (`platform.rest.client`) with `operations.list/call`.
|
|
47
|
+
It reuses saved OpenAPI toolsets, credentials and current-viewer workspace permissions.
|
|
48
|
+
`@xpert-ai/plugin-analytics-rest` supplies the `rest.json` provider with an approved
|
|
49
|
+
dataset catalog, typed JSON projection and bounded offset/cursor pagination. Binding
|
|
50
|
+
payloads cannot supply URLs, headers, credentials or result mappings. Incomplete page
|
|
51
|
+
traversal stays explicitly partial. Deploy the matching SDK and host before installation.
|
|
52
|
+
|
|
31
53
|
## Execution
|
|
32
54
|
|
|
33
55
|
- `GET /api/data-source/analytics/sources`: authorized IDs and supported providers, never credentials.
|
|
@@ -41,6 +63,12 @@ PostgreSQL discovery uses the platform Workbench adapter's comments, types and k
|
|
|
41
63
|
|
|
42
64
|
For composed queries, the platform assigns `executionId` before provider execution. Forward `signal`, `deadlineAt` and `ancestry` through the optional third argument of `AnalyticsRuntimeApi.query`. These are trusted execution constraints, not fields accepted from an HTTP body or Binding payload. Child queries cannot extend the parent deadline; the platform checks provider cycles and nesting depth.
|
|
43
65
|
|
|
66
|
+
## Authorization and revocation
|
|
67
|
+
|
|
68
|
+
HTTP and WebSocket JWT validation loads current database role permissions, including for third-party identities. Explicit token permission claims narrow those grants; they cannot recreate deleted or disabled permissions. An empty claim grants no permissions; missing or null claims retain the current database grants for older tokens. Permissions newly granted outside an explicit token ceiling require a refreshed token.
|
|
69
|
+
|
|
70
|
+
Permission guards reuse role permissions freshly loaded by authentication for the current request, including token restrictions, without issuing a duplicate policy query. Enabled grants must match the current tenant and role. A loaded empty list denies access and never triggers a broader database lookup. When authentication has not loaded the permission relation, the guard queries current tenant/role policy without a cross-request decision cache. Authentication must reload permissions on each request, so revocation applies to subsequent requests without waiting for token expiry. This is a request-time authorization snapshot, not cancellation of operations already authorized and running; capability and resource access checks remain necessary during execution.
|
|
71
|
+
|
|
44
72
|
## Reusable Artifacts changes
|
|
45
73
|
|
|
46
74
|
`listArtifacts.resourceIdPrefix` matches a literal resource ID prefix, never a pattern, within the caller's existing access scope. Storage-specific matching stays inside the platform Artifacts service.
|
|
@@ -64,3 +92,17 @@ The generic [isolated HTML document host](artifact-documents.md) provides the if
|
|
|
64
92
|
[Workspace live script queries](workspace-dataset-pipelines.md) documents the implemented `@xpert-ai/plugin-analytics-workspace-script` example. Its Python/JavaScript entrypoints, file/source aliases, CSV helpers and execution evidence belong to the plugin. The platform supplies the reusable Analytics, Workspace Files, Artifacts and Sandbox Jobs capabilities, including execution-time invocation and parent deadline/cancellation propagation.
|
|
65
93
|
|
|
66
94
|
Each query executes the script against current authorized inputs and returns the same Dataset contract to either presentation mode. Script or dependency reuse must not turn a dashboard refresh into reuse of a previous result. Deployment requires compatible SDK/contracts exports, a compute runtime artifact and a matching Runtime Binding; local source validation does not establish published-package compatibility.
|
|
95
|
+
|
|
96
|
+
## Declarative Workspace files
|
|
97
|
+
|
|
98
|
+
The `file.table` provider in `@xpert-ai/plugin-analytics-files` registers the `workspace-files` source type. Its administrator-owned catalog specifies authorized Workspace file references, explicit CSV/JSON/XLSX readers, field types and business descriptions. Provider discovery returns its native query schema and real bounded previews. Queries select/filter/group/aggregate/sort; neither Binding payloads nor controls may replace file references or reader options.
|
|
99
|
+
|
|
100
|
+
The plugin reuses `WorkspaceFilesRuntimeCapability` for file access and `ProjectAccessRuntimeCapability` for human Project membership. Assistant files retain the exact published Assistant ACL, and private file references bind the current viewer. Parsing, format dependencies, decimal aggregation and Worker execution remain plugin-owned. No parser or file-query dialect is added to the platform.
|
|
101
|
+
|
|
102
|
+
Each execution rereads the current source and records a content digest. Input limits fail closed before partial-input aggregation; output limits preserve Dataset completeness. Artifact history pins declarations, not file bytes. See the plugin's bilingual configuration and verification documentation for formula-cache, type and format limits.
|
|
103
|
+
|
|
104
|
+
## Discovered payload feedback for Agent tools
|
|
105
|
+
|
|
106
|
+
`validateAnalyticsPayload(payload, queryContract.payloadSchema)`, exported from `@xpert-ai/plugin-sdk`, is a synchronous server SDK helper for structural feedback before a preview call. It uses the provider's declared JSON Schema and reports a bounded field path and failing keyword without echoing payload values. It does not coerce values, remove properties, inject defaults, resolve remote references or validate JSON Schema `format` annotations. Malformed/unresolved schemas and asynchronous (`$async`) schemas fail explicitly. Provider semantic validation, current-actor authorization and bounded execution remain mandatory after this check. A successful structural check is not a preview receipt or permission grant.
|
|
107
|
+
|
|
108
|
+
Live Dashboard uses this helper on both canonical and simplified preview tools. Keep provider-specific syntax in discovery; do not introduce SQL/file/MCP branches in the dashboard middleware to repair input.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Authenticated Artifact presentations
|
|
3
|
+
description: Plugin renderers for immutable shared Artifact versions
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Artifact presentations separate authenticated display from owner-only management. The platform owns link policy, version resolution, plugin registration, request context and the isolated browser host. Providers own content schemas and rendering. No new Artifact kind or share table is needed.
|
|
7
|
+
|
|
8
|
+
## Provider contract
|
|
9
|
+
|
|
10
|
+
Register a Nest provider with `@ArtifactPresentationProvider({pluginName, resourceType})`, implement `IArtifactPresentationProvider`, and include it in the plugin module. Registry discovery uses the explicit source pair and plugin provenance in the authorized organization.
|
|
11
|
+
|
|
12
|
+
- `getEntry()` returns `{html}` with its packaged frontend assets.
|
|
13
|
+
- `read(context)` returns the provider's initial JSON data.
|
|
14
|
+
- `operations` declares the read-only operation names available to the page.
|
|
15
|
+
- `query(context, request)` validates application input and executes those operations as `context.actor`.
|
|
16
|
+
|
|
17
|
+
The context contains the current viewer, authorized Artifact metadata, the exact formal version and its bytes. It does not grant access to the creator's Workspace or other sources. Never replace the viewer with the Artifact owner. Validate the application's content package, identity, limits and integrity before use. Keep draft, save and publish operations out of this interface.
|
|
18
|
+
|
|
19
|
+
## Platform transport
|
|
20
|
+
|
|
21
|
+
`ArtifactLinkRecord.presentationUrl` points to `/artifacts/view/:slug`. It is derived by the platform from its configured public URL. Use it directly rather than constructing plugin-specific URLs. The page requires normal authenticated login and preserves the return URL.
|
|
22
|
+
|
|
23
|
+
`GET /api/artifacts/shared-links/:slug/presentation` returns schema version 1, `target: {artifactId, versionId}`, published title/version number, `readOnly: true`, entry HTML, data and allowed operations. `POST` to the same path plus `/query` takes `{target, operation, input}`. These are authenticated management-session APIs, not ChatKit client-secret endpoints or anonymous content URLs.
|
|
24
|
+
|
|
25
|
+
Every read/query resolves current link status, membership and its formal target. Queries reject target changes before dispatch. Access and target are rechecked before returning results, so in-flight revocation or publication cannot release stale results. Follow-latest links require reopening after publication; fixed links remain on their selected formal version. Source authorization remains the provider's existing governed capability boundary.
|
|
26
|
+
|
|
27
|
+
To open `presentationUrl` from an authoring Workbench iframe, declare the `artifact.presentation.open` client command in its View manifest and invoke it with `{url: presentationUrl}` (`ArtifactPresentationOpenRequest`). The platform opens a separate window with no opener, accepts only its own `/artifacts/view/:slug` URL, and reports blocked popups as a failed result. The new page performs normal authentication and authorization. A raw `target="_blank"` link inherits the remote iframe's sandbox and can prevent the login application from starting. Keep the iframe sandbox unchanged. The standalone read-only presentation does not expose this command. Browser bundles can use a type-only contracts import and the command string to avoid pulling server-oriented runtime exports into their CSP-restricted entry.
|
|
28
|
+
|
|
29
|
+
The Cloud application opts in through `provideArtifactPresentationCommands()` in its root providers. Registration and cleanup belong to the Artifact feature; `ViewClientCommandRegistry` only stores and dispatches commands and has no dependency on Artifact presentation code.
|
|
30
|
+
|
|
31
|
+
## Browser protocol
|
|
32
|
+
|
|
33
|
+
The generic component hosts the entry in an opaque `sandbox="allow-scripts"` iframe with no-network CSP. It accepts remote-component protocol v1 `ready`, `requestData` and `executeAction` messages only. The host validates the exact source window and instance ID, and relays only declared read operations with the server-resolved target. It exposes no file, navigation, client-command or authoring channels and never sends credentials to the iframe. Theme and locale changes resend `init` for the same instance; providers must handle it without resetting the selected resource or reloading unchanged data. Changing the share route cancels in-flight requests and creates a new instance.
|
|
34
|
+
|
|
35
|
+
Bundle assets into the entry or immutable application package. External scripts, network fetches, forms, frames to network URLs and direct parent access are unavailable. Reuse Artifact document dependency snapshots for version-pinned HTML libraries.
|
|
36
|
+
|
|
37
|
+
The Live Dashboard plugin is a reference implementation: it reuses one React bundle in authoring/read-only modes, routes only `query` / `query-binding`, and resolves each Binding from the authorized immutable package. Its source capability still receives the current viewer.
|
|
38
|
+
|
|
39
|
+
## Source collaboration restrictions
|
|
40
|
+
|
|
41
|
+
`AnalyticsProviderDescriptor.sharing` optionally declares `viewer_permissions` or `owner_only`, with a stable diagnostic `reasonCode`. This is a compatibility restriction, never an authorization grant. Omission retains ordinary per-viewer source checks. Providers with private transitive dependencies should declare `owner_only` until those dependencies support explicit collaborative authorization.
|
|
42
|
+
|
|
43
|
+
No database migration is needed. Deploy platform contracts, SDK, backend and Cloud support together before loading plugins using this registry. Older hosts cannot provide the standalone page merely by upgrading the plugin.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# MCP Client Runtime
|
|
2
|
+
|
|
3
|
+
`McpClientRuntimeCapability` (`platform.mcp.client`) resolves a `McpClientRuntimeApi`
|
|
4
|
+
for governed access to existing platform MCP connections. It is shared by plugin consumers,
|
|
5
|
+
independent of Analytics, Dataset, Binding and dashboard rendering.
|
|
6
|
+
|
|
7
|
+
The initial API implements **read-only `tools.list/call` only**. Resources, Prompts,
|
|
8
|
+
Tasks and subscriptions are not exposed. The host fixes the tools policy; a request cannot
|
|
9
|
+
enable writes, interaction, asynchronous tasks or arbitrary protocol methods.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { McpClientRuntimeCapability } from '@xpert-ai/plugin-sdk'
|
|
15
|
+
|
|
16
|
+
const client = runtime.require(McpClientRuntimeCapability)
|
|
17
|
+
const tools = await client.tools.list(scope)
|
|
18
|
+
// Select an exact tool from the application's approved catalog and discovery result.
|
|
19
|
+
const result = await client.tools.call(scope, {
|
|
20
|
+
toolName: selected.name,
|
|
21
|
+
contractHash: selected.contractHash,
|
|
22
|
+
arguments: validatedArguments
|
|
23
|
+
})
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`runtime` is the injected platform capability registry. `scope: McpClientScope` contains
|
|
27
|
+
the current `actor` (tenant, organization, user), an existing
|
|
28
|
+
`workspaceId`/`toolsetId`/`serverName`, `signal` and an absolute `deadlineAt`.
|
|
29
|
+
Supply identity from trusted execution context. The host requires an exact match with
|
|
30
|
+
the current authenticated request and rechecks workspace read access. The toolset must
|
|
31
|
+
belong to the same tenant, organization and workspace and have category MCP.
|
|
32
|
+
URLs, credentials, connection snapshots and policy overrides are rejected inputs.
|
|
33
|
+
|
|
34
|
+
## Tools policy and contracts
|
|
35
|
+
|
|
36
|
+
- Discovery includes enabled, model-visible tools with `readOnlyHint: true` and without
|
|
37
|
+
`destructiveHint: true` or required task execution. Calls repeat this selection.
|
|
38
|
+
- Consumers additionally restrict operations to their own approved catalog. Read-only
|
|
39
|
+
annotations narrow selection; they neither grant permission nor prove remote behavior.
|
|
40
|
+
- `contractHash` pins input/output schemas and annotations. Changed contracts require
|
|
41
|
+
rediscovery and an explicit caller-side update; the hash does not pin remote code.
|
|
42
|
+
- Arguments and structured output use JSON Schema validation without coercion. Remote
|
|
43
|
+
schemas are isolated so repeated refreshes and reused `$id` values cannot collide.
|
|
44
|
+
- A successful result contains optional JSON `structuredContent` and plain `text` blocks.
|
|
45
|
+
Tool errors, invalid output and interaction requests fail. Resource links are not fetched.
|
|
46
|
+
Consumers must explicitly choose whether to accept structured JSON or text JSON.
|
|
47
|
+
|
|
48
|
+
## Execution boundary
|
|
49
|
+
|
|
50
|
+
The platform reuses ToolRuntime and MCP Consumer authentication. A shared internal connection
|
|
51
|
+
lifecycle owns authorization, cancellation, cleanup and safe runtime errors; protocol clients
|
|
52
|
+
and connection credentials stay internal. Access and connection/tool selection are checked
|
|
53
|
+
around remote I/O and immediately before tool execution. Revoked access discards the result.
|
|
54
|
+
|
|
55
|
+
Each operation has a 30-second maximum budget bounded by its caller's deadline. Discovery
|
|
56
|
+
has at most 20 pages and 1,000 tools, with cyclic cursors rejected. Call envelopes and individual
|
|
57
|
+
tool metadata are bounded to 64,000 bytes; remote tool results are bounded to 2,500,000 bytes.
|
|
58
|
+
Consumers such as Analytics may enforce tighter limits. Successful results are not cached.
|
|
59
|
+
|
|
60
|
+
Future capabilities must define their own host-authorized policies before being exposed;
|
|
61
|
+
expanding this API must preserve the read-only contract used by analytics consumers.
|
|
62
|
+
Deploy the matching host and SDK before consuming this capability. This new export does not
|
|
63
|
+
imply that an older published SDK or host supports it.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Provider credential validation
|
|
2
|
+
|
|
3
|
+
The credential dialog can test unsaved credentials without creating a provider record. The host selects a verification method from the provider strategy's explicit capabilities:
|
|
4
|
+
|
|
5
|
+
1. If `discoverModels(credentials)` exists, use it to fetch the account-visible model list. An empty successful list is valid. Discovery failures never trigger an automatic inference fallback.
|
|
6
|
+
2. Otherwise, if `credentialValidation.mode` is `model`, require a user-selected model type and Model ID or Endpoint ID. Run the provider's local credential checks, then that model manager's `validateCredentials(model, credentials)`.
|
|
7
|
+
3. Otherwise, retain the provider's existing `validateProviderCredentials(credentials)` behavior.
|
|
8
|
+
|
|
9
|
+
## Discovery
|
|
10
|
+
|
|
11
|
+
Implement the existing optional `IAIModelProviderStrategy.discoverModels` method. Use `discoverOpenAIModels` only when the upstream documents an authenticated OpenAI-compatible model-list endpoint. Public catalog metadata is not credential verification. Do not invoke inference, persist models or return credentials from discovery.
|
|
12
|
+
|
|
13
|
+
## Model-based verification
|
|
14
|
+
|
|
15
|
+
Providers without an API-key model-list endpoint can declare:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
readonly credentialValidation = {
|
|
19
|
+
mode: 'model' as const,
|
|
20
|
+
modelTypes: [AiModelTypeEnum.LLM]
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Declare only types whose model manager can perform a real, bounded validation request. The provider-level validator should check local fields, without choosing a fixed model. The host obtains suggestions from the provider catalog, but permits user-entered IDs that are absent from it. Catalog membership is not evidence of access.
|
|
25
|
+
|
|
26
|
+
## HTTP and persistence
|
|
27
|
+
|
|
28
|
+
- `GET /api/ai-model/provider/:provider/credential-validation` returns the supported verification method and, for model tests, model types and reference suggestions.
|
|
29
|
+
- `POST` to the same path accepts `{ credentials, validationTarget? }`, where the target is `{ modelType, model }`. It requires `COPILOT_EDIT`, does not save credentials or models, and returns only a verification result.
|
|
30
|
+
- Provider create/update requests can include the same `validationTarget`. The controller validates and strips it from the persisted entity, then passes it through the upsert and credential-validation commands.
|
|
31
|
+
- The save path repeats verification with the submitted credentials. Client-side success is never used as authorization or a reason to skip verification. Editing credentials or the test target invalidates the dialog's current result.
|
|
32
|
+
- Discovery proves access to the model-list API; successful inference validates only the selected target. Neither guarantees access to every listed model.
|
|
33
|
+
|
|
34
|
+
Deploy this host update before a plugin that relies on `credentialValidation`: older hosts do not enforce selected-model verification. Existing saved credentials and configured models are not migrated by this change.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# REST Client Runtime
|
|
2
|
+
|
|
3
|
+
`RestClientRuntimeCapability` (`platform.rest.client`) resolves a generic `RestClientRuntimeApi` independently of Analytics and dashboard plugins. The first version exposes `operations.list/call` for governed JSON reads on existing platform OpenAPI toolsets.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
const client = runtime.require(RestClientRuntimeCapability)
|
|
7
|
+
const operations = await client.operations.list(scope)
|
|
8
|
+
const result = await client.operations.call(scope, {
|
|
9
|
+
operationId: selected.operationId,
|
|
10
|
+
contractHash: selected.contractHash,
|
|
11
|
+
arguments: { query: { region: 'East' } }
|
|
12
|
+
})
|
|
13
|
+
// result.body is JSON; result.sourceFetchedAt records this fetch.
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`scope: RestClientScope` requires the current actor's tenant, organization and user, the saved workspace/toolset IDs, an AbortSignal and an absolute deadline. The host requires an exact identity match, workspace read access and a toolset in the same tenant/organization/workspace, with category API and type `openapi`. A caller cannot supply a URL, credential snapshot or policy override.
|
|
17
|
+
|
|
18
|
+
Discovery returns enabled operations, descriptions, an argument schema and an opaque contract hash. Calls pin endpoint, method, serialization and schema to that hash. GET is supported; POST requires a persisted `x-xpert-read-only: true` declaration and an optional JSON body. The declaration narrows eligible operations but cannot prove a remote service is read-only. Only approved, trusted connections should be registered.
|
|
19
|
+
|
|
20
|
+
Arguments are grouped by `query`, `path` and `body` and validated without coercion or defaults. Query scalars/arrays use OpenAPI form serialization and path scalars use simple serialization; header/cookie parameters and unsupported serializers fail closed. Path values cannot traverse segments or change host, method or query. Caller headers are absent. HTTP(S) endpoints are selected from saved definitions; an administrator may intentionally configure an internal service. There is no arbitrary destination fetch API.
|
|
21
|
+
|
|
22
|
+
Authentication reuses saved OpenAPI `none` or `api_key` settings and the shared API-key header builder, including existing bearer/basic prefixes. The legacy UI spelling `bearar` is accepted as `bearer`; empty prefixes preserve the raw API-key value. Header assembly never modifies saved credentials. Credentials are never returned to consumers. Redirects are disabled. Responses must be successful JSON, bounded to 2,500,000 bytes. Input contracts and envelopes are bounded to 64,000 bytes; lists have at most 1,000 operations. Each request has a 30-second maximum budget bounded by the parent deadline. Raw HTTP failures and source content are not included in errors.
|
|
23
|
+
|
|
24
|
+
Access and connection definitions are checked before and after I/O. A changed connection, disabled operation or revoked grant discards the response. Pagination and Dataset projection belong to consumers and must preserve the same caller identity/deadline for each call. Successful results are not cached. Deploy the matching SDK and host before consuming this new capability; older published SDK packages do not supply it.
|
|
@@ -58,3 +58,9 @@ chooses a default provider. Graph compilation and runtime workspace paths use th
|
|
|
58
58
|
mapped work area; server-side file access retains the Volume path and scope.
|
|
59
59
|
This does not add default-provider selection to hosts that require an explicit
|
|
60
60
|
provider, or change workspace authorization and sandbox lifecycle ownership.
|
|
61
|
+
|
|
62
|
+
## Recovering failed file edits
|
|
63
|
+
|
|
64
|
+
`sandbox_write_file` creates a new file; it does not overwrite an existing editing copy. Read an existing file and use exact-text edit tools. Structured mutation results containing an error provide a portable `recovery.read` tool call and recovery guidance without converting the error into success.
|
|
65
|
+
|
|
66
|
+
`BaseSandbox.multiEdit` persists operations sequentially, stops at the first error, and does not roll back earlier successful edits. Its optional `MultiEditResult.progress` reports `mode: "sequential"`, `appliedEdits`, and a one-based `failedEdit` on failure. Other backends may omit progress; consumers must not infer rollback or applied counts when it is absent. Transport exceptions propagate. Always reread current contents after a failed batch and apply only remaining changes.
|