@qoren/cli 0.1.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 (171) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +162 -0
  3. package/dist/args.d.ts +5 -0
  4. package/dist/args.d.ts.map +1 -0
  5. package/dist/args.js +23 -0
  6. package/dist/args.js.map +1 -0
  7. package/dist/commands/account.d.ts +4 -0
  8. package/dist/commands/account.d.ts.map +1 -0
  9. package/dist/commands/account.js +154 -0
  10. package/dist/commands/account.js.map +1 -0
  11. package/dist/commands/agent.d.ts +27 -0
  12. package/dist/commands/agent.d.ts.map +1 -0
  13. package/dist/commands/agent.js +968 -0
  14. package/dist/commands/agent.js.map +1 -0
  15. package/dist/commands/api.d.ts +4 -0
  16. package/dist/commands/api.d.ts.map +1 -0
  17. package/dist/commands/api.js +66 -0
  18. package/dist/commands/api.js.map +1 -0
  19. package/dist/commands/approvals.d.ts +11 -0
  20. package/dist/commands/approvals.d.ts.map +1 -0
  21. package/dist/commands/approvals.js +140 -0
  22. package/dist/commands/approvals.js.map +1 -0
  23. package/dist/commands/auth.d.ts +4 -0
  24. package/dist/commands/auth.d.ts.map +1 -0
  25. package/dist/commands/auth.js +215 -0
  26. package/dist/commands/auth.js.map +1 -0
  27. package/dist/commands/clients.d.ts +62 -0
  28. package/dist/commands/clients.d.ts.map +1 -0
  29. package/dist/commands/clients.js +311 -0
  30. package/dist/commands/clients.js.map +1 -0
  31. package/dist/commands/console.d.ts +4 -0
  32. package/dist/commands/console.d.ts.map +1 -0
  33. package/dist/commands/console.js +26 -0
  34. package/dist/commands/console.js.map +1 -0
  35. package/dist/commands/customAgent.d.ts +42 -0
  36. package/dist/commands/customAgent.d.ts.map +1 -0
  37. package/dist/commands/customAgent.js +449 -0
  38. package/dist/commands/customAgent.js.map +1 -0
  39. package/dist/commands/designer.d.ts +32 -0
  40. package/dist/commands/designer.d.ts.map +1 -0
  41. package/dist/commands/designer.js +682 -0
  42. package/dist/commands/designer.js.map +1 -0
  43. package/dist/commands/env.d.ts +15 -0
  44. package/dist/commands/env.d.ts.map +1 -0
  45. package/dist/commands/env.js +245 -0
  46. package/dist/commands/env.js.map +1 -0
  47. package/dist/commands/interactive.d.ts +4 -0
  48. package/dist/commands/interactive.d.ts.map +1 -0
  49. package/dist/commands/interactive.js +30 -0
  50. package/dist/commands/interactive.js.map +1 -0
  51. package/dist/commands/jobs.d.ts +4 -0
  52. package/dist/commands/jobs.d.ts.map +1 -0
  53. package/dist/commands/jobs.js +59 -0
  54. package/dist/commands/jobs.js.map +1 -0
  55. package/dist/commands/secrets.d.ts +15 -0
  56. package/dist/commands/secrets.d.ts.map +1 -0
  57. package/dist/commands/secrets.js +164 -0
  58. package/dist/commands/secrets.js.map +1 -0
  59. package/dist/commands/webhook.d.ts +4 -0
  60. package/dist/commands/webhook.d.ts.map +1 -0
  61. package/dist/commands/webhook.js +275 -0
  62. package/dist/commands/webhook.js.map +1 -0
  63. package/dist/config.d.ts +38 -0
  64. package/dist/config.d.ts.map +1 -0
  65. package/dist/config.js +117 -0
  66. package/dist/config.js.map +1 -0
  67. package/dist/context.d.ts +52 -0
  68. package/dist/context.d.ts.map +1 -0
  69. package/dist/context.js +163 -0
  70. package/dist/context.js.map +1 -0
  71. package/dist/duration.d.ts +9 -0
  72. package/dist/duration.d.ts.map +1 -0
  73. package/dist/duration.js +30 -0
  74. package/dist/duration.js.map +1 -0
  75. package/dist/index.d.ts +3 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +27 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/issues.d.ts +10 -0
  80. package/dist/issues.d.ts.map +1 -0
  81. package/dist/issues.js +45 -0
  82. package/dist/issues.js.map +1 -0
  83. package/dist/jobProgress.d.ts +12 -0
  84. package/dist/jobProgress.d.ts.map +1 -0
  85. package/dist/jobProgress.js +56 -0
  86. package/dist/jobProgress.js.map +1 -0
  87. package/dist/loopback.d.ts +28 -0
  88. package/dist/loopback.d.ts.map +1 -0
  89. package/dist/loopback.js +110 -0
  90. package/dist/loopback.js.map +1 -0
  91. package/dist/migrate/apply.d.ts +29 -0
  92. package/dist/migrate/apply.d.ts.map +1 -0
  93. package/dist/migrate/apply.js +135 -0
  94. package/dist/migrate/apply.js.map +1 -0
  95. package/dist/migrate/bundle.d.ts +89 -0
  96. package/dist/migrate/bundle.d.ts.map +1 -0
  97. package/dist/migrate/bundle.js +681 -0
  98. package/dist/migrate/bundle.js.map +1 -0
  99. package/dist/migrate/tar.d.ts +9 -0
  100. package/dist/migrate/tar.d.ts.map +1 -0
  101. package/dist/migrate/tar.js +89 -0
  102. package/dist/migrate/tar.js.map +1 -0
  103. package/dist/output.d.ts +46 -0
  104. package/dist/output.d.ts.map +1 -0
  105. package/dist/output.js +152 -0
  106. package/dist/output.js.map +1 -0
  107. package/dist/program.d.ts +17 -0
  108. package/dist/program.d.ts.map +1 -0
  109. package/dist/program.js +89 -0
  110. package/dist/program.js.map +1 -0
  111. package/dist/runtimes.d.ts +11 -0
  112. package/dist/runtimes.d.ts.map +1 -0
  113. package/dist/runtimes.js +20 -0
  114. package/dist/runtimes.js.map +1 -0
  115. package/dist/slug.d.ts +3 -0
  116. package/dist/slug.d.ts.map +1 -0
  117. package/dist/slug.js +15 -0
  118. package/dist/slug.js.map +1 -0
  119. package/dist/taskChain.d.ts +20 -0
  120. package/dist/taskChain.d.ts.map +1 -0
  121. package/dist/taskChain.js +40 -0
  122. package/dist/taskChain.js.map +1 -0
  123. package/dist/taskDelivery.d.ts +33 -0
  124. package/dist/taskDelivery.d.ts.map +1 -0
  125. package/dist/taskDelivery.js +67 -0
  126. package/dist/taskDelivery.js.map +1 -0
  127. package/dist/tui/app.d.ts +5 -0
  128. package/dist/tui/app.d.ts.map +1 -0
  129. package/dist/tui/app.js +130 -0
  130. package/dist/tui/app.js.map +1 -0
  131. package/dist/tui/index.d.ts +12 -0
  132. package/dist/tui/index.d.ts.map +1 -0
  133. package/dist/tui/index.js +34 -0
  134. package/dist/tui/index.js.map +1 -0
  135. package/dist/tui/model.d.ts +110 -0
  136. package/dist/tui/model.d.ts.map +1 -0
  137. package/dist/tui/model.js +257 -0
  138. package/dist/tui/model.js.map +1 -0
  139. package/dist/tui/overlay.d.ts +66 -0
  140. package/dist/tui/overlay.d.ts.map +1 -0
  141. package/dist/tui/overlay.js +216 -0
  142. package/dist/tui/overlay.js.map +1 -0
  143. package/dist/tui/panes/account.d.ts +5 -0
  144. package/dist/tui/panes/account.d.ts.map +1 -0
  145. package/dist/tui/panes/account.js +108 -0
  146. package/dist/tui/panes/account.js.map +1 -0
  147. package/dist/tui/panes/agents.d.ts +9 -0
  148. package/dist/tui/panes/agents.d.ts.map +1 -0
  149. package/dist/tui/panes/agents.js +340 -0
  150. package/dist/tui/panes/agents.js.map +1 -0
  151. package/dist/tui/panes/chat.d.ts +14 -0
  152. package/dist/tui/panes/chat.d.ts.map +1 -0
  153. package/dist/tui/panes/chat.js +169 -0
  154. package/dist/tui/panes/chat.js.map +1 -0
  155. package/dist/tui/panes/environments.d.ts +6 -0
  156. package/dist/tui/panes/environments.d.ts.map +1 -0
  157. package/dist/tui/panes/environments.js +364 -0
  158. package/dist/tui/panes/environments.js.map +1 -0
  159. package/dist/tui/panes/jobs.d.ts +5 -0
  160. package/dist/tui/panes/jobs.d.ts.map +1 -0
  161. package/dist/tui/panes/jobs.js +104 -0
  162. package/dist/tui/panes/jobs.js.map +1 -0
  163. package/dist/tui/store.d.ts +40 -0
  164. package/dist/tui/store.d.ts.map +1 -0
  165. package/dist/tui/store.js +124 -0
  166. package/dist/tui/store.js.map +1 -0
  167. package/dist/tui/ui.d.ts +95 -0
  168. package/dist/tui/ui.d.ts.map +1 -0
  169. package/dist/tui/ui.js +144 -0
  170. package/dist/tui/ui.js.map +1 -0
  171. package/package.json +51 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,162 @@
