qualiloop 0.1.0 → 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 CHANGED
@@ -88,23 +88,41 @@ so no secret passes through the chat.
88
88
 
89
89
  ```text
90
90
  qualiloop login | logout | whoami | tokens [revoke <id>]
91
- qualiloop projects [show <project> | use <project>]
91
+ qualiloop projects [show <project> | use <project> | delete <project> [--yes]]
92
+ qualiloop projects ui-tools [project] | ui-tools set <tool>... | ui-tools clear
93
+ qualiloop dashboard [--period <p> | --from <date> --to <date>] [--source live]
92
94
  qualiloop knowledge capabilities and coverage at a glance
93
95
  qualiloop knowledge list [--section <s>] | show <id> | edit <id> | general
94
96
  qualiloop knowledge explore [--note <text>] | explorations
95
97
  qualiloop knowledge sources [--kind <k>] [--in-force] | source <id>
96
98
  qualiloop knowledge add-doc <name> --file <path> | retire-source <id>
97
- qualiloop change <description> report a change to the agent
98
- qualiloop tests [show <id> | create | edit <id> | delete <id> [--yes]]
99
+ qualiloop change <description> [--explore] report a change to the agent
100
+ qualiloop tests [show <id> | create | edit <id> | delete <id> [--yes] | seen <id>... | seen --all]
99
101
  qualiloop suites [run <suite> --wait | create <name> [--test <id>] | add <suite> <test-id>...]
100
- qualiloop run <test-id>... [--wait] [--fail-on major|minor|none] [--timeout <min>]
101
- qualiloop runs [show <run> | wait <batch>] [--batch <id>]
102
- qualiloop problems [--run <n>] [--severity major]
103
- qualiloop problems categories [show <id> | solve <id> [--reopen]]
102
+ qualiloop run <test-id>... [--category <c>] [--wait] [--fail-on major|minor|none] [--timeout <min>]
103
+ qualiloop runs [show <run> | wait <batch>] [--batch <id>] [--mode <m>] [--result <r>]
104
+ [--from <date>] [--to <date>] [--started scheduled|manual] [--category <c>]
105
+ [--test <id>] [--schedule <id>] [--search <text>] [--offset <n>]
106
+ qualiloop runs batches [--kind <k>] [--suite <s>] [--status running|completed]
107
+ qualiloop runs restart <run>... | rejudge <run>... [--batch <id>]
108
+ qualiloop runs rejudge-conversation <id> | delete-conversation <run> <id> [--yes]
109
+ qualiloop problems [--run <n>] [--severity major] [--category <id> | --unsorted]
110
+ qualiloop problems severity <id> major|minor | delete <id> [--with-category] [--yes] | sort [--scope <s>]
111
+ qualiloop problems categories [show <id> | solve <id> [--reopen] | delete <id> [--yes]]
112
+ qualiloop problems checks [add <title> --severity <s> | set [--token-limit on|off] [--max-tokens <n>] [--unanswered on|off]]
113
+ qualiloop conversations [--run <n>] [--batch <id>] [--verdict <v>] [--mode <m>]
104
114
  qualiloop conversation <id>
115
+ qualiloop reports [show <id> | create [--runs <n>... | --days <n> | --from <date> --to <date>]]
116
+ qualiloop reports rebuild <id> | share <id> [--expires 7|30|90|365|never] | unshare <id> | delete <id> [--yes]
117
+ qualiloop reports download <id> [--format pdf|summary-csv|csv] [--out <file>]
105
118
  qualiloop gate [run [<gate>] --wait --ref <sha> | runs | show <n> | cancel <n>]
119
+ qualiloop gate create <name> --pack <pack> | edit <gate> | delete <gate> [--yes]
120
+ qualiloop gate packs | pack create <name> --test <project>:<id>... | pack edit <pack> |
121
+ pack delete <pack> [--yes] | history <pack>
122
+ qualiloop gate ci-snippet <gate> [--format shell|github|cli]
106
123
  qualiloop generate <prompt> [--suite <s> | --new-suite <name>] [--max <n>] [--wait]
107
- qualiloop generate status <id> | cancel <id>
124
+ qualiloop generate status <id> | cancel <id> | list [--everyone]
125
+ qualiloop export [project] [--format <f>] [--from <date>] [--to <date>] [--out <file>]
108
126
  qualiloop guide how to use the commands well
109
127
  qualiloop connect [project] sign in, choose the project, write .env, print the steps
110
128
  qualiloop connect guide the connect skill, from your QualiLoop
@@ -122,24 +140,55 @@ use`), `--json` for output a script can read.
122
140
  Lists (`tests`, `suites`, `runs`, `problems`, `problems categories`, `gate runs`)
