3.8 KiB
3.8 KiB
1. Platform AI Invocation Contracts
- 1.1 Add domain and DTO contracts for AI invocation requests, context refs, purposes, recommendations, usage metadata, and safe errors.
- 1.2 Add validators for purpose authorization, provider IDs, model preferences, bounded input/output, context refs, and unsafe credential/path/socket content.
- 1.3 Add a platform provider client interface and deterministic mock provider implementation for tests/local verification.
2. Platform AI Invocation Service And API
- 2.1 Add service methods that authorize purpose-scoped invocation, select enabled providers, call the provider client, redact outputs, and return typed responses.
- 2.2 Implement AI invocation route using named DTOs and service methods.
- 2.3 Ensure config-related AI responses produce reviewable recommendations/diffs and never dispatch run-side writes directly.
- 2.4 Update platform route/protocol documentation for mediated AI invocation and live-provider deferral.
- 2.5 Add platform tests for allowed invocation, undeclared purpose denial, unsafe payload rejection, provider failure redaction, config recommendation reviewability, and no raw key exposure.
3. Frontend And Plugin Integration
- 3.1 Add centralized
platform_web/apiAI invocation types and client methods. - 3.2 Integrate AI invocation into plugin bridge host execution flow for
ai.invokeresponses. - 3.3 Add plugin SDK/example helpers for AI invocation request builders and safe response parsing.
- 3.4 Add frontend and plugin tests for mediated AI requests, denied purposes, redacted results, and no direct provider config exposure.
4. Verification
- 4.1 Run
cd platform && go test ./...and record evidence. - 4.2 Run
cd platform_web && npm run typecheck && npm test && npm run buildand record evidence. - 4.3 Run
cd plugins && npm run typecheck && npm testand record evidence. - 4.4 Run browser walkthrough for mediated AI invocation and record evidence.
- 4.5 Run
scripts/check-structure.shand record evidence. - 4.6 Run
openspec validate implement-platform-mediated-ai-invocation --strictand record evidence.
Evidence
- 2026-07-06:
cd platform && GOCACHE=/private/tmp/browser-go-build-cache go test ./... -run TestAIInvocationAPIIsMediatedAndSafe -count=1passed for mediated invocation, purpose denial, unsafe prompt rejection, config suggestion reviewability/no job dispatch, bridgeai.invoke, and no forbidden response fragments. - 2026-07-06:
cd platform_web && npm run typecheckandcd platform_web && npm test -- --run api/client.test.ts utils/pluginBridgeHost.test.tspassed for AI invocation API types/client and bridgeai.invokedispatcher behavior. - 2026-07-06:
cd plugins && npm run typecheckandcd plugins && npm test -- --run tests/manifest-validation.test.tspassed for SDK AI invocation request/response helpers and no provider config exposure. - 2026-07-06:
cd platform && GOCACHE=/private/tmp/browser-go-build-cache go test ./...passed. - 2026-07-06:
cd platform_web && npm run typecheck,cd platform_web && npm test, andcd platform_web && npm run buildpassed. - 2026-07-06:
cd plugins && npm run typecheckandcd plugins && npm testpassed. - 2026-07-06: Browser walkthrough passed using a local mock platform API plus headless Chrome: logged in, opened
#/servers/server-ai-walkthrough, switched to插件控制, clickedAI 调用, verifiedAI 建议已返回, and confirmed no forbidden credential/path/provider fragments were rendered. - 2026-07-06:
scripts/check-structure.shpassed. - 2026-07-06:
openspec validate implement-platform-mediated-ai-invocation --strictpassed (Change 'implement-platform-mediated-ai-invocation' is valid; PostHog DNS flush warnings were non-fatal telemetry failures).