@orchestraai/agent-tools 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,7 +58,11 @@ export function startTargets(probe) {
58
58
  // composer, unsent; ChatGPT.app keeps the scheme from the Codex app.
59
59
  link: {
60
60
  url: (project, prompt) => `codex://new?path=${encodeURIComponent(project)}&prompt=${encodeURIComponent(prompt)}`,
61
- steps: ["Enable orchestra under Plugins if you haven't yet", "Press Enter in the new chat to send the prompt"],
61
+ steps: [
62
+ "Enable orchestra under Plugins if you haven't yet",
63
+ "Press Enter in the new chat to send the prompt",
64
+ "No chat or no prompt? Paste the prompt above into a new Codex thread",
65
+ ],
62
66
  },
63
67
  });
64
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/onboarding/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA4C5C,MAAM,UAAU,gBAAgB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACnE,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/D,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;QACrE,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CACf,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,IAAI,MAAM,CAAC,EAAE,IAA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AAC,IAAI,CAAC;YACX,EAAE,EAAE,QAAQ;YACZ,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,0CAA0C;YAChD,IAAI,EAAE,KAAK;YACX,GAAG,EAAE,QAAQ;YACb,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,8BAA8B,EAAE,wCAAwC,CAAC;SACxF,CAAC,CAAC;IACL,CAAC;IACD,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC;YACX,EAAE,EAAE,WAAW;YACf,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO;YACzF,IAAI,EAAE,4BAA4B;YAClC,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC;SAC3B,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,IAAI,CAAC;QACX,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,QAAQ,OAAO,uBAAuB,EAAE,kCAAkC,CAAC;KACjG,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,gCAAgC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACrG,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,126 @@
1
+ # Claude Code through Orchestra
2
+
3
+ `orchestra claude` uses your saved Orchestra credential only in the Claude
4
+ child process. Install Claude Code and sign in with `orchestra login` first.
5
+ Run from a named Git branch with a GitHub `origin` remote.
6
+
7
+ ```sh
8
+ orchestra claude --org org_example --project example --workload coding \
9
+ --environment test -- --model <gateway-model-id>
10
+ ```
11
+
12
+ This sends Claude's model traffic, including prompts and tool results, to the
13
+ configured gateway. Repository name, branch, initial HEAD and session ID are
14
+ sent as attribution metadata. Capture and retention follow the selected
15
+ workload's configuration; this command does not enable capture or change it.
16
+ Gateway usage is billed separately from a Claude subscription.
17
+
18
+ The launcher prints its session ID and stores metadata privately under the
19
+ Orchestra home directory. It does not save the API key in that metadata.
20
+ Resume from the same worktree and branch:
21
+
22
+ ```sh
23
+ orchestra claude --resume <session-id> -- --model <gateway-model-id>
24
+ orchestra claude-session show <session-id>
25
+ ```
26
+
27
+ The original base commit and routing scope stay fixed across resume. A changed
28
+ branch, repository, organization, project, workload, environment or gateway
29
+ is rejected. Start a new session for another branch. Concurrent resumes,
30
+ background/cloud sessions, automatic worktrees and Claude's own session
31
+ switching flags are not supported.
32
+
33
+ The launcher disables user/project/local settings sources for this invocation
34
+ because settings can replace gateway credentials and attribution headers.
35
+ It leaves saved configuration untouched. Supply tool permissions and MCP
36
+ configuration explicitly when needed. Organization-managed settings still
37
+ apply; this is not a bypass of administrator policy. Claude Code 2.1.312 has been verified in headless and interactive terminal modes,
38
+ including Read/Edit and close/reopen resume. Other versions and background/cloud
39
+ launch modes need separate compatibility checks.
40
+
41
+ ## Account for a session without transcripts
42
+
43
+ ```sh
44
+ orchestra claude-session account <session-id>
45
+ ```
46
+
47
+ The launcher gives each new session a persistent W3C traceparent header. This
48
+ command reads the existing customer trace API, including failed requests and
49
+ background calls carrying that trace ID, and joins customer billing records. It
50
+ walks a frozen ingestion snapshot and checks every request against the session
51
+ trace, organization, project, workload and environment. Re-run after
52
+ ingestion/pricing catches up. No platform changes are required. Resuming a
53
+ session preserves its trace ID, so resumed invocations are accounted together.
54
+
55
+ The report separates priced cost from unpriced request IDs and uncaptured
56
+ request IDs. A total stays null if any request is unpriced or the inventory is
57
+ empty. Coverage warnings are preserved: requests without the session trace ID, early
58
+ rejections without a record, and later arrivals cannot be inferred from the
59
+ snapshot. Missing-ID and shared-ID ambiguity is unknown, never a fabricated zero.
60
+
61
+ With authenticated `gh`, the command discovers the unique PR for the branch,
62
+ checks repository/branch/base ancestry, and refreshes its merge status. Use
63
+ `--pr <number>` to select among multiple PRs. A missing or ambiguous linkage is
64
+ reported separately from request cost. Both source and merge commits are retained.
65
+
66
+ To verify stored request/response bodies as well, pass
67
+ `--out <private-directory> --include-payload --yes`. The metadata-only command
68
+ does not download payloads. Capture presence in the request log is an expectation,
69
+ not proof of successful download; capture verification records missing exports.
70
+
71
+ Sessions created before trace attribution remain resumable, but cannot use this
72
+ accounting path. Start a new session, or use transcript reconciliation below for
73
+ earlier sessions. Trace retention and gateway coverage limits still apply.
74
+
75
+ ## Reconcile a completed headless run
76
+
77
+ Keep stream output private: it contains prompts, tool results and completions.
78
+ Use a separate output file for each invocation, including resumes. The
79
+ transcripts and the capture export go under a private temporary directory
80
+ created with `mktemp -d`, which is readable only by you.
81
+
82
+ ```sh
83
+ umask 077
84
+ artifacts=$(mktemp -d)
85
+ orchestra claude --org org_example --project example --workload coding \
86
+ --environment test -- --model <gateway-model-id> --max-budget-usd 1 \
87
+ --output-format stream-json --verbose -p 'Describe this repository' \
88
+ > "$artifacts/initial.jsonl"
89
+ orchestra claude --resume <session-id> -- --model <gateway-model-id> \
90
+ --max-budget-usd 1 --output-format stream-json --verbose \
91
+ -p 'Summarize your previous answer' > "$artifacts/resumed.jsonl"
92
+ orchestra claude-session reconcile <session-id> \
93
+ --transcript "$artifacts/initial.jsonl" "$artifacts/resumed.jsonl" \
94
+ --out "$artifacts/captures" --include-payload --yes
95
+ ```
96
+
97
+ Reconciliation resolves assistant message IDs through the customer cost API,
98
+ requires complete pricing, compares token totals with the supplied transcripts,
99
+ and exports captures through the existing capture exporter. It verifies request
100
+ identity, environment, attribution tags and request/response body presence.
101
+ Output contains cost and verification metadata, never capture bodies. Retry
102
+ when ingestion or pricing is still pending. Duplicate results, mixed sessions,
103
+ missing payloads or token discrepancies fail reconciliation.
104
+
105
+ Coverage is the successful requests represented in the supplied completed
106
+ transcripts. This does not enumerate omitted invocations, failed requests or
107
+ background traffic. Compare a gateway session inventory before describing the
108
+ report as the cost of an entire session. Keep exports outside version control.
109
+
110
+ ## Link a pull request
111
+
112
+ With the GitHub CLI authenticated:
113
+
114
+ ```sh
115
+ orchestra claude-session link <session-id>
116
+ # Select explicitly if more than one PR matches the branch:
117
+ orchestra claude-session link <session-id> --pr 12
118
+ ```
119
+
120
+ The command verifies the PR head repository and branch against the session and
121
+ stores the head commit separately from the merge commit. Run it again after
122
+ merge to refresh the linkage. It reads GitHub only; it does not create, review
123
+ or merge a PR. This is explicit branch attribution, not proof that Claude
124
+ produced every change, that every session was included, or that the PR belongs
125
+ to only one session. PR and reconciliation records remain separate private
126
+ artifacts keyed by session ID.
@@ -41,10 +41,15 @@ Before publishing a package, run:
41
41
  npm run package:smoke -- --release
