@fs/mycroft 0.1.1 → 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.
Files changed (55) hide show
  1. package/README.md +28 -2
  2. package/completions/mycroft.bash +22 -1
  3. package/completions/mycroft.fish +12 -0
  4. package/completions/mycroft.zsh +25 -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-IZDBS3IL.js +13 -0
  10. package/dist/batch-embedder-IZDBS3IL.js.map +1 -0
  11. package/dist/batch-embedder-LYCZDYI4.js +15 -0
  12. package/dist/batch-embedder-LYCZDYI4.js.map +1 -0
  13. package/dist/batch-embedder-RHKD2OJD.js +14 -0
  14. package/dist/batch-embedder-RHKD2OJD.js.map +1 -0
  15. package/dist/batch-embedder-VQZUI7R6.js +14 -0
  16. package/dist/batch-embedder-VQZUI7R6.js.map +1 -0
  17. package/dist/batch-embedder-ZJZLNLOK.js +14 -0
  18. package/dist/batch-embedder-ZJZLNLOK.js.map +1 -0
  19. package/dist/batch-summarizer-7MCT4HJB.js +14 -0
  20. package/dist/batch-summarizer-7MCT4HJB.js.map +1 -0
  21. package/dist/batch-summarizer-BMIBVFAE.js +14 -0
  22. package/dist/batch-summarizer-BMIBVFAE.js.map +1 -0
  23. package/dist/chunk-35EO53CC.js +8058 -0
  24. package/dist/chunk-35EO53CC.js.map +1 -0
  25. package/dist/chunk-57ZGGKEF.js +8060 -0
  26. package/dist/chunk-57ZGGKEF.js.map +1 -0
  27. package/dist/chunk-6DLQHHCC.js +249 -0
  28. package/dist/chunk-6DLQHHCC.js.map +1 -0
  29. package/dist/chunk-7CO4PMU5.js +92 -0
  30. package/dist/chunk-7CO4PMU5.js.map +1 -0
  31. package/dist/chunk-7DUQNGEK.js +253 -0
  32. package/dist/chunk-7DUQNGEK.js.map +1 -0
  33. package/dist/chunk-7IPX4MKA.js +4637 -0
  34. package/dist/chunk-7IPX4MKA.js.map +1 -0
  35. package/dist/chunk-7NLMBXXY.js +6438 -0
  36. package/dist/chunk-7NLMBXXY.js.map +1 -0
  37. package/dist/chunk-BR2PM6D3.js +11047 -0
  38. package/dist/chunk-BR2PM6D3.js.map +1 -0
  39. package/dist/chunk-KGG7WEYE.js +162 -0
  40. package/dist/chunk-KGG7WEYE.js.map +1 -0
  41. package/dist/chunk-QRDUQX63.js +256 -0
  42. package/dist/chunk-QRDUQX63.js.map +1 -0
  43. package/dist/chunk-R3FOJK5A.js +2088 -0
  44. package/dist/chunk-R3FOJK5A.js.map +1 -0
  45. package/dist/chunk-XXO66RCF.js +94 -0
  46. package/dist/chunk-XXO66RCF.js.map +1 -0
  47. package/dist/cli.js +1050 -201
  48. package/dist/cli.js.map +1 -1
  49. package/dist/fileFromPath-FLANAQWT.js +128 -0
  50. package/dist/fileFromPath-FLANAQWT.js.map +1 -0
  51. package/dist/main-36PRDAPE.js +1857 -0
  52. package/dist/main-36PRDAPE.js.map +1 -0
  53. package/dist/main-B3QJZGLU.js +1859 -0
  54. package/dist/main-B3QJZGLU.js.map +1 -0
  55. package/package.json +7 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # mycroft-cli
1
+ # mycroft
2
2
 
3
3
  Command-line tool that ingests EPUB files, builds a local searchable index, and answers questions using a retrieval-augmented workflow.
4
4
 
@@ -16,17 +16,42 @@ Ensure `node` is on your PATH (the CLI uses Node.js as its runtime).
16
16
 
17
17
  ## Usage
18
18
 
19
- Run `mycroft config onboard` first to set everything up, then use the book commands.
19
+ Run `mycroft config onboard` first to set everything up, then use the book and chat commands.
20
20
 
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?"
30
+ mycroft chat start <id>
31
+ mycroft chat ask <session> "What does this foreshadow?"
32
+ mycroft chat repl <session>
25
33
  mycroft config init
26
34
  mycroft config resolve
27
35
  mycroft config onboard
28
36
  ```
29
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
+
30
55
  ## Local dev
31
56
 
32
57
  ```bash
@@ -71,5 +96,6 @@ CLI overrides:
71
96
  - `--max-chapter <n>`
72
97
  - `--top-k <n>`
73
98
  - `--manual` (interactive chapter selection)
99
+ - `--batch`
74
100
  - `--summary`
75
101
  - `--force`
@@ -3,10 +3,11 @@ _mycroft() {
3
3
  cur="${COMP_WORDS[COMP_CWORD]}"
4
4
  prev="${COMP_WORDS[COMP_CWORD-1]}"
5
5
 
6
- local top_commands="book config"
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
9
  local config_commands="path init resolve onboard"
10
+ local chat_commands="start ask list show repl"
10
11
 
11
12
  if [[ ${COMP_CWORD} -le 1 ]]; then
12
13
  COMPREPLY=( $(compgen -W "${top_commands} ${global_flags}" -- "${cur}") )
@@ -40,6 +41,26 @@ _mycroft() {
40
41
  return 0
41
42
  fi
42
43
  ;;
44
+ chat)
45
+ if [[ ${COMP_CWORD} -eq 2 ]]; then
46
+ COMPREPLY=( $(compgen -W "${chat_commands} ${global_flags}" -- "${cur}") )
47
+ return 0
48
+ fi
49
+ case "${COMP_WORDS[2]}" in
50
+ ask|repl)
51
+ COMPREPLY=( $(compgen -W "--top-k --max-chapter" -- "${cur}") )
52
+ return 0
53
+ ;;
54
+ show)
55
+ COMPREPLY=( $(compgen -W "--tail" -- "${cur}") )
56
+ return 0
57
+ ;;
58
+ start)
59
+ COMPREPLY=( $(compgen -W "--title" -- "${cur}") )
60
+ return 0
61
+ ;;
62
+ esac
63
+ ;;
43
64
  esac
44
65
  }
45
66
 
@@ -17,6 +17,7 @@ end
17
17
 
18
18
  complete -c mycroft -n '__mycroft_needs_command' -a 'book' -d 'Manage books and queries'
19
19
  complete -c mycroft -n '__mycroft_needs_command' -a 'config' -d 'Manage configuration'
20
+ complete -c mycroft -n '__mycroft_needs_command' -a 'chat' -d 'Run multi-turn chat sessions'
20
21
  complete -c mycroft -s h -l help -d 'Show help'
21
22
  complete -c mycroft -l version -d 'Show version'
22
23
  complete -c mycroft -l data-dir -r -d 'Override data directory'
@@ -38,3 +39,14 @@ complete -c mycroft -n '__mycroft_using_command config' -a 'path' -d 'Print conf
38
39
  complete -c mycroft -n '__mycroft_using_command config' -a 'init' -d 'Create default config file'
39
40
  complete -c mycroft -n '__mycroft_using_command config' -a 'resolve' -d 'Print resolved config values'
40
41
  complete -c mycroft -n '__mycroft_using_command config' -a 'onboard' -d 'Initialize config and show next step'
42
+
43
+ complete -c mycroft -n '__mycroft_using_command chat' -a 'start' -d 'Start a chat session for a book'
44
+ complete -c mycroft -n '__mycroft_using_command chat' -a 'ask' -d 'Ask a question in a chat session'
45
+ complete -c mycroft -n '__mycroft_using_command chat' -a 'list' -d 'List chat sessions'
46
+ complete -c mycroft -n '__mycroft_using_command chat' -a 'show' -d 'Show chat session details'
47
+ complete -c mycroft -n '__mycroft_using_command chat' -a 'repl' -d 'Start interactive chat session'
48
+
49
+ complete -c mycroft -n '__mycroft_using_command chat; and __fish_seen_subcommand_from ask repl' -l top-k -r -d 'Number of passages to retrieve'
50
+ complete -c mycroft -n '__mycroft_using_command chat; and __fish_seen_subcommand_from ask repl' -l max-chapter -r -d 'Spoiler-free limit'
51
+ complete -c mycroft -n '__mycroft_using_command chat; and __fish_seen_subcommand_from show' -l tail -r -d 'Show last N messages'
52
+ complete -c mycroft -n '__mycroft_using_command chat; and __fish_seen_subcommand_from start' -l title -r -d 'Session title'
@@ -2,7 +2,7 @@
2
2
 
3
3
  _mycroft() {
4
4
  local -a top_commands
5
- top_commands=(book config)
5
+ top_commands=(book config chat)
6
6
 
7
7
  local -a book_commands
8
8
  book_commands=(ingest list show ask search delete)
@@ -10,6 +10,9 @@ _mycroft() {
10
10
  local -a config_commands
11
11
  config_commands=(path init resolve onboard)
12
12
 
13
+ local -a chat_commands
14
+ chat_commands=(start ask list show repl)
15
+
13
16
  local -a global_flags
14
17
  global_flags=(--help --version --data-dir)
15
18
 
@@ -48,6 +51,27 @@ _mycroft() {
48
51
  return
49
52
  fi
50
53
  ;;
54
+ chat)
55
+ if (( CURRENT == 3 )); then
56
+ _describe -t commands "chat commands" chat_commands
57
+ _describe -t flags "global flags" global_flags
58
+ return
59
+ fi
60
+ case ${words[3]} in
61
+ ask|repl)
62
+ _arguments "--top-k[Number of passages to retrieve]:n" "--max-chapter[Spoiler-free limit]:n"
63
+ return
64
+ ;;
65
+ show)
66
+ _arguments "--tail[Show last N messages]:n"
67
+ return
68
+ ;;
69
+ start)
70
+ _arguments "--title[Session title]:text"
71
+ return
72
+ ;;
73
+ esac
74
+ ;;
51
75
  esac
52
76
  }
53
77
 
@@ -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,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":[]}