@staal/node 0.25.0 → 0.27.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.
- package/LICENSE-THIRD-PARTY.txt +601 -4
- package/README.md +18 -6
- package/bin/darwin-arm64/staal.node +0 -0
- package/bin/darwin-x64/staal.node +0 -0
- package/bin/linux-arm64-gnu/staal.node +0 -0
- package/bin/linux-x64-gnu/staal.node +0 -0
- package/claude-agent-sdk.d.mts +5 -0
- package/claude-agent-sdk.mjs +77 -0
- package/index.d.ts +7 -0
- package/index.js +26 -6
- package/package.json +28 -4
- package/vercel-ai.d.mts +5 -0
- package/vercel-ai.mjs +58 -0
package/LICENSE-THIRD-PARTY.txt
CHANGED
|
@@ -7,7 +7,7 @@ verbatim. staalc's own licence is in LICENSE and NOTICE.
|
|
|
7
7
|
SQLite, which rusqlite builds into staalc (through libsqlite3-sys), is in the public
|
|
8
8
|
domain: https://www.sqlite.org/copyright.html
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
181 crates.
|
|
11
11
|
|
|
12
12
|
================================================================================
|
|
13
13
|
aho-corasick 1.1.5: Unlicense OR MIT <https://github.com/BurntSushi/aho-corasick>
|
|
@@ -532,6 +532,288 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
|
532
532
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
533
533
|
DEALINGS IN THE SOFTWARE.
|
|
534
534
|
|
|
535
|
+
================================================================================
|
|
536
|
+
atomic-waker 1.1.2: Apache-2.0 OR MIT <https://github.com/smol-rs/atomic-waker>
|
|
537
|
+
================================================================================
|
|
538
|
+
|
|
539
|
+
--- LICENSE-APACHE ---
|
|
540
|
+
|
|
541
|
+
Apache License
|
|
542
|
+
Version 2.0, January 2004
|
|
543
|
+
http://www.apache.org/licenses/
|
|
544
|
+
|
|
545
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
546
|
+
|
|
547
|
+
1. Definitions.
|
|
548
|
+
|
|
549
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
550
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
551
|
+
|
|
552
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
553
|
+
the copyright owner that is granting the License.
|
|
554
|
+
|
|
555
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
556
|
+
other entities that control, are controlled by, or are under common
|
|
557
|
+
control with that entity. For the purposes of this definition,
|
|
558
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
559
|
+
direction or management of such entity, whether by contract or
|
|
560
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
561
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
562
|
+
|
|
563
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
564
|
+
exercising permissions granted by this License.
|
|
565
|
+
|
|
566
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
567
|
+
including but not limited to software source code, documentation
|
|
568
|
+
source, and configuration files.
|
|
569
|
+
|
|
570
|
+
"Object" form shall mean any form resulting from mechanical
|
|
571
|
+
transformation or translation of a Source form, including but
|
|
572
|
+
not limited to compiled object code, generated documentation,
|
|
573
|
+
and conversions to other media types.
|
|
574
|
+
|
|
575
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
576
|
+
Object form, made available under the License, as indicated by a
|
|
577
|
+
copyright notice that is included in or attached to the work
|
|
578
|
+
(an example is provided in the Appendix below).
|
|
579
|
+
|
|
580
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
581
|
+
form, that is based on (or derived from) the Work and for which the
|
|
582
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
583
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
584
|
+
of this License, Derivative Works shall not include works that remain
|
|
585
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
586
|
+
the Work and Derivative Works thereof.
|
|
587
|
+
|
|
588
|
+
"Contribution" shall mean any work of authorship, including
|
|
589
|
+
the original version of the Work and any modifications or additions
|
|
590
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
591
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
592
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
593
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
594
|
+
means any form of electronic, verbal, or written communication sent
|
|
595
|
+
to the Licensor or its representatives, including but not limited to
|
|
596
|
+
communication on electronic mailing lists, source code control systems,
|
|
597
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
598
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
599
|
+
excluding communication that is conspicuously marked or otherwise
|
|
600
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
601
|
+
|
|
602
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
603
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
604
|
+
subsequently incorporated within the Work.
|
|
605
|
+
|
|
606
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
607
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
608
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
609
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
610
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
611
|
+
Work and such Derivative Works in Source or Object form.
|
|
612
|
+
|
|
613
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
614
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
615
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
616
|
+
(except as stated in this section) patent license to make, have made,
|
|
617
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
618
|
+
where such license applies only to those patent claims licensable
|
|
619
|
+
by such Contributor that are necessarily infringed by their
|
|
620
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
621
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
622
|
+
institute patent litigation against any entity (including a
|
|
623
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
624
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
625
|
+
or contributory patent infringement, then any patent licenses
|
|
626
|
+
granted to You under this License for that Work shall terminate
|
|
627
|
+
as of the date such litigation is filed.
|
|
628
|
+
|
|
629
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
630
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
631
|
+
modifications, and in Source or Object form, provided that You
|
|
632
|
+
meet the following conditions:
|
|
633
|
+
|
|
634
|
+
(a) You must give any other recipients of the Work or
|
|
635
|
+
Derivative Works a copy of this License; and
|
|
636
|
+
|
|
637
|
+
(b) You must cause any modified files to carry prominent notices
|
|
638
|
+
stating that You changed the files; and
|
|
639
|
+
|
|
640
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
641
|
+
that You distribute, all copyright, patent, trademark, and
|
|
642
|
+
attribution notices from the Source form of the Work,
|
|
643
|
+
excluding those notices that do not pertain to any part of
|
|
644
|
+
the Derivative Works; and
|
|
645
|
+
|
|
646
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
647
|
+
distribution, then any Derivative Works that You distribute must
|
|
648
|
+
include a readable copy of the attribution notices contained
|
|
649
|
+
within such NOTICE file, excluding those notices that do not
|
|
650
|
+
pertain to any part of the Derivative Works, in at least one
|
|
651
|
+
of the following places: within a NOTICE text file distributed
|
|
652
|
+
as part of the Derivative Works; within the Source form or
|
|
653
|
+
documentation, if provided along with the Derivative Works; or,
|
|
654
|
+
within a display generated by the Derivative Works, if and
|
|
655
|
+
wherever such third-party notices normally appear. The contents
|
|
656
|
+
of the NOTICE file are for informational purposes only and
|
|
657
|
+
do not modify the License. You may add Your own attribution
|
|
658
|
+
notices within Derivative Works that You distribute, alongside
|
|
659
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
660
|
+
that such additional attribution notices cannot be construed
|
|
661
|
+
as modifying the License.
|
|
662
|
+
|
|
663
|
+
You may add Your own copyright statement to Your modifications and
|
|
664
|
+
may provide additional or different license terms and conditions
|
|
665
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
666
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
667
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
668
|
+
the conditions stated in this License.
|
|
669
|
+
|
|
670
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
671
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
672
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
673
|
+
this License, without any additional terms or conditions.
|
|
674
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
675
|
+
the terms of any separate license agreement you may have executed
|
|
676
|
+
with Licensor regarding such Contributions.
|
|
677
|
+
|
|
678
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
679
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
680
|
+
except as required for reasonable and customary use in describing the
|
|
681
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
682
|
+
|
|
683
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
684
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
685
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
686
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
687
|
+
implied, including, without limitation, any warranties or conditions
|
|
688
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
689
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
690
|
+
appropriateness of using or redistributing the Work and assume any
|
|
691
|
+
risks associated with Your exercise of permissions under this License.
|
|
692
|
+
|
|
693
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
694
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
695
|
+
unless required by applicable law (such as deliberate and grossly
|
|
696
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
697
|
+
liable to You for damages, including any direct, indirect, special,
|
|
698
|
+
incidental, or consequential damages of any character arising as a
|
|
699
|
+
result of this License or out of the use or inability to use the
|
|
700
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
701
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
702
|
+
other commercial damages or losses), even if such Contributor
|
|
703
|
+
has been advised of the possibility of such damages.
|
|
704
|
+
|
|
705
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
706
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
707
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
708
|
+
or other liability obligations and/or rights consistent with this
|
|
709
|
+
License. However, in accepting such obligations, You may act only
|
|
710
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
711
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
712
|
+
defend, and hold each Contributor harmless for any liability
|
|
713
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
714
|
+
of your accepting any such warranty or additional liability.
|
|
715
|
+
|
|
716
|
+
END OF TERMS AND CONDITIONS
|
|
717
|
+
|
|
718
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
719
|
+
|
|
720
|
+
To apply the Apache License to your work, attach the following
|
|
721
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
722
|
+
replaced with your own identifying information. (Don't include
|
|
723
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
724
|
+
comment syntax for the file format. We also recommend that a
|
|
725
|
+
file or class name and description of purpose be included on the
|
|
726
|
+
same "printed page" as the copyright notice for easier
|
|
727
|
+
identification within third-party archives.
|
|
728
|
+
|
|
729
|
+
Copyright [yyyy] [name of copyright owner]
|
|
730
|
+
|
|
731
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
732
|
+
you may not use this file except in compliance with the License.
|
|
733
|
+
You may obtain a copy of the License at
|
|
734
|
+
|
|
735
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
736
|
+
|
|
737
|
+
Unless required by applicable law or agreed to in writing, software
|
|
738
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
739
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
740
|
+
See the License for the specific language governing permissions and
|
|
741
|
+
limitations under the License.
|
|
742
|
+
|
|
743
|
+
--- LICENSE-MIT ---
|
|
744
|
+
|
|
745
|
+
Permission is hereby granted, free of charge, to any
|
|
746
|
+
person obtaining a copy of this software and associated
|
|
747
|
+
documentation files (the "Software"), to deal in the
|
|
748
|
+
Software without restriction, including without
|
|
749
|
+
limitation the rights to use, copy, modify, merge,
|
|
750
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
751
|
+
the Software, and to permit persons to whom the Software
|
|
752
|
+
is furnished to do so, subject to the following
|
|
753
|
+
conditions:
|
|
754
|
+
|
|
755
|
+
The above copyright notice and this permission notice
|
|
756
|
+
shall be included in all copies or substantial portions
|
|
757
|
+
of the Software.
|
|
758
|
+
|
|
759
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
760
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
761
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
762
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
763
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
764
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
765
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
766
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
767
|
+
DEALINGS IN THE SOFTWARE.
|
|
768
|
+
|
|
769
|
+
--- LICENSE-THIRD-PARTY ---
|
|
770
|
+
|
|
771
|
+
===============================================================================
|
|
772
|
+
|
|
773
|
+
Copyright (c) 2016 Alex Crichton
|
|
774
|
+
Copyright (c) 2017 The Tokio Authors
|
|
775
|
+
|
|
776
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
777
|
+
you may not use this file except in compliance with the License.
|
|
778
|
+
You may obtain a copy of the License at
|
|
779
|
+
|
|
780
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
781
|
+
|
|
782
|
+
Unless required by applicable law or agreed to in writing, software
|
|
783
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
784
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
785
|
+
See the License for the specific language governing permissions and
|
|
786
|
+
limitations under the License.
|
|
787
|
+
|
|
788
|
+
===============================================================================
|
|
789
|
+
|
|
790
|
+
Copyright (c) 2016 Alex Crichton
|
|
791
|
+
Copyright (c) 2017 The Tokio Authors
|
|
792
|
+
|
|
793
|
+
Permission is hereby granted, free of charge, to any
|
|
794
|
+
person obtaining a copy of this software and associated
|
|
795
|
+
documentation files (the "Software"), to deal in the
|
|
796
|
+
Software without restriction, including without
|
|
797
|
+
limitation the rights to use, copy, modify, merge,
|
|
798
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
799
|
+
the Software, and to permit persons to whom the Software
|
|
800
|
+
is furnished to do so, subject to the following
|
|
801
|
+
conditions:
|
|
802
|
+
|
|
803
|
+
The above copyright notice and this permission notice
|
|
804
|
+
shall be included in all copies or substantial portions
|
|
805
|
+
of the Software.
|
|
806
|
+
|
|
807
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
808
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
809
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
810
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
811
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
812
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
813
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
814
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
815
|
+
DEALINGS IN THE SOFTWARE.
|
|
816
|
+
|
|
535
817
|
================================================================================
|
|
536
818
|
base64 0.22.1: MIT OR Apache-2.0 <https://github.com/marshallpierce/rust-base64>
|
|
537
819
|
================================================================================
|
|
@@ -8585,6 +8867,39 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
|
8585
8867
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
8586
8868
|
DEALINGS IN THE SOFTWARE.
|
|
8587
8869
|
|
|
8870
|
+
================================================================================
|
|
8871
|
+
http-body 1.1.0: MIT <https://github.com/hyperium/http-body>
|
|
8872
|
+
http-body-util 0.1.5: MIT <https://github.com/hyperium/http-body>
|
|
8873
|
+
================================================================================
|
|
8874
|
+
|
|
8875
|
+
--- LICENSE ---
|
|
8876
|
+
|
|
8877
|
+
Copyright (c) 2019-2026 Sean McArthur & Hyper Contributors
|
|
8878
|
+
|
|
8879
|
+
Permission is hereby granted, free of charge, to any
|
|
8880
|
+
person obtaining a copy of this software and associated
|
|
8881
|
+
documentation files (the "Software"), to deal in the
|
|
8882
|
+
Software without restriction, including without
|
|
8883
|
+
limitation the rights to use, copy, modify, merge,
|
|
8884
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
8885
|
+
the Software, and to permit persons to whom the Software
|
|
8886
|
+
is furnished to do so, subject to the following
|
|
8887
|
+
conditions:
|
|
8888
|
+
|
|
8889
|
+
The above copyright notice and this permission notice
|
|
8890
|
+
shall be included in all copies or substantial portions
|
|
8891
|
+
of the Software.
|
|
8892
|
+
|
|
8893
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
8894
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
8895
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
8896
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
8897
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
8898
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
8899
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
8900
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
8901
|
+
DEALINGS IN THE SOFTWARE.
|
|
8902
|
+
|
|
8588
8903
|
================================================================================
|
|
8589
8904
|
httparse 1.10.1: MIT OR Apache-2.0 <https://github.com/seanmonstar/httparse>
|
|
8590
8905
|
================================================================================
|
|
@@ -8815,6 +9130,236 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
8815
9130
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
8816
9131
|
THE SOFTWARE.
|
|
8817
9132
|
|
|
9133
|
+
================================================================================
|
|
9134
|
+
httpdate 1.0.3: MIT OR Apache-2.0 <https://github.com/pyfisch/httpdate>
|
|
9135
|
+
================================================================================
|
|
9136
|
+
|
|
9137
|
+
--- LICENSE-APACHE ---
|
|
9138
|
+
|
|
9139
|
+
Apache License
|
|
9140
|
+
Version 2.0, January 2004
|
|
9141
|
+
http://www.apache.org/licenses/
|
|
9142
|
+
|
|
9143
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
9144
|
+
|
|
9145
|
+
1. Definitions.
|
|
9146
|
+
|
|
9147
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
9148
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
9149
|
+
|
|
9150
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
9151
|
+
the copyright owner that is granting the License.
|
|
9152
|
+
|
|
9153
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
9154
|
+
other entities that control, are controlled by, or are under common
|
|
9155
|
+
control with that entity. For the purposes of this definition,
|
|
9156
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
9157
|
+
direction or management of such entity, whether by contract or
|
|
9158
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
9159
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
9160
|
+
|
|
9161
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
9162
|
+
exercising permissions granted by this License.
|
|
9163
|
+
|
|
9164
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
9165
|
+
including but not limited to software source code, documentation
|
|
9166
|
+
source, and configuration files.
|
|
9167
|
+
|
|
9168
|
+
"Object" form shall mean any form resulting from mechanical
|
|
9169
|
+
transformation or translation of a Source form, including but
|
|
9170
|
+
not limited to compiled object code, generated documentation,
|
|
9171
|
+
and conversions to other media types.
|
|
9172
|
+
|
|
9173
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
9174
|
+
Object form, made available under the License, as indicated by a
|
|
9175
|
+
copyright notice that is included in or attached to the work
|
|
9176
|
+
(an example is provided in the Appendix below).
|
|
9177
|
+
|
|
9178
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
9179
|
+
form, that is based on (or derived from) the Work and for which the
|
|
9180
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
9181
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
9182
|
+
of this License, Derivative Works shall not include works that remain
|
|
9183
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
9184
|
+
the Work and Derivative Works thereof.
|
|
9185
|
+
|
|
9186
|
+
"Contribution" shall mean any work of authorship, including
|
|
9187
|
+
the original version of the Work and any modifications or additions
|
|
9188
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
9189
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
9190
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
9191
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
9192
|
+
means any form of electronic, verbal, or written communication sent
|
|
9193
|
+
to the Licensor or its representatives, including but not limited to
|
|
9194
|
+
communication on electronic mailing lists, source code control systems,
|
|
9195
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
9196
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
9197
|
+
excluding communication that is conspicuously marked or otherwise
|
|
9198
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
9199
|
+
|
|
9200
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
9201
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
9202
|
+
subsequently incorporated within the Work.
|
|
9203
|
+
|
|
9204
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
9205
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
9206
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
9207
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
9208
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
9209
|
+
Work and such Derivative Works in Source or Object form.
|
|
9210
|
+
|
|
9211
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
9212
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
9213
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
9214
|
+
(except as stated in this section) patent license to make, have made,
|
|
9215
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
9216
|
+
where such license applies only to those patent claims licensable
|
|
9217
|
+
by such Contributor that are necessarily infringed by their
|
|
9218
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
9219
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
9220
|
+
institute patent litigation against any entity (including a
|
|
9221
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
9222
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
9223
|
+
or contributory patent infringement, then any patent licenses
|
|
9224
|
+
granted to You under this License for that Work shall terminate
|
|
9225
|
+
as of the date such litigation is filed.
|
|
9226
|
+
|
|
9227
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
9228
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
9229
|
+
modifications, and in Source or Object form, provided that You
|
|
9230
|
+
meet the following conditions:
|
|
9231
|
+
|
|
9232
|
+
(a) You must give any other recipients of the Work or
|
|
9233
|
+
Derivative Works a copy of this License; and
|
|
9234
|
+
|
|
9235
|
+
(b) You must cause any modified files to carry prominent notices
|
|
9236
|
+
stating that You changed the files; and
|
|
9237
|
+
|
|
9238
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
9239
|
+
that You distribute, all copyright, patent, trademark, and
|
|
9240
|
+
attribution notices from the Source form of the Work,
|
|
9241
|
+
excluding those notices that do not pertain to any part of
|
|
9242
|
+
the Derivative Works; and
|
|
9243
|
+
|
|
9244
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
9245
|
+
distribution, then any Derivative Works that You distribute must
|
|
9246
|
+
include a readable copy of the attribution notices contained
|
|
9247
|
+
within such NOTICE file, excluding those notices that do not
|
|
9248
|
+
pertain to any part of the Derivative Works, in at least one
|
|
9249
|
+
of the following places: within a NOTICE text file distributed
|
|
9250
|
+
as part of the Derivative Works; within the Source form or
|
|
9251
|
+
documentation, if provided along with the Derivative Works; or,
|
|
9252
|
+
within a display generated by the Derivative Works, if and
|
|
9253
|
+
wherever such third-party notices normally appear. The contents
|
|
9254
|
+
of the NOTICE file are for informational purposes only and
|
|
9255
|
+
do not modify the License. You may add Your own attribution
|
|
9256
|
+
notices within Derivative Works that You distribute, alongside
|
|
9257
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
9258
|
+
that such additional attribution notices cannot be construed
|
|
9259
|
+
as modifying the License.
|
|
9260
|
+
|
|
9261
|
+
You may add Your own copyright statement to Your modifications and
|
|
9262
|
+
may provide additional or different license terms and conditions
|
|
9263
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
9264
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
9265
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
9266
|
+
the conditions stated in this License.
|
|
9267
|
+
|
|
9268
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
9269
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
9270
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
9271
|
+
this License, without any additional terms or conditions.
|
|
9272
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
9273
|
+
the terms of any separate license agreement you may have executed
|
|
9274
|
+
with Licensor regarding such Contributions.
|
|
9275
|
+
|
|
9276
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
9277
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
9278
|
+
except as required for reasonable and customary use in describing the
|
|
9279
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
9280
|
+
|
|
9281
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
9282
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
9283
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
9284
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
9285
|
+
implied, including, without limitation, any warranties or conditions
|
|
9286
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
9287
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
9288
|
+
appropriateness of using or redistributing the Work and assume any
|
|
9289
|
+
risks associated with Your exercise of permissions under this License.
|
|
9290
|
+
|
|
9291
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
9292
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
9293
|
+
unless required by applicable law (such as deliberate and grossly
|
|
9294
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
9295
|
+
liable to You for damages, including any direct, indirect, special,
|
|
9296
|
+
incidental, or consequential damages of any character arising as a
|
|
9297
|
+
result of this License or out of the use or inability to use the
|
|
9298
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
9299
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
9300
|
+
other commercial damages or losses), even if such Contributor
|
|
9301
|
+
has been advised of the possibility of such damages.
|
|
9302
|
+
|
|
9303
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
9304
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
9305
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
9306
|
+
or other liability obligations and/or rights consistent with this
|
|
9307
|
+
License. However, in accepting such obligations, You may act only
|
|
9308
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
9309
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
9310
|
+
defend, and hold each Contributor harmless for any liability
|
|
9311
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
9312
|
+
of your accepting any such warranty or additional liability.
|
|
9313
|
+
|
|
9314
|
+
END OF TERMS AND CONDITIONS
|
|
9315
|
+
|
|
9316
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
9317
|
+
|
|
9318
|
+
To apply the Apache License to your work, attach the following
|
|
9319
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
9320
|
+
replaced with your own identifying information. (Don't include
|
|
9321
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
9322
|
+
comment syntax for the file format. We also recommend that a
|
|
9323
|
+
file or class name and description of purpose be included on the
|
|
9324
|
+
same "printed page" as the copyright notice for easier
|
|
9325
|
+
identification within third-party archives.
|
|
9326
|
+
|
|
9327
|
+
Copyright [yyyy] [name of copyright owner]
|
|
9328
|
+
|
|
9329
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
9330
|
+
you may not use this file except in compliance with the License.
|
|
9331
|
+
You may obtain a copy of the License at
|
|
9332
|
+
|
|
9333
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9334
|
+
|
|
9335
|
+
Unless required by applicable law or agreed to in writing, software
|
|
9336
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9337
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9338
|
+
See the License for the specific language governing permissions and
|
|
9339
|
+
limitations under the License.
|
|
9340
|
+
|
|
9341
|
+
--- LICENSE-MIT ---
|
|
9342
|
+
|
|
9343
|
+
Copyright (c) 2016 Pyfisch
|
|
9344
|
+
|
|
9345
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9346
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9347
|
+
in the Software without restriction, including without limitation the rights
|
|
9348
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9349
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9350
|
+
furnished to do so, subject to the following conditions:
|
|
9351
|
+
|
|
9352
|
+
The above copyright notice and this permission notice shall be included in
|
|
9353
|
+
all copies or substantial portions of the Software.
|
|
9354
|
+
|
|
9355
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
9356
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
9357
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
9358
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
9359
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
9360
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
9361
|
+
THE SOFTWARE.
|
|
9362
|
+
|
|
8818
9363
|
================================================================================
|
|
8819
9364
|
hybrid-array 0.4.15: MIT OR Apache-2.0 <https://github.com/RustCrypto/hybrid-array>
|
|
8820
9365
|
================================================================================
|
|
@@ -9051,6 +9596,58 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
|
9051
9596
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
9052
9597
|
DEALINGS IN THE SOFTWARE.
|
|
9053
9598
|
|
|
9599
|
+
================================================================================
|
|
9600
|
+
hyper 1.12.0: MIT <https://github.com/hyperium/hyper>
|
|
9601
|
+
================================================================================
|
|
9602
|
+
|
|
9603
|
+
--- LICENSE ---
|
|
9604
|
+
|
|
9605
|
+
Copyright (c) 2014-2026 Sean McArthur
|
|
9606
|
+
|
|
9607
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9608
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9609
|
+
in the Software without restriction, including without limitation the rights
|
|
9610
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9611
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9612
|
+
furnished to do so, subject to the following conditions:
|
|
9613
|
+
|
|
9614
|
+
The above copyright notice and this permission notice shall be included in
|
|
9615
|
+
all copies or substantial portions of the Software.
|
|
9616
|
+
|
|
9617
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
9618
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
9619
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
9620
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
9621
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
9622
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
9623
|
+
THE SOFTWARE.
|
|
9624
|
+
|
|
9625
|
+
================================================================================
|
|
9626
|
+
hyper-util 0.1.21: MIT <https://github.com/hyperium/hyper-util>
|
|
9627
|
+
================================================================================
|
|
9628
|
+
|
|
9629
|
+
--- LICENSE ---
|
|
9630
|
+
|
|
9631
|
+
Copyright (c) 2023-2025 Sean McArthur
|
|
9632
|
+
|
|
9633
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9634
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9635
|
+
in the Software without restriction, including without limitation the rights
|
|
9636
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9637
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9638
|
+
furnished to do so, subject to the following conditions:
|
|
9639
|
+
|
|
9640
|
+
The above copyright notice and this permission notice shall be included in
|
|
9641
|
+
all copies or substantial portions of the Software.
|
|
9642
|
+
|
|
9643
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
9644
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
9645
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
9646
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
9647
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
9648
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
9649
|
+
THE SOFTWARE.
|
|
9650
|
+
|
|
9054
9651
|
================================================================================
|
|
9055
9652
|
icu_collections 2.3.0: Unicode-3.0 <https://github.com/unicode-org/icu4x>
|
|
9056
9653
|
icu_locale_core 2.3.0: Unicode-3.0 <https://github.com/unicode-org/icu4x>
|
|
@@ -13378,7 +13975,7 @@ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
13378
13975
|
DEALINGS IN THE SOFTWARE.
|
|
13379
13976
|
|
|
13380
13977
|
================================================================================
|
|
13381
|
-
rustls-webpki 0.103.
|
|
13978
|
+
rustls-webpki 0.103.16: ISC <https://github.com/rustls/webpki>
|
|
13382
13979
|
================================================================================
|
|
13383
13980
|
|
|
13384
13981
|
--- LICENSE ---
|
|
@@ -17129,8 +17726,8 @@ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
17129
17726
|
DEALINGS IN THE SOFTWARE.
|
|
17130
17727
|
|
|
17131
17728
|
================================================================================
|
|
17132
|
-
webpki-root-certs 1.0.
|
|
17133
|
-
webpki-roots 1.0.
|
|
17729
|
+
webpki-root-certs 1.0.11: CDLA-Permissive-2.0 <https://github.com/rustls/webpki-roots>
|
|
17730
|
+
webpki-roots 1.0.11: CDLA-Permissive-2.0 <https://github.com/rustls/webpki-roots>
|
|
17134
17731
|
================================================================================
|
|
17135
17732
|
|
|
17136
17733
|
--- LICENSE ---
|
package/README.md
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Run [Staal](https://github.com/laurells/staal) programs from Node.js and TypeScript.
|
|
4
4
|
Staal is the programming language for agents: its compiler refuses a
|
|
5
|
-
program that could act without
|
|
6
|
-
|
|
5
|
+
program that could act without a capability, use a model's answer unchecked, or
|
|
6
|
+
exceed its declared model budget, and its runtime journals every action, so a
|
|
7
|
+
resumed run replays what finished and never sends an action in doubt again blind.
|
|
7
8
|
|
|
8
9
|
Install it with `npm install @staal/node`. This package holds no Staal logic of its own. It calls staalc's C interface
|
|
9
10
|
in-process, so a Node app gets exactly the results `staalc` and the Python package
|
|
@@ -51,16 +52,27 @@ const r = await refund.call({ order: '4417', amount: { amount: '35.00', currency
|
|
|
51
52
|
A grant is never an argument, and the model never sees one. An app serving several
|
|
52
53
|
tenants or users from one directory also gives `scope: (customer) => customer.tenantId`,
|
|
53
54
|
from its own records: `once` keys are then held per scope, and a run's status is given
|
|
54
|
-
only in its scope (`refund.status(run, { context: customer })`).
|
|
55
|
+
only in its scope (`refund.status(run, { context: customer })`). Inputs that only the
|
|
56
|
+
app may give, such as the customer a call is for, are `appInputs: { customer: (customer)
|
|
57
|
+
=> customer.id }`: they are left out of the schema a model sees, and a call whose
|
|
58
|
+
arguments name one is refused. One process uses a
|
|
55
59
|
journal directory at a time, so give each worker its own directory (whose quotas are
|
|
56
60
|
then its own), or send the calls through one process.
|
|
57
61
|
|
|
58
62
|
**Agent frameworks.** `functionTool` from `@staal/node/openai-agents` gives an OpenAI
|
|
59
63
|
Agents SDK tool (grants from the run's `context`), and `structuredTool` from
|
|
60
64
|
`@staal/node/langgraph` a LangChain tool for LangGraph (context from
|
|
61
|
-
`config.configurable.staal_context`).
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
`config.configurable.staal_context`). `aiTools` from `@staal/node/vercel-ai` gives
|
|
66
|
+
Vercel AI SDK tools, an ES module for `ai` 7 (Node 22 or newer), whose context is each
|
|
67
|
+
tool's entry in `toolsContext`; a refusal reaches the model as an error with Staal's
|
|
68
|
+
message. `mcpServer` from `@staal/node/claude-agent-sdk` serves tools to the Claude Agent SDK as
|
|
69
|
+
an in-process MCP server, with the session's context bound when the server is made
|
|
70
|
+
(one per query), and `allowedTools` gives their names for `allowedTools`. The
|
|
71
|
+
frameworks are optional peer dependencies. Each is tested through the framework's own
|
|
72
|
+
agent loop (@openai/agents 0.20.0, @langchain/langgraph 1.5.1, ai 7.0.145,
|
|
73
|
+
@anthropic-ai/claude-agent-sdk 0.3.304, whose loop runs in the CLI it ships, against a
|
|
74
|
+
local stand-in for the Messages API), and once a week against each framework's latest
|
|
75
|
+
release; the examples are in
|
|
64
76
|
[examples/frameworks](https://github.com/laurells/staal/tree/main/examples/frameworks).
|
|
65
77
|
|
|
66
78
|
**Platforms.** Node 18 or newer, on Linux (x86_64 and arm64, glibc 2.28 or newer) and
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tool } from './index.js';
|
|
2
|
+
/** staal Tools as an in-process MCP server config for the Claude Agent SDK's `mcpServers`. */
|
|
3
|
+
export function mcpServer(tools: Tool<any>[], options?: { name?: string; context?: unknown }): { type: 'sdk'; name: string; instance: any };
|
|
4
|
+
/** The names the Agent SDK gives `tools` served under `name`, for `allowedTools`. */
|
|
5
|
+
export function allowedTools(name: string, tools: Tool<any>[]): string[];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// staal Tools as an in-process MCP server for the Claude Agent SDK
|
|
2
|
+
// (@anthropic-ai/claude-agent-sdk, with @modelcontextprotocol/sdk 1.x, which the app
|
|
3
|
+
// installs; @staal/node depends on neither). The Agent SDK is published as ES modules
|
|
4
|
+
// only, so this adapter is one too.
|
|
5
|
+
//
|
|
6
|
+
// import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
7
|
+
// import { allowedTools, mcpServer } from '@staal/node/claude-agent-sdk';
|
|
8
|
+
// for await (const message of query({ prompt, options: {
|
|
9
|
+
// mcpServers: { staal: mcpServer([refund], { context: customer }) }, // one per query
|
|
10
|
+
// allowedTools: allowedTools('staal', [refund]),
|
|
11
|
+
// tools: [],
|
|
12
|
+
// } })) { ... }
|
|
13
|
+
//
|
|
14
|
+
// The Agent SDK gives a tool only its arguments, so the app's context for the session
|
|
15
|
+
// (the signed-in customer, the tenant) is bound when the server is made: make one per
|
|
16
|
+
// query, from the app's own records, never from anything the model wrote. Each call
|
|
17
|
+
// runs the Staal program with the grants the app's policy gives for that context.
|
|
18
|
+
//
|
|
19
|
+
// The server is a plain MCP server (the MCP SDK's low-level Server), so the program's
|
|
20
|
+
// argument schema reaches the model as JSON Schema, unconverted, and Staal's own check
|
|
21
|
+
// of the arguments is the one that decides. A refusal, a failure or an unknown tool is
|
|
22
|
+
// a tool result with isError, with Staal's message, so the model can correct itself;
|
|
23
|
+
// nothing is retried. The model sees each tool as `mcp__<name>__<tool name>`.
|
|
24
|
+
|
|
25
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
26
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
27
|
+
|
|
28
|
+
const HINTS = ['title', 'readOnlyHint', 'destructiveHint', 'idempotentHint', 'openWorldHint'];
|
|
29
|
+
|
|
30
|
+
function checked(tools) {
|
|
31
|
+
if (!Array.isArray(tools) || tools.length === 0) throw new TypeError('staal: mcpServer takes a list of Tools from Tool.open');
|
|
32
|
+
const byName = new Map();
|
|
33
|
+
for (const t of tools) {
|
|
34
|
+
if (!t || typeof t.call !== 'function' || typeof t.name !== 'string') throw new TypeError('staal: mcpServer takes a list of Tools from Tool.open');
|
|
35
|
+
if (byName.has(t.name)) throw new TypeError(`staal: mcpServer: two tools are named '${t.name}'`);
|
|
36
|
+
byName.set(t.name, t);
|
|
37
|
+
}
|
|
38
|
+
return byName;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* `tools` as an in-process MCP server for the Agent SDK's `mcpServers` option.
|
|
43
|
+
* `options.context` is what each tool's grants (and scope) function receives, for
|
|
44
|
+
* every call made through this server; `options.name` (default "staal") must be the
|
|
45
|
+
* key the server is given in `mcpServers`.
|
|
46
|
+
*/
|
|
47
|
+
export function mcpServer(tools, options = {}) {
|
|
48
|
+
const byName = checked(tools);
|
|
49
|
+
const name = options.name ?? 'staal';
|
|
50
|
+
if (typeof name !== 'string' || !/^[A-Za-z0-9_-]+$/.test(name)) throw new TypeError('staal: mcpServer: name is letters, digits, _ and -');
|
|
51
|
+
const context = options.context;
|
|
52
|
+
const server = new Server({ name, version: '1.0.0' }, { capabilities: { tools: {} } });
|
|
53
|
+
const listed = [...byName.values()].map((t) => {
|
|
54
|
+
const annotations = {};
|
|
55
|
+
for (const k of HINTS) if (t.annotations && k in t.annotations) annotations[k] = t.annotations[k];
|
|
56
|
+
return { name: t.name, description: t.description, inputSchema: t.schema, annotations };
|
|
57
|
+
});
|
|
58
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: listed }));
|
|
59
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
60
|
+
const t = byName.get(request.params.name);
|
|
61
|
+
if (!t) return { content: [{ type: 'text', text: `there is no tool '${request.params.name}'` }], isError: true };
|
|
62
|
+
try {
|
|
63
|
+
const result = await t.call(request.params.arguments ?? {}, { context });
|
|
64
|
+
return { content: [{ type: 'text', text: result.text }], isError: result.isError };
|
|
65
|
+
} catch (e) {
|
|
66
|
+
// The call did not reach an answer (the host is closed, the grants function
|
|
67
|
+
// threw): the model is told so, as an MCP tool error, not a protocol error.
|
|
68
|
+
return { content: [{ type: 'text', text: `the tool could not be called: ${e && e.message ? e.message : String(e)}` }], isError: true };
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return { type: 'sdk', name, instance: server };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** The names the Agent SDK gives `tools` served under `name`, for `allowedTools`. */
|
|
75
|
+
export function allowedTools(name, tools) {
|
|
76
|
+
return [...checked(tools).keys()].map((n) => `mcp__${name}__${n}`);
|
|
77
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -127,6 +127,13 @@ export interface ToolOptions<Context = unknown> {
|
|
|
127
127
|
* and a run's status is given only in its scope.
|
|
128
128
|
*/
|
|
129
129
|
scope?: (context: Context) => string | Promise<string>;
|
|
130
|
+
/**
|
|
131
|
+
* Inputs only the app supplies, such as the customer a call is for: each name, an
|
|
132
|
+
* input of the entry function, maps to a function of the call's context giving its
|
|
133
|
+
* value. They are not in the schema a model sees, and a call whose arguments name
|
|
134
|
+
* one is refused.
|
|
135
|
+
*/
|
|
136
|
+
appInputs?: { [name: string]: (context: Context) => Json | Promise<Json> };
|
|
130
137
|
/** A journal directory, or an open host: one is required. */
|
|
131
138
|
journals?: string;
|
|
132
139
|
host?: Host;
|
package/index.js
CHANGED
|
@@ -134,13 +134,22 @@ const SPEC_KEYS = ['title', 'entry', 'quota', 'once', 'deadline', 'max_concurren
|
|
|
134
134
|
* same context returning the call's trusted scope as a string (a tenant's or a user's
|
|
135
135
|
* id, from the app's own records, never from the arguments): a `once` key is held
|
|
136
136
|
* within its scope, and a run's status is given only in its scope. An app serving more
|
|
137
|
-
* than one tenant or user from one journal directory gives a scope.
|
|
138
|
-
*
|
|
137
|
+
* than one tenant or user from one journal directory gives a scope. `appInputs`, if
|
|
138
|
+
* given, maps names of the entry function's inputs to functions of the same context
|
|
139
|
+
* that give their values: inputs only the app supplies, such as the customer a call
|
|
140
|
+
* is for. They are not in the schema a model sees, and a call whose arguments name
|
|
141
|
+
* one is refused. Give `journals` (a directory) or `host`.
|
|
139
142
|
*/
|
|
140
143
|
class Tool {
|
|
141
144
|
static async open(program, options) {
|
|
142
|
-
const { name, description, grants, scope, journals, host, ...spec } = options || {};
|
|
145
|
+
const { name, description, grants, scope, appInputs, journals, host, ...spec } = options || {};
|
|
143
146
|
if (scope !== undefined && typeof scope !== 'function') throw new TypeError("staal: Tool: scope is a function of the call's context");
|
|
147
|
+
if (appInputs !== undefined) {
|
|
148
|
+
const entries = appInputs !== null && typeof appInputs === 'object' && !Array.isArray(appInputs) ? Object.entries(appInputs) : [];
|
|
149
|
+
if (entries.length === 0 || !entries.every(([, f]) => typeof f === 'function')) {
|
|
150
|
+
throw new TypeError("staal: Tool: appInputs maps input names to functions of the call's context");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
144
153
|
for (const k of Object.keys(spec)) {
|
|
145
154
|
if (!SPEC_KEYS.includes(k)) throw new TypeError(`staal: Tool: unknown option '${k}'`);
|
|
146
155
|
}
|
|
@@ -151,6 +160,7 @@ class Tool {
|
|
|
151
160
|
const h = ownHost ? await Host.open(journals) : host;
|
|
152
161
|
const body = { name, description, program: str(program, 'program') };
|
|
153
162
|
if (grants !== undefined && typeof grants !== 'function') body.grants = grants;
|
|
163
|
+
if (appInputs !== undefined) body.app_inputs = Object.keys(appInputs);
|
|
154
164
|
for (const [k, v] of Object.entries(spec)) if (v !== undefined && v !== null) body[k] = v;
|
|
155
165
|
let out;
|
|
156
166
|
try {
|
|
@@ -159,7 +169,7 @@ class Tool {
|
|
|
159
169
|
if (ownHost) await h.close();
|
|
160
170
|
throw e;
|
|
161
171
|
}
|
|
162
|
-
const t = new Tool(out, h, ownHost, typeof grants === 'function' ? grants : null, scope || null);
|
|
172
|
+
const t = new Tool(out, h, ownHost, typeof grants === 'function' ? grants : null, scope || null, appInputs ? { ...appInputs } : null);
|
|
163
173
|
if (t.perCallGrants && t._grants === null) {
|
|
164
174
|
await t.close();
|
|
165
175
|
throw new TypeError('staal: Tool: the program needs grants; give grants (an object or a function of the context)');
|
|
@@ -171,9 +181,10 @@ class Tool {
|
|
|
171
181
|
return t;
|
|
172
182
|
}
|
|
173
183
|
|
|
174
|
-
constructor(out, host, ownHost, grants, scope) {
|
|
184
|
+
constructor(out, host, ownHost, grants, scope, appInputs) {
|
|
175
185
|
this._handle = out.tool;
|
|
176
186
|
this._scope = scope;
|
|
187
|
+
this._appInputs = appInputs;
|
|
177
188
|
this.host = host;
|
|
178
189
|
this._ownHost = ownHost;
|
|
179
190
|
this._grants = grants;
|
|
@@ -193,6 +204,9 @@ class Tool {
|
|
|
193
204
|
* a refusal is a result too, so a model can be told why.
|
|
194
205
|
*/
|
|
195
206
|
async call(args = {}, options = {}) {
|
|
207
|
+
if (args === null || typeof args !== 'object' || Array.isArray(args)) {
|
|
208
|
+
throw new TypeError(`staal: the arguments are an object (a JSON object), not ${args === null ? 'null' : Array.isArray(args) ? 'an array' : typeof args}`);
|
|
209
|
+
}
|
|
196
210
|
let grants;
|
|
197
211
|
if (this.perCallGrants) {
|
|
198
212
|
const g = await this._grants(options.context);
|
|
@@ -200,7 +214,13 @@ class Tool {
|
|
|
200
214
|
grants = JSON.stringify(g);
|
|
201
215
|
}
|
|
202
216
|
const scope = this._scope ? scopeOf(await this._scope(options.context)) : undefined;
|
|
203
|
-
|
|
217
|
+
let inputs;
|
|
218
|
+
if (this._appInputs) {
|
|
219
|
+
const values = {};
|
|
220
|
+
for (const [k, f] of Object.entries(this._appInputs)) values[k] = await f(options.context);
|
|
221
|
+
inputs = JSON.stringify(values);
|
|
222
|
+
}
|
|
223
|
+
const out = ok(parse(await addon.toolCall(this._handle, JSON.stringify(args), inputs, grants, scope)));
|
|
204
224
|
return {
|
|
205
225
|
status: out.status,
|
|
206
226
|
isError: out.is_error,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@staal/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Staal, the programming language for agents, for Node.js: the staalc compiler and runtime, through its C interface",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"staal",
|
|
@@ -31,7 +31,11 @@
|
|
|
31
31
|
"openai-agents.js",
|
|
32
32
|
"openai-agents.d.ts",
|
|
33
33
|
"langgraph.js",
|
|
34
|
-
"langgraph.d.ts"
|
|
34
|
+
"langgraph.d.ts",
|
|
35
|
+
"vercel-ai.mjs",
|
|
36
|
+
"vercel-ai.d.mts",
|
|
37
|
+
"claude-agent-sdk.mjs",
|
|
38
|
+
"claude-agent-sdk.d.mts"
|
|
35
39
|
],
|
|
36
40
|
"publishConfig": {
|
|
37
41
|
"access": "public"
|
|
@@ -49,7 +53,7 @@
|
|
|
49
53
|
],
|
|
50
54
|
"scripts": {
|
|
51
55
|
"test": "node --test test/staal.test.mjs",
|
|
52
|
-
"types": "tsc --noEmit -p test/tsconfig.json"
|
|
56
|
+
"types": "tsc --noEmit -p test/tsconfig.json && tsc --noEmit -p test/tsconfig.esm.json"
|
|
53
57
|
},
|
|
54
58
|
"devDependencies": {
|
|
55
59
|
"@types/node": "22.10.2",
|
|
@@ -68,11 +72,22 @@
|
|
|
68
72
|
"types": "./langgraph.d.ts",
|
|
69
73
|
"default": "./langgraph.js"
|
|
70
74
|
},
|
|
75
|
+
"./vercel-ai": {
|
|
76
|
+
"types": "./vercel-ai.d.mts",
|
|
77
|
+
"import": "./vercel-ai.mjs"
|
|
78
|
+
},
|
|
79
|
+
"./claude-agent-sdk": {
|
|
80
|
+
"types": "./claude-agent-sdk.d.mts",
|
|
81
|
+
"import": "./claude-agent-sdk.mjs"
|
|
82
|
+
},
|
|
71
83
|
"./package.json": "./package.json"
|
|
72
84
|
},
|
|
73
85
|
"peerDependencies": {
|
|
74
86
|
"@openai/agents": ">=0.20.0",
|
|
75
|
-
"@langchain/core": ">=1.2.18"
|
|
87
|
+
"@langchain/core": ">=1.2.18",
|
|
88
|
+
"ai": ">=7.0.145",
|
|
89
|
+
"@anthropic-ai/claude-agent-sdk": ">=0.3.304",
|
|
90
|
+
"@modelcontextprotocol/sdk": ">=1.29.0"
|
|
76
91
|
},
|
|
77
92
|
"peerDependenciesMeta": {
|
|
78
93
|
"@openai/agents": {
|
|
@@ -80,6 +95,15 @@
|
|
|
80
95
|
},
|
|
81
96
|
"@langchain/core": {
|
|
82
97
|
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"ai": {
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
"@anthropic-ai/claude-agent-sdk": {
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
105
|
+
"@modelcontextprotocol/sdk": {
|
|
106
|
+
"optional": true
|
|
83
107
|
}
|
|
84
108
|
}
|
|
85
109
|
}
|
package/vercel-ai.d.mts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tool } from './index.js';
|
|
2
|
+
/** A staal Tool as a Vercel AI SDK tool; `context` maps the tool's `toolsContext` entry to the staal Tool's context. */
|
|
3
|
+
export function aiTool(staalTool: Tool<any>, options?: { context?: (toolContext: any) => unknown }): any;
|
|
4
|
+
/** Several staal Tools as an AI SDK tool set, keyed by each tool's name. */
|
|
5
|
+
export function aiTools(staalTools: Tool<any>[], options?: { context?: (toolContext: any) => unknown }): Record<string, any>;
|
package/vercel-ai.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// A staal Tool as a tool of the Vercel AI SDK (`ai`, version 7, which the app installs;
|
|
2
|
+
// @staal/node does not depend on it). The AI SDK is published as ES modules only, so
|
|
3
|
+
// this adapter is one too.
|
|
4
|
+
//
|
|
5
|
+
// import { generateText, stepCountIs } from 'ai';
|
|
6
|
+
// import { aiTools } from '@staal/node/vercel-ai';
|
|
7
|
+
// const result = await generateText({
|
|
8
|
+
// model, prompt, stopWhen: stepCountIs(5),
|
|
9
|
+
// tools: aiTools([refund]),
|
|
10
|
+
// toolsContext: { refund_order: customer }, // the app's context for that tool
|
|
11
|
+
// });
|
|
12
|
+
//
|
|
13
|
+
// Each call runs the Staal program with the grants the app's policy gives for the
|
|
14
|
+
// tool's context: the AI SDK hands each tool its own entry of `toolsContext`, keyed by
|
|
15
|
+
// the tool's name, and that entry is what the Staal tool's grants (and scope) function
|
|
16
|
+
// receives, unless `options.context` maps it to something else. Context never reaches
|
|
17
|
+
// the model.
|
|
18
|
+
//
|
|
19
|
+
// The model is shown the program's argument schema as it is, without validation by
|
|
20
|
+
// the AI SDK: Staal's own check of the arguments is the one that decides, and a call it
|
|
21
|
+
// refuses comes back to the model as an error with Staal's message, as a refusal by the
|
|
22
|
+
// broker does, so the model can correct itself. Nothing is retried. An abort of the
|
|
23
|
+
// generation does not stop a Staal run that has started: its outcome is in its journal
|
|
24
|
+
// and in the tool's status, as with any call.
|
|
25
|
+
|
|
26
|
+
import { tool, jsonSchema } from 'ai';
|
|
27
|
+
|
|
28
|
+
/** `staalTool` (from Tool.open) as an AI SDK tool. Give it to `tools` under `staalTool.name`. */
|
|
29
|
+
export function aiTool(staalTool, options = {}) {
|
|
30
|
+
if (!staalTool || typeof staalTool.call !== 'function' || typeof staalTool.name !== 'string') {
|
|
31
|
+
throw new TypeError('staal: aiTool takes a Tool from Tool.open');
|
|
32
|
+
}
|
|
33
|
+
const pick = options.context || ((context) => context);
|
|
34
|
+
if (typeof pick !== 'function') throw new TypeError('staal: aiTool: options.context is a function of the tool context');
|
|
35
|
+
const schema = { ...staalTool.schema };
|
|
36
|
+
delete schema.$schema;
|
|
37
|
+
return tool({
|
|
38
|
+
description: staalTool.description,
|
|
39
|
+
// No `validate`: the AI SDK passes the model's input on as it is, and Staal checks it.
|
|
40
|
+
inputSchema: jsonSchema(schema),
|
|
41
|
+
execute: async (input, { context }) => staalTool.call(input ?? {}, { context: await pick(context) }),
|
|
42
|
+
// What the model reads: the answer's text, as an MCP client would get it, marked
|
|
43
|
+
// as an error when Staal refused or the run failed.
|
|
44
|
+
toModelOutput: ({ output }) => (output.isError ? { type: 'error-text', value: output.text } : { type: 'text', value: output.text }),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Several staal Tools as an AI SDK tool set, each under its own name. */
|
|
49
|
+
export function aiTools(staalTools, options = {}) {
|
|
50
|
+
if (!Array.isArray(staalTools)) throw new TypeError('staal: aiTools takes a list of Tools');
|
|
51
|
+
const set = {};
|
|
52
|
+
for (const t of staalTools) {
|
|
53
|
+
const made = aiTool(t, options);
|
|
54
|
+
if (Object.prototype.hasOwnProperty.call(set, t.name)) throw new TypeError(`staal: aiTools: two tools are named '${t.name}'`);
|
|
55
|
+
set[t.name] = made;
|
|
56
|
+
}
|
|
57
|
+
return set;
|
|
58
|
+
}
|