ClawsJoy/dsh-plugins--packages-tool-attribution ↗★ 0

@clawsjoy/dsh-tool-attribution

Publishes DSH_TOOL_CALL_ID/DSH_TOOL_NAME for shell tool executions via the public ctx.shellEnv registry. 适合需要精确追踪 Shell 子进程归属,为可观测性或审计层提供调用链关联的开发者。

패키지
@clawsjoy/dsh-tool-attribution
호환성
미검증
Cordis peer 범위
^4.0.0
버전
0.1.1
라이선스
MIT
최근 업데이트
2026. 9. 21.

설치

검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 README 읽기 ↗

@clawsjoy/dsh-tool-attribution

Publishes DSH_TOOL_CALL_ID and DSH_TOOL_NAME for every shell tool execution, through the public ctx.shellEnv registry.

Why

Upstream DSH (0.1.5-rc.2) does not set those variables for tool subprocesses (verified: no reference in the tree; env inside a tool call shows nothing). Without them a subprocess cannot say which tool call it belongs to, so any egress or observability layer can only guess — and a guessed attribution is worse than none, because it looks authoritative.

What it does

ctx.shellEnv.register({
  name: 'clawsjoy-tool-attribution',
  variables: { DSH_TOOL_CALL_ID: {...}, DSH_TOOL_NAME: {...} },
  resolve: execution => attribute(execution),   // {} when unattributable
})
  • Reads the host's ToolExecution structurally (callId, name, rootCallId) so a host type change cannot break the build;
  • Sanitizes values (trimmed, no NUL/newline, bounded) and publishes nothing when the identity is unusable — the negative control;
  • Touches no subprocess-local/shell-env internals: the registry validates keys and rejects undeclared ones.

Install

dsh plugin --profile web add @clawsjoy/dsh-tool-attribution
- insert:
    - id: tool-attribution
      name: '@clawsjoy/dsh-tool-attribution'

Verification

pnpm test

License

MIT