@fs/mycroft 0.2.0 → 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.
Files changed (65) hide show
  1. package/README.md +23 -0
  2. package/completions/mycroft.bash +11 -1
  3. package/completions/mycroft.fish +15 -2
  4. package/completions/mycroft.zsh +14 -1
  5. package/dist/batch-embedder-6IIWAZPW.js +14 -0
  6. package/dist/batch-embedder-6IIWAZPW.js.map +1 -0
  7. package/dist/batch-embedder-7DGZAQKL.js +14 -0
  8. package/dist/batch-embedder-7DGZAQKL.js.map +1 -0
  9. package/dist/batch-embedder-C2E6OHBQ.js +14 -0
  10. package/dist/batch-embedder-C2E6OHBQ.js.map +1 -0
  11. package/dist/batch-embedder-IZDBS3IL.js +13 -0
  12. package/dist/batch-embedder-IZDBS3IL.js.map +1 -0
  13. package/dist/batch-embedder-LYCZDYI4.js +15 -0
  14. package/dist/batch-embedder-LYCZDYI4.js.map +1 -0
  15. package/dist/batch-embedder-RHKD2OJD.js +14 -0
  16. package/dist/batch-embedder-RHKD2OJD.js.map +1 -0
  17. package/dist/batch-embedder-VQZUI7R6.js +14 -0
  18. package/dist/batch-embedder-VQZUI7R6.js.map +1 -0
  19. package/dist/batch-embedder-ZJZLNLOK.js +14 -0
  20. package/dist/batch-embedder-ZJZLNLOK.js.map +1 -0
  21. package/dist/batch-summarizer-7MCT4HJB.js +14 -0
  22. package/dist/batch-summarizer-7MCT4HJB.js.map +1 -0
  23. package/dist/batch-summarizer-BMIBVFAE.js +14 -0
  24. package/dist/batch-summarizer-BMIBVFAE.js.map +1 -0
  25. package/dist/batch-summarizer-CM3NO7TK.js +14 -0
  26. package/dist/batch-summarizer-CM3NO7TK.js.map +1 -0
  27. package/dist/chunk-35EO53CC.js +8058 -0
  28. package/dist/chunk-35EO53CC.js.map +1 -0
  29. package/dist/chunk-57ZGGKEF.js +8060 -0
  30. package/dist/chunk-57ZGGKEF.js.map +1 -0
  31. package/dist/chunk-6DLQHHCC.js +249 -0
  32. package/dist/chunk-6DLQHHCC.js.map +1 -0
  33. package/dist/chunk-7CO4PMU5.js +92 -0
  34. package/dist/chunk-7CO4PMU5.js.map +1 -0
  35. package/dist/chunk-7DUQNGEK.js +253 -0
  36. package/dist/chunk-7DUQNGEK.js.map +1 -0
  37. package/dist/chunk-7IPX4MKA.js +4637 -0
  38. package/dist/chunk-7IPX4MKA.js.map +1 -0
  39. package/dist/chunk-7NLMBXXY.js +6438 -0
  40. package/dist/chunk-7NLMBXXY.js.map +1 -0
  41. package/dist/chunk-BR2PM6D3.js +11047 -0
  42. package/dist/chunk-BR2PM6D3.js.map +1 -0
  43. package/dist/chunk-KGG7WEYE.js +162 -0
  44. package/dist/chunk-KGG7WEYE.js.map +1 -0
  45. package/dist/chunk-LV52FEMB.js +169 -0
  46. package/dist/chunk-LV52FEMB.js.map +1 -0
  47. package/dist/chunk-QRDUQX63.js +256 -0
  48. package/dist/chunk-QRDUQX63.js.map +1 -0
  49. package/dist/chunk-R3FOJK5A.js +2088 -0
  50. package/dist/chunk-R3FOJK5A.js.map +1 -0
  51. package/dist/chunk-T6X7DRBN.js +275 -0
  52. package/dist/chunk-T6X7DRBN.js.map +1 -0
  53. package/dist/chunk-VBEGUDHG.js +103 -0
  54. package/dist/chunk-VBEGUDHG.js.map +1 -0
  55. package/dist/chunk-XXO66RCF.js +94 -0
  56. package/dist/chunk-XXO66RCF.js.map +1 -0
  57. package/dist/cli.js +769 -317
  58. package/dist/cli.js.map +1 -1
  59. package/dist/fileFromPath-FLANAQWT.js +128 -0
  60. package/dist/fileFromPath-FLANAQWT.js.map +1 -0
  61. package/dist/main-36PRDAPE.js +1857 -0
  62. package/dist/main-36PRDAPE.js.map +1 -0
  63. package/dist/main-B3QJZGLU.js +1859 -0
  64. package/dist/main-B3QJZGLU.js.map +1 -0
  65. package/package.json +14 -2