123
141
  take `--limit <n>` and end with "N of M shown" when they are cut.
124
142
 
143
+ `export` writes the project's corrected pairs (turns with a saved correction)
144
+ to a file in one of the Export page's formats: `openai-chat-jsonl` (default),
145
+ `openai-completion-jsonl`, `anthropic-jsonl`, `csv`, `tsv`, `qa-json`,
146
+ `prompt-completion`, `instruction-json`, `cot-jsonl`, `json-batching`. It covers
147
+ the last 30 days unless `--from` and `--to` say otherwise. Admins and the ML team.
148
+
149
+ Actions with no command of their own run with `qualiloop action <name>`: for
150
+ example `list_jobs`, `cancel_job`, `get_usage`, `list_members`, `get_help_topic`,
151
+ the test category jobs and manual testing (`start_manual_test`,
152
+ `send_manual_message`, `score_manual_test`, `save_manual_test`).
153
+
125
154
  `run --wait` and `suites run --wait` print the batch first; if you stop waiting,
126
155
  `qualiloop runs wait <batch>` picks it up again. A wait lasts until every run
127
156
  has talked to the agent, been judged and had its problems sorted, so it shows
128
157
  what the runs are doing (running, judging, sorting problems) as it goes.
129
158
 
130
- `tests delete` asks before deleting; `--yes` skips the question (and is needed
131
- without a terminal). `gate cancel` ends a gate run still waiting on its tests,
159
+ `tests delete` and `projects delete` ask before deleting; `--yes` skips the
160
+ question (and is needed without a terminal). `gate cancel` ends a gate run still waiting on its tests,
132
161
  as cancelled, which CI treats as not passed; QualiLoop also ends a gate run that
133
162
  is still open past its gate's CI time limit, as failed.
134
163
 
164
+ `reports share` makes a public link to a ready report and prints the link and
165
+ its password once; QualiLoop keeps only their hashes. Anyone with both can read
166
+ the report without signing in until the link expires or `reports unshare`
167
+ revokes it. Sharing again replaces the link. `reports rebuild` builds a report
168
+ again from the current results with its period, runs and options, keeping its
169
+ id and link. `reports download` saves the executive PDF, the test summary CSV
170
+ or the CSV of every conversation.
171
+
172
+ A pack holds tests of any project, so each `--test` names its project as
173
+ `<project>:<test id>` (a bare id uses the `-p` project); `--schedule` does the
174
+ same for schedules. `gate pack edit` replaces the saved tests when given
175
+ `--test` and the schedules when given `--schedule`. `gate delete` and
176
+ `gate pack delete` ask first, like `tests delete`; a pack a gate still runs is
177
+ not deleted. `gate ci-snippet <gate>` prints the script the app's CI integration
178
+ shows. It reads the deploy token from `$QUALILOOP_RELEASE_GATE_TOKEN` and never
179
+ prints one; deploy tokens are made in the app.
180
+
135
181
  `knowledge` shows what the System knowledge page shows you: capabilities,
136
182
  entity groups and entities for everyone, every section with its statuses and
137
183
  evidence for a QualiLoop super admin (`show` and `edit` are theirs only).
138
184
  `knowledge edit` sets a status by adding manual evidence (`yes`, `opposite`) or
139
185
  removing it (`clear`). `knowledge general` changes the agent's name, summary or
140
186
  description. `knowledge explore` starts a plain exploration: 3 rounds of up to
