Repository navigation
feat(client): ai.savedQuestions and ai.answers for the AI answer follow-up routes - #38539
Conversation
… spec Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jREYTQb5JmJ3TewGpr
…d payload Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jREYTQb5JmJ3TewGpr
📓 Docs Drift CheckThis PR changes 1 package(s): 8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 21 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 9a025af8f0a97f71b2417bbb69fd47840e28b049 && git checkout 9a025af8f0a97f71b2417bbb69fd47840e28b049
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 430a3119d3cde3b0b0032acb7df26a4411097ea0 5b9ac603b8cc952a56ec6cc375c9883324050d2c && git checkout -B drift-repro 430a3119d3cde3b0b0032acb7df26a4411097ea0 && git merge --no-ff 5b9ac603b8cc952a56ec6cc375c9883324050d2c
node scripts/docs-audit/affected-docs.mjs --json 430a3119d3cde3b0b0032acb7df26a4411097ea0
|
|
repo:objectstack#1 · zhuangjianguo · session_01QsR2jTsdScTh3o2fSjbxSz Contract reviewServed-tier: Face: the ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · zhuangjianguo · session_01QsR2jTsdScTh3o2fSjbxSz 席位核对L1: ACCEPT at
|
Requested by Jianguo · project thread
Fixes #32644
Clause-②: yes
Metadata-protocol: none
维护者速读
What changes
ObjectStackClient.aigains two namespaces for the eight route and method pairspackages/spec/src/api/ai-answer.zod.tsdeclares. Every parameter and return type is a@objectstack/spec/apitype from that file; there is no hand-written shape.ai.savedQuestions.list()GET /api/v1/ai/saved-questionsListAiSavedQuestionsResponseai.savedQuestions.create(request)POST /api/v1/ai/saved-questionsCreateAiSavedQuestionResponseai.savedQuestions.delete(id)DELETE /api/v1/ai/saved-questions/:idvoid(204)ai.savedQuestions.run(id)POST /api/v1/ai/saved-questions/:id/run, no bodyRunAiSavedQuestionResponseai.answers.createArtifact(conversationId, turnId, request)POST …/conversations/:id/turns/:turnId/artifactCreateAiAnswerArtifactResponseai.answers.getFeedback(conversationId, turnId)GET …/turns/:turnId/feedbackGetAiAnswerFeedbackResponseai.answers.setFeedback(conversationId, turnId, request)POST …/turns/:turnId/feedbackSetAiAnswerFeedbackResponseai.answers.deleteFeedback(conversationId, turnId)DELETE …/turns/:turnId/feedbackvoid(204)Each method resolves to the route's
datapayload afterunwrapResponsestrips the envelope, the same reading the rest ofai.*uses. The payload is returned whole rather than plucked (questions,feedback), so no?? []fallback stands in for a missing member. A refusal throws the shared transport error, carrying the route's code onerr.codeand the status onerr.httpStatus. The request and response types, plusAiSavedQuestion,AiSavedQuestionErrorCode,AiAnswerArtifactKind,AiAnswerRatingandAiAnswerFeedback, are re-exported from the package root beside the other AI wire types.Files:
packages/client/src/index.ts,packages/client/src/ai-answer-follow-ups.test.ts,.changeset/32644-client-ai-answer-follow-ups.md.Why
#31889 and #31865 (console,
plugin-chatbot) need these routes from the SDK. The card's ruling: "Type them from the spec shapes only; ⛔ no hand-written shapes."Tests
packages/client/src/ai-answer-follow-ups.test.ts, 11 tests:err.codeRESOURCE_CONFLICTanderr.httpStatus409 off anAiSavedQuestionErrorSchema-legal envelope;expectTypeOfpins every request parameter and resolved type to the spec type, compiled bycheck:test-typecheck.Reverse checks, each restored afterwards: sending
PUTfromsetFeedbackand an unencoded id plus a{}body fromrunturned 2 of 11 red; typingsetFeedback's request as a hand-written{ rating: string; note?: string | null }turnedtsc -p tsconfig.test.jsonred at the signature pin (TS2344).Acceptance notes
client-url-conformance.test.tsexempts/api/v1/ai/for that reason and stays green with the new methods enumerated and driven; the cloud repo's AI route ledger drives everyai.*method against its real table, so these URLs are checked there.minorchangeset.Metadata-protocol: nonetakespatch(AGENTS.md Post-Task Checklist step 3,check-changeset-no-major), so it shipspatch.packages/client/README.mdlists one example perai.*namespace; it is outside this card's file surface, so the new namespaces are not added there.Verification
All local readings at head
5b9ac603(base0af813f3;origin/mainhas moved 3 commits since, none underpackages/clientorpackages/spec).Package tests and type-check
pnpm --filter @objectstack/client run typecheck: exit 0 (tsc --noEmit, thencheck:test-typecheck: 0 files / 0 errors held in the debt ledger).packages/client:vitest run --maxWorkers=2: Test Files 60 passed (60), Tests 840 passed (840).eslint --no-inline-configon the two touched source files: exit 0.turbo run build --filter '@objectstack/client...', 46 of 46 tasks, VERDICT command-exit 0.Derived gate families (dispatch-gates --commands, 69)
check-plugin-teardown-shape --self-testandspec check:skill-examplesfirst exited 3 on prerequisites (the shallow clone's pinned fixture commit; an unbuilt@objectstack/client-react); both were cleared and re-run green.pnpm check:dual-build-cjs-loads, reason: PREREQUISITE NOT MET (it needs every workspace package'sdist/); CI's Lint and Repo Gates runs it.dispatch-gates --ran: 69 derived families accounted for, 68 run, 1 NOT MEASURED, 0 unrun.!in the title, no(narrowing)arm).Read first:
packages/client/src/index.tsin theai = {namespace, thesavedQuestionsandanswersblocks (the two 204 deletes are the risk hunk: they must not parse a body); thenai-answer-follow-ups.test.ts.Two-minute check:
cd packages/client && pnpm exec vitest run src/ai-answer-follow-ups.test.tsshows 11 passed.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses. (eslint on the touched files locally; CI runs the repository lint)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jREYTQb5JmJ3TewGpr
Generated by Claude Code