package/README.md CHANGED
@@ -21,6 +21,11 @@ Run `mycroft config onboard` first to set everything up, then use the book and c
21
21
  ```bash
22
22
  mycroft book list
23
23
  mycroft book ingest /path/to/book.epub
24
+ mycroft book ingest /path/to/book.epub --summary
25
+ mycroft book ingest /path/to/book.epub --batch
26
+ mycroft book ingest /path/to/book.epub --batch --summary
27
+ mycroft book ingest status <id>
28
+ mycroft book ingest resume <id>
24
29
  mycroft book ask <id> "What is the main conflict?"
25
30
  mycroft chat start <id>
26
31
  mycroft chat ask <session> "What does this foreshadow?"
@@ -30,6 +35,23 @@ mycroft config resolve
30
35
  mycroft config onboard
31
36
  ```
32
37
 
38
+ ## Cost estimates (approximate)
39
+
40
+ These are rough, model-dependent estimates for embeddings + optional summaries. Costs vary by model pricing and book structure. Use this as a directional guide only. Summarization estimates assume `gpt-5-nano` and embeddings assume `text-embedding-3-small`.
41
+
42
+ | Book size | Example | No summaries | With summaries | With summaries (batched) |
43
+ | --- | --- | --- | --- | --- |
44
+ | Small | 200-300 pages | ~$0.002-$0.004 | ~$0.04-$0.08 | ~$0.02-$0.04 |
45
+ | Average novel | 350-450 pages | ~$0.004-$0.006 | ~$0.08-$0.15 | ~$0.04-$0.08 |
46
+ | Large novel | 600-800 pages | ~$0.007-$0.01 | ~$0.15-$0.25 | ~$0.08-$0.13 |
47
+ | Trilogy | 1,500-2,000 pages | ~$0.02-$0.03 | ~$0.30-$0.60 | ~$0.15-$0.30 |
48
+
49
+ Reference point: a ~700 page book (~1,600 chunks) is about ~$0.008 for embeddings only, ~$0.20 with summaries, or ~$0.10 with summaries batched.
50
+
51
+ Use `--summary` to generate per-chapter summaries during ingestion. Summaries improve retrieval quality but are significantly more expensive than embeddings alone (see cost table above). Without `--summary`, ingestion only generates embeddings, which is fast and cheap.
52
+
53
+ Use `--batch` to cut costs by 50% via the OpenAI Batch API. This applies to both embeddings and summaries. Batch jobs may take up to 24 hours to complete. When using `--batch`, the command returns immediately after submitting the job. When combined with `--summary`, the summary batch runs first; once complete, run `resume` to submit the embedding batch. Use `mycroft book ingest status <id>` to check progress, and `mycroft book ingest resume <id>` to advance to the next phase. If a non-batch ingest is interrupted, use the same resume command to continue without re-embedding completed chunks.
54
+
33
55
  ## Local dev
34
56
 