42
42
  ```
43
43
 
44
- It runs `npm pack --dry-run --json` and inspects the included files for local
44
+ It runs `npm pack --dry-run --json` and inspects Orchestra-owned files for local
45
45
  artifacts, private paths, raw payload markers, production/control-plane URLs,
46
46
  and secret-shaped strings.
47
47
 
48
+ Bundled public dependencies are checked against npm registry integrity entries in
49
+ `package-lock.json` and their installed names/versions. Run `npm ci` before this
50
+ check: npm verifies the downloaded archives. Upstream examples and localized
51
+ strings are outside Orchestra's private-term policy; unpinned dependencies fail.
52
+
48
53
  ## Desktop release
49
54
 
50
55
  Understudy Desktop is deprecated and no longer released from this repository.
package/install.sh CHANGED
@@ -2140,11 +2140,120 @@ launch_selected_agent() {
2140
2140
  fi
2141
2141
  }
2142
2142
 
2143
- need npm || {
2144
- say "npm is required. Install Node.js 20+ first: https://nodejs.org"
2145
- exit 1
2143
+ # ── prerequisites ────────────────────────────────────────────────────
2144
+ # Checked before anything is installed, and reported together with the fix
2145
+ # for this machine, so a missing prerequisite costs one rerun. Node is never
2146
+ # installed silently: a person at a terminal is offered `brew install node`.
2147
+ MIN_NODE="22.19.0" # keep in step with engines.node and src/node-version.ts
2148
+
2149
+ version_at_least() {
2150
+ local have="$1" need="$2" a b i
2151
+ local IFS=.
2152
+ # shellcheck disable=SC2206
2153
+ a=($have)
2154
+ # shellcheck disable=SC2206
2155
+ b=($need)
2156
+ for i in 0 1 2; do
2157
+ [ "${a[$i]:-0}" -gt "${b[$i]:-0}" ] 2>/dev/null && return 0
2158
+ [ "${a[$i]:-0}" -lt "${b[$i]:-0}" ] 2>/dev/null && return 1
2159
+ done
2160
+ return 0
2161
+ }
2162
+
2163
+ node_version() {
2164
+ node -p 'process.versions.node' 2>/dev/null
2146
2165
  }
2147
2166
 
2167
+ # The command that updates Node the way it was installed.
2168
+ node_update_hint() {
2169
+ local path
2170
+ path="$(command -v node 2>/dev/null)"
2171
+ path="$(readlink "$path" 2>/dev/null || printf '%s' "$path")"
2172
+ case "$path" in
2173
+ */.nvm/*) printf 'nvm install 22 && nvm alias default 22' ;;
2174
+ */fnm/*|*/.fnm/*) printf 'fnm install 22 && fnm default 22' ;;
2175
+ */.volta/*) printf 'volta install node@22' ;;
2176
+ /opt/homebrew/*|/usr/local/Cellar/*|/usr/local/opt/*) printf 'brew upgrade node' ;;
2177
+ *) node_install_hint ;;
2178
+ esac
2179
+ }
2180
+
2181
+ node_install_hint() {
2182
+ if need brew; then
2183
+ printf 'brew install node'
2184
+ else
2185
+ printf 'install Node 22 from https://nodejs.org'
2186
+ fi
2187
+ }
2188
+
2189
+ PREFLIGHT_PROBLEMS=()
2190
+ PREFLIGHT_NODE=""
2191
+
2192
+ # Fills PREFLIGHT_PROBLEMS with "problem<TAB>fix" lines; PREFLIGHT_NODE says
2193
+ # what is wrong with Node (missing / old), if anything.
2194
+ collect_prerequisites() {
2195
+ local os version
2196
+ PREFLIGHT_PROBLEMS=()
2197
+ PREFLIGHT_NODE=""
2198
+ os="$(uname -s 2>/dev/null)"
2199
+ case "$os" in
2200
+ Darwin|Linux) ;;
2201
+ *) PREFLIGHT_PROBLEMS+=("Orchestra runs on macOS and Linux; this is ${os:-an unknown system}."$'\t'"On Windows, run the installer inside WSL: https://learn.microsoft.com/windows/wsl/install") ;;
2202
+ esac
2203
+ if ! need node; then
2204
+ PREFLIGHT_NODE="missing"
2205
+ PREFLIGHT_PROBLEMS+=("Node.js is not installed. Orchestra needs Node $MIN_NODE or newer."$'\t'"$(node_install_hint)")
2206
+ else
2207
+ version="$(node_version)"
2208
+ if ! version_at_least "${version:-0}" "$MIN_NODE"; then
2209
+ PREFLIGHT_NODE="old"
2210
+ PREFLIGHT_PROBLEMS+=("Node ${version:-of unknown version} is too old. Orchestra needs Node $MIN_NODE or newer."$'\t'"$(node_update_hint)")
2211
+ elif ! need npm; then
2212
+ PREFLIGHT_PROBLEMS+=("npm is missing; it normally comes with Node."$'\t'"Reinstall Node: $(node_install_hint)")
2213
+ fi
2214
+ fi
2215
+ }
2216
+
2217
+ # A person at a terminal with Homebrew can have Node installed or updated
2218
+ # for them, after saying yes. --yes and scripts never install Node.
2219
+ offer_node_with_homebrew() {
2220
+ local verb
2221
+ [ -n "$PREFLIGHT_NODE" ] || return 1
2222
+ need brew || return 1
2223
+ [ "$YES" = "0" ] || return 1
2224
+ noninteractive_enabled && return 1
2225
+ { : </dev/tty >/dev/tty; } 2>/dev/null || return 1
2226
+ # An old Node from a version manager is updated there, not with brew.
2227
+ case "$PREFLIGHT_NODE:$(node_update_hint)" in
2228
+ missing:*) verb="install" ;;
2229
+ "old:brew upgrade node") verb="upgrade" ;;
2230
+ *) return 1 ;;
2231
+ esac
2232
+ confirm_default_yes "Orchestra needs Node $MIN_NODE or newer. Run brew $verb node now?" || return 1
2233
+ run_logged "brew $verb node" brew "$verb" node || return 1
2234
+ hash -r
2235
+ return 0
2236
+ }
2237
+
2238
+ check_prerequisites() {
2239
+ local entry
2240
+ collect_prerequisites
2241
+ [ "${#PREFLIGHT_PROBLEMS[@]}" -eq 0 ] && return 0
2242
+ if offer_node_with_homebrew; then
2243
+ collect_prerequisites
2244
+ [ "${#PREFLIGHT_PROBLEMS[@]}" -eq 0 ] && return 0
2245
+ fi
2246
+ section "Before you install"
2247
+ for entry in "${PREFLIGHT_PROBLEMS[@]}"; do
2248
+ fail_line "${entry%%$'\t'*}"
2249
+ say " Fix: ${entry#*$'\t'}"
2250
+ done
2251
+ say "Nothing was installed. Run the installer again once these are fixed."
2252
+ return 1
2253
+ }
2254
+
2255
+ check_prerequisites || exit 1
2256
+
2148
2257
  validate_agent_platforms || exit 2
2149
2258
  configure_resume
2150
2259
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchestraai/agent-tools",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Orchestra agent tools: the orchestra CLI and coding-agent skill library.",
5
5
  "repository": {
6
6
  "type": "git",