@weave-os/router 0.2.22 → 0.2.24

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.
package/LICENSE CHANGED
@@ -1,90 +1,202 @@
1
- Copyright 2025 Workweave, Inc.
2
1
 
3
- Elastic License 2.0
4
-
5
- URL: https://www.elastic.co/licensing/elastic-license
6
-
7
- ## Acceptance
8
-
9
- By using the software, you agree to all of the terms and conditions below.
10
-
11
- ## Copyright License
12
-
13
- The licensor grants you a non-exclusive, royalty-free, worldwide,
14
- non-sublicensable, non-transferable license to use, copy, distribute, make
15
- available, and prepare derivative works of the software, in each case subject to
16
- the limitations and conditions below.
17
-
18
- ## Limitations
19
-
20
- You may not provide the software to third parties as a hosted or managed
21
- service, where the service provides users with access to any substantial set of
22
- the features or functionality of the software.
23
-
24
- You may not move, change, disable, or circumvent the license key functionality
25
- in the software, and you may not remove or obscure any functionality in the
26
- software that is protected by the license key.
27
-
28
- You may not alter, remove, or obscure any licensing, copyright, or other notices
29
- of the licensor in the software. Any use of the licensor's trademarks is subject
30
- to applicable law.
31
-
32
- ## Patents
33
-
34
- The licensor grants you a license, under any patent claims the licensor can
35
- license, or becomes able to license, to make, have made, use, practice,
36
- sell, offer for sale, import or transfer any part of the software. This license
37
- does not cover any patent claims that you cause to be infringed by modifications
38
- or additions to the software. If you or your company make any written claim that
39
- the software infringes or contributes to infringement of any patent, your patent
40
- license for the software granted under these terms ends immediately.
41
-
42
- ## Notices
43
-
44
- You must ensure that anyone who gets a copy of any part of the software from you
45
- also gets a copy of these terms.
46
-
47
- If you modify the software, you must include in any modified copies of the
48
- software prominent notices stating that you have modified the software.
49
-
50
- ## No Other Rights
51
-
52
- These terms do not imply any licenses other than those expressly granted in
53
- these terms.
54
-
55
- ## Termination
56
-
57
- If you use the software in violation of these terms, such use is not licensed,
58
- and your licenses will automatically terminate. If the licensor provides you
59
- with a notice of your violation, and you cease all violation of this license no
60
- later than 30 days after you receive that notice, your licenses will
61
- automatically be reinstated unless the licensor notifies you otherwise. If you
62
- violate these terms after reinstatement, any additional violation will
63
- automatically and permanently terminate your licenses.
64
-
65
- ## No Liability
66
-
67
- *As far as the law allows, the software comes as is, without any warranty or
68
- condition, and the licensor will not be liable to you for any damages arising
69
- out of these terms or the use or nature of the software, under any kind of
70
- legal claim.*
71
-
72
- ## Definitions
73
-
74
- The **licensor** is the entity offering these terms, and the **software** is the
75
- software the licensor makes available under these terms, including any portion
76
- of it.
77
-
78
- **you** refers to the individual or entity agreeing to these terms.
79
-
80
- **your company** is any legal entity, sole proprietorship, or other kind of
81
- organization that you work for, plus all organizations that have more than 25%
82
- ownership in the relationship with you.
83
-
84
- **your licenses** are all the licenses granted to you for the software under
85
- these terms.
86
-
87
- **use** includes anything you do with the software requiring one of your
88
- licenses.
89
-
90
- **trademark** includes logos, service marks, and other designations.
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,16 @@
1
+ Weave Router
2
+ Copyright 2025-2026 Workweave, Inc.
3
+
4
+ This product includes software developed at Workweave, Inc.
5
+ (https://workweave.ai/).
6
+
7
+ The router server includes software from Switchyard:
8
+ Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
9
+
10
+ prompt.md and schema.json are unmodified from NVIDIA-NeMo/Switchyard revision
11
+ 9c774d2ee6fcac818410419dab3578c3e7abee57. transcript.go adapts its Unicode-aware
12
+ transcript condenser to Weave's normalized conversation representation.
13
+
14
+ Switchyard is licensed under the Apache License, Version 2.0.
15
+ Its original notices are retained under internal/router/llmescalation/ in
16
+ the source distribution. Switchyard is not bundled in the npm installer.
package/README.md CHANGED
@@ -21,6 +21,7 @@ npx @weave-os/router --scope project # per-repo install, commit settings.j
21
21
  npx @weave-os/router --local # self-hosted via docker-compose (localhost:8080)
22
22
  npx @weave-os/router --base-url https://router.acme.internal
23
23
  npx @weave-os/router --email you@example.com # set identity without prompting
24
+ npx @weave-os/router --claude --return-url https://app.example.com/onboarding # continue after a verified install
24
25
  npx @weave-os/router --non-interactive # reads $WEAVE_ROUTER_KEY, no prompts (defaults to claude)
25
26
  ```
26
27
 
@@ -100,11 +101,17 @@ Four install targets:
100
101
  api.anthropic.com.
101
102
  - **Codex** (`--codex`) — patches `~/.codex/config.toml` (or
102
103
  `<repo>/.codex/config.toml`) with a managed `[model_providers.weave]`
103
- block plus `model_provider = "weave"`. The provider preserves the existing
104
- ChatGPT OAuth login. No install pins `X-Weave-Router-Strategy`; every
105
- endpoint keeps its router's configured default. HMM or forced
106
- `gpt-5.6-sol`, `gpt-5.6-terra`, and `gpt-5.6-luna` turns use that plan;
107
- every other selected model uses its WorkWeave deployment or BYOK credential.
104
+ block plus `model_provider = "weave"`. Fresh installs select `weave-auto`,
105
+ while reinstalling preserves an existing model choice. The provider preserves
106
+ the active ChatGPT OAuth login. No install pins `X-Weave-Router-Strategy`;
107
+ every endpoint keeps its router's configured default. Codex's native
108
+ `/model` picker can force a named model and its selected reasoning effort;
109
+ **Weave Router (automatic)** resumes per-request routing. An existing `$fm`
110
+ session pin still applies in automatic mode until `$ufm` clears it. Re-run
111
+ `npx @weave-os/router --codex` and restart Codex to enable this on an older
112
+ install. `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`, and `gpt-6-sol`
113
+ can use the active ChatGPT plan; other selected models use their WorkWeave
114
+ deployment or BYOK credential.
108
115
  The block lives between begin/end markers
109
116
  so re-running the installer rewrites it cleanly and `--uninstall --codex`
110
117
  removes it without touching the rest of your config. Codex does not load
@@ -135,6 +142,13 @@ Four install targets:
135
142
  See the [main installer docs](https://github.com/weave-os/router/tree/main/install)
136
143
  for the full reference.
137
144
 
145
+ ## License
146
+
147
+ Apache-2.0 starting with version `0.2.24` of both `@weave-os/router` and
148
+ `@workweave/router`. See the bundled `LICENSE` and `NOTICE` files.
149
+ Earlier published versions retain their original licenses. Third-party peer
150
+ dependencies are separately licensed and are not bundled in this package.
151
+
138
152
  ## Requirements
139
153
 
140
154
  - Node ≥ 18 (ships with `npx`)
package/cc-statusline.sh CHANGED
@@ -476,12 +476,14 @@ prices='{
476
476
  "claude-opus-4-7": 0.005,
477
477
  "claude-opus-4-8": 0.005,
478
478
  "claude-opus-5": 0.005,
479
+ "claude-opus-5-5": 0.004,
479
480
  "claude-sonnet-4-5": 0.003,
480
481
  "claude-sonnet-4-6": 0.003,
481
482
  "claude-sonnet-5": 0.003,
482
483
  "deepseek/deepseek-v4-flash": 0.0001134,
483
484
  "deepseek/deepseek-v4-pro": 0.00174,
484
485
  "deepseek/deepseek-v4-pro-0813": 0.00174,
486
+ "deepseek/deepseek-v4.1-flash": 0.00022,
485
487
  "gemini-2.0-flash": 0.0001,
486
488
  "gemini-2.0-flash-lite": 0.000075,
487
489
  "gemini-2.5-flash": 0.0003,
@@ -520,9 +522,12 @@ prices='{
520
522
  "gpt-5.6-sol-pro": 0.004,
521
523
  "gpt-5.6-terra": 0.002,
522
524
  "gpt-6-astra": 0.01,
525
+ "gpt-6-luna": 0.0001,
526
+ "gpt-6-sol": 0.002,
523
527
  "grok-4.5": 0.002,
524
528
  "grok-4.6": 0.002,
525
529
  "grok-4.7": 0.002,
530
+ "inclusionai/ling-3.0-flash": 0.00006,
526
531
  "minimax/minimax-m2.7": 0.0003,
527
532
  "minimax/minimax-m3": 0.0003,
528
533
  "mistralai/mistral-small-2603": 0.0002,
@@ -541,6 +546,8 @@ prices='{
541
546
  "qwen/qwen3.7-plus": 0.0004,
542
547
  "qwen/qwen3.8-max": 0.002,
543
548
  "xiaomi/mimo-v2.5-pro": 0.001,
549
+ "xiaomi/mimo-v2.6-flash": 0.00014,
550
+ "xiaomi/mimo-v2.6-pro": 0.000435,
544
551
  "z-ai/glm-5": 0.001,
545
552
  "z-ai/glm-5.1": 0.0014,
546
553
  "z-ai/glm-5.2": 0.0014,
@@ -558,12 +565,14 @@ prices='{
558
565
  "claude-opus-4-7": 0.025,
559
566
  "claude-opus-4-8": 0.025,
560
567
  "claude-opus-5": 0.025,
568
+ "claude-opus-5-5": 0.02,
561
569
  "claude-sonnet-4-5": 0.015,
562
570
  "claude-sonnet-4-6": 0.015,
563
571
  "claude-sonnet-5": 0.015,
564
572
  "deepseek/deepseek-v4-flash": 0.0002791,
565
573
  "deepseek/deepseek-v4-pro": 0.00348,
566
574
  "deepseek/deepseek-v4-pro-0813": 0.00348,
575
+ "deepseek/deepseek-v4.1-flash": 0.00066,
567
576
  "gemini-2.0-flash": 0.0004,
568
577
  "gemini-2.0-flash-lite": 0.0003,
569
578
  "gemini-2.5-flash": 0.0012,
@@ -602,9 +611,12 @@ prices='{
602
611
  "gpt-5.6-sol-pro": 0.02,
603
612
  "gpt-5.6-terra": 0.012,
604
613
  "gpt-6-astra": 0.05,
614
+ "gpt-6-luna": 0.0005,
615
+ "gpt-6-sol": 0.01,
605
616
  "grok-4.5": 0.006,
606
617
  "grok-4.6": 0.006,
607
618
  "grok-4.7": 0.006,
619
+ "inclusionai/ling-3.0-flash": 0.00018,
608
620
  "minimax/minimax-m2.7": 0.0012,
609
621
  "minimax/minimax-m3": 0.0012,
610
622
  "mistralai/mistral-small-2603": 0.0006,
@@ -623,6 +635,8 @@ prices='{
623
635
  "qwen/qwen3.7-plus": 0.0016,
624
636
  "qwen/qwen3.8-max": 0.006,
625
637
  "xiaomi/mimo-v2.5-pro": 0.003,
638
+ "xiaomi/mimo-v2.6-flash": 0.00028,
639
+ "xiaomi/mimo-v2.6-pro": 0.00087,
626
640
  "z-ai/glm-5": 0.0032,
627
641
  "z-ai/glm-5.1": 0.0044,
628
642
  "z-ai/glm-5.2": 0.0044,
@@ -640,12 +654,14 @@ prices='{
640
654
  "claude-opus-4-7": 0.1,
641
655
  "claude-opus-4-8": 0.1,
642
656
  "claude-opus-5": 0.1,
657
+ "claude-opus-5-5": 0.05,
643
658
  "claude-sonnet-4-5": 0.1,
644
659
  "claude-sonnet-4-6": 0.1,
645
660
  "claude-sonnet-5": 0.1,
646
661
  "deepseek/deepseek-v4-flash": 0.2,
647
662
  "deepseek/deepseek-v4-pro": 0.11494252873563218,
648
663
  "deepseek/deepseek-v4-pro-0813": 0.11494252873563218,
664
+ "deepseek/deepseek-v4.1-flash": 0.031818181818181815,
649
665
  "gemini-2.0-flash": 0.25,
650
666
  "gemini-2.0-flash-lite": 0.25,
651
667
  "gemini-2.5-flash": 0.1,
@@ -684,9 +700,12 @@ prices='{
684
700
  "gpt-5.6-sol-pro": 0.1,
685
701
  "gpt-5.6-terra": 0.1,
686
702
  "gpt-6-astra": 0.1,
703
+ "gpt-6-luna": 0.1,
704
+ "gpt-6-sol": 0.1,
687
705
  "grok-4.5": 0.25,
688
706
  "grok-4.6": 0.25,
689
707
  "grok-4.7": 0.25,
708
+ "inclusionai/ling-3.0-flash": 0.2,
690
709
  "minimax/minimax-m2.7": 0.2,
691
710
  "minimax/minimax-m3": 0.2,
692
711
  "mistralai/mistral-small-2603": 0.1,
@@ -705,6 +724,8 @@ prices='{
705
724
  "qwen/qwen3.7-plus": 0.2,
706
725
  "qwen/qwen3.8-max": 0.125,
707
726
  "xiaomi/mimo-v2.5-pro": 0.1,
727
+ "xiaomi/mimo-v2.6-flash": 0.02,
728
+ "xiaomi/mimo-v2.6-pro": 0.00827586,
708
729
  "z-ai/glm-5": 0.2,
709
730
  "z-ai/glm-5.1": 0.18571428571428572,
710
731
  "z-ai/glm-5.2": 0.18571428571428572,
package/codex-status.sh CHANGED
@@ -32,6 +32,9 @@ set -euo pipefail
32
32
  # WEAVE_STATUSLINE_UPDATE and WEAVE_STATUSLINE_UPDATE_INTERVAL_DAYS variables
33
33
  # remain accepted as aliases for users who configure both clients together.
34
34
  weave_self_refresh() {
35
+ # The published helper may predate classifier lifecycle forwarding. Do not
36
+ # replace the hook implementation underneath an opted-in session.
37
+ [ "${WEAVE_CAPTURE_LLM_CLASSIFIER:-}" = "1" ] && return 0
35
38
  [ "${WEAVE_CODEX_STATUS_UPDATE:-${WEAVE_STATUSLINE_UPDATE:-1}}" = "0" ] && return 0
36
39
  command -v curl >/dev/null 2>&1 || return 0
37
40
 
@@ -98,9 +101,10 @@ emit_title() {
98
101
  local title="$1"
99
102
  if [ -n "${WEAVE_CODEX_STATUS_TITLE_FILE:-}" ]; then
100
103
  printf '%s\n' "$title" >"$WEAVE_CODEX_STATUS_TITLE_FILE"
101
- elif [ -w /dev/tty ]; then
104
+ elif [ -t 2 ] && [ -w /dev/tty ]; then
102
105
  printf '\033]0;%s\007' "$title" >/dev/tty
103
106
  fi
107
+ return 0
104
108
  }
105
109
 
106
110
  safe_session_id() {
@@ -328,6 +332,21 @@ command -v jq >/dev/null 2>&1 || exit 0
328
332
  jq -e . >/dev/null 2>&1 <<<"$payload" || exit 0
329
333
 
330
334
  hook_event_name="$(jq -r '.hook_event_name // ""' <<<"$payload")"
335
+ if [ "${WEAVE_CAPTURE_LLM_CLASSIFIER:-}" = "1" ] && [ -n "${WEAVE_CAPTURE_HOOK_TOKEN:-}" ]; then
336
+ classifier_hook_url="${WEAVE_CAPTURE_HOOK_URL:-http://127.0.0.1:41984/classifier/hook}"
337
+ if [[ "$classifier_hook_url" =~ ^http://(127\.0\.0\.1|localhost|\[::1\]):[0-9]+/classifier/hook$ ]]; then
338
+ case "$hook_event_name" in
339
+ SessionStart|PreToolUse|PreCompact)
340
+ # Send lifecycle identifiers only. A failed hook cannot enroll a thread;
341
+ # the opted-in capture proxy rejects its inference request instead.
342
+ jq -c '{hook_event_name,session_id,source,tool_name}' <<<"$payload" |
343
+ curl -fsS --max-time 2 -H 'Content-Type: application/json' \
344
+ -H "X-Weave-Capture-Hook-Token: $WEAVE_CAPTURE_HOOK_TOKEN" \
345
+ --data-binary @- "$classifier_hook_url" >/dev/null 2>&1 || true
346
+ ;;
347
+ esac
348
+ fi
349
+ fi
331
350
  if [ "$hook_event_name" = "SessionStart" ]; then
332
351
  if [ -f "$disabled_marker" ]; then
333
352
  emit_title "Codex · direct"
@@ -337,6 +356,10 @@ if [ "$hook_event_name" = "SessionStart" ]; then
337
356
  exit 0
338
357
  fi
339
358
 
359
+ if [ "$hook_event_name" = "PreToolUse" ] || [ "$hook_event_name" = "PreCompact" ]; then
360
+ exit 0
361
+ fi
362
+
340
363
  if [ -f "$disabled_marker" ]; then
341
364
  exit 0
342
365
  fi