141
- 8 conversations, so up to 24 conversation credits, not judged; `qualiloop
142
- change` instead re-checks only what a described change touches.
187
+ 8 conversations, so up to 24 conversation credits (the project's first
188
+ exploration is free), not judged; `qualiloop
189
+ change --explore` instead re-checks only what a described change touches.
190
+ Nothing starts an exploration by itself: without `--explore`, `change` only
191
+ records the change.
143
192
 
144
193
  `knowledge sources` lists what the knowledge is read from: the agent's system
145
194
  prompts, tools and documentation, each with where it came from (the coding
package/dist/api.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { resolveUrl, storedCredentials } from './config.js';
2
- export const VERSION = '0.1.0';
2
+ export const VERSION = '0.3.0';
3
3
  export const EXIT = {
4
4
  ok: 0,
5
5
  failed: 1,
@@ -32,6 +32,15 @@ const detailOf = (body, fallback) => {
32
32
  const detail = body.detail;
33
33
  if (typeof detail === 'string')
34
34
  return detail;
35
+ if (detail && typeof detail === 'object' && !Array.isArray(detail)) {
36
+ const nested = detail;
37
+ for (const part of [nested.message, nested.error]) {
38
+ if (typeof part === 'string' && part)
39
+ return part;
40
+ }
41
+ if (nested.detail !== undefined)
42
+ return detailOf({ detail: nested.detail }, fallback);
43
+ }
35
44
  if (Array.isArray(detail)) {
36
45
  return detail
37
46
  .map((item) => item && typeof item === 'object' && 'msg' in item
@@ -113,6 +122,41 @@ export class QualiloopClient {
113
122
  }
114
123
  return body;
115
124
  }
125
+ async download(path) {
126
+ const token = this.token();
127
+ if (!token) {
128
+ throw new ApiError(`Not signed in to ${this.url}. Run: qualiloop login`, 401, EXIT.auth);
129
+ }
130
+ let response;
131
+ try {
132
+ response = await this.fetchImpl(`${this.url}${path}`, {
133
+ method: 'GET',
134
+ headers: {
135
+ 'User-Agent': `qualiloop-cli/${VERSION}`,
136
+ ...(this.kind === 'cli' ? { 'X-Qualiloop-Client': 'cli' } : {}),
137
+ Authorization: `Bearer ${token}`,
138
+ },
139
+ signal: AbortSignal.timeout(this.timeoutMs),
140
+ });
141
+ }
142
+ catch (error) {
143
+ const reason = error instanceof Error ? error.message : String(error);
144
+ throw new ApiError(`Could not reach QualiLoop at ${this.url}: ${reason}`, 0, EXIT.server);
145
+ }
146
+ if (!response.ok) {
147
+ const text = await response.text();
148
+ let body = text;
149
+ try {
150
+ body = JSON.parse(text);
151
+ }
152
+ catch {
153
+ }
154
+ throw new ApiError(detailOf(body, `${response.status} ${response.statusText}`), response.status, exitFor(response.status));
155
+ }
156
+ const disposition = response.headers.get('content-disposition') || '';
157
+ const filename = /filename="?([^";]+)"?/i.exec(disposition)?.[1];
158
+ return { data: Buffer.from(await response.arrayBuffer()), filename };
159
+ }
116
160
  async action(name, args = {}) {
117
161
  const clean = Object.fromEntries(Object.entries(args).filter(([, value]) => value !== undefined));
118
162
  const body = await this.request('POST', `/v1/actions/${name}`, { body: clean });
package/dist/auth.js CHANGED
@@ -28,7 +28,12 @@ export const login = async (client, options = {}) => {
28
28
  body: { client: options.client || 'cli', hostname: os.hostname() },
29
29
  });
30
30
  const opened = options.browser === false ? false : openBrowser(started.verification_url_complete);
31
- options.onStarted?.({ url: started.verification_url_complete, code: started.user_code, opened });
31
+ options.onStarted?.({
32
+ url: started.verification_url_complete,
33
+ code: started.user_code,
34
+ opened,
35
+ expiresIn: started.expires_in,
36
+ });
32
37
  let interval = Math.max(1, started.interval) * 1000;
33
38
  const deadline = Date.now() + started.expires_in * 1000;
34
39
  while (Date.now() < deadline) {