@giftsofprometheus/cli 0.2.2 → 0.4.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
@@ -37,6 +37,7 @@ giftsofprometheus doctor
37
37
  ## Быстрый старт
38
38
 
39
39
  ```bash
40
+ giftsofprometheus ask 'как оценивать агентов' --q 'agent evaluation' # фрагменты транскриптов
40
41
  giftsofprometheus talks search 'оценка агентов' # без аккаунта
41
42
  giftsofprometheus talks get <slug> # описание, спикеры, темы, ссылка на видео
42
43
 
@@ -112,10 +113,11 @@ npx skills add timurkhakhalev/giftsofprometheus-cli
112
113
 
113
114
  | Команда | Что делает | Аккаунт |
114
115
  |---|---|---|
116
+ | `ask <вопрос> [--q формулировка] [--limit n] [--per-talk n]` | Фрагменты транскриптов с цитатами и ссылками на секунду; `--q` повторяется до двух раз | ✓ |
115
117
  | `talks search <запрос> [--page n]` | Поиск опубликованных докладов по названию, описанию, спикеру и теме | |
116
118
  | `talks list [--page n]` | Каталог по страницам | |
117
119
  | `talks get <slug-или-id>` | Доклад с описанием, спикерами, темами и видео | |
118
- | `talks content <slug-или-id>` | Полный транскрипт на языке доклада | ✓ |
120
+ | `talks content <slug-или-id> [--rec-id UUID]` | Полный транскрипт на языке доклада | ✓ |
119
121
  | `favorites list [--page n] [--limit n]` | Ваше избранное | ✓ |
120
122
  | `favorites add <slug-или-id>` / `remove` | Добавить в избранное или убрать | ✓ |
121
123
  | `profile get` | Ваши интересы и текущая задача | ✓ |
package/dist/index.js CHANGED
@@ -375,9 +375,16 @@ async function resolveTalk(value) {
375
375
  .loose()
376
376
  .parse(await request(`/api/knowledge/talks/${encodeURIComponent(value)}`, 'GET', undefined, false));
377
377
  }
378
- async function event(talk, type) {
378
+ // The service checks the recId against its own deliveries; the CLI only refuses what cannot be one
379
+ const recIdOption = z.uuid();
380
+ function recIdQuery(recId) {
381
+ return recId === undefined ? '' : `?recId=${encodeURIComponent(recIdOption.parse(recId))}`;
382
+ }
383
+ async function event(talk, type, recId) {
379
384
  const item = await resolveTalk(talk);
380
- return request('/api/knowledge/events', 'POST', [{ id: randomUUID(), type, talkId: item.id, context: 'talk_page' }]);
385
+ // With a recId the service takes the context from that list; `similar` only passes its check
386
+ const source = recId === undefined ? { context: 'talk_page' } : { context: 'similar', recId: recIdOption.parse(recId) };
387
+ return request('/api/knowledge/events', 'POST', [{ id: randomUUID(), type, talkId: item.id, ...source }]);
381
388
  }
382
389
  program.exitOverride();
383
390
  program.configureOutput({
@@ -449,6 +456,29 @@ program
449
456
  nextStep: !reachable ? 'Check GIFTSOFPROMETHEUS_URL and server availability' : !authenticated ? 'Run giftsofprometheus login' : null,
450
457
  };
451
458
  }));
459
+ program
460
+ .command('ask')
461
+ .description('Find relevant passages in talk transcripts')
462
+ .argument('<query>', 'question or search formulation')
463
+ .option('--q <query>', 'another formulation, up to three in total', (value, previous) => [...previous, value], [])
464
+ .option('--limit <n>', 'maximum number of talks')
465
+ .option('--per-talk <n>', 'maximum passages per talk')
466
+ .action(run((query, options) => {
467
+ const queries = z
468
+ .array(z.string().trim().min(1).max(200))
469
+ .min(1)
470
+ .max(3)
471
+ .parse([query, ...options.q]);
472
+ const number = z.string().regex(/^\d+$/);
473
+ const params = new URLSearchParams();
474
+ for (const value of queries)
475
+ params.append('q', value);
476
+ if (options.limit !== undefined)
477
+ params.set('limit', number.parse(options.limit));
478
+ if (options.perTalk !== undefined)
479
+ params.set('perTalk', number.parse(options.perTalk));
480
+ return request(`/api/knowledge/passages?${params}`);
481
+ }));
452
482
  const talks = program.command('talks').description('Browse talks');
453
483
  talks
454
484
  .command('list')
@@ -458,7 +488,7 @@ talks
458
488
  .command('search')
459
489
  .argument('<query>')
460
490
  .option('--page <page>', 'page number', '1')
461
- .action(run((query, options) => request(`/api/knowledge/talks?q=${encodeURIComponent(query)}&page=${encodeURIComponent(options.page)}`, 'GET', undefined, false)));
491
+ .action(run((query, options) => request(`/api/knowledge/talks?q=${encodeURIComponent(query)}&page=${encodeURIComponent(options.page)}`)));
462
492
  // The command a person typed, so a hint can be pasted back as is
463
493
  const launcher = /[\\/]_npx[\\/]/.test(packageRoot) ? 'npx @giftsofprometheus/cli' : 'giftsofprometheus';
464
494
  talks
@@ -474,9 +504,28 @@ talks
474
504
  talks
475
505
  .command('content')
476
506
  .argument('<slug-or-id>')
507
+ .option('--rec-id <recId>', 'recId of the list the talk came from (feed, search or similar)')
508
+ .action(run(async (id, options) => {
509
+ const query = recIdQuery(options.recId);
510
+ const talk = await resolveTalk(id);
511
+ const result = await request(`/api/knowledge/talks/${encodeURIComponent(String(talk.slug))}/content${query}`, 'POST');
512
+ // After the transcript: talks like this one, or saving it if the user found it useful
513
+ console.error(`Next: similar talks — ${launcher} talks similar ${talk.slug}; save it if the user asks — ${launcher} favorites add ${talk.slug}`);
514
+ return result;
515
+ }));
516
+ talks
517
+ .command('similar')
518
+ .argument('<slug-or-id>')
477
519
  .action(run(async (id) => {
478
520
  const talk = await resolveTalk(id);
479
- return request(`/api/knowledge/talks/${encodeURIComponent(String(talk.slug))}/content`, 'POST');
521
+ // Public; with a session the list gets a recId, and each item's contentUrl carries it
522
+ const result = z
523
+ .object({ recId: z.string().optional() })
524
+ .loose()
525
+ .parse(await request(`/api/knowledge/talks/${encodeURIComponent(String(talk.slug))}/similar`));
526
+ if (result.recId)
527
+ console.error(`Next: open one with ${launcher} talks content <slug> --rec-id ${result.recId}`);
528
+ return result;
480
529
  }));
481
530
  const favorites = program.command('favorites').description('Manage bookmarks');
482
531
  favorites
@@ -487,7 +536,8 @@ favorites
487
536
  favorites
488
537
  .command('add')
489
538
  .argument('<slug-or-id>')
490
- .action(run((id) => event(id, 'bookmark')));
539
+ .option('--rec-id <recId>', 'recId of the list the talk came from')
540
+ .action(run((id, options) => event(id, 'bookmark', options.recId)));
491
541
  favorites
492
542
  .command('remove')
493
543
  .argument('<slug-or-id>')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giftsofprometheus/cli",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "Search AI conference talks, read transcripts, and manage your Gifts of Prometheus favorites from the shell or an AI agent",
5
5
  "keywords": [
6
6
  "agents",
@@ -18,7 +18,7 @@ Run `command -v giftsofprometheus`. If it is missing, run every command below as
18
18
 
19
19
  ## Sign in
20
20
 
21
- Do not stop the task to send the user to the terminal. When a command needs an account (transcripts, favorites, profile, feed, `onboarding finish`) or fails with status 401:
21
+ Do not stop the task to send the user to the terminal. When a command needs an account (passage search, transcripts, favorites, profile, feed, `onboarding finish`) or fails with status 401:
22
22
 
23
23
  1. Run `giftsofprometheus --json login --start`. It returns `verificationUrl` and `userCode` at once and tries to open the browser.
24
24
  2. Tell the user in one line to open the link and confirm the code.
@@ -30,20 +30,36 @@ The CLI stores its session outside the project. Never print, copy or ask for it.
30
30
  ## Read
31
31
 
32
32
  ```bash
