tianshu-harness 3.23.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.
Files changed (255) hide show
  1. package/LICENSE +189 -0
  2. package/README.en.md +1066 -0
  3. package/README.ja.md +1214 -0
  4. package/README.ko.md +1216 -0
  5. package/README.md +309 -0
  6. package/completions/rivet.bash +118 -0
  7. package/completions/rivet.fish +110 -0
  8. package/completions/rivet.ps1 +230 -0
  9. package/completions/rivet.zsh +187 -0
  10. package/dist/account-OAEKORZE.js +47 -0
  11. package/dist/account-login-V6FOLHJR.js +65 -0
  12. package/dist/account-status-KHNPPAFL.js +23 -0
  13. package/dist/agent/worker-process/child.js +407 -0
  14. package/dist/browser-cli-FLNY5ZHI.js +19 -0
  15. package/dist/browser-readiness-LWVGSBD5.js +12 -0
  16. package/dist/build-backends-5KXKR2S4.js +13 -0
  17. package/dist/build-options-66Y4ZE7C.js +9 -0
  18. package/dist/bundled-skills/brainstorming/SKILL.md +139 -0
  19. package/dist/bundled-skills/visual-acceptance/SKILL.md +64 -0
  20. package/dist/chain-7MAMFXZ3.js +10 -0
  21. package/dist/checkpoint-MND4DUIX.js +33 -0
  22. package/dist/chunk-2E6CK2RC.js +392 -0
  23. package/dist/chunk-2EBWGAXD.js +51 -0
  24. package/dist/chunk-2HDP7RMR.js +119 -0
  25. package/dist/chunk-2HKD2UFM.js +1000 -0
  26. package/dist/chunk-2VYRLULP.js +51 -0
  27. package/dist/chunk-2XN7PM4N.js +125 -0
  28. package/dist/chunk-35H7GVNR.js +66 -0
  29. package/dist/chunk-3C3R7JXY.js +77 -0
  30. package/dist/chunk-3VGD2FXB.js +118 -0
  31. package/dist/chunk-424AP7FM.js +534 -0
  32. package/dist/chunk-4J5TZGOE.js +3707 -0
  33. package/dist/chunk-4QJ3Y5JM.js +898 -0
  34. package/dist/chunk-4U2ET7ZY.js +1326 -0
  35. package/dist/chunk-4XPFLICE.js +876 -0
  36. package/dist/chunk-5B2OCU5P.js +31707 -0
  37. package/dist/chunk-5GGOGLSN.js +73 -0
  38. package/dist/chunk-5JRZPLI6.js +251 -0
  39. package/dist/chunk-5TQ3JYBU.js +397 -0
  40. package/dist/chunk-66JPZSGX.js +55 -0
  41. package/dist/chunk-6HSVXHCZ.js +764 -0
  42. package/dist/chunk-6S5FPUS7.js +21 -0
  43. package/dist/chunk-722LQO64.js +131 -0
  44. package/dist/chunk-73NJ7IT7.js +354 -0
  45. package/dist/chunk-7FW3I7WC.js +95 -0
  46. package/dist/chunk-7KUCBNLB.js +173 -0
  47. package/dist/chunk-7RDOV3DF.js +201 -0
  48. package/dist/chunk-A5MNH4ER.js +79 -0
  49. package/dist/chunk-ADIVZ2D5.js +15 -0
  50. package/dist/chunk-AE3P3F6W.js +366 -0
  51. package/dist/chunk-AERM3VGP.js +280 -0
  52. package/dist/chunk-AEWHC4WM.js +246 -0
  53. package/dist/chunk-AOVQ7VIF.js +169 -0
  54. package/dist/chunk-AOYHP3WI.js +12411 -0
  55. package/dist/chunk-B3YEBABJ.js +7160 -0
  56. package/dist/chunk-BCQXEZPJ.js +154 -0
  57. package/dist/chunk-BKTQAYO2.js +418 -0
  58. package/dist/chunk-BSECIPAQ.js +80 -0
  59. package/dist/chunk-BUIMGNDD.js +52 -0
  60. package/dist/chunk-BXHV3GSB.js +10320 -0
  61. package/dist/chunk-C6ZVZCPP.js +139 -0
  62. package/dist/chunk-CEZNQVWM.js +82 -0
  63. package/dist/chunk-CGFZGR7G.js +1492 -0
  64. package/dist/chunk-CGOADM2X.js +337 -0
  65. package/dist/chunk-CI4R6P2B.js +24 -0
  66. package/dist/chunk-D2TCGRSX.js +73 -0
  67. package/dist/chunk-D4PTYFOG.js +154 -0
  68. package/dist/chunk-D54ZWG4T.js +717 -0
  69. package/dist/chunk-DEBI37QB.js +145 -0
  70. package/dist/chunk-DWROHPXP.js +1051 -0
  71. package/dist/chunk-DZ6UOJ5D.js +92 -0
  72. package/dist/chunk-EBJTVRQN.js +81 -0
  73. package/dist/chunk-EGEI2RQA.js +1167 -0
  74. package/dist/chunk-EHHUASO5.js +1305 -0
  75. package/dist/chunk-EPKTIOED.js +41 -0
  76. package/dist/chunk-ER5JW2QZ.js +5681 -0
  77. package/dist/chunk-ETHFACAB.js +315 -0
  78. package/dist/chunk-EXUE5W2F.js +112 -0
  79. package/dist/chunk-EXXICUIW.js +73 -0
  80. package/dist/chunk-FFQSZJOO.js +169 -0
  81. package/dist/chunk-FHFKPGDO.js +85 -0
  82. package/dist/chunk-FW3QKMFX.js +158 -0
  83. package/dist/chunk-GD4ZNZ7W.js +30 -0
  84. package/dist/chunk-GHVMWF2I.js +581 -0
  85. package/dist/chunk-GMKAXSYQ.js +297 -0
  86. package/dist/chunk-HBVF6BWO.js +325 -0
  87. package/dist/chunk-HV4YGVMS.js +379 -0
  88. package/dist/chunk-ILBCKAV6.js +89 -0
  89. package/dist/chunk-J4U4AW46.js +440 -0
  90. package/dist/chunk-J6ESSM47.js +1791 -0
  91. package/dist/chunk-JBZHIC6T.js +2309 -0
  92. package/dist/chunk-JCFWOULR.js +245 -0
  93. package/dist/chunk-JRF5L6OD.js +131 -0
  94. package/dist/chunk-JSS75KCG.js +2014 -0
  95. package/dist/chunk-JSXWIWWJ.js +225 -0
  96. package/dist/chunk-JYV7I2QH.js +98 -0
  97. package/dist/chunk-KIOXTQQL.js +1596 -0
  98. package/dist/chunk-KWVTXT5B.js +89 -0
  99. package/dist/chunk-KX22RD6R.js +33 -0
  100. package/dist/chunk-LA6IPTGH.js +709 -0
  101. package/dist/chunk-LH5VCGLB.js +1796 -0
  102. package/dist/chunk-LQQ6XJ2Y.js +269 -0
  103. package/dist/chunk-MJQ55WZZ.js +65 -0
  104. package/dist/chunk-ML3UKMH3.js +40 -0
  105. package/dist/chunk-MOZPLHSU.js +5526 -0
  106. package/dist/chunk-NGEWJ4DF.js +89 -0
  107. package/dist/chunk-NH6VIOAR.js +211 -0
  108. package/dist/chunk-O5VZQKCB.js +26106 -0
  109. package/dist/chunk-OHSV42QB.js +748 -0
  110. package/dist/chunk-OO3TAHO5.js +4070 -0
  111. package/dist/chunk-OTNHSAGN.js +38282 -0
  112. package/dist/chunk-OUWAC7AQ.js +442 -0
  113. package/dist/chunk-OXMIV4WE.js +270 -0
  114. package/dist/chunk-P5KJURUR.js +229 -0
  115. package/dist/chunk-P6GJOVO6.js +307 -0
  116. package/dist/chunk-QARAGUXX.js +23 -0
  117. package/dist/chunk-R43HJCDX.js +2711 -0
  118. package/dist/chunk-RAXBAWRN.js +210 -0
  119. package/dist/chunk-RK3JHWPT.js +39 -0
  120. package/dist/chunk-RWA23GMM.js +24 -0
  121. package/dist/chunk-S4K4L6IM.js +179 -0
  122. package/dist/chunk-SAXK6LVF.js +124 -0
  123. package/dist/chunk-SEPGEJNK.js +1607 -0
  124. package/dist/chunk-SUJERP5I.js +285 -0
  125. package/dist/chunk-T3ED6BY2.js +913 -0
  126. package/dist/chunk-THKDVSEC.js +90 -0
  127. package/dist/chunk-TI4GSEL5.js +52 -0
  128. package/dist/chunk-TPI73L57.js +164 -0
  129. package/dist/chunk-TVHW77C7.js +338 -0
  130. package/dist/chunk-TWNHOSDT.js +1073 -0
  131. package/dist/chunk-UFMN76QD.js +347 -0
  132. package/dist/chunk-UHGLFRZE.js +205 -0
  133. package/dist/chunk-UTZYPKBF.js +15231 -0
  134. package/dist/chunk-UXNLELW6.js +25 -0
  135. package/dist/chunk-UXXS53EA.js +166 -0
  136. package/dist/chunk-V5DHFGI7.js +171 -0
  137. package/dist/chunk-V5YIPMHV.js +2353 -0
  138. package/dist/chunk-WMUWEO2C.js +754 -0
  139. package/dist/chunk-WOE3D7JM.js +945 -0
  140. package/dist/chunk-X2IK5LVR.js +2592 -0
  141. package/dist/chunk-XU2YXCDL.js +459 -0
  142. package/dist/chunk-YJG5HIX5.js +203 -0
  143. package/dist/chunk-Z3QE7TZM.js +72 -0
  144. package/dist/chunk-Z5Z3JHJY.js +64 -0
  145. package/dist/chunk-ZDIFBJFT.js +168 -0
  146. package/dist/chunk-ZGGCEXDC.js +176 -0
  147. package/dist/chunk-ZMZCZNKU.js +263 -0
  148. package/dist/chunk-ZNC5T65N.js +17 -0
  149. package/dist/chunk-ZO3I3A7O.js +308 -0
  150. package/dist/chunk-ZQKXBUB7.js +217 -0
  151. package/dist/chunk-ZTRINFM2.js +78 -0
  152. package/dist/chunk-ZU7JZCVP.js +193 -0
  153. package/dist/chunk-ZZAWNALS.js +350 -0
  154. package/dist/cli/entry.js +54 -0
  155. package/dist/connector-L5QQTR6Y.js +26 -0
  156. package/dist/context-62DC6EC3.js +31 -0
  157. package/dist/council-convene-NJWPNBDU.js +46 -0
  158. package/dist/create-agent-config-ODSQWNVC.js +55 -0
  159. package/dist/default-registry-2PU3BTAU.js +68 -0
  160. package/dist/deliver-task-KONV4C4M.js +57 -0
  161. package/dist/delivery-gate-v2-F2YVMVGK.js +27 -0
  162. package/dist/domain-knowledge-store-DDZ3F4J7.js +11 -0
  163. package/dist/fetch-core-ZPPYDSZH.js +14 -0
  164. package/dist/galaxy-K72BBDQN.js +91 -0
  165. package/dist/goal-criteria-SCALAU2D.js +141 -0
  166. package/dist/goal-persist-XWY2GDQX.js +19 -0
  167. package/dist/goal-tracker-FXMJ2GVK.js +11 -0
  168. package/dist/headless-LSB6I7PT.js +162 -0
  169. package/dist/headless-coordinator-VDPDMVUT.js +90 -0
  170. package/dist/inject-U55SMB6A.js +39 -0
  171. package/dist/login-flow-CD4ZGXOC.js +59 -0
  172. package/dist/logs-cli-SQVYFMMN.js +283 -0
  173. package/dist/loop-ULZYBDA3.js +76 -0
  174. package/dist/main.js +4064 -0
  175. package/dist/manager-ROZBCWPA.js +171 -0
  176. package/dist/manager-Z7XFFUOM.js +10670 -0
  177. package/dist/meridian-indexer-ZIW363L7.js +21 -0
  178. package/dist/native-resolver-PN34UIVV.js +13 -0
  179. package/dist/node_modules/better-sqlite3/lib/database.js +90 -0
  180. package/dist/node_modules/better-sqlite3/lib/index.js +3 -0
  181. package/dist/node_modules/better-sqlite3/lib/methods/aggregate.js +43 -0
  182. package/dist/node_modules/better-sqlite3/lib/methods/backup.js +67 -0
  183. package/dist/node_modules/better-sqlite3/lib/methods/function.js +31 -0
  184. package/dist/node_modules/better-sqlite3/lib/methods/inspect.js +7 -0
  185. package/dist/node_modules/better-sqlite3/lib/methods/pragma.js +12 -0
  186. package/dist/node_modules/better-sqlite3/lib/methods/serialize.js +16 -0
  187. package/dist/node_modules/better-sqlite3/lib/methods/table.js +189 -0
  188. package/dist/node_modules/better-sqlite3/lib/methods/transaction.js +78 -0
  189. package/dist/node_modules/better-sqlite3/lib/methods/wrappers.js +54 -0
  190. package/dist/node_modules/better-sqlite3/lib/sqlite-error.js +20 -0
  191. package/dist/node_modules/better-sqlite3/lib/util.js +12 -0
  192. package/dist/node_modules/better-sqlite3/package.json +59 -0
  193. package/dist/ownership-ledger-E3WIEKPL.js +9 -0
  194. package/dist/package.json +3 -0
  195. package/dist/path-grants-XRRXHXG7.js +40 -0
  196. package/dist/paths-LVV5IMQN.js +49 -0
  197. package/dist/plan-fact-anchors-LMVQZCW5.js +13 -0
  198. package/dist/plan-store-ODLTTPFB.js +17 -0
  199. package/dist/plan-templates-5FPFBOL6.js +109 -0
  200. package/dist/plugin-loader-ZZKX7ZE6.js +22 -0
  201. package/dist/prefix-budget-62OV5HQC.js +13 -0
  202. package/dist/project-trust-5WS5MOMU.js +31 -0
  203. package/dist/provider-cli-ALDQXIT7.js +37 -0
  204. package/dist/providers-XQYTAVPK.js +11 -0
  205. package/dist/proxy-resolver-V2Y6534D.js +15 -0
  206. package/dist/recovery-cli-KPGY6FY3.js +106 -0
  207. package/dist/review-discipline-MNSYCST5.js +55 -0
  208. package/dist/review-router-BVQZW3MX.js +18 -0
  209. package/dist/seed-capsules/seed-capsule-attack-methodology.md +62 -0
  210. package/dist/seed-capsules/seed-capsule-changgeng.md +31 -0
  211. package/dist/seed-capsules/seed-capsule-design-aesthetics.md +38 -0
  212. package/dist/seed-capsules/seed-capsule-diagnostic-ladder.md +54 -0
  213. package/dist/seed-capsules/seed-capsule-fu.md +39 -0
  214. package/dist/seed-capsules/seed-capsule-huagai.md +73 -0
  215. package/dist/seed-capsules/seed-capsule-kaiyang.md +65 -0
  216. package/dist/seed-capsules/seed-capsule-knowledge-work.md +40 -0
  217. package/dist/seed-capsules/seed-capsule-tanlang.md +47 -0
  218. package/dist/seed-capsules/seed-capsule-tianfu.md +23 -0
  219. package/dist/seed-capsules/seed-capsule-tianliang.md +63 -0
  220. package/dist/seed-capsules/seed-capsule-tianquan.md +32 -0
  221. package/dist/seed-capsules/seed-capsule-tianxuan-ccr.md +22 -0
  222. package/dist/seed-capsules/seed-capsule-tianxuan.md +64 -0
  223. package/dist/seed-capsules/seed-capsule-yaoguang.md +87 -0
  224. package/dist/serve-X2R2UTLF.js +170 -0
  225. package/dist/serve-agent-KHSU6RVV.js +965 -0
  226. package/dist/session-persist-HUUC772H.js +37 -0
  227. package/dist/session-registry-6XUD5C4Y.js +15 -0
  228. package/dist/skill-loader-CK3RMO47.js +48 -0
  229. package/dist/skills/cli-harness-sop.md +207 -0
  230. package/dist/spawn-git-4HFU65AH.js +29 -0
  231. package/dist/sse-EYUTBWUK.js +512 -0
  232. package/dist/starflow-NOFBMPFU.js +30 -0
  233. package/dist/streamableHttp-V67CNJMO.js +447 -0
  234. package/dist/task-contract-6XHBNJQK.js +32 -0
  235. package/dist/task-ledger-3K4TJIER.js +9 -0
  236. package/dist/team-orchestrate-S6NHZP7X.js +64 -0
  237. package/dist/title-extract-QX4XGCYN.js +50 -0
  238. package/dist/todo-QDXGRZZP.js +31 -0
  239. package/dist/todo-store-V3TTO5AH.js +12 -0
  240. package/dist/tool-preset-LU5BYEDZ.js +23 -0
  241. package/dist/tool-tiers-GD742YBN.js +23 -0
  242. package/dist/turndown.es-OI55K6C3.js +17373 -0
  243. package/dist/verification-attribution-EKG4CNUV.js +13 -0
  244. package/dist/volatile-git-MBTST7RA.js +15 -0
  245. package/dist/wave-checkpoint-XLIIHXQA.js +30 -0
  246. package/dist/web-cli-DUG4I35O.js +233 -0
  247. package/dist/web-search-3IK542AA.js +34 -0
  248. package/dist/workers/cpu-worker.js +45 -0
  249. package/dist/workflow-runner-HX7UBAYG.js +297 -0
  250. package/dist/worktree-baseline-O5NCU6M2.js +9 -0
  251. package/package.json +122 -0
  252. package/scripts/check-mobile-env.mjs +76 -0
  253. package/scripts/fetch-native-sqlite.js +392 -0
  254. package/scripts/prune-installed-wasms.js +45 -0
  255. package/scripts/tree-sitter-wasm-keep.js +40 -0