35
57
  ```bash
@@ -74,5 +96,6 @@ CLI overrides:
74
96
  - `--max-chapter <n>`
75
97
  - `--top-k <n>`
76
98
  - `--manual` (interactive chapter selection)
99
+ - `--batch`
77
100
  - `--summary`
78
101
  - `--force`
@@ -6,6 +6,7 @@ _mycroft() {
6
6
  local top_commands="book config chat"
7
7
  local global_flags="--help --version --data-dir"
8
8
  local book_commands="ingest list show ask search delete"
9
+ local ingest_commands="status resume"
9
10
  local config_commands="path init resolve onboard"
10
11
  local chat_commands="start ask list show repl"
11
12
 
@@ -22,7 +23,16 @@ _mycroft() {
22
23
  fi
23
24
  case "${COMP_WORDS[2]}" in
24
25
  ingest)
25
- COMPREPLY=( $(compgen -W "--manual --no-summary" -- "${cur}") )
26
+ if [[ ${COMP_CWORD} -eq 3 ]]; then
27
+ COMPREPLY=( $(compgen -W "${ingest_commands} --manual --summary --batch" -f -- "${cur}") )
28
+ return 0
29
+ fi
30
+ case "${COMP_WORDS[3]}" in
31
+ status|resume)
32
+ return 0
33
+ ;;
34
+ esac
35
+ COMPREPLY=( $(compgen -W "--manual --summary --batch" -- "${cur}") )
26
36
  return 0
27
37
  ;;
28
38
  ask|search)
@@ -15,6 +15,16 @@ function __mycroft_using_command
15
15
  return 1
16
16
  end
17
17
 
18
+ function __mycroft_using_subcommand
19
+ set -l cmd (commandline -opc)
20
+ set -l sub $argv[1]
21
+ set -l subsub $argv[2]
22
+ if test (count $cmd) -ge 3; and test $cmd[2] = $sub; and test $cmd[3] = $subsub
23
+ return 0
24
+ end
25
+ return 1
26
+ end
27
+
18
28
  complete -c mycroft -n '__mycroft_needs_command' -a 'book' -d 'Manage books and queries'
19
29
  complete -c mycroft -n '__mycroft_needs_command' -a 'config' -d 'Manage configuration'
20
30
  complete -c mycroft -n '__mycroft_needs_command' -a 'chat' -d 'Run multi-turn chat sessions'
@@ -29,8 +39,11 @@ complete -c mycroft -n '__mycroft_using_command book' -a 'ask' -d 'Ask a questio
29
39
  complete -c mycroft -n '__mycroft_using_command book' -a 'search' -d 'Vector search without LLM'
30
40
  complete -c mycroft -n '__mycroft_using_command book' -a 'delete' -d 'Remove book, EPUB, and vectors'
31
41
 
32
- complete -c mycroft -n '__mycroft_using_command book; and __fish_seen_subcommand_from ingest' -l manual -d 'Interactive chapter selection'
33
- complete -c mycroft -n '__mycroft_using_command book; and __fish_seen_subcommand_from ingest' -l no-summary -d 'Skip AI chapter summaries'
42
+ complete -c mycroft -n '__mycroft_using_subcommand book ingest' -a 'status' -d 'Check ingestion status'
43
+ complete -c mycroft -n '__mycroft_using_subcommand book ingest' -a 'resume' -d 'Resume a pending ingestion'
44
+ complete -c mycroft -n '__mycroft_using_subcommand book ingest' -l manual -d 'Interactive chapter selection'
45
+ complete -c mycroft -n '__mycroft_using_subcommand book ingest' -l summary -d 'Enable AI chapter summaries'
46
+ complete -c mycroft -n '__mycroft_using_subcommand book ingest' -l batch -d 'Use OpenAI Batch API'
34
47
  complete -c mycroft -n '__mycroft_using_command book; and __fish_seen_subcommand_from ask search' -l top-k -r -d 'Number of passages to retrieve'
35
48
  complete -c mycroft -n '__mycroft_using_command book; and __fish_seen_subcommand_from ask search' -l max-chapter -r -d 'Spoiler-free limit'
36
49
  complete -c mycroft -n '__mycroft_using_command book; and __fish_seen_subcommand_from delete' -l force -d 'Skip confirmation'
@@ -7,6 +7,9 @@ _mycroft() {
7
7
  local -a book_commands
8
8
  book_commands=(ingest list show ask search delete)
9
9
 
10
+ local -a ingest_commands
11
+ ingest_commands=(status resume)
12
+
10
13
  local -a config_commands
11
14
  config_commands=(path init resolve onboard)
12
15
 
@@ -31,7 +34,17 @@ _mycroft() {
31
34
  fi
32
35
  case ${words[3]} in
33
36
  ingest)
34
- _arguments "--manual[Interactive chapter selection]" "--no-summary[Skip AI chapter summaries]"
37
+ if (( CURRENT == 4 )); then
38
+ _describe -t commands "ingest commands" ingest_commands
39
+ _arguments "--manual[Interactive chapter selection]" "--summary[Enable AI chapter summaries]" "--batch[Use OpenAI Batch API]" '*:epub file:_files -g "*.epub"'
40
+ return
41
+ fi
42
+ case ${words[4]} in
43
+ status|resume)
44
+ return
45
+ ;;
46
+ esac
47
+ _arguments "--manual[Interactive chapter selection]" "--summary[Enable AI chapter summaries]" "--batch[Use OpenAI Batch API]"
35
48
  return
36
49
  ;;
37
50
  ask|search)
@@ -0,0 +1,14 @@
1
+ import {
2
+ checkBatchStatus,
3
+ cleanupBatchFiles,
4
+ downloadBatchResults,
5
+ submitBatchEmbeddings
6
+ } from "./chunk-BR2PM6D3.js";
7
+ import "./chunk-R3FOJK5A.js";
8
+ export {
9
+ checkBatchStatus,
10
+ cleanupBatchFiles,
11
+ downloadBatchResults,
12
+ submitBatchEmbeddings
13
+ };
14
+ //# sourceMappingURL=batch-embedder-6IIWAZPW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ import {
2
+ checkBatchStatus,
3
+ cleanupBatchFiles,
4
+ downloadBatchResults,
5
+ submitBatchEmbeddings
6
+ } from "./chunk-7CO4PMU5.js";
7
+ import "./chunk-KGG7WEYE.js";
8
+ export {
9
+ checkBatchStatus,
10
+ cleanupBatchFiles,
11
+ downloadBatchResults,
12
+ submitBatchEmbeddings
13
+ };
14
+ //# sourceMappingURL=batch-embedder-7DGZAQKL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ import {
2
+ checkBatchStatus,
3
+ cleanupBatchFiles,
4
+ downloadBatchResults,
5
+ submitBatchEmbeddings
6
+ } from "./chunk-VBEGUDHG.js";
7
+ import "./chunk-LV52FEMB.js";
8
+ export {
9
+ checkBatchStatus,
10
+ cleanupBatchFiles,
11
+ downloadBatchResults,
12
+ submitBatchEmbeddings
13
+ };
14
+ //# sourceMappingURL=batch-embedder-C2E6OHBQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,13 @@
1
+ import {
2
+ checkBatchStatus,
3
+ cleanupBatchFiles,
4
+ downloadBatchResults,
5
+ submitBatchEmbeddings
6
+ } from "./chunk-6DLQHHCC.js";
7
+ export {
8
+ checkBatchStatus,
9
+ cleanupBatchFiles,
10
+ downloadBatchResults,
11
+ submitBatchEmbeddings
12
+ };
13
+ //# sourceMappingURL=batch-embedder-IZDBS3IL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,15 @@
1
+ import {
2
+ checkBatchStatus,
3
+ cleanupBatchFiles,
4
+ downloadBatchResults,
5
+ submitBatchEmbeddings
6
+ } from "./chunk-7NLMBXXY.js";
7
+ import "./chunk-7IPX4MKA.js";
8
+ import "./chunk-R3FOJK5A.js";
9
+ export {
10
+ checkBatchStatus,
11
+ cleanupBatchFiles,
12
+ downloadBatchResults,
13
+ submitBatchEmbeddings
14
+ };
15
+ //# sourceMappingURL=batch-embedder-LYCZDYI4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ import {
2
+ checkBatchStatus,
3
+ cleanupBatchFiles,
4
+ downloadBatchResults,
5
+ submitBatchEmbeddings
6
+ } from "./chunk-57ZGGKEF.js";
7
+ import "./chunk-R3FOJK5A.js";
8
+ export {
9
+ checkBatchStatus,
10
+ cleanupBatchFiles,
11
+ downloadBatchResults,
12
+ submitBatchEmbeddings
13
+ };
14
+ //# sourceMappingURL=batch-embedder-RHKD2OJD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ import {
2
+ checkBatchStatus,
3
+ cleanupBatchFiles,
4
+ downloadBatchResults,
5
+ submitBatchEmbeddings
6
+ } from "./chunk-35EO53CC.js";
7
+ import "./chunk-R3FOJK5A.js";
8
+ export {
9
+ checkBatchStatus,
10
+ cleanupBatchFiles,
11
+ downloadBatchResults,
12
+ submitBatchEmbeddings
13
+ };
14
+ //# sourceMappingURL=batch-embedder-VQZUI7R6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ import {
2
+ checkBatchStatus,
3
+ cleanupBatchFiles,
4
+ downloadBatchResults,
5
+ submitBatchEmbeddings
6
+ } from "./chunk-XXO66RCF.js";
7
+ import "./chunk-KGG7WEYE.js";
8
+ export {
9
+ checkBatchStatus,
10
+ cleanupBatchFiles,
11
+ downloadBatchResults,
12
+ submitBatchEmbeddings
13
+ };
14
+ //# sourceMappingURL=batch-embedder-ZJZLNLOK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ import {
2
+ downloadBatchSummaryResults,
3
+ downloadMergeResults,
4
+ submitBatchSummaries,
5
+ submitMergePass
6
+ } from "./chunk-QRDUQX63.js";
7
+ import "./chunk-KGG7WEYE.js";
8
+ export {
9
+ downloadBatchSummaryResults,
10
+ downloadMergeResults,
11
+ submitBatchSummaries,
12
+ submitMergePass
13
+ };
14
+ //# sourceMappingURL=batch-summarizer-7MCT4HJB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ import {
2
+ downloadBatchSummaryResults,
3
+ downloadMergeResults,
4
+ submitBatchSummaries,
5
+ submitMergePass
6
+ } from "./chunk-7DUQNGEK.js";
7
+ import "./chunk-KGG7WEYE.js";
8
+ export {
9
+ downloadBatchSummaryResults,
10
+ downloadMergeResults,
11
+ submitBatchSummaries,
12
+ submitMergePass
13
+ };
14
+ //# sourceMappingURL=batch-summarizer-BMIBVFAE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ import {
2
+ downloadBatchSummaryResults,
3
+ downloadMergeResults,
4
+ submitBatchSummaries,
5
+ submitMergePass
6
+ } from "./chunk-T6X7DRBN.js";
7
+ import "./chunk-LV52FEMB.js";
8
+ export {
9
+ downloadBatchSummaryResults,
10
+ downloadMergeResults,
11
+ submitBatchSummaries,
12
+ submitMergePass
13
+ };
14
+ //# sourceMappingURL=batch-summarizer-CM3NO7TK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}