@giftsofprometheus/cli 0.6.1 → 0.7.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 +2 -2
- package/dist/index.js +39 -9
- package/package.json +1 -1
- package/skills/giftsofprometheus/SKILL.md +7 -2
- package/skills/history.json +5 -0
package/README.md
CHANGED
|
@@ -116,8 +116,8 @@ npx skills add timurkhakhalev/giftsofprometheus-cli
|
|
|
116
116
|
| `ask <вопрос> [--q формулировка] [--limit n] [--per-talk n]` | Фрагменты транскриптов с цитатами и ссылками на секунду; `--q` повторяется до двух раз | ✓ |
|
|
117
117
|
| `talks search <запрос> [--page n]` | Поиск опубликованных докладов по названию, описанию, спикеру и теме | |
|
|
118
118
|
| `talks list [--page n]` | Каталог по страницам | |
|
|
119
|
-
| `talks get <slug-или-id>` | Доклад с описанием,
|
|
120
|
-
| `talks content <slug-или-id> [--rec-id UUID]` |
|
|
119
|
+
| `talks get <slug-или-id>` | Доклад с описанием, спикерами (компания и должность), темами и видео | |
|
|
120
|
+
| `talks content <slug-или-id> [--rec-id UUID] [--from время] [--to время] [--outline]` | Транскрипт на языке доклада: целиком, отрезок (`--from 12:30 --to 18:00`) или только спикеры и главы (`--outline`) | ✓ |
|
|
121
121
|
| `favorites list [--page n] [--limit n]` | Ваше избранное | ✓ |
|
|
122
122
|
| `favorites add <slug-или-id>` / `remove` | Добавить в избранное или убрать | ✓ |
|
|
123
123
|
| `profile get` | Ваши интересы и текущая задача | ✓ |
|
package/dist/index.js
CHANGED
|
@@ -498,15 +498,11 @@ program
|
|
|
498
498
|
.command('ask')
|
|
499
499
|
.description('Find relevant passages in talk transcripts')
|
|
500
500
|
.argument('<query>', 'question or search formulation')
|
|
501
|
-
.option('--q <query>', 'another formulation
|
|
502
|
-
.option('--limit <n>', 'maximum number of talks')
|
|
503
|
-
.option('--per-talk <n>', 'maximum passages per talk')
|
|
501
|
+
.option('--q <query>', 'another formulation; the query and --q together are at most three, so at most two --q', (value, previous) => [...previous, value], [])
|
|
502
|
+
.option('--limit <n>', 'maximum number of talks (1-20)')
|
|
503
|
+
.option('--per-talk <n>', 'maximum passages per talk (1-3)')
|
|
504
504
|
.action(run((query, options) => {
|
|
505
|
-
const queries =
|
|
506
|
-
.array(z.string().trim().min(1).max(200))
|
|
507
|
-
.min(1)
|
|
508
|
-
.max(3)
|
|
509
|
-
.parse([query, ...options.q]);
|
|
505
|
+
const queries = askQueries([query, ...options.q]);
|
|
510
506
|
const number = z.string().regex(/^\d+$/);
|
|
511
507
|
const params = new URLSearchParams();
|
|
512
508
|
for (const value of queries)
|
|
@@ -517,6 +513,25 @@ program
|
|
|
517
513
|
params.set('perTalk', number.parse(options.perTalk));
|
|
518
514
|
return request(`/api/knowledge/passages?${params}`);
|
|
519
515
|
}));
|
|
516
|
+
/** The service takes one to three texts of up to 200 characters; a plain message tells an agent what to drop */
|
|
517
|
+
function askQueries(values) {
|
|
518
|
+
const queries = values.map(value => value.trim());
|
|
519
|
+
if (queries.some(value => !value))
|
|
520
|
+
throw new ApiError('Empty formulation: the query and every --q need text');
|
|
521
|
+
if (queries.length > 3)
|
|
522
|
+
throw new ApiError(`ask takes at most 3 formulations in total: the query and up to two --q. Got ${queries.length}; drop ${queries.length - 3}.`);
|
|
523
|
+
const long = queries.find(value => value.length > 200);
|
|
524
|
+
if (long !== undefined)
|
|
525
|
+
throw new ApiError(`A formulation is longer than 200 characters (${long.length}); shorten it`);
|
|
526
|
+
return queries;
|
|
527
|
+
}
|
|
528
|
+
/** Seconds as `90`, `1:30` or `1:02:03` */
|
|
529
|
+
function seconds(value) {
|
|
530
|
+
if (!/^\d+(:\d{1,2}){0,2}$/.test(value))
|
|
531
|
+
throw new ApiError(`Invalid time "${value}": use seconds (90), m:ss (1:30) or h:mm:ss (1:02:03)`);
|
|
532
|
+
return value.split(':').reduce((total, part) => total * 60 + Number(part), 0);
|
|
533
|
+
}
|
|
534
|
+
const contentShape = z.object({ transcript: z.array(z.object({ startMs: z.number() }).loose()) }).loose();
|
|
520
535
|
const talks = program.command('talks').description('Browse talks');
|
|
521
536
|
talks
|
|
522
537
|
.command('list')
|
|
@@ -548,10 +563,25 @@ talks
|
|
|
548
563
|
.command('content')
|
|
549
564
|
.argument('<slug-or-id>')
|
|
550
565
|
.option('--rec-id <recId>', 'recId of the list the talk came from (feed, search or similar)')
|
|
566
|
+
.option('--from <time>', 'keep transcript segments that start at or after this time: seconds, m:ss or h:mm:ss')
|
|
567
|
+
.option('--to <time>', 'keep transcript segments that start before this time')
|
|
568
|
+
.option('--outline', 'speakers, chapters and publication without the transcript')
|
|
551
569
|
.action(run(async (id, options) => {
|
|
552
570
|
const query = recIdQuery(options.recId);
|
|
571
|
+
const from = options.from === undefined ? 0 : seconds(options.from) * 1000;
|
|
572
|
+
const to = options.to === undefined ? Infinity : seconds(options.to) * 1000;
|
|
573
|
+
if (from >= to)
|
|
574
|
+
throw new ApiError('--from must be earlier than --to');
|
|
553
575
|
const talk = await resolveTalk(id);
|
|
554
|
-
const
|
|
576
|
+
const raw = await request(`/api/knowledge/talks/${encodeURIComponent(String(talk.slug))}/content${query}`, 'POST');
|
|
577
|
+
const whole = !options.outline && options.from === undefined && options.to === undefined;
|
|
578
|
+
const content = whole ? null : contentShape.parse(raw);
|
|
579
|
+
// A range keeps the chapters, so an agent still sees where it is in the talk
|
|
580
|
+
const result = content === null
|
|
581
|
+
? raw
|
|
582
|
+
: options.outline
|
|
583
|
+
? { ...content, transcript: undefined, transcriptSegments: content.transcript.length }
|
|
584
|
+
: { ...content, transcript: content.transcript.filter(segment => segment.startMs >= from && segment.startMs < to) };
|
|
555
585
|
// After the transcript: talks like this one, or saving it if the user found it useful
|
|
556
586
|
console.error(`Next: similar talks — ${launcher} talks similar ${talk.slug}; save it if the user asks — ${launcher} favorites add ${talk.slug}`);
|
|
557
587
|
return result;
|
package/package.json
CHANGED
|
@@ -39,14 +39,19 @@ giftsofprometheus --json talks search 'agent evaluation' # published talks by
|
|
|
39
39
|
giftsofprometheus --json talks list --page 2 # the whole catalog, page by page
|
|
40
40
|
giftsofprometheus --json talks get <slug-or-id> # one talk: summary, speakers, topics, publication
|
|
41
41
|
giftsofprometheus --json talks content <slug-or-id> # full transcript, requires login
|
|
42
|
+
giftsofprometheus --json talks content <slug> --outline # speakers and chapters, no transcript
|
|
43
|
+
giftsofprometheus --json talks content <slug> --from 12:30 --to 18:00 # one stretch of the transcript
|
|
42
44
|
giftsofprometheus --json talks similar <slug-or-id> # up to four similar talks with a reason each
|
|
43
45
|
giftsofprometheus --json feed # personal recommendations, requires login
|
|
44
46
|
giftsofprometheus --json favorites list # saved talks, requires login
|
|
45
47
|
giftsofprometheus --json profile get # interests and current task, requires login
|
|
46
48
|
```
|
|
47
49
|
|
|
48
|
-
- For questions about what speakers say, use `ask
|
|
49
|
-
- Open a found transcript with `talks content <slug> --rec-id <recId>` from the `ask` response. Summarize positions of different speakers and give
|
|
50
|
+
- For questions about what speakers say, use `ask`. It takes at most three formulations in total: the query and up to two `--q`, for example English, Chinese and the user's language. For names, titles, topics and conferences use `talks search`.
|
|
51
|
+
- Open a found transcript with `talks content <slug> --rec-id <recId>` from the `ask` response. To read around a passage, take `--outline` for the chapters, then `--from`/`--to` for the stretch you need instead of the whole transcript. Summarize positions of different speakers and give links with timecodes.
|
|
52
|
+
- A link to a moment is the talk `url` with `t` set to the second where the cited words start in the transcript segment, not the start of the `ask` passage. Keep the `recId` in every link.
|
|
53
|
+
- Each speaker has `organization` and `jobTitle` (`null` when unknown). Name a person's company only from these fields, never guess it. In a talk with several speakers, attribute a claim to a person only when the transcript makes clear who says it; otherwise attribute it to the talk. A company named in a title or a summary may be a customer or the subject of the talk, not the speaker's employer.
|
|
54
|
+
- For "how does the industry do X" questions, separate companies that describe their own production practice from vendors presenting their product (the speaker works at the company that sells the tool). Lead with the first; say plainly when the evidence is mostly vendor talks.
|
|
50
55
|
- If `ask` fails with code `passages_unavailable`, use `talks search`.
|
|
51
56
|
- Lists are paginated: check `totalPages` and pass `--page`.
|
|
52
57
|
- Search and use the returned `slug` or `id` for exact reads.
|
package/skills/history.json
CHANGED
|
@@ -63,5 +63,10 @@
|
|
|
63
63
|
"version": "0.6.1",
|
|
64
64
|
"hash": "fd663594e9d37fd3",
|
|
65
65
|
"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."
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"version": "0.7.0",
|
|
69
|
+
"hash": "ab66d3c17c52874a",
|
|
70
|
+
"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."
|
|
66
71
|
}
|
|
67
72
|
]
|