larkin 0.2.92 → 0.3.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/README.md +27 -1
- package/artifacts/release/THIRD_PARTY_NOTICES.txt +100 -1
- package/dist/app/binary-entry.mjs +6 -1
- package/dist/runtime/pi-bash-timeout-extension.mjs +4 -3
- package/dist/runtime/pi-bash-timeout-injection.mjs +6 -12
- package/dist/runtime/pi-inline-extensions.mjs +13 -0
- package/dist/runtime/pi-provider-config.cjs +13 -0
- package/dist/runtime/pi-provider-config.mjs +13 -0
- package/dist/runtime/pi-subagent-injection.mjs +6 -16
- package/dist/runtime/runtime-adapters.mjs +18 -13
- package/dist/setup/bot-register.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ npm install -g larkin
|
|
|
22
22
|
larkin --version
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Standalone binaries for macOS, Linux, and Windows (x64) are attached to every [GitHub Release](https://github.com/eddiearc/larkin/releases) for environments without Bun or npm. Windows
|
|
25
|
+
Standalone binaries for macOS, Linux, and Windows (x64) are attached to every [GitHub Release](https://github.com/eddiearc/larkin/releases) for environments without Bun or npm. The Windows 11 x64 core path has passed native end-to-end startup verification. Pull requests and releases also have a blocking native Windows gate that verifies the standalone executable's manifest and SHA-256 before checking its version, help output, and embedded Dashboard over HTTP.
|
|
26
26
|
|
|
27
27
|
## Usage
|
|
28
28
|
|
|
@@ -42,6 +42,32 @@ DeepSeek, Kimi/Moonshot, MiniMax, Zhipu/BigModel, and a custom OpenAI-compatible
|
|
|
42
42
|
are stored only in the selected Agent's private provider directory, not in the ordinary Agent config. Setup
|
|
43
43
|
also discovers every API-key and OAuth/subscription login exposed by the pinned official Pi registry and
|
|
44
44
|
delegates those flows to Pi. Use `larkin pi-auth status` or `larkin pi-auth logout <provider>` to manage them.
|
|
45
|
+
The builtin Pi runtime loads Larkin's two supported extensions inline: background subagents and the 60-second
|
|
46
|
+
foreground bash timeout guard are enabled without writing extension files or arguments. A compatible external
|
|
47
|
+
Pi installation keeps the existing explicit `-e` extension path.
|
|
48
|
+
|
|
49
|
+
### Windows support boundary and optional autostart
|
|
50
|
+
|
|
51
|
+
Windows 11 x64 core support covers the standalone CLI, local Runtime Host startup, builtin Pi RPC with the
|
|
52
|
+
inline extensions above, and the embedded Dashboard. Provider authentication, the official `lark-cli`, and
|
|
53
|
+
external Codex, Claude Code, or Pi executables remain separately installed dependencies; secret-bearing live
|
|
54
|
+
channel/provider tests are intentionally outside the hosted Windows CI gate.
|
|
55
|
+
|
|
56
|
+
An Administrator account can optionally start Larkin at that account's interactive logon with Task Scheduler.
|
|
57
|
+
From an elevated PowerShell prompt, adjust the executable and working-directory paths first:
|
|
58
|
+
|
|
59
|
+
```powershell
|
|
60
|
+
$Exe = 'C:\Tools\Larkin\larkin.exe'
|
|
61
|
+
$WorkDir = 'C:\Tools\Larkin'
|
|
62
|
+
$Action = New-ScheduledTaskAction -Execute $Exe -Argument 'start' -WorkingDirectory $WorkDir
|
|
63
|
+
$Trigger = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME
|
|
64
|
+
Register-ScheduledTask -TaskName 'Larkin Runtime Host' -Action $Action -Trigger $Trigger `
|
|
65
|
+
-Description 'Start Larkin for this Administrator account at logon' -RunLevel Highest
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
This is an optional per-user Administrator-logon task, not SYSTEM boot support or a Windows service. Keep the
|
|
69
|
+
account profile available because Larkin stores its state there. Release executables are currently unsigned;
|
|
70
|
+
normal Windows security policy and SmartScreen decisions still apply.
|
|
45
71
|
|
|
46
72
|
For supported Feishu cloud-document comments (`doc`, `docx`, `sheet`, and `file`), the safe default accepts only comments or replies that @ the Bot. Document comments never reuse IM `require`/`free` settings. An explicit platform-verified application-dimension Bot subscription accepts every supported comment event that Feishu actually delivers, whether or not it mentions the Bot. Larkin stores accepted comments as `kind=document_comment` canonical Inbox events and wakes the Bot's persistent Agent. Replies are bound back to the exact comment; whole-document comments use Feishu's top-level fallback. `larkin setup --comment-subscription application` makes the broad trigger surface explicit, creates the Bot subscription through the official `lark-cli` structured API, and then verifies it with the read-only platform status API. `--comment-subscription none` explicitly removes that application subscription and verifies removal. Until positive status verification, only @Bot comments enter the Inbox. Setup requests `docs:document.comment:create` for both in-thread replies and whole-document `create_v2` fallback, while retaining `drive:drive` for event/read support. `larkin agents` reports event readiness, reply-scope readiness, subscription mode/status/dimension, arrivals, and read failures.
|
|
47
73
|
|
|
@@ -4,7 +4,7 @@ Generated at release time from Larkin's installed runtime dependency closure.
|
|
|
4
4
|
Development-only dependencies are intentionally excluded. Packages without a bundled license file
|
|
5
5
|
use an explicitly audited, version- and hash-pinned license source and remain identified by locked package name and version.
|
|
6
6
|
|
|
7
|
-
Runtime package versions:
|
|
7
|
+
Runtime package versions: 212
|
|
8
8
|
|
|
9
9
|
| Package | Version | Relationship | Declared license | License texts (SHA-256) | Lock integrity |
|
|
10
10
|
| --- | ---: | --- | --- | --- | --- |
|
|
@@ -89,6 +89,7 @@ Runtime package versions: 208
|
|
|
89
89
|
| @radix-ui/react-use-effect-event | 0.0.5 | runtime transitive | MIT | LICENSE (0e80a2d229d2fd4fc7e8636142ec5d0ff0bc031f14c15b682e2ac01dfd5b5138) | sha512-7cshFL8HGS/7HEiHH+9kL9HBwp2sa9yX18Knwek6KYWmXwM7pegMgta2AXMQKI+rq3JnfSj9x8wYqFMTdG1Jgg== |
|
|
90
90
|
| @radix-ui/react-use-layout-effect | 1.1.4 | runtime transitive | MIT | LICENSE (0e80a2d229d2fd4fc7e8636142ec5d0ff0bc031f14c15b682e2ac01dfd5b5138) | sha512-K20DkRkUwDnxEYMBPcg3Y6voLkEy5p5QQmszZgLngKKiC7dzBR/aEuK3w1qlx2JWDUNH6FluahYdgR3BP+QbYw== |
|
|
91
91
|
| @silvia-odwyer/photon-node | 0.3.4 | runtime transitive | Apache-2.0 | LICENSE.md (db5502bc3655d2665d535496106117b522be88275d3ae459185fa20fa087a9b9) | sha512-bnly4BKB3KDTFxrUIcgCLbaeVVS8lrAkri1pEzskpmxu9MdfGQTy8b8EgcD83ywD3RPMsIulY8xJH5Awa+t9fA== |
|
|
92
|
+
| @sinclair/typebox | 0.34.52 | runtime transitive | MIT | license (411f1c560755e27b3dec9622c13b8b7a3ec1c83f4ffb8c56a8847528aa96911a) | sha512-XiMQh7qqVlxZzcVD+kkGMNGMzcTrDMLWI7S4x7z1MkCkbDPrekpZXEUK0eZqZFMuHQg2a2DZOcDIh9o5v3Gonw== |
|
|
92
93
|
| @smithy/core | 3.31.1 | runtime transitive | Apache-2.0 | LICENSE (07364a5f7d0177a59a05a0002187431f8f899320983c0dc049d72df015e8064c) | sha512-CyogUINxvi7C7LDsh8Syo6hVJOT9ckz4rG8dRZfTJ8r91HkMY59PnNooaj7WcHyxEkxPfBAmbgztZU+xTo76lg== |
|
|
93
94
|
| @smithy/credential-provider-imds | 4.4.16 | runtime transitive | Apache-2.0 | LICENSE (b659ef9e3ce8fe45329e05916c9c8bb98b436a16f4d4730a8946eec83e3950fe) | sha512-QfuLWAkLzptffFW980AFeHZFdqds2B64rpEd3uJ6lgs3xVn9QegGMUgUcj+4d7dRrAsya3r58ZKpku97WcFb4w== |
|
|
94
95
|
| @smithy/fetch-http-handler | 5.6.13 | runtime transitive | Apache-2.0 | LICENSE (b659ef9e3ce8fe45329e05916c9c8bb98b436a16f4d4730a8946eec83e3950fe) | sha512-4fW86pEUOMbrD5nkbyl/tTvPHHWJFbuB2odl6ps9lWfHoXf9HWh3Q/Smh59qH1g7+c/BSZghX6bbUk4gsiMs8A== |
|
|
@@ -99,6 +100,7 @@ Runtime package versions: 208
|
|
|
99
100
|
| @smithy/types | 4.16.1 | runtime transitive | Apache-2.0 | LICENSE (07364a5f7d0177a59a05a0002187431f8f899320983c0dc049d72df015e8064c) | sha512-0JFs3V2y2M9tKW5na/qxe69Zv+uxLMO7QBbhxF/FHu/Gp2NFZAAL9tWl9PU02xxo07pb3G9FTyjNc6D5uZrJIg== |
|
|
100
101
|
| @smithy/util-buffer-from | 2.2.0 | runtime transitive | Apache-2.0 | LICENSE (b659ef9e3ce8fe45329e05916c9c8bb98b436a16f4d4730a8946eec83e3950fe) | sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA== |
|
|
101
102
|
| @smithy/util-utf8 | 2.3.0 | runtime transitive | Apache-2.0 | LICENSE (b659ef9e3ce8fe45329e05916c9c8bb98b436a16f4d4730a8946eec83e3950fe) | sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A== |
|
|
103
|
+
| @tintinweb/pi-subagents | 0.14.3 | runtime direct | MIT | LICENSE (e7d9d11c28cce34f09dc7d2b0a3a6609ccba5fbc8e926e6d1bfdf060930e9f05) | sha512-iDqeadh6114AZvw8HYe1PEq8M0MZ9czJKTAIsklCPUbV9vUMS+g/LAV0vW3O9PiBXKNJh8hkrY8L6iIr8XNEqA== |
|
|
102
104
|
| agent-base | 6.0.2 | runtime transitive | MIT | AUDITED-agent-base@9.0.0-LICENSE (71368fd0f5b4129191e9afcd1e1ef2dc89a9090d3e4d80bbab92dafd032b3bef) | sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== |
|
|
103
105
|
| agent-base | 7.1.4 | runtime transitive | MIT | LICENSE (71368fd0f5b4129191e9afcd1e1ef2dc89a9090d3e4d80bbab92dafd032b3bef) | sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ== |
|
|
104
106
|
| agent-base | 9.0.0 | runtime transitive | MIT | LICENSE (71368fd0f5b4129191e9afcd1e1ef2dc89a9090d3e4d80bbab92dafd032b3bef) | sha512-TQf59BsZnytt8GdJKLPfUZ54g/iaUL2OWDSFCCvMOhsHduDQxO8xC4PNeyIkVcA5KwL2phPSv0douC0fgWzmnA== |
|
|
@@ -115,6 +117,7 @@ Runtime package versions: 208
|
|
|
115
117
|
| call-bound | 1.0.4 | runtime transitive | MIT | LICENSE (5e325595b4ea8cfec3802f545b1def5d7b73e4a5b8e9ba63e32a320f67732292) | sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg== |
|
|
116
118
|
| chalk | 5.6.2 | runtime transitive | MIT | license (5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3) | sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA== |
|
|
117
119
|
| combined-stream | 1.0.8 | runtime transitive | MIT | License (47eb8ca82c798246774946d1be0f9aa08f025fa8325ced0947aeeb4c05fe5547) | sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== |
|
|
120
|
+
| croner | 10.0.1 | runtime transitive | MIT | LICENSE (ad9aa40aaab4bee08121a0180096cc6a72abf29e19e606328b66c0178f41d267) | sha512-ixNtAJndqh173VQ4KodSdJEI6nuioBWI0V1ITNKhZZsO0pEMoDxz539T4FTTbSZ/xIOSuDnzxLVRqBVSvPNE2g== |
|
|
118
121
|
| cross-spawn | 7.0.6 | runtime transitive | MIT | LICENSE (aaa78451b6fecd1b9c4594c796c133c0e90cad100372ff8bc6de615e9ef9adf1) | sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== |
|
|
119
122
|
| data-uri-to-buffer | 4.0.1 | runtime transitive | MIT | AUDITED-package-declared-MIT (508a77d2e7b51d98adeed32648ad124b7b30241a8e70b2e72c99f92d8e5874d1) | sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== |
|
|
120
123
|
| debug | 4.4.3 | runtime transitive | MIT | LICENSE (23eb8602cd5902bcfca56b23aa08e8672a809f5a12eaf8bb56abfa9d44e1a4fd) | sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== |
|
|
@@ -173,6 +176,7 @@ Runtime package versions: 208
|
|
|
173
176
|
| minimatch | 10.2.5 | runtime transitive | BlueOak-1.0.0 | LICENSE.md (2c7c5d22ed5a8ee968c64757710979afcd77438c48b4a265b94e615babd8a901) | sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg== |
|
|
174
177
|
| minipass | 7.1.3 | runtime transitive | BlueOak-1.0.0 | LICENSE.md (8a1af140fdfbf5afd3df27f7e662f989c5b963a300020dfafce42033cae9e004) | sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== |
|
|
175
178
|
| ms | 2.1.3 | runtime transitive | MIT | license.md (1662fae9b5314d11cf51284e2dcd1f006a354f7343f08712a730fcff9a359801) | sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== |
|
|
179
|
+
| nanoid | 5.1.16 | runtime transitive | MIT | LICENSE (4383cb2c3608397ce7a4159502614ed66890f8999c2a9c056dd3b1024d6721f0) | sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ== |
|
|
176
180
|
| node-domexception | 1.0.0 | runtime transitive | MIT | LICENSE (8ec1386f7f078b0c7cd25341cd80f332df902371cda9f40c10ec2b4007b420b7) | sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== |
|
|
177
181
|
| node-fetch | 3.3.2 | runtime transitive | MIT | LICENSE.md (182caebbe3ce0187afa7e320d2e6038994705af419176219b959c248c984c329) | sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA== |
|
|
178
182
|
| object-inspect | 1.13.4 | runtime transitive | MIT | LICENSE (bd40cc437e28a3ad7bef2ad34e6b72e757b182e67bda1acadbab4ef0476f8232) | sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew== |
|
|
@@ -1277,6 +1281,33 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
1277
1281
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1278
1282
|
SOFTWARE.
|
|
1279
1283
|
|
|
1284
|
+
--- SHA-256 411f1c560755e27b3dec9622c13b8b7a3ec1c83f4ffb8c56a8847528aa96911a ---
|
|
1285
|
+
TypeBox
|
|
1286
|
+
|
|
1287
|
+
Json Schema Type Builder with Static Type Resolution for TypeScript
|
|
1288
|
+
|
|
1289
|
+
The MIT License (MIT)
|
|
1290
|
+
|
|
1291
|
+
Copyright (c) 2017-2026 Haydn Paterson
|
|
1292
|
+
|
|
1293
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1294
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1295
|
+
in the Software without restriction, including without limitation the rights
|
|
1296
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1297
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1298
|
+
furnished to do so, subject to the following conditions:
|
|
1299
|
+
|
|
1300
|
+
The above copyright notice and this permission notice shall be included in
|
|
1301
|
+
all copies or substantial portions of the Software.
|
|
1302
|
+
|
|
1303
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1304
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1305
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1306
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1307
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1308
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1309
|
+
THE SOFTWARE.
|
|
1310
|
+
|
|
1280
1311
|
--- SHA-256 4186c3f89c23f27b4c0caab574737c49ee5137c36a3c103484feaca4aeec2310 ---
|
|
1281
1312
|
Apache License
|
|
1282
1313
|
Version 2.0, January 2004
|
|
@@ -1503,6 +1534,28 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
1503
1534
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1504
1535
|
SOFTWARE.
|
|
1505
1536
|
|
|
1537
|
+
--- SHA-256 4383cb2c3608397ce7a4159502614ed66890f8999c2a9c056dd3b1024d6721f0 ---
|
|
1538
|
+
The MIT License (MIT)
|
|
1539
|
+
|
|
1540
|
+
Copyright 2017 Andrey Sitnik <andrey@sitnik.es>
|
|
1541
|
+
|
|
1542
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
1543
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
1544
|
+
the Software without restriction, including without limitation the rights to
|
|
1545
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
1546
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
1547
|
+
subject to the following conditions:
|
|
1548
|
+
|
|
1549
|
+
The above copyright notice and this permission notice shall be included in all
|
|
1550
|
+
copies or substantial portions of the Software.
|
|
1551
|
+
|
|
1552
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1553
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
1554
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
1555
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
1556
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
1557
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1558
|
+
|
|
1506
1559
|
--- SHA-256 46231df5a7733c3f52f11b71f3df61813007745b62b09031acfb45fb42d75082 ---
|
|
1507
1560
|
MIT License
|
|
1508
1561
|
|
|
@@ -3522,6 +3575,29 @@ SOFTWARE.
|
|
|
3522
3575
|
See the License for the specific language governing permissions and
|
|
3523
3576
|
limitations under the License.
|
|
3524
3577
|
|
|
3578
|
+
--- SHA-256 ad9aa40aaab4bee08121a0180096cc6a72abf29e19e606328b66c0178f41d267 ---
|
|
3579
|
+
The MIT License (MIT)
|
|
3580
|
+
|
|
3581
|
+
Copyright (c) 2015-2021 Hexagon <github.com/Hexagon>
|
|
3582
|
+
|
|
3583
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3584
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
3585
|
+
in the Software without restriction, including without limitation the rights
|
|
3586
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3587
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
3588
|
+
furnished to do so, subject to the following conditions:
|
|
3589
|
+
|
|
3590
|
+
The above copyright notice and this permission notice shall be included in all
|
|
3591
|
+
copies or substantial portions of the Software.
|
|
3592
|
+
|
|
3593
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3594
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3595
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3596
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3597
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3598
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
3599
|
+
SOFTWARE.
|
|
3600
|
+
|
|
3525
3601
|
--- SHA-256 b495047bd93a9b06913511076f504daba17d5bbeb3e0650f3bb53a4220329c57 ---
|
|
3526
3602
|
ISC License
|
|
3527
3603
|
|
|
@@ -5279,6 +5355,29 @@ Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors
|
|
|
5279
5355
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
5280
5356
|
THE SOFTWARE.
|
|
5281
5357
|
|
|
5358
|
+
--- SHA-256 e7d9d11c28cce34f09dc7d2b0a3a6609ccba5fbc8e926e6d1bfdf060930e9f05 ---
|
|
5359
|
+
MIT License
|
|
5360
|
+
|
|
5361
|
+
Copyright (c) 2026 tintinweb
|
|
5362
|
+
|
|
5363
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5364
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5365
|
+
in the Software without restriction, including without limitation the rights
|
|
5366
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
5367
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
5368
|
+
furnished to do so, subject to the following conditions:
|
|
5369
|
+
|
|
5370
|
+
The above copyright notice and this permission notice shall be included in all
|
|
5371
|
+
copies or substantial portions of the Software.
|
|
5372
|
+
|
|
5373
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
5374
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
5375
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
5376
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
5377
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
5378
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
5379
|
+
SOFTWARE.
|
|
5380
|
+
|
|
5282
5381
|
--- SHA-256 e7dc37bf662d7f786efcb46c545615e70c1daf458a38385521c63cf6607cdfe1 ---
|
|
5283
5382
|
BSD 3-Clause License
|
|
5284
5383
|
|
|
@@ -52,7 +52,12 @@ async function dispatchInternal(mode, rest) {
|
|
|
52
52
|
case "pi-rpc": {
|
|
53
53
|
const { prepareBuiltinPiPackageAssets } = await import("../runtime/builtin-pi-assets.mjs");
|
|
54
54
|
prepareBuiltinPiPackageAssets();
|
|
55
|
-
|
|
55
|
+
process.title = "pi-rpc";
|
|
56
|
+
process.env.PI_CODING_AGENT = "true";
|
|
57
|
+
process.emitWarning = (() => { });
|
|
58
|
+
const { main: piMain } = await import("@earendil-works/pi-coding-agent");
|
|
59
|
+
const { invokeBuiltinPiRpc } = await import("../runtime/pi-inline-extensions.mjs");
|
|
60
|
+
await invokeBuiltinPiRpc(piMain, rest);
|
|
56
61
|
return;
|
|
57
62
|
}
|
|
58
63
|
case "pi-auth":
|
|
@@ -2,15 +2,16 @@ import { createBashToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
|
2
2
|
/**
|
|
3
3
|
* pi bash 工具超时护栏扩展。
|
|
4
4
|
*
|
|
5
|
-
* 由
|
|
5
|
+
* 由 Larkin 向 builtin Pi 传入 inline factory,或通过 external Pi 的
|
|
6
|
+
* `pi --extension/-e <bundle>` 注入,覆盖内置 `bash` 工具:
|
|
6
7
|
* - 无论模型是否传 `timeout`,都强制收窄到 <= MAX_BASH_SECONDS(默认 60s),
|
|
7
8
|
* 避免单个 bash 调用无限期占住整个 agent 回合(issue #55)。
|
|
8
9
|
* - 超时时 pi 会杀掉整个进程树(不残留卡死子进程,issue #56 的进程堆积),
|
|
9
10
|
* 并在返回的错误里明确提示:长任务必须改用后台 subagent
|
|
10
11
|
* (Agent(run_in_background: true),来自 pi-subagents 扩展)。
|
|
11
12
|
*
|
|
12
|
-
* 这是 pi 扩展,运行在
|
|
13
|
-
*
|
|
13
|
+
* 这是 pi 扩展,运行在 Pi RPC 子进程内部;build.mjs 仍为 external Pi
|
|
14
|
+
* 单独产出注入 bundle。
|
|
14
15
|
*/
|
|
15
16
|
/** 前台 bash 的硬性上限(秒)。issue #55 建议默认 60s。 */
|
|
16
17
|
const MAX_BASH_SECONDS = 60;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import {
|
|
5
|
-
import { parsePiVersion, piVersionSupportsSubagents, probeExternalPiVersion } from "./pi-subagent-injection.mjs";
|
|
4
|
+
import { piVersionSupportsSubagents, probeExternalPiVersion } from "./pi-subagent-injection.mjs";
|
|
6
5
|
/**
|
|
7
6
|
* pi-bash-timeout 扩展注入(bash 60s 超时护栏,issue #55/#56)。
|
|
8
7
|
*
|
|
9
8
|
* 分发:构建期把 src/runtime/pi-bash-timeout-extension.ts bundle 成单文件
|
|
10
|
-
* `dist/runtime/pi-bash-timeout.bundle.js`(pi-* 包 external
|
|
11
|
-
* `pi --extension/-e`
|
|
12
|
-
*
|
|
9
|
+
* `dist/runtime/pi-bash-timeout.bundle.js`(pi-* 包 external),运行时仅向 external
|
|
10
|
+
* (用户 pi CLI)通过 `pi --extension/-e` 显式注入,不碰用户 ~/.pi 配置。
|
|
11
|
+
* Builtin Pi 直接接收静态 factory。与 pi-subagents 共享同一个 external 版本门槛。
|
|
13
12
|
*/
|
|
14
13
|
/** 把 embedded bundle 落盘到 <configDir>/providers/pi/extensions/(0700/0600)。无 embedded 资产返回 null。 */
|
|
15
14
|
export function materializeEmbeddedPiBashTimeoutBundle(configDir) {
|
|
@@ -46,15 +45,10 @@ export function bundledPiBashTimeoutExtensionPath(configDir) {
|
|
|
46
45
|
}
|
|
47
46
|
return materializeEmbeddedPiBashTimeoutBundle(configDir);
|
|
48
47
|
}
|
|
49
|
-
/**
|
|
50
|
-
* 注入决策:builtin 恒注入(内嵌 pi 版本固定);external 需探测版本(与
|
|
51
|
-
* pi-subagents 同门槛 >= 0.80.0,保证 createBashToolDefinition 可用)。
|
|
52
|
-
* 返回 `-e` 参数值,或 null(产物缺失或版本不达标)。
|
|
53
|
-
*/
|
|
48
|
+
/** External Pi 需满足 >= 0.80.0;返回 bundle 路径或 null。 */
|
|
54
49
|
export function resolvePiBashTimeoutExtensionArg(input, probeVersion = () => probeExternalPiVersion(input.piCommand, input.env), resolveBundle = () => bundledPiBashTimeoutExtensionPath(input.env.LARKIN_CONFIG_DIR)) {
|
|
55
50
|
const bundle = resolveBundle();
|
|
56
51
|
if (!bundle)
|
|
57
52
|
return null;
|
|
58
|
-
|
|
59
|
-
return piVersionSupportsSubagents(version) ? bundle : null;
|
|
53
|
+
return piVersionSupportsSubagents(probeVersion()) ? bundle : null;
|
|
60
54
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import subagentsExtension from "@tintinweb/pi-subagents/dist/index.js";
|
|
2
|
+
import bashTimeoutExtension from "./pi-bash-timeout-extension.mjs";
|
|
3
|
+
/** Builtin Pi extensions are loaded as code, never through Pi's path/data-URL loader. */
|
|
4
|
+
export const BUILTIN_PI_EXTENSION_FACTORIES = Object.freeze([
|
|
5
|
+
subagentsExtension,
|
|
6
|
+
bashTimeoutExtension,
|
|
7
|
+
]);
|
|
8
|
+
/** Invoke Pi RPC with Larkin's builtin-only extension factories. */
|
|
9
|
+
export async function invokeBuiltinPiRpc(piMain, rest) {
|
|
10
|
+
await piMain(["--mode", "rpc", ...rest], {
|
|
11
|
+
extensionFactories: [...BUILTIN_PI_EXTENSION_FACTORIES],
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -37,6 +37,19 @@ exports.PI_PROVIDER_PRESETS = Object.freeze([
|
|
|
37
37
|
{ id: "kimi-coding", name: "Kimi For Coding", provider: "kimi-coding", baseUrl: "https://api.kimi.com/coding", defaultModel: "kimi-for-coding", api: "openai-completions" },
|
|
38
38
|
{ id: "qwen-cn", name: "通义千问 Token Plan(中国)", provider: "qwen-token-plan-cn", baseUrl: "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1", defaultModel: "qwen3.7-max", api: "openai-completions" },
|
|
39
39
|
{ id: "opencode-go", name: "OpenCode Go", provider: "opencode-go", baseUrl: "https://opencode.ai/zen/go/v1", defaultModel: "kimi-k2.6", api: "openai-completions" },
|
|
40
|
+
{ id: "ant-ling", name: "Ant Ling", provider: "ant-ling", baseUrl: "https://api.ant-ling.com/v1", defaultModel: "Ring-2.6-1T", api: "openai-completions" },
|
|
41
|
+
{ id: "nvidia", name: "NVIDIA NIM", provider: "nvidia", baseUrl: "https://integrate.api.nvidia.com/v1", defaultModel: "google/gemma-3-12b-it", api: "openai-completions" },
|
|
42
|
+
{ id: "huggingface", name: "Hugging Face", provider: "huggingface", baseUrl: "https://router.huggingface.co/v1", defaultModel: "MiniMaxAI/MiniMax-M2", api: "openai-completions" },
|
|
43
|
+
{ id: "minimax-global", name: "MiniMax(全球)", provider: "minimax", baseUrl: "https://api.minimax.io/anthropic", defaultModel: "MiniMax-M2.7", api: "anthropic-messages" },
|
|
44
|
+
{ id: "moonshotai", name: "Moonshot(全球)", provider: "moonshotai", baseUrl: "https://api.moonshot.ai/v1", defaultModel: "kimi-k2-0711-preview", api: "openai-completions" },
|
|
45
|
+
{ id: "opencode", name: "OpenCode Zen", provider: "opencode", baseUrl: "https://opencode.ai/zen", defaultModel: "claude-fable-5", api: "openai-completions" },
|
|
46
|
+
{ id: "qwen-token-plan", name: "通义千问 Token Plan(全球)", provider: "qwen-token-plan", baseUrl: "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1", defaultModel: "qwen3.7-max", api: "openai-completions" },
|
|
47
|
+
{ id: "vercel-ai-gateway", name: "Vercel AI Gateway", provider: "vercel-ai-gateway", baseUrl: "https://ai-gateway.vercel.sh", defaultModel: "zai/glm-5.1", api: "anthropic-messages" },
|
|
48
|
+
{ id: "xiaomi", name: "Xiaomi MiMo", provider: "xiaomi", baseUrl: "https://api.xiaomimimo.com/v1", defaultModel: "mimo-v2-flash", api: "openai-completions" },
|
|
49
|
+
{ id: "xiaomi-token-plan-cn", name: "Xiaomi MiMo Token Plan(中国)", provider: "xiaomi-token-plan-cn", baseUrl: "https://token-plan-cn.xiaomimimo.com/v1", defaultModel: "mimo-v2.5-pro", api: "openai-completions" },
|
|
50
|
+
{ id: "xiaomi-token-plan-ams", name: "Xiaomi MiMo Token Plan(阿姆斯特丹)", provider: "xiaomi-token-plan-ams", baseUrl: "https://token-plan-ams.xiaomimimo.com/v1", defaultModel: "mimo-v2.5-pro", api: "openai-completions" },
|
|
51
|
+
{ id: "xiaomi-token-plan-sgp", name: "Xiaomi MiMo Token Plan(新加坡)", provider: "xiaomi-token-plan-sgp", baseUrl: "https://token-plan-sgp.xiaomimimo.com/v1", defaultModel: "mimo-v2.5-pro", api: "openai-completions" },
|
|
52
|
+
{ id: "zai", name: "ZAI Coding Plan(全球)", provider: "zai", baseUrl: "https://api.z.ai/api/coding/paas/v4", defaultModel: "glm-4.5-air", api: "openai-completions" },
|
|
40
53
|
]);
|
|
41
54
|
const APP_ID = /^cli_[A-Za-z0-9]+$/;
|
|
42
55
|
const MODEL_ID = /^[A-Za-z0-9][A-Za-z0-9._:@+\/-]{0,255}$/;
|
|
@@ -23,6 +23,19 @@ export const PI_PROVIDER_PRESETS = Object.freeze([
|
|
|
23
23
|
{ id: "kimi-coding", name: "Kimi For Coding", provider: "kimi-coding", baseUrl: "https://api.kimi.com/coding", defaultModel: "kimi-for-coding", api: "openai-completions" },
|
|
24
24
|
{ id: "qwen-cn", name: "通义千问 Token Plan(中国)", provider: "qwen-token-plan-cn", baseUrl: "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1", defaultModel: "qwen3.7-max", api: "openai-completions" },
|
|
25
25
|
{ id: "opencode-go", name: "OpenCode Go", provider: "opencode-go", baseUrl: "https://opencode.ai/zen/go/v1", defaultModel: "kimi-k2.6", api: "openai-completions" },
|
|
26
|
+
{ id: "ant-ling", name: "Ant Ling", provider: "ant-ling", baseUrl: "https://api.ant-ling.com/v1", defaultModel: "Ring-2.6-1T", api: "openai-completions" },
|
|
27
|
+
{ id: "nvidia", name: "NVIDIA NIM", provider: "nvidia", baseUrl: "https://integrate.api.nvidia.com/v1", defaultModel: "google/gemma-3-12b-it", api: "openai-completions" },
|
|
28
|
+
{ id: "huggingface", name: "Hugging Face", provider: "huggingface", baseUrl: "https://router.huggingface.co/v1", defaultModel: "MiniMaxAI/MiniMax-M2", api: "openai-completions" },
|
|
29
|
+
{ id: "minimax-global", name: "MiniMax(全球)", provider: "minimax", baseUrl: "https://api.minimax.io/anthropic", defaultModel: "MiniMax-M2.7", api: "anthropic-messages" },
|
|
30
|
+
{ id: "moonshotai", name: "Moonshot(全球)", provider: "moonshotai", baseUrl: "https://api.moonshot.ai/v1", defaultModel: "kimi-k2-0711-preview", api: "openai-completions" },
|
|
31
|
+
{ id: "opencode", name: "OpenCode Zen", provider: "opencode", baseUrl: "https://opencode.ai/zen", defaultModel: "claude-fable-5", api: "openai-completions" },
|
|
32
|
+
{ id: "qwen-token-plan", name: "通义千问 Token Plan(全球)", provider: "qwen-token-plan", baseUrl: "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1", defaultModel: "qwen3.7-max", api: "openai-completions" },
|
|
33
|
+
{ id: "vercel-ai-gateway", name: "Vercel AI Gateway", provider: "vercel-ai-gateway", baseUrl: "https://ai-gateway.vercel.sh", defaultModel: "zai/glm-5.1", api: "anthropic-messages" },
|
|
34
|
+
{ id: "xiaomi", name: "Xiaomi MiMo", provider: "xiaomi", baseUrl: "https://api.xiaomimimo.com/v1", defaultModel: "mimo-v2-flash", api: "openai-completions" },
|
|
35
|
+
{ id: "xiaomi-token-plan-cn", name: "Xiaomi MiMo Token Plan(中国)", provider: "xiaomi-token-plan-cn", baseUrl: "https://token-plan-cn.xiaomimimo.com/v1", defaultModel: "mimo-v2.5-pro", api: "openai-completions" },
|
|
36
|
+
{ id: "xiaomi-token-plan-ams", name: "Xiaomi MiMo Token Plan(阿姆斯特丹)", provider: "xiaomi-token-plan-ams", baseUrl: "https://token-plan-ams.xiaomimimo.com/v1", defaultModel: "mimo-v2.5-pro", api: "openai-completions" },
|
|
37
|
+
{ id: "xiaomi-token-plan-sgp", name: "Xiaomi MiMo Token Plan(新加坡)", provider: "xiaomi-token-plan-sgp", baseUrl: "https://token-plan-sgp.xiaomimimo.com/v1", defaultModel: "mimo-v2.5-pro", api: "openai-completions" },
|
|
38
|
+
{ id: "zai", name: "ZAI Coding Plan(全球)", provider: "zai", baseUrl: "https://api.z.ai/api/coding/paas/v4", defaultModel: "glm-4.5-air", api: "openai-completions" },
|
|
26
39
|
]);
|
|
27
40
|
const APP_ID = /^cli_[A-Za-z0-9]+$/;
|
|
28
41
|
const MODEL_ID = /^[A-Za-z0-9][A-Za-z0-9._:@+\/-]{0,255}$/;
|
|
@@ -2,14 +2,13 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { BUNDLED_PI_VERSION } from "./pi-provider-config.mjs";
|
|
6
5
|
/**
|
|
7
6
|
* pi-subagents 扩展注入。
|
|
8
7
|
*
|
|
9
8
|
* 分发:构建期把 @tintinweb/pi-subagents bundle 成单文件
|
|
10
|
-
* `dist/runtime/pi-subagents.bundle.js`(pi-* 包 external
|
|
11
|
-
* `pi --extension/-e`
|
|
12
|
-
*
|
|
9
|
+
* `dist/runtime/pi-subagents.bundle.js`(pi-* 包 external),运行时仅向 external
|
|
10
|
+
* (用户 pi CLI)通过 `pi --extension/-e` 显式注入,不碰用户 ~/.pi 配置。
|
|
11
|
+
* Builtin Pi 直接接收静态 factory,不经过本文件或 Pi 的路径加载器。
|
|
13
12
|
*
|
|
14
13
|
* 版本门槛:pi-subagents peerDependency 要求 @earendil-works/pi-* >= 0.80.0;
|
|
15
14
|
* external 的 pi 版本低于 0.80 时不注入(降级为无 subagent 能力)。
|
|
@@ -70,21 +69,13 @@ export function piVersionSupportsSubagents(version) {
|
|
|
70
69
|
return false;
|
|
71
70
|
return version.major > 0 || (version.major === 0 && version.minor >= 80);
|
|
72
71
|
}
|
|
73
|
-
/**
|
|
74
|
-
* 解析 `pi --version`(external 专用;builtin 用 BUNDLED_PI_VERSION 常量,无需探测)。
|
|
75
|
-
* 返回 null 表示无法确认版本(视为不支持,不注入)。
|
|
76
|
-
*/
|
|
72
|
+
/** 解析 external `pi --version`;无法确认版本时视为不支持,不注入。 */
|
|
77
73
|
export function probeExternalPiVersion(piCommand, env) {
|
|
78
74
|
const result = spawnSync(piCommand, ["--version"], { env, encoding: "utf8", timeout: 5_000, maxBuffer: 64 * 1024 });
|
|
79
75
|
if (result.error || result.status !== 0)
|
|
80
76
|
return null;
|
|
81
77
|
return parsePiVersion(String(result.stdout || result.stderr || ""));
|
|
82
78
|
}
|
|
83
|
-
/**
|
|
84
|
-
* 注入决策:builtin 恒注入(内嵌 pi 版本固定 BUNDLED_PI_VERSION);external 需探测版本。
|
|
85
|
-
* 返回 `-e` 参数值(扩展 bundle 路径),或 null(不注入:产物缺失或版本不达标)。
|
|
86
|
-
* `probeVersion` 仅供测试注入;缺省时 external 用 probeExternalPiVersion 探测。
|
|
87
|
-
*/
|
|
88
79
|
/**
|
|
89
80
|
* 用户 pi 是否已自行安装 pi-subagents(settings.json packages 或包目录)。
|
|
90
81
|
* 已装时 Larkin 不再 -e 注入,避免同名工具(Agent/get_subagent_result/steer_subagent)
|
|
@@ -122,8 +113,7 @@ export function resolvePiSubagentExtensionArg(input, probeVersion = () => probeE
|
|
|
122
113
|
if (!bundle)
|
|
123
114
|
return null;
|
|
124
115
|
// 用户已自行安装同款扩展时跳过注入,避免工具名重复注册冲突。
|
|
125
|
-
if (
|
|
116
|
+
if (userPiAlreadyHasSubagentsExtension(input.env))
|
|
126
117
|
return null;
|
|
127
|
-
|
|
128
|
-
return piVersionSupportsSubagents(version) ? bundle : null;
|
|
118
|
+
return piVersionSupportsSubagents(probeVersion()) ? bundle : null;
|
|
129
119
|
}
|
|
@@ -9,7 +9,6 @@ import { internalCommandSpec } from "../app/internal-command.mjs";
|
|
|
9
9
|
import { piAgentDirectory } from "./pi-provider-config.mjs";
|
|
10
10
|
import { resolvePiSubagentExtensionArg } from "./pi-subagent-injection.mjs";
|
|
11
11
|
import { resolvePiBashTimeoutExtensionArg } from "./pi-bash-timeout-injection.mjs";
|
|
12
|
-
import { isWindows } from "../platform/secure-metadata.mjs";
|
|
13
12
|
import { classifyRuntimePrerequisite, probeNativeRuntimeReadiness, providerAuthenticationFailureReadiness, RuntimePrerequisiteError, } from "./runtime-readiness.mjs";
|
|
14
13
|
class EventSession {
|
|
15
14
|
listeners = new Set();
|
|
@@ -795,6 +794,21 @@ class PiRpcBackend {
|
|
|
795
794
|
return () => { offEvent(); offFailure(); };
|
|
796
795
|
}
|
|
797
796
|
}
|
|
797
|
+
export function resolvePiProcessExtensionArgs(input, resolvers = {}) {
|
|
798
|
+
// Builtin factories are passed directly to Pi main on every platform. The platform
|
|
799
|
+
// field makes that invariant explicit and testable without changing process.platform.
|
|
800
|
+
if (input.distribution === "builtin")
|
|
801
|
+
return [];
|
|
802
|
+
const resolverInput = { distribution: "external", piCommand: input.piCommand, env: input.env };
|
|
803
|
+
const args = [];
|
|
804
|
+
const subagents = (resolvers.subagents ?? resolvePiSubagentExtensionArg)(resolverInput);
|
|
805
|
+
if (subagents)
|
|
806
|
+
args.push("-e", subagents);
|
|
807
|
+
const bashTimeout = (resolvers.bashTimeout ?? resolvePiBashTimeoutExtensionArg)(resolverInput);
|
|
808
|
+
if (bashTimeout)
|
|
809
|
+
args.push("-e", bashTimeout);
|
|
810
|
+
return args;
|
|
811
|
+
}
|
|
798
812
|
async function createPiRpcBackend(input, dependencies, spawn) {
|
|
799
813
|
const stateRoot = input.stateDir ?? path.join(input.workspaceDir, ".larkin");
|
|
800
814
|
const runtimeDir = path.join(stateRoot, "runtime");
|
|
@@ -821,21 +835,12 @@ async function createPiRpcBackend(input, dependencies, spawn) {
|
|
|
821
835
|
mergedEnv.PI_CODING_AGENT_DIR = piAgentDirectory(mergedEnv.LARKIN_CONFIG_DIR, input.agentId);
|
|
822
836
|
mergedEnv.PI_TELEMETRY = "0";
|
|
823
837
|
}
|
|
824
|
-
|
|
825
|
-
distribution: builtin ? "builtin" : "external",
|
|
826
|
-
piCommand: command,
|
|
827
|
-
env: mergedEnv,
|
|
828
|
-
});
|
|
829
|
-
if (subagentExtension)
|
|
830
|
-
commandArgs.push("-e", subagentExtension);
|
|
831
|
-
// bash 60s 超时护栏(issue #55/#56):与 pi-subagents 一起注入,两者工具名不冲突。
|
|
832
|
-
const bashTimeoutExtension = builtin && isWindows ? null : resolvePiBashTimeoutExtensionArg({
|
|
838
|
+
commandArgs.push(...(dependencies.resolvePiProcessExtensionArgs ?? resolvePiProcessExtensionArgs)({
|
|
833
839
|
distribution: builtin ? "builtin" : "external",
|
|
834
840
|
piCommand: command,
|
|
835
841
|
env: mergedEnv,
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
commandArgs.push("-e", bashTimeoutExtension);
|
|
842
|
+
platform: process.platform,
|
|
843
|
+
}));
|
|
839
844
|
const child = spawn(command, commandArgs, {
|
|
840
845
|
cwd: input.workspaceDir,
|
|
841
846
|
env: mergedEnv,
|
|
@@ -596,7 +596,7 @@ export async function main() {
|
|
|
596
596
|
const setupModel = flag("--model");
|
|
597
597
|
if (piDistributionFlag === "builtin") {
|
|
598
598
|
if (!setupProvider && !setupBaseUrl) {
|
|
599
|
-
throw new Error(
|
|
599
|
+
throw new Error(`builtin-pi 需要 --provider <id>(${PI_PROVIDER_PRESETS.map((p) => p.id).join("|")}|custom)或 --base-url;或改用 --runtime external-pi 使用已有 pi 环境`);
|
|
600
600
|
}
|
|
601
601
|
if (!setupApiKey)
|
|
602
602
|
throw new Error("builtin-pi 需要 --api-key;或改用 --runtime external-pi 使用已有 pi 登录");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "larkin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"larkinPackageRole": "npm-published",
|
|
6
6
|
"files": [
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@earendil-works/pi-coding-agent": "0.83.0",
|
|
86
|
+
"@tintinweb/pi-subagents": "0.14.3",
|
|
86
87
|
"@larksuite/channel": "^0.4.0",
|
|
87
88
|
"@opentelemetry/api": "^1.9.1",
|
|
88
89
|
"@opentelemetry/resources": "^2.10.0",
|
|
@@ -101,7 +102,6 @@
|
|
|
101
102
|
"@testing-library/jest-dom": "^7.0.0",
|
|
102
103
|
"@testing-library/react": "^16.3.2",
|
|
103
104
|
"@testing-library/user-event": "^14.6.1",
|
|
104
|
-
"@tintinweb/pi-subagents": "0.14.3",
|
|
105
105
|
"@types/node": "^26.1.1",
|
|
106
106
|
"@types/react": "19.2.14",
|
|
107
107
|
"@types/react-dom": "19.2.3",
|