@@ -0,0 +1,230 @@
1
+ # PowerShell completion for Rivet (rivet)
2
+ #
3
+ # Install: dot-source this file from your $PROFILE so the completer loads in every session:
4
+ # Add-Content $PROFILE ". C:\path\to\rivet.ps1"
5
+ # Then restart PowerShell (or run `. .\rivet.ps1` once).
6
+ #
7
+ # Works on Windows PowerShell 5.1 and PowerShell 7+.
8
+
9
+ function Get-RivetProviders {
10
+ $configFile = Join-Path $env:USERPROFILE ".rivet\config.json"
11
+ if (-not (Test-Path $configFile)) { return @() }
12
+ try {
13
+ $cfg = Get-Content $configFile -Raw | ConvertFrom-Json
14
+ if ($cfg.provider -and $cfg.provider.providers) {
15
+ return @($cfg.provider.providers.PSObject.Properties.Name)
16
+ }
17
+ } catch { }
18
+ return @()
19
+ }
20
+
21
+ # The completer is self-contained (all tables defined inside) so it does not depend
22
+ # on outer-scope variable resolution when invoked by the PowerShell engine.
23
+ $rivetCompleter = {
24
+ param($wordToComplete, $commandAst, $cursorPosition)
25
+
26
+ # NOTE: both helpers are always consumed via @(...) at the call sites. PowerShell
27
+ # unwraps a single-element array into a scalar, and `CompletionResult + array`
28
+ # throws op_Addition, so the @() cast around every call is load-bearing.
29
+ function Add-Match($map, $type, $prefix) {
30
+ $out = @()
31
+ foreach ($k in $map.Keys) {
32
+ if ($k -like "$prefix*") {
33
+ $out += [System.Management.Automation.CompletionResult]::new($k, $k, $type, $map[$k])
34
+ }
35
+ }
36
+ return $out
37
+ }
38
+
39
+ function Add-List($items, $type, $prefix) {
40
+ $out = @()
41
+ foreach ($k in $items) {
42
+ if ($k -like "$prefix*") {
43
+ $out += [System.Management.Automation.CompletionResult]::new($k, $k, $type, $k)
44
+ }
45
+ }
46
+ return $out
47
+ }
48
+
49
+ $topCommands = [ordered]@{
50
+ 'config' = 'Manage providers, API keys and models'
51
+ 'serve' = 'Start the sidecar HTTP/SSE runtime server'
52
+ 'sessions' = 'Print the session list and exit'
53
+ 'browser' = 'Check or install the Chromium used by browser tools'
54
+ 'logs' = 'Show where sessions, caches and logs are written'
55
+ }
56
+
57
+ $topFlags = [ordered]@{
58
+ '-p' = 'Run a single prompt headlessly and print the result'
59
+ '--print' = 'Run a single prompt headlessly and print the result'
60
+ '--json' = 'Emit a single JSON result object'
61
+ '--stream-json' = 'Emit the run as an NDJSON event stream'
62
+ '--goal' = 'Run headless autonomous goal mode'
63
+ '--budget' = 'Turn budget for goal mode (default 100)'
64
+ '--model' = 'Override the model for this session'
65
+ '--provider' = 'Override the provider for this session'
66
+ '-c' = 'Resume the most recent session for this directory'
67
+ '--continue' = 'Resume the most recent session for this directory'
68
+ '-r' = 'Resume a session by id or prefix'
69
+ '--resume' = 'Resume a session by id or prefix'
70
+ '--new' = 'Force a brand-new session'
71
+ '--list' = 'Print the session list and exit'
72
+ '--dangerously-skip-permissions' = 'Skip all tool approvals'
73
+ '--screen-reader' = 'Screen-reader friendly output'
74
+ '--skip-welcome' = 'Skip the welcome screen'
75
+ '--stream-events' = 'Mirror the run as an NDJSON SessionEvent file'
76
+ }
77
+
78
+ $configCommands = [ordered]@{
79
+ 'show' = 'Print the resolved configuration as JSON'
80
+ 'providers' = 'List configured providers and key status'
81
+ 'setup' = 'Configure a provider in one shot'
82
+ 'set-url' = 'Set the base URL for a provider'
83
+ 'set-model' = 'Set the active model for a provider'
84
+ 'set-key' = 'Set the API key for a provider'
85
+ 'set-key-env' = 'Read the API key from an environment variable'
86
+ 'set-default' = 'Set the default provider'
87
+ 'set-approval' = 'Set the tool approval mode'
88
+ 'add-model' = 'Add a model to a provider'
89
+ 'remove-model' = 'Remove a model from a provider'
90
+ 'mcp' = 'Manage MCP servers'
91
+ }
92
+
93
+ $mcpCommands = [ordered]@{
94
+ 'list' = 'List configured MCP servers'
95
+ 'add-stdio' = 'Add a stdio MCP server'
96
+ 'add-sse' = 'Add an SSE MCP server'
97
+ 'remove' = 'Remove an MCP server'
98
+ 'enable' = 'Enable an MCP server'
99
+ 'disable' = 'Disable an MCP server'
100
+ }
101
+
102
+ $approvalModes = [ordered]@{
103
+ 'auto-safe' = 'Auto-approve read-only tools, ask for the rest'
104
+ 'manual' = 'Ask before every tool call'
105
+ 'auto-accept' = 'Auto-approve everything except destructive actions'
106
+ 'dangerously-skip-permissions' = 'Skip all approvals'
107
+ }
108
+
109
+ $setupFlags = [ordered]@{
110
+ '--key' = 'API key literal'
111
+ '--key-env' = 'Environment variable holding the key'
112
+ '--url' = 'Base URL'
113
+ '--model' = 'Model id'
114
+ '--context-window' = 'Context window size in tokens'
115
+ '--max-tokens' = 'Max output tokens'
116
+ '--alias' = 'Model alias'
117
+ '--default' = 'Make this the default provider'
118
+ }
119
+
120
+ $browserCommands = [ordered]@{
121
+ 'status' = 'Report whether Chromium is ready'
122
+ 'check' = 'Alias for status'
123
+ 'install' = 'Download and install Chromium'
124
+ 'help' = 'Show browser command help'
125
+ }
126
+
127
+ $logsFlags = [ordered]@{
128
+ '--session' = 'Restrict the report to one session'
129
+ '--json' = 'Emit a structured manifest'
130
+ }
131
+
132
+ $providerVerbs = @('setup', 'set-url', 'set-model', 'set-key', 'set-key-env', 'set-default', 'add-model', 'remove-model')
133
+
134
+ # --- Tokenise the line, excluding the word currently being typed ---
135
+ $all = @(($commandAst.ToString().Trim()) -split '\s+' | Where-Object { $_ })
136
+ $tokens = @()
137
+ if ($all.Count -gt 1) { $tokens = @($all[1..($all.Count - 1)]) }
138
+ if ($wordToComplete -and $tokens.Count -gt 0 -and $tokens[-1] -eq $wordToComplete) {
139
+ if ($tokens.Count -eq 1) { $tokens = @() }
140
+ else { $tokens = @($tokens[0..($tokens.Count - 2)]) }
141
+ }
142
+
143
+ # A value-taking flag immediately before the cursor wins over positional logic.
144
+ if ($tokens.Count -gt 0) {
145
+ switch ($tokens[-1]) {
146
+ '--provider' { return @(Add-List (Get-RivetProviders) 'ParameterValue' $wordToComplete) }
147
+ '--model' { return @() }
148
+ '--budget' { return @() }
149
+ '--goal' { return @() }
150
+ '--port' { return @() }
151
+ '--session' { return @() }
152
+ }
153
+ }
154
+
155
+ # Positional tokens only (flags filtered out), so interleaved flags do not shift positions.
156
+ $positional = @($tokens | Where-Object { $_ -notlike '-*' })
157
+
158
+ if ($positional.Count -eq 0) {
159
+ return @(Add-Match $topCommands 'Command' $wordToComplete) +
160
+ @(Add-Match $topFlags 'ParameterName' $wordToComplete)
161
+ }
162
+
163
+ switch ($positional[0]) {
164
+ 'config' {
165
+ if ($positional.Count -eq 1) {
166
+ return @(Add-Match $configCommands 'Command' $wordToComplete)
167
+ }
168
+ $sub = $positional[1]
169
+ switch ($sub) {
170
+ 'mcp' {
171
+ if ($positional.Count -eq 2) {
172
+ return @(Add-Match $mcpCommands 'Command' $wordToComplete)
173
+ }
174
+ return @()
175
+ }
176
+ 'set-approval' {
177
+ if ($positional.Count -eq 2) {
178
+ return @(Add-Match $approvalModes 'ParameterValue' $wordToComplete)
179
+ }
180
+ return @()
181
+ }
182
+ 'setup' {
183
+ if ($positional.Count -eq 2) {
184
+ return @(Add-List (Get-RivetProviders) 'ParameterValue' $wordToComplete) +
185
+ @(Add-Match $setupFlags 'ParameterName' $wordToComplete)
186
+ }
187
+ return @(Add-Match $setupFlags 'ParameterName' $wordToComplete)
188
+ }
189
+ }
190
+ if ($positional.Count -eq 2 -and $providerVerbs -contains $sub) {
191
+ return @(Add-List (Get-RivetProviders) 'ParameterValue' $wordToComplete)
192
+ }
193
+ return @()
194
+ }
195
+ 'serve' {
196
+ return @(Add-Match ([ordered]@{ '--port' = 'Port to listen on' }) 'ParameterName' $wordToComplete)
197
+ }
198
+ 'browser' {
199
+ if ($positional.Count -eq 1) {
200
+ return @(Add-Match $browserCommands 'Command' $wordToComplete)
201
+ }
202
+ if ($positional[1] -eq 'install') {
203
+ return @(Add-Match ([ordered]@{ '--no-mirror' = 'Skip the download mirror' }) 'ParameterName' $wordToComplete)
204
+ }
205
+ return @()
206
+ }
207
+ 'logs' {
208
+ if ($positional.Count -eq 1) {
209
+ return @(Add-Match ([ordered]@{ 'open' = 'Open the log location' }) 'Command' $wordToComplete) +
210
+ @(Add-Match $logsFlags 'ParameterName' $wordToComplete)
211
+ }
212
+ if ($positional[1] -eq 'open' -and $positional.Count -eq 2) {
213
+ return @(Add-Match ([ordered]@{ 'desktop' = 'Open the desktop log directory' }) 'Command' $wordToComplete) +
214
+ @(Add-Match $logsFlags 'ParameterName' $wordToComplete)
215
+ }
216
+ return @(Add-Match $logsFlags 'ParameterName' $wordToComplete)
217
+ }
218
+ 'sessions' { return @() }
219
+ }
220
+
221
+ return @()
222
+ }
223
+
224
+ # -Native is required for external commands on PowerShell 7+, but is not a valid
225
+ # switch on Windows PowerShell 5.1 (where native completion is implicit).
226
+ $registerParams = @{ CommandName = 'rivet'; ScriptBlock = $rivetCompleter }
227
+ if ((Get-Command Register-ArgumentCompleter).Parameters.ContainsKey('Native')) {
228
+ $registerParams['Native'] = $true
229
+ }
230
+ Register-ArgumentCompleter @registerParams
@@ -0,0 +1,187 @@
1
+ #compdef rivet
2
+ #
3
+ # Zsh completion for Rivet (rivet)
4
+ #
5
+ # Install: put this file somewhere on your $fpath as `_rivet`, e.g.
6
+ # mkdir -p ~/.zsh/completions && cp rivet.zsh ~/.zsh/completions/_rivet
7
+ # echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
8
+
9
+ # Provider names are read from ~/.rivet/config.json when available.
10
+ _rivet_providers() {
11
+ local config_file="$HOME/.rivet/config.json"
12
+ [[ -f $config_file ]] || return 0
13
+ local -a providers
14
+ providers=(${(f)"$(node -e '
15
+ try {
16
+ const c = JSON.parse(require("fs").readFileSync(process.argv[1], "utf-8"))
17
+ console.log(Object.keys((c.provider && c.provider.providers) || {}).join("\n"))
18
+ } catch {}
19
+ ' "$config_file" 2>/dev/null)"})
20
+ (( ${#providers} )) && _describe -t providers 'provider' providers
21
+ }
22
+
23
+ _rivet_config() {
24
+ local -a config_commands mcp_commands approval_modes
25
+
26
+ config_commands=(
27
+ 'show:Print the resolved configuration as JSON'
28
+ 'providers:List configured providers and key status'
29
+ 'setup:Configure a provider in one shot'
30
+ 'set-url:Set the base URL for a provider'
31
+ 'set-model:Set the active model for a provider'
32
+ 'set-key:Set the API key for a provider'
33
+ 'set-key-env:Read the API key from an environment variable'
34
+ 'set-default:Set the default provider'
35
+ 'set-approval:Set the tool approval mode'
36
+ 'add-model:Add a model to a provider'
37
+ 'remove-model:Remove a model from a provider'
38
+ 'mcp:Manage MCP servers'
39
+ )
40
+
41
+ mcp_commands=(
42
+ 'list:List configured MCP servers'
43
+ 'add-stdio:Add a stdio MCP server'
44
+ 'add-sse:Add an SSE MCP server'
45
+ 'remove:Remove an MCP server'
46
+ 'enable:Enable an MCP server'
47
+ 'disable:Disable an MCP server'
48
+ )
49
+
50
+ approval_modes=(
51
+ 'auto-safe:Auto-approve read-only tools, ask for the rest'
52
+ 'manual:Ask before every tool call'
53
+ 'auto-accept:Auto-approve everything except destructive actions'
54
+ 'dangerously-skip-permissions:Skip all approvals'
55
+ )
56
+
57
+ _arguments -C \
58
+ '1:config command:->config_cmd' \
59
+ '*::config arg:->config_args'
60
+
61
+ case $state in
62
+ config_cmd)
63
+ _describe -t commands 'config command' config_commands
64
+ ;;
65
+ config_args)
66
+ case $words[1] in
67
+ mcp)
68
+ if (( CURRENT == 2 )); then
69
+ _describe -t commands 'mcp command' mcp_commands
70
+ fi
71
+ ;;
72
+ set-approval)
73
+ if (( CURRENT == 2 )); then
74
+ _describe -t modes 'approval mode' approval_modes
75
+ fi
76
+ ;;
77
+ setup)
78
+ # `setup` may target a provider that does not exist yet, so the flags are
79
+ # offered alongside the known provider names at the first argument slot.
80
+ if (( CURRENT == 2 )); then
81
+ _rivet_providers
82
+ _arguments \
83
+ '--key[API key literal]:key:' \
84
+ '--key-env[Environment variable holding the key]:env var:' \
85
+ '--url[Base URL]:url:' \
86
+ '--model[Model id]:model:' \
87
+ '--context-window[Context window size]:tokens:' \
88
+ '--max-tokens[Max output tokens]:tokens:' \
89
+ '--alias[Model alias]:alias:' \
90
+ '--default[Make this the default provider]'
91
+ else
92
+ _arguments \
93
+ '--key[API key literal]:key:' \
94
+ '--key-env[Environment variable holding the key]:env var:' \
95
+ '--url[Base URL]:url:' \
96
+ '--model[Model id]:model:' \
97
+ '--context-window[Context window size]:tokens:' \
98
+ '--max-tokens[Max output tokens]:tokens:' \
99
+ '--alias[Model alias]:alias:' \
100
+ '--default[Make this the default provider]'
101
+ fi
102
+ ;;
103
+ set-url|set-model|set-key|set-key-env|set-default|add-model|remove-model)
104
+ if (( CURRENT == 2 )); then
105
+ _rivet_providers
106
+ fi
107
+ ;;
108
+ esac
109
+ ;;
110
+ esac
111
+ }
112
+
113
+ _rivet() {
114
+ local -a commands
115
+ commands=(
116
+ 'config:Manage providers, API keys and models'
117
+ 'serve:Start the sidecar HTTP/SSE runtime server'
118
+ 'sessions:Print the session list and exit'
119
+ 'browser:Check or install the Chromium used by browser tools'
120
+ 'logs:Show where sessions, caches and logs are written'
121
+ )
122
+
123
+ _arguments -C \
124
+ '(-p --print)'{-p,--print}'[Run a single prompt headlessly and print the result]:prompt:' \
125
+ '--json[Emit a single JSON result object]' \
126
+ '--stream-json[Emit the run as an NDJSON event stream]' \
127
+ '--goal[Run headless autonomous goal mode]:goal:' \
128
+ '--budget[Turn budget for goal mode (default 100)]:turns:' \
129
+ '--model[Override the model for this session]:model:' \
130
+ '--provider[Override the provider for this session]:provider:_rivet_providers' \
131
+ '(-c --continue)'{-c,--continue}'[Resume the most recent session for this directory]' \
132
+ '(-r --resume)'{-r,--resume}'[Resume a session by id or prefix]:session id:' \
133
+ '--new[Force a brand-new session]' \
134
+ '--list[Print the session list and exit]' \
135
+ '--dangerously-skip-permissions[Skip all tool approvals]' \
136
+ '--screen-reader[Screen-reader friendly output]' \
137
+ '--skip-welcome[Skip the welcome screen]' \
138
+ '--stream-events[Mirror the run as an NDJSON SessionEvent file]:path:_files' \
139
+ '1:command:->command' \
140
+ '*::arg:->args'
141
+
142
+ case $state in
143
+ command)
144
+ _describe -t commands 'command' commands
145
+ ;;
146
+ args)
147
+ case $words[1] in
148
+ config)
149
+ _rivet_config
150
+ ;;
151
+ serve)
152
+ _arguments '--port[Port to listen on]:port:'
153
+ ;;
154
+ browser)
155
+ if (( CURRENT == 2 )); then
156
+ local -a browser_commands
157
+ browser_commands=(
158
+ 'status:Report whether Chromium is ready'
159
+ 'check:Alias for status'
160
+ 'install:Download and install Chromium'
161
+ 'help:Show browser command help'
162
+ )
163
+ _describe -t commands 'browser command' browser_commands
164
+ elif [[ $words[2] == install ]]; then
165
+ _arguments '--no-mirror[Skip the download mirror]'
166
+ fi
167
+ ;;
168
+ logs)
169
+ if (( CURRENT == 2 )); then
170
+ local -a logs_commands
171
+ logs_commands=('open:Open the log location')
172
+ _describe -t commands 'logs command' logs_commands
173
+ _arguments '--session[Restrict to one session]:session id:' '--json[Emit a structured manifest]'
174
+ elif [[ $words[2] == open ]] && (( CURRENT == 3 )); then
175
+ local -a open_targets
176
+ open_targets=('desktop:Open the desktop log directory')
177
+ _describe -t targets 'target' open_targets
178
+ else
179
+ _arguments '--session[Restrict to one session]:session id:' '--json[Emit a structured manifest]'
180
+ fi
181
+ ;;
182
+ esac
183
+ ;;
184
+ esac
185
+ }
186
+
187
+ _rivet "$@"
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
2
+ import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
3
+ import {
4
+ ACCOUNT_IDENTITY_TTL_MS,
5
+ accountApiBase,
6
+ accountIdentityUrl,
7
+ accountStore,
8
+ cachedAccountIdentity,
9
+ checkDeviceOnce,
10
+ deviceAuthorizeUrl,
11
+ fetchAccountProfile,
12
+ fetchStellarIdentity,
13
+ isAccountIdentityStale,
14
+ isTerminalPollStatus,
15
+ jwtSubject,
16
+ parseDeviceCreate,
17
+ parseDevicePoll,
18
+ parseStellarIdentity,
19
+ pollForAccountToken,
20
+ requestDeviceCode,
21
+ saveAccountIdentity,
22
+ saveAccountToken
23
+ } from "./chunk-AEWHC4WM.js";
24
+ import "./chunk-2VYRLULP.js";
25
+ import "./chunk-P5KJURUR.js";
26
+ import "./chunk-5GGOGLSN.js";
27
+ export {
28
+ ACCOUNT_IDENTITY_TTL_MS,
29
+ accountApiBase,
30
+ accountIdentityUrl,
31
+ accountStore,
32
+ cachedAccountIdentity,
33
+ checkDeviceOnce,
34
+ deviceAuthorizeUrl,
35
+ fetchAccountProfile,
36
+ fetchStellarIdentity,
37
+ isAccountIdentityStale,
38
+ isTerminalPollStatus,
39
+ jwtSubject,
40
+ parseDeviceCreate,
41
+ parseDevicePoll,
42
+ parseStellarIdentity,
43
+ pollForAccountToken,
44
+ requestDeviceCode,
45
+ saveAccountIdentity,
46
+ saveAccountToken
47
+ };
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
2
+ import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
3
+ import {
4
+ init_esm_shims
5
+ } from "./chunk-5GGOGLSN.js";
6
+
7
+ // src/tui/account-login.ts
8
+ init_esm_shims();
9
+ import { hostname } from "os";
10
+ async function handleAccountLogin(app) {
11
+ const {
12
+ requestDeviceCode,
13
+ pollForAccountToken,
14
+ accountStore,
15
+ saveAccountToken,
16
+ isTerminalPollStatus
17
+ } = await import("./account-OAEKORZE.js");
18
+ const { openInBrowser } = await import("./login-flow-CD4ZGXOC.js");
19
+ const { rivetHome } = await import("./paths-LVV5IMQN.js");
20
+ app.commitStatic("\u6B63\u5728\u5411\u5929\u67A2\u7533\u8BF7\u8BBE\u5907\u6388\u6743\u2026");
21
+ let created;
22
+ try {
23
+ created = await requestDeviceCode({ deviceName: hostname() });
24
+ } catch (e) {
25
+ app.commitStatic(`\u26A0\uFE0F \u65E0\u6CD5\u8FDE\u63A5\u5929\u67A2\u8D26\u53F7\u670D\u52A1\uFF1A${e.message}`);
26
+ return true;
27
+ }
28
+ openInBrowser(created.verifyUrl);
29
+ app.commitStatic(
30
+ `\u8BF7\u5728\u6D4F\u89C8\u5668\u5B8C\u6210\u6388\u6743\uFF08\u5DF2\u5C1D\u8BD5\u81EA\u52A8\u6253\u5F00\uFF09\uFF1A
31
+ ${created.verifyUrl}
32
+
33
+ \u8BBE\u5907\u7801\uFF1A${created.userCode} \xB7 ${Math.round(created.expiresIn / 60)} \u5206\u949F\u5185\u6709\u6548
34
+ \u7B49\u5F85\u6388\u6743\u4E2D\u2026\uFF08Ctrl+C \u53EF\u53D6\u6D88\uFF09`
35
+ );
36
+ const result = await pollForAccountToken(created.deviceCode, {
37
+ intervalSeconds: created.pollInterval,
38
+ timeoutMs: created.expiresIn * 1e3
39
+ });
40
+ if (result.status === "approved" && result.accessToken) {
41
+ const token = saveAccountToken(accountStore(rivetHome()), result);
42
+ const { primeStellarIdentity } = await import("./account-status-KHNPPAFL.js");
43
+ const identityLine = await primeStellarIdentity(token.accessToken);
44
+ app.commitStatic("\u2705 \u5DF2\u767B\u5F55\u5929\u67A2\u8D26\u53F7\u2014\u2014\u684C\u9762\u7AEF\u4E0E\u7F51\u9875\u7AEF\u73B0\u5728\u770B\u5230\u540C\u4E00\u4EFD\u8BBE\u5907\u4E0E\u8BA2\u9605\u3002");
45
+ if (identityLine) app.commitStatic(`\u661F\u7C4D\uFF1A${identityLine}`);
46
+ return true;
47
+ }
48
+ const hint = result.status === "denied" ? "\u4F60\u5728\u6D4F\u89C8\u5668\u91CC\u62D2\u7EDD\u4E86\u672C\u6B21\u6388\u6743\u3002" : result.status === "expired" ? "\u6388\u6743\u7801\u5DF2\u8FC7\u671F\uFF085 \u5206\u949F\u6709\u6548\uFF09\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C /login account\u3002" : `\u672C\u6B21\u6388\u6743\u672A\u80FD\u5B8C\u6210\uFF08${result.status}\uFF09\u3002`;
49
+ void isTerminalPollStatus;
50
+ app.commitStatic(`\u26A0\uFE0F ${hint}`);
51
+ return true;
52
+ }
53
+ async function handleAccountLogout(app) {
54
+ const { accountStore } = await import("./account-OAEKORZE.js");
55
+ const { rivetHome } = await import("./paths-LVV5IMQN.js");
56
+ const store = accountStore(rivetHome());
57
+ const had = store.load() !== null;
58
+ store.clear();
59
+ app.commitStatic(had ? "\u2705 \u5DF2\u767B\u51FA\u5929\u67A2\u8D26\u53F7\u3002" : "\u5F53\u524D\u672A\u767B\u5F55\u5929\u67A2\u8D26\u53F7\u3002");
60
+ return true;
61
+ }
62
+ export {
63
+ handleAccountLogin,
64
+ handleAccountLogout
65
+ };
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
2
+ import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
3
+ import {
4
+ accountIdentityLines,
5
+ commitWelcomeStellarIdentityLine,
6
+ formatStellarIdentityLine,
7
+ primeStellarIdentity
8
+ } from "./chunk-AOVQ7VIF.js";
9
+ import "./chunk-AEWHC4WM.js";
10
+ import "./chunk-CGOADM2X.js";
11
+ import "./chunk-ADIVZ2D5.js";
12
+ import "./chunk-2VYRLULP.js";
13
+ import "./chunk-CGFZGR7G.js";
14
+ import "./chunk-P5KJURUR.js";
15
+ import "./chunk-WMUWEO2C.js";
16
+ import "./chunk-BCQXEZPJ.js";
17
+ import "./chunk-5GGOGLSN.js";
18
+ export {
19
+ accountIdentityLines,
20
+ commitWelcomeStellarIdentityLine,
21
+ formatStellarIdentityLine,
22
+ primeStellarIdentity
23
+ };