SSH Tunnel 示例包
本示例面向想看完整扩展包结构的开发者。读完后,你会知道 examples/extensions/ssh-tunnel-pack 每个文件的作用,以及 /ssh-tunnel 如何启动工作流。
文件结构
标题为“文件结构”的章节examples/extensions/ssh-tunnel-pack/ jarvis-pack.yaml README.md LICENSE CHANGELOG.md profiles/ tunnel-operator.yaml workflows/ open-tunnel.yaml examples/ basic.mdManifest
标题为“Manifest”的章节jarvis-pack.yaml 定义 pack 身份、权限和贡献点:
schemaVersion: 1id: example.ssh-tunnelpublisher: examplename: ssh-tunneldisplayName: SSH Tunnel Workflow Packversion: 0.1.0engines: jarvis: ">=0.0.1"permissions: sessions: launch: true terminal: requested: truecontributes: profiles: - id: tunnel-operator path: profiles/tunnel-operator.yaml workflows: - id: open-tunnel path: workflows/open-tunnel.yaml title: Open reviewed SSH tunnel commands: - command: "/ssh-tunnel" title: Open SSH tunnel action: type: startWorkflow workflow: open-tunnel taskTemplate: "Tunnel request: {{args}}"terminal.requested 会在验证报告里显示为 high risk。它不是直接授权;worker 仍然走 Jarvis 的权限模型。
Profile
标题为“Profile”的章节profiles/tunnel-operator.yaml 给 worker 一组专门指令:
version: 2name: Tunnel Operatorruntime: claude-codetools: builtin: - Read - Bashpermissions: mode: acceptEdits ask: - "Bash(ssh:*)"这个 profile 是 pack-owned。安装后,它在 Agent Profiles 中显示为扩展提供,不能原地编辑。需要改动时,复制后编辑。
Workflow
标题为“Workflow”的章节workflows/open-tunnel.yaml 有两个节点:
plan:检查输入并生成命令,不执行。open:等待显式放行后再执行。
第二个节点设置 requires_approval: true,适合终端或外部副作用动作。
Slash command 映射
标题为“Slash command 映射”的章节/ssh-tunnel 的 action 是 startWorkflow。执行流程是:
- 前端 slash menu 从
GET /api/v1/commands读取命令。 - 用户提交
/ssh-tunnel ...。 - Jarvis Core 找到
example.ssh-tunnel的 enabled command contribution。 - Core 解析
taskTemplate,把参数传入 materialized workflow。 - Pipeline engine 启动 workflow run。
扩展包没有可执行入口,也不会接收命令回调。
本地验证
标题为“本地验证”的章节.venv/bin/jarvis extensions validate examples/extensions/ssh-tunnel-pack.venv/bin/jarvis extensions install examples/extensions/ssh-tunnel-pack --enable在 Jarvis chat 输入:
/ssh-tunnel 15432:database.internal:5432 bastion