When to Use
Use this skill when any upstream step has already created a real local artifact and the user now needs a downloadable platform link.
Typical examples:
- A report generator produced
.docx,.pdf,.xlsx,.csv,.md, or.htmlfiles. - An image, audio, or video step produced
.png,.jpg,.webp,.mp3,.wav, or.mp4files. - A code or shell step exported
.json,.txt,.zip,.tar.gz, or other build artifacts. - The upstream step wrote several files into a directory and the user wants the latest one or a packaged archive.
- The user explicitly asks for a download link instead of only a local sandbox path.
Core Rules
1. This skill publishes links; it does not generate files
- Use it after any file-producing skill, tool call, script, or shell command.
- Do not call it until a real file already exists on disk.
- Never invent a path just to produce a link.
2. It is format-agnostic
- This skill is not limited to Word documents.
- If the platform upload endpoint accepts the file bytes, this skill can publish the link.
- Common cases include documents, spreadsheets, archives, code exports, images, audio, video, logs, and structured data files.
3. Prefer absolute existing paths, but support discovery when needed
- Always use an absolute local path when possible.
- If a previous step returned a relative path, resolve it before upload.
- If the file does not exist, stop and fix the generation step first.
- If the upstream step only gives you a directory, glob, or output folder, use the helper script's discovery options.
- If the file was just created in the current sandbox working directory, prefer
./file.extorfile.extover$(pwd)/file.ext.
4. Required config is the platform API, not MinIO
- This skill uploads through the SSTIDP application API such as
/api/fileor/api/application/.../upload_file. BASE_URLmust point to the SSTIDP service that exposes those API routes.- MinIO endpoint, bucket, access key, and secret key are not substitutes for
BASE_URLorAPI_TOKEN. - If
BASE_URLorAPI_TOKENis missing, stop and surface that configuration gap instead of probing unrelated storage variables.
5. Default to generic upload for first-round testing
- The helper script defaults to the generic
/api/fileendpoint. - This only requires
BASE_URLandAPI_TOKEN, so it is the easiest way to test whether link publishing works. - Generic upload is enough when the immediate goal is “return a user-visible download URL”.
6. Chat upload is optional and only for later use
- If
UPLOAD_MODE=chatand bothAPPLICATION_IDandCHAT_IDare configured, the script will call the chat upload endpoint. - Chat mode is useful when you want the file to follow the conversation lifecycle.
- For the first verification round, prefer generic upload mode unless chat binding is required.
7. Surface the result clearly
- After upload succeeds, return the relative URL and absolute URL.
- Prefer a markdown link like
[下载 文件名](relative_url)in the final answer. - If helpful, also include the plain absolute URL for copy-and-paste use outside the platform.
8. Treat the helper implementation as read-only
publish_download_link.py,SKILL.md, and sibling files are part of the skill implementation.- Do not use
write_file,edit_file,str_replace, or similar tools to modify anything under/skills/download-link-publisher/during normal skill execution. - Execute the helper script as-is and consume its stdout instead of rewriting the script to change output shape.
- If the output format feels inconvenient, parse the existing
UPLOAD_RESULTS_JSON=block rather than patching the script. - If upload fails, fix the input path or config, or report the failure. Do not mutate the skill implementation in place.
9. Use the narrowest discovery rule that matches the artifact
- If you already know the file path, use
--file. - If the producer writes into a folder, use
--dirwith one or more--patternrules. - If only the newest artifact matters, add
--latest. - If the upstream step produces a whole folder, use
--zip-dirto publish one archive. - Use
--dry-runfirst if file selection is ambiguous.
Helper Script
The helper script publish_download_link.py is stored next to this SKILL.md.
Treat that script as read-only during normal use. A successful run already emits a machine-readable UPLOAD_RESULTS_JSON= block and a human-readable DOWNLOAD_LINKS: section. After one successful upload for the chosen artifact, stop using this skill and answer the user. Do not rerun the same upload just to reshape the output.
Typical single-file command:
python <skill_dir>/publish_download_link.py --file "/absolute/path/to/output.any"
Multiple files are also supported:
python <skill_dir>/publish_download_link.py --file "/absolute/path/to/a.pdf" --file "/absolute/path/to/b.png"
Upload the newest matching file in a build directory:
python <skill_dir>/publish_download_link.py --dir "/workspace/output" --pattern "*.pdf" --pattern "*.docx" --latest
Resolve candidates first without uploading:
python <skill_dir>/publish_download_link.py --dir "/workspace/output" --pattern "*.xlsx" --recursive --dry-run
Zip a whole folder and publish that archive:
python <skill_dir>/publish_download_link.py --zip-dir "/workspace/export_bundle"
The script automatically loads a sibling .env file when the platform mounts this skill and injects skill parameters.
Supported Config Keys
BASE_URL: Required. Example:http://127.0.0.1:8081API_TOKEN: Required. Supports raw token orBearer <token>UPLOAD_MODE: Optional.auto,file, orchat. Default isautoAPPLICATION_ID: Optional. Required only for chat upload modeCHAT_ID: Optional. Required only for chat upload modeDEBUG: Optional.trueorfalse. Only used by chat upload modeSOURCE_TYPE: Optional. Used by generic/api/filemodeSOURCE_ID: Optional. Used by generic/api/filemodeMETA: Optional. JSON string merged into generic upload metadata
Recommended Workflow
- Let an upstream producer create the file or output directory.
- If you already have a direct file path, run
publish_download_link.pywith--file. - If you only have a directory or output area, use
--dir/--pattern,--glob, or--zip-dir. - If file selection is ambiguous, run once with
--dry-run. - Run the real upload command.
- Read
UPLOAD_RESULTS_JSON=orDOWNLOAD_LINKS:from the script output. - Reply to the user with the generated markdown link and the plain URL.
- Stop after the first successful upload. Only rerun if the previous attempt failed or the selected file was wrong.
Compatible Producers
This skill is designed to follow any upstream producer that leaves a real local file, including:
- document generators
- spreadsheet exporters
- image or video renderers
- dataset and report exports
- code or JSON artifact writers
- shell commands and custom scripts
- archive and build packaging steps
微信扫一扫