33
+ giftsofprometheus --json ask 'how to evaluate agents' --q 'agent evaluation' --q '智能体评估' # passages, requires login
33
34
  giftsofprometheus --json talks search 'agent evaluation' # published talks by title, summary, speaker or topic
34
35
  giftsofprometheus --json talks list --page 2 # the whole catalog, page by page
35
36
  giftsofprometheus --json talks get <slug-or-id> # one talk: summary, speakers, topics, publication
36
37
  giftsofprometheus --json talks content <slug-or-id> # full transcript, requires login
38
+ giftsofprometheus --json talks similar <slug-or-id> # up to four similar talks with a reason each
37
39
  giftsofprometheus --json feed # personal recommendations, requires login
38
40
  giftsofprometheus --json favorites list # saved talks, requires login
39
41
  giftsofprometheus --json profile get # interests and current task, requires login
40
42
  ```
41
43
 
44
+ - For questions about what speakers say, use `ask` with 2–3 formulations: English, Chinese and the original language. For names, titles, topics and conferences use `talks search`.
45
+ - Open a found transcript with `talks content <slug> --rec-id <recId>` from the `ask` response. Summarize positions of different speakers and give the passage `url` links with timecodes.
46
+ - If `ask` returns 503, try later or use `talks search`.
42
47
  - Lists are paginated: check `totalPages` and pass `--page`.
43
48
  - Search and use the returned `slug` or `id` for exact reads.
44
49
  - A transcript is in the talk's original language. Segment timecodes are in milliseconds from the start of the talk. When a talk is a part of a longer recording, `sourceRange` gives its bounds in that recording. A talk without a transcript returns an empty array.
45
50
  - `request <path>` makes a read-only GET to a path under `/api/knowledge/` or `/api/account/` that no command covers.
46
51
  - Reading never needs the user's confirmation: search, open talks and transcripts as the task requires.
52
+ - A list with a `recId` (feed, search, similar) puts it into each item's `contentUrl`. When you open a talk from that list, pass it on: `talks content <slug> --rec-id <recId>`, and `favorites add <slug> --rec-id <recId>` when the user saves it.
53
+
54
+ ## Next steps
55
+
56
+ After answering, offer one next step in a short line, matched to where the user is. Offer each kind at most once per talk, and skip it when the user is busy with something else:
57
+
58
+ - After a summary (`talks get`): the full transcript.
59
+ - After the transcript or a discussion of it: talks like this one (`talks similar`); show titles with their `reason`.
60
+ - When the user says a talk was useful: saving it to favorites. Save only after they agree.
61
+
62
+ Commands print the suggested next command on stderr. It is a hint for you; do not run a change without the user.
47
63
 
48
64
  ## Onboarding
49
65
 
@@ -33,5 +33,15 @@
33
33
  "version": "0.2.2",
34
34
  "hash": "dc7123cc1ecddd93",
35
35
  "description": "description: Find AI conference talks (AI Engineer, BAAI, Apsara and others) with Russian summaries, read their full transcripts, and manage the signed-in user's favorites, interests and personal feed through the giftsofprometheus CLI, and build a starting profile in the chat. Use when the user asks for talks, speakers or transcripts on an AI engineering topic, or wants to save, list or remove favorites on Gifts of Prometheus."
36
+ },
37
+ {
38
+ "version": "0.3.0",
39
+ "hash": "dd211af3576fc485",
40
+ "description": "description: Find AI conference talks (AI Engineer, BAAI, Apsara and others) with Russian summaries, read their full transcripts, and manage the signed-in user's favorites, interests and personal feed through the giftsofprometheus CLI, and build a starting profile in the chat. Use when the user asks for talks, speakers or transcripts on an AI engineering topic, or wants to save, list or remove favorites on Gifts of Prometheus."
41
+ },
42
+ {
43
+ "version": "0.4.0",
44
+ "hash": "2beae7a9ece869e0",
45
+ "description": "description: Find AI conference talks (AI Engineer, BAAI, Apsara and others) with Russian summaries, read their full transcripts, and manage the signed-in user's favorites, interests and personal feed through the giftsofprometheus CLI, and build a starting profile in the chat. Use when the user asks for talks, speakers or transcripts on an AI engineering topic, or wants to save, list or remove favorites on Gifts of Prometheus."
36
46
  }
37
47
  ]