1
+ # @qoren/cli
2
+
3
+ Drive your Qoren account, environments and agents from a terminal.
4
+
5
+ ```bash
6
+ npm install -g @qoren/cli
7
+ qoren login
8
+ qoren # the whole account on one screen
9
+ qoren env ls # or one answer at a time
10
+ ```
11
+
12
+ This is the short version. The full user guide, covering the sign-in flow, every
13
+ command, scripting, configuration and troubleshooting, is at
14
+ <https://qoren.sh/docs/cli>.
15
+
16
+ ## Interactive mode
17
+
18
+ Run `qoren` with nothing after it at a terminal and it opens full screen:
19
+ environments, agents, jobs, a chat pane and your account, all on the keyboard.
20
+ `qoren tui` is the explicit form. Everything the commands can do it can do,
21
+ through the same credential and the same plan limits.
22
+
23
+ ```
24
+ tab / 1-5 move between sections enter open what is selected
25
+ up down j k move within a list r refresh
26
+ ? every key, in context q quit
27
+ ```
28
+
29
+ Two things it does that a command cannot. A reply streams in as the agent
30
+ writes it, naming the tool it is running, instead of a spinner and then a wall
31
+ of text. And when a region cannot run the size you asked for, it offers you the
32
+ region that can, rather than printing a flag to re-run with.
33
+
34
+ Piping or a non-interactive shell is unaffected: `qoren` with no terminal still
35
+ prints the help text, and `--json` is refused rather than half-honoured.
36
+
37
+ ## Commands
38
+
39
+ ```
40
+ qoren login [--token] [--name <label>] sign this computer in
41
+ qoren logout [--all]
42
+ qoren whoami
43
+
44
+ qoren env ls | get <id> | vitals <id>
45
+ qoren env create --name <n> [--size <s>] [--region <r>] [--auto-region]
46
+ qoren env rm <id> | rename <id> <name> | resize <id> --size <s>
47
+ qoren env collaboration <id> on|off
48
+
49
+ qoren agent ls [--env <id>] | get <id>
50
+ qoren agent create --env <id> --template <slug> --name <n> [--model <m>] [--runtime <r>]
51
+ qoren agent rm <id> | rename <id> <name>
52
+ qoren agent message <id> "<text>" [--resume <sessionId>]
53
+ qoren agent exec <id> "<command>"
54
+ qoren agent logs <id> [--limit <n>] | status <id> | telemetry <id> [--days <n>]
55
+ qoren agent doctor <id> [--no-repair] [--no-wait] | doctor <id> --history
56
+ qoren agent chatgpt-login <id> [--no-wait] | chatgpt-logout <id>
57
+
58
+ qoren account usage | spending [--days <n>] | options | templates
59
+
60
+ qoren jobs ls | get <id> | watch <id> | cancel <id>
61
+
62
+ qoren api <METHOD> <path> [--data <json|@file>] [--query k=v]
63
+
64
+ qoren tui open interactive mode
65
+ ```
66
+
67
+ Run `qoren <command> --help` for full options.
68
+
69
+ ## Regions
70
+
71
+ Leave `--region` off and the platform picks one that can run the size you
72
+ asked for. Pass `--region` and it is pinned: a region you named is never
73
+ swapped for another, so if it cannot run that size the create is refused
74
+ rather than quietly moved. The refusal names the closest region that does have
75
+ it, and `--auto-region` on a re-run is your permission to use it. It also lists
76
+ the sizes your region does have, in case staying put suits you better.
77
+
78
+ `qoren env resize` is refused the same way when the region an environment
79
+ already lives in cannot run the target size. There is no `--auto-region` there:
80
+ an environment cannot change region, so the refusal lists the sizes that region
81
+ can run and one of those is the way forward.
82
+
83
+ ## Scripting
84
+
85
+ Every command takes `--json`. In that mode stdout carries only the payload;
86
+ progress and warnings go to stderr, so piping is safe.
87
+
88
+ ```bash
89
+ qoren env ls --json | jq -r '.[].name'
90
+ ```
91
+
92
+ Exit codes:
93
+
94
+ | Code | Meaning |
95
+ | --- | --- |
96
+ | 0 | success |
97
+ | 1 | the request failed |
98
+ | 2 | a mistake in the command |
99
+ | 3 | sign in again (missing, expired or revoked credential) |
100
+ | 4 | the plan does not allow this, including a plan without API access |
101
+
102
+ The CLI is API access, which the Ultimate, Business and Enterprise plans
103
+ include. On another plan every command exits 4 and names the plans that include
104
+ it; see <https://qoren.sh/pricing>. The web console works on every plan.
105
+
106
+ ## CI
107
+
108
+ Create a token under Settings, CLI tokens, and set it as `QOREN_TOKEN`. It
109
+ overrides any stored login, so a pipeline can never pick up a developer's
110
+ profile.
111
+
112
+ ```bash
113
+ export QOREN_TOKEN=qrn_...
114
+ qoren agent create --env "$ENV_ID" --template deploy-bot --name "Deploy bot" --json
115
+ ```
116
+
117
+ ## Configuration
118
+
119
+ | Variable | Effect |
120
+ | --- | --- |
121
+ | `QOREN_TOKEN` | token to use; the config file is not consulted |
122
+ | `QOREN_API_URL` | server to talk to (default `https://qoren.sh`) |
123
+ | `QOREN_PROFILE` | which stored login to use |
124
+ | `NO_COLOR` | disable colour |
125
+
126
+ Credentials live in `~/.config/qoren/config.json` (or `$XDG_CONFIG_HOME/qoren`),
127
+ written `0600`. It holds bearer tokens: treat it as a password. Named profiles
128
+ let you hold several logins; switch with `--profile`.
129
+
130
+ ## Jobs
131
+
132
+ Creating an environment or deploying an agent is asynchronous. The CLI follows
133
+ the job and prints each step as it happens. Add `--no-wait` to get the job id
134
+ immediately and follow it later with `qoren jobs watch <id>`.
135
+
136
+ ## Anything not yet a command
137
+
138
+ `qoren api` reaches any control-plane endpoint with the same credential and the
139
+ same rules, so a missing command is an inconvenience rather than a blocker.
140
+
141
+ ```bash
142
+ qoren api GET fleetSummary
143
+ qoren api POST machines --data @environment.json
144
+ ```
145
+
146
+ ## Development
147
+
148
+ ```bash
149
+ npm install
150
+ npm run check # eslint + tsc
151
+ npm test
152
+ npm run build && node dist/index.js --help
153
+ ```
154
+
155
+ Interactive mode is Ink (React on a terminal). Its logic lives in
156
+ `src/tui/model.ts` as pure functions so it can be tested without a screen;
157
+ `src/tui/model.test.ts` is where its behaviour is pinned down. Ink and React are
158
+ loaded dynamically, so a scripted `qoren env ls --json` never pays for them.
159
+
160
+ Commands live in `src/commands/` and call `@qoren/sdk`; interactive mode lives
161
+ in `src/tui/` and calls the same SDK. Neither ever builds a URL itself. That is the rule that keeps the CLI and the SDK in step: an endpoint
162
+ is described once, in the SDK, and every client reads it there.
package/dist/args.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /** `on`/`off` (and the usual synonyms) off the command line, or null when it is neither. */
2
+ export declare function parseOnOff(input: string): boolean | null;
3
+ /** A JSON value given inline, or read from a file with `@path`. */
4
+ export declare function readJsonArg(value: string, what: string): unknown;
5
+ //# sourceMappingURL=args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAKA,4FAA4F;AAC5F,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAMxD;AAED,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAShE"}
package/dist/args.js ADDED
@@ -0,0 +1,23 @@
1
+ import { readFileSync } from "node:fs";
2
+ // Small readers for values typed on the command line, shared by the commands
3
+ // that take them so each reads the same way everywhere.
4
+ /** `on`/`off` (and the usual synonyms) off the command line, or null when it is neither. */
5
+ export function parseOnOff(input) {
6
+ const v = input.trim().toLowerCase();
7
+ if (["on", "true", "yes", "enable", "enabled", "1"].includes(v))
8
+ return true;
9
+ if (["off", "false", "no", "disable", "disabled", "0"].includes(v))
10
+ return false;
11
+ return null;
12
+ }
13
+ /** A JSON value given inline, or read from a file with `@path`. */
14
+ export function readJsonArg(value, what) {
15
+ const text = value.startsWith("@") ? readFileSync(value.slice(1), "utf8") : value;
16
+ try {
17
+ return JSON.parse(text);
18
+ }
19
+ catch {
20
+ throw new Error(`${what} is not valid JSON. Pass it inline, or as @file.json to read a file.`);
21
+ }
22
+ }
23
+ //# sourceMappingURL=args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,6EAA6E;AAC7E,wDAAwD;AAExD,4FAA4F;AAC5F,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7E,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAChE,OAAO,KAAK,CAAC;IACf,OAAO,IAAI,CAAC;AACd,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,IAAY;IACrD,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAClF,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,sEAAsE,CAC9E,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Command } from "commander";
2
+ import { type GlobalOptions } from "../context.js";
3
+ export declare function accountCommands(program: Command, global: () => GlobalOptions): void;
4
+ //# sourceMappingURL=account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/commands/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAMxE,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,QAmL5E"}
@@ -0,0 +1,154 @@
1
+ import { requireContext, run } from "../context.js";
2
+ import { bold, details, emit, note, table, warn } from "../output.js";
3
+ import { gated, parseCostWindow, renderCosts } from "./clients.js";
4
+ // The account: what the plan allows, and what is being spent against it.
5
+ export function accountCommands(program, global) {
6
+ const account = program.command("account").description("Account and usage");
7
+ account
8
+ .command("usage")
9
+ .description("Credits, spend and standing this billing period")
10
+ .action(() => run(async () => {
11
+ const ctx = requireContext(global());
12
+ const usage = await ctx.qoren.account.usage();
13
+ emit(usage, () => {
14
+ details([
15
+ [
16
+ "Credits used",
17
+ usage.unlimitedCredits
18
+ ? "unlimited plan"
19
+ : String(usage.creditsUsed),
20
+ ],
21
+ [
22
+ "Credits left",
23
+ usage.unlimitedCredits ? "-" : String(usage.creditsRemaining),
24
+ ],
25
+ ["Balance", `$${usage.creditBalanceUsd.toFixed(2)}`],
26
+ ["Model spend", `$${usage.managedLlmUsd.toFixed(2)}`],
27
+ ["Web operations", String(usage.webSearchesUsed)],
28
+ ["State", usage.alertState],
29
+ ["Period ends", String(usage.periodEnd ?? "")],
30
+ ]);
31
+ // These stop agents from working, so they are the point of the
32
+ // command when they are true, not a footnote.
33
+ if (usage.blocked) {
34
+ warn("Out of credits: agents are stopped until you top up.");
35
+ }
36
+ if (usage.budgetPaused) {
37
+ warn("Your monthly budget has been reached: agents are stopped until you raise or clear it.");
38
+ }
39
+ });
40
+ })());
41
+ account
42
+ .command("spending")
43
+ .description("Infrastructure spend per environment")
44
+ .option("--days <n>", "window in days", "30")
45
+ .action((options) => run(async () => {
46
+ const ctx = requireContext(global());
47
+ const data = await ctx.qoren.account.spending(Number.parseInt(options.days, 10) || 30);
48
+ emit(data, () => {
49
+ table(data.machines, [
50
+ { header: "environment", value: (m) => m.machineName },
51
+ {
52
+ header: "model spend",
53
+ value: (m) => `$${m.openRouterTotalUsd.toFixed(2)}`,
54
+ },
55
+ // "actual" vs "estimated" matters: an environment without the
56
+ // metrics agent installed reports a guess, and presenting that as
57
+ // a measured figure would be misleading.
58
+ { header: "basis", value: (m) => m.costStatus },
59
+ { header: "error", value: (m) => m.error ?? "" },
60
+ ]);
61
+ const total = data.machines.reduce((sum, m) => sum + m.openRouterTotalUsd, 0);
62
+ note(`Total: ${bold(`$${total.toFixed(2)}`)}`);
63
+ });
64
+ })());
65
+ account
66
+ .command("costs")
67
+ .description("What each client cost, in credits and dollars")
68
+ .option("--from <date>", "start of the window, ISO date (default 30 days ago)")
69
+ .option("--to <date>", "end of the window, ISO date (default now)")
70
+ .action((options) => run(async () => {
71
+ const window = parseCostWindow(options.from, options.to);
72
+ const ctx = requireContext(global());
73
+ const costs = await gated(ctx.qoren.account.costs(window));
74
+ emit(costs, () => renderCosts(costs));
75
+ })());
76
+ account
77
+ .command("options")
78
+ .description("Sizes, regions and models your plan allows")
79
+ .action(() => run(async () => {
80
+ const ctx = requireContext(global());
81
+ const options = await ctx.qoren.account.options();
82
+ emit(options, () => {
83
+ note(bold("Sizes"));
84
+ table(options.sizes, [
85
+ { header: "slug", value: (s) => s.slug },
86
+ { header: "description", value: (s) => s.description },
87
+ {
88
+ header: "default",
89
+ value: (s) => (s.slug === options.defaultSize ? "yes" : ""),
90
+ },
91
+ ]);
92
+ note(bold("\nRegions"));
93
+ table(options.regions, [
94
+ { header: "slug", value: (r) => r.slug },
95
+ { header: "description", value: (r) => r.description },
96
+ {
97
+ header: "default",
98
+ value: (r) => (r.slug === options.defaultRegion ? "yes" : ""),
99
+ },
100
+ ]);
101
+ // Models arrive as plain ids, with a recommended subset alongside.
102
+ note(bold("\nModels"));
103
+ const recommended = new Set(options.recommendedModels);
104
+ table(options.models, [
105
+ { header: "model", value: (m) => m },
106
+ {
107
+ header: "note",
108
+ value: (m) => m === options.defaultModel
109
+ ? "default"
110
+ : recommended.has(m)
111
+ ? "recommended"
112
+ : "",
113
+ },
114
+ ]);
115
+ });
116
+ })());
117
+ account
118
+ .command("models")
119
+ .description("Models an agent can run on, with prices and context windows")
120
+ .action(() => run(async () => {
121
+ const ctx = requireContext(global());
122
+ const models = await ctx.qoren.account.models();
123
+ emit(models, () => {
124
+ const price = (usd) => usd == null ? "" : `$${usd.toFixed(2)}`;
125
+ table(models, [
126
+ { header: "model", value: (m) => m.modelId },
127
+ { header: "name", value: (m) => m.name ?? "" },
128
+ { header: "in $/M", value: (m) => price(m.promptUsdPerM) },
129
+ { header: "out $/M", value: (m) => price(m.completionUsdPerM) },
130
+ {
131
+ header: "context",
132
+ value: (m) => m.contextLength ? `${Math.round(m.contextLength / 1000)}k` : "",
133
+ },
134
+ {
135
+ header: "note",
136
+ value: (m) => m.recommended ? "recommended" : m.custom ? "saved" : "",
137
+ },
138
+ ]);
139
+ });
140
+ })());
141
+ account
142
+ .command("templates")
143
+ .description("Templates you can deploy agents from")
144
+ .action(() => run(async () => {
145
+ const ctx = requireContext(global());
146
+ const templates = await ctx.qoren.templates.list();
147
+ emit(templates, () => table(templates, [
148
+ { header: "slug", value: (t) => t.name },
149
+ { header: "description", value: (t) => t.description },
150
+ { header: "source", value: (t) => t.source ?? "" },
151
+ ]));
152
+ })());
153
+ }
154
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/commands/account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAsB,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEnE,yEAAyE;AAEzE,MAAM,UAAU,eAAe,CAAC,OAAgB,EAAE,MAA2B;IAC3E,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAE5E,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,iDAAiD,CAAC;SAC9D,MAAM,CAAC,GAAG,EAAE,CACX,GAAG,CAAC,KAAK,IAAI,EAAE;QACb,MAAM,GAAG,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;QAC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Options } from "../context.js";
4
+ import { parseOnOff } from "../args.js";
5
+ export { parseOnOff };
6
+ /** One line saying where approval mode stands, for `agent approval-mode`. */
7
+ export declare function approvalModeLine(name: string | null, enabled: boolean): string;
8
+ /** The largest cap the control plane accepts, in credits. */
9
+ export declare const MAX_SPEND_CAP = 100000000;
10
+ /** A `--daily`/`--weekly`/`--monthly` value: a whole number of credits, or
11
+ * `off` (or `none`) to remove the cap. "off" rather than null because
12
+ * commander turns a parser's null into an empty string. */
13
+ export declare function parseSpendCap(input: string): number | "off";
14
+ export type SpendCapFlags = {
15
+ daily?: number | "off";
16
+ weekly?: number | "off";
17
+ monthly?: number | "off";
18
+ };
19
+ /** The caps to send: the current ones with only the given flags changed,
20
+ * since the endpoint replaces all three. Null when no flag was given. */
21
+ export declare function mergeSpendCaps(current: AgentSpendLimitCaps, flags: SpendCapFlags): AgentSpendLimitCaps | null;
22
+ /** One line saying whether the caps bite, from the agent's key state. */
23
+ export declare function spendKeyLine(limits: AgentSpendLimits): string;
24
+ /** The windows a cap is already at or under this window's spend. */
25
+ export declare function capsAlreadyReached(limits: AgentSpendLimits): string[];
26
+ export declare function agentCommands(program: Command, global: () => GlobalOptions): void;
27
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EAMV,mBAAmB,EACnB,gBAAgB,EAIjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AA8BvB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAexC,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAK9E;AAuID,6DAA6D;AAC7D,eAAO,MAAM,aAAa,YAAc,CAAC;AAEzC;;2DAE2D;AAC3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAgB3D;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAC1B,CAAC;AAEF;yEACyE;AACzE,wBAAgB,cAAc,CAC5B,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,aAAa,GACnB,mBAAmB,GAAG,IAAI,CAe5B;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAa7D;AAQD,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAOrE;AAyBD,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,QA48B1E"}