Skip to content

feat: show and change who can open an artifact's share link - #71

Open
warmwind wants to merge 9 commits into
mainfrom
t17344-artifact-share
Open

warmwind wants to merge 9 commits into
mainfrom
t17344-artifact-share

Conversation

@warmwind

@warmwind warmwind commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Part of T17726 在 Jiri 对话里管理分享范围.

Jiri makes HTML artifacts in a conversation, and T17344 lets them be shared by a link. T17726 lets Jiri change who can open the link from inside the conversation, through this CLI in its sandbox.

What changes

  • jinshuju artifact share get <artifact> reads GET /artifacts/{id}/published_artifact: who can open the share link (allowed_audience), the link, the version it shows, whether it was blocked (banned), whether the plan includes share links (can_use_artifact_url) and internal (can_use_internal), the account internal lets in (account_name), and a link that always shows that version (preview_url).
  • jinshuju artifact share set <artifact> --audience private|internal|public sends PUT /artifacts/{id}/published_artifact with { allowed_audience, version_id }. The link shows the version <artifact> names; to share another version, name that one. --audience private sends no version_id, so the link keeps the version it shows. There is no --version flag, so the global --version keeps its meaning.
  • <artifact> is a version id, a version token, or the address https://…/artifacts/<token>. An address must end in /artifacts/<token>. Anything else, the jinapp.net share link included, exits 2 before a request is sent.
  • spec/openapi.yaml gains the two operations and the PublishedArtifact / PublishedArtifactInput schemas (operations getPublishedArtifact / updatePublishedArtifact), line for line as goldendata's branch defines them, ahead of the daily sync. The first get creates the link, so url and published_version are never null; a version that is not HTML or failed the content check answers 422 (exit 5).
  • auth login asks for the new share_artifacts OAuth scope by default, which these endpoints need. A session from an older CLI has to log in again to use artifact share.
  • README gets a "Sharing artifacts" section.

Release order

API → CLI. Do not release this before the API serves /api/v1/artifacts/{id}/published_artifact in production. Until then both commands answer 404, and the daily spec-sync PR drops the two operations and fails.

The scope makes the order stricter: until goldendata serves share_artifacts as an OAuth scope, auth login from this CLI fails with invalid_scope for everyone, not only for artifact share. If the jinshuju_cli_public OAuth application has its own scope list, share_artifacts must be added to it too.

Test plan

  • npm run check
  • node --test over commands, help, spec and spec-diff tests (266 pass)
  • Against a goldendata build that serves the endpoint

🤖 Generated with Claude Code

warmwind and others added 6 commits October 23, 2026 20:36
artifact share get <artifact> shows who can open an artifact version's
share link, the link, the version it shows, whether it was blocked, and
whether the plan includes internal. artifact share set <artifact>
--audience private|internal|public creates or changes the link and shares
the version <artifact> names. <artifact> is a version id, a version token,
or the address https://…/artifacts/<token>. spec/openapi.yaml takes the
API's publication operations ahead of the daily sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
spec/openapi.yaml now carries the publication operations exactly as the
API defines them: the first get creates the share link, so url and
publishedVersion are never null; a version that is not HTML or failed the
content check answers 422; the body takes no other keys. Help and README
say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The artifact publication endpoints take the new share_artifacts OAuth
scope rather than form_setting, so auth login asks for it by default; a
session from an older CLI has to log in again to use artifact share.
spec/openapi.yaml follows the API: share_artifacts on both operations,
400 for an account access token, and an address only from Jinshuju.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only an HTML version whose file is still there can be shared, and not one
the content check judged high risk. A version need not have passed the
check first: sharing takes effect at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es it private

--audience private sends no versionId, so the API keeps the version the
link shows. Taking a share back to private from an older version's
receipt no longer changes what a later public share shows. internal and
public still share the version <artifact> names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…I now names them

GET and PUT /api/v1/artifacts/{id}/published_artifact replace .../publication,
which the API no longer serves. The operations are getPublishedArtifact and
updatePublishedArtifact and the schemas PublishedArtifact and
PublishedArtifactInput. spec/openapi.yaml also takes the API's latest
answer, with accountName and canUseArtifactUrl, and its paid-feature 402;
help and README say which plan features sharing needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@warmwind
warmwind force-pushed the t17344-artifact-share branch from 929a3fd to ea4e7b0 Compare October 23, 2026 12:44
warmwind and others added 3 commits October 23, 2026 21:22
…1 now names them

The published_artifact endpoints follow API v1's snake_case rule:
artifact share set sends allowed_audience and version_id, and the answer
carries allowed_audience, published_version, can_use_internal,
account_name, can_use_artifact_url and the new preview_url.
spec/openapi.yaml takes PublishedArtifact, PublishedArtifactInput and the
path from goldendata line for line; help names the new keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
goldendata shipped the share API without preview_url: a preview link is now
signed per version and lasts 24 hours, so the share no longer carries one.
Only a banned version is refused, not one judged high risk, and an account
the share toggle leaves out gets 403. Take the spec line for line from
goldendata again and say the same in the command help.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The address check looked at the last two path segments only, so
/not-an-artifact/artifacts/<token> and /artifacts//<token> went out as that
token. The whole path has to be /artifacts/<token>, with or without a
trailing slash; the host is still not checked. artifactVersion is no longer
exported, as nothing outside the module uses it.

The spec takes goldendata's share section again: refusals carry an error code
(PublishedArtifactError), and account_name and can_use_artifact_url are
required.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant