@lingochunk/mcp 0.3.1 → 0.8.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
@@ -14,13 +14,23 @@ contributions (see [CONTRIBUTING.md](CONTRIBUTING.md)).
14
14
  > Install: `/plugin marketplace add lingochunk/lingochunk-mcp` in Claude Code (server
15
15
  > plus lesson skills), or `npx -y @lingochunk/mcp` as a standalone MCP server.
16
16
 
17
+ **A creator rather than a coder?** If you make audio (a podcast, a YouTube
18
+ channel, classes) and want your episodes to become annotated transcripts,
19
+ lessons, courses and multi-language study guides your audience can use, start
20
+ with **[LingoChunk for creators](docs/creator-guide.md)** - no programming
21
+ required, everything happens by talking to an AI assistant.
22
+
17
23
  ## What it gives an agent
18
24
 
19
- Twelve tools, each wrapping one public endpoint. The first seven are read-only;
20
- the last five write to your account.
25
+ Thirty tools. Twelve read from your account; sixteen write to it; two serve
26
+ guidance: `whats_possible` answers "what can I do here?" with a short menu
27
+ and an example prompt per area, and `get_authoring_guide` serves the full
28
+ authoring craft guides so remote clients that never see the skills still
29
+ compose good lessons, cards and annotations.
21
30
 
22
31
  | Tool | Scope | What it does |
23
32
  |---|---|---|
33
+ | `whats_possible` | none | The quick tour: every area this connection covers (discuss, vocabulary, lessons, courses, cards, languages, creator notes, publishing), one example prompt each. The agent answers short and offers to go deeper per area. |
24
34
  | `get_vocabulary` | `vocab:read` | Your vocabulary, aggregated per word with FSRS maturity (known/learning/new/due). Filterable; incremental sync via `since` + `cursor` (additive-only, so full-resync periodically). |
25
35
  | `lookup_word` | `vocab:read` | One word: your own context plus a shared-lexicon gender/CEFR fallback. Grounds an LLM's guesses. |
26
36
  | `list_library` | `content:read` | Your ready-to-study episodes (own + followed collections), cursor-paginated. |
@@ -28,33 +38,74 @@ the last five write to your account.
28
38
  | `get_audio_url` | `content:read` | A short-lived presigned URL to the full native audio (Range-capable). |
29
39
  | `search_examples` | `content:read` | Example sentences across your library, by word (`lemma`) or text (`q`). A capped sample, not exhaustive. |
30
40
  | `get_audio_clip` | `content:read` | Cuts a short native-audio snippet, **saves it to a local file**, and returns `{path, media_type, size_bytes}` for embedding in lessons. |
41
+ | `get_authoring_guide` | none | Returns the full craft guide for `topic` (`overview`, `lesson`, `course`, `cards`, `annotations`, `add-language`, `discuss`) - the same content as the bundled skills, embedded in the package so remote clients get it too. Call it before composing. |
31
42
  | `list_decks` | `cards:write` or `decks:export` | Your study decks with card counts, for picking a `deck_id` to add to or export. |
32
43
  | `add_card` | `cards:write` | Adds a card to your review queue (FSRS, starts new). Preferred: the `card.v1` kinds (`word`, `phrase`, `collocation`, `idiom`, `chunk`, `grammar`, `cloze`, `contrast`, `qa`, `production`) anchored to a verbatim transcript sentence - the server derives the highlight/blur painting and native-audio clip, so the card matches the app's own. Legacy: `kind=vocab` from your vocabulary, or `kind=custom` front/back. Omit `deck_id` to use the deck for the card's own submission. |
33
44
  | `export_anki_deck` | `decks:export` | Exports a deck to Anki `.apkg` (no LLM), polling internally; returns a download URL when ready. A deck with no linked episode can't be exported. |
34
- | `save_lesson` | `lessons:write` | Saves a lesson to your private library (100 max). Preferred: a structured `lesson.v1` document the app renders natively (Lessons tab on the episode, real audio, live word state, Ask AI); returns metadata + an `app_url`. Legacy: a self-contained HTML file (10 MB cap) opened via a short-lived view URL. |
45
+ | `validate_lesson` | `lessons:write` | Dry-run validates a `lesson.v1` document WITHOUT saving it, reporting EVERY problem at once (schema faults with a `loc`, reference faults with the same codes `save_lesson` raises) so you fix a document in one pass. Stores nothing; spends no lesson-cap budget. Call it before `save_lesson`. |
46
+ | `save_lesson` | `lessons:write` | Saves a lesson to your private library (100 max). Preferred: a structured `lesson.v1` document the app renders natively (Lessons tab on the episode, real audio, live word state, Ask AI); returns metadata + an `app_url`. Legacy: a self-contained HTML file (10 MB cap) opened via a short-lived view URL. Optional `course_id` (+ `sequence`) files it under a course. Creators: `visibility:'public'` publishes the lesson to everyone who can view the source episode (documents only, own episodes only). |
47
+ | `list_lessons` | `lessons:write` | Your saved lessons, newest first (id, title, language, format, source episode, and `course_id`/`sequence`/`course_title` when filed under a course), cursor-paginated - for finding ids and seeing what already exists. |
48
+ | `get_lesson` | `lessons:write` | Reads back a saved `lesson.v1` document by id. Closes the revision loop: lessons are immutable, so revise = read -> save new -> delete old. |
35
49
  | `delete_lesson` | `lessons:write` | Permanently deletes one saved lesson by id (destructive; owner-scoped server-side). Mainly for iterating: re-saving creates a new lesson, so superseded drafts count against the 100-lesson cap. |
36
-
37
- Plus three skills:
38
-
50
+ | `create_course` | `lessons:write` | Creates a course: a named, ordered series to file lessons under. Returns its id, for `save_lesson`'s `course_id`. Authored via the API only (no in-app course editor). |
51
+ | `list_courses` | `lessons:write` | Your courses, newest first, each with its lesson count - for finding a `course_id` or seeing what series exist. |
52
+ | `delete_course` | `lessons:write` | Deletes one course by id (destructive to the grouping, idempotent). Its lessons SURVIVE - their `course_id` is set null, un-grouping them; authored content is never deleted. |
53
+ | `list_languages` | `content:read` | An episode's target languages and how to add more: the fan-out group so far (each with its own submission id + status), `available_targets` (ordinary Groq targets), `simplify_targets` (leveled same-language codes like `de-a2`) and in-progress drafts. |
54
+ | `get_translation_source` | `content:read` | Pages the primary's sentences to translate yourself: source text, the pivot-language gloss per sentence and per token (which fixes each word's sense). Feeds the draft flow. |
55
+ | `add_language` | `translations:write` | Fans an episode out into 1-10 extra **ordinary** target languages server-side (Groq, no tokens of yours); returns a job per language. Leveled same-language codes are rejected here - use the draft flow. |
56
+ | `put_language_translations` | `translations:write` | Uploads a batch (1-100) of agent-written draft sentences (whole-sentence translation + one meaning per token) for a target or leveled language; returns per-sentence rejections to repair. |
57
+ | `commit_language` | `translations:write` | Validates a complete draft and applies it, minting the sibling deck; polls the job and returns the new submission id when ready. |
58
+ | `discard_language_draft` | `translations:write` | Deletes the in-progress draft rows for a language (destructive; never a committed sibling). |
59
+ | `list_annotations` | `content:read` | An episode's creator annotations (each a markdown note on a transcript sentence span), plus `count` and `max_annotations` so you can budget and avoid duplicates. |
60
+ | `create_annotation` | `annotations:write` | Attaches a markdown creator note to a sentence span (Unicode code-point offsets into the sentence's `display`, or a whole-sentence note); the response echoes `selected_text` to verify the span. |
61
+ | `update_annotation` | `annotations:write` | Replaces one annotation's note in place (the anchor stays put). |
62
+ | `delete_annotation` | `annotations:write` | Deletes one annotation (destructive); also how you fix a mis-anchored span before re-creating it. |
63
+
64
+ Plus seven skills:
65
+
66
+ - **`lingochunk-overview`** - the "what can I do?" tour: a short menu of
67
+ every area (with an example prompt each) and instructions to answer
68
+ briefly, then expand whichever area the user picks.
39
69
  - **`lingochunk-lesson`** - composes a coursebook-style `lesson.v1` document
40
70
  (listen, text, vocabulary, one grammar point, graded exercises, review)
41
71
  from the tools above, filtering out words you already know; the app
42
72
  renders it natively and can export an offline HTML worksheet.
73
+ - **`lingochunk-course`** - plans a multi-lesson series: slices an episode (or
74
+ collection) into coherent parts, creates a course, then builds N lessons via
75
+ the lesson skill with a different grammar point and ramping difficulty per
76
+ lesson, each filed under the course in order.
43
77
  - **`lingochunk-cards`** - builds native-grade flashcards with the `card.v1`
44
78
  kinds: verbatim transcript anchors, per-kind guidance (grammar =
45
79
  production cloze of the morpheme with a hint), and a quality rubric
46
80
  distilled from the known failure modes of AI-generated cards.
47
81
  - **`lingochunk-discuss`** - a lighter, conversational "talk me through this
48
82
  episode" workflow.
83
+ - **`lingochunk-add-language`** - adds another language to one of your episodes
84
+ as a new sibling deck: either the server-side Groq fan-out for an ordinary
85
+ target, or an agent-supplied translation you write sentence by sentence and
86
+ commit - the only way to build a leveled same-language deck (e.g.
87
+ "German (A2)", German audio glossed in simpler A2 German).
88
+ - **`lingochunk-annotate`** - finds the genuinely useful expressions in one of
89
+ your episodes (idioms, phrasal verbs, collocations, discourse markers,
90
+ culture-bound references) and attaches a short markdown creator note to each
91
+ exact span: an iris tint + note sheet for you, a forward-only note card for
92
+ your followers.
93
+
94
+ The Claude Code plugin installs these as skills. Every client also gets the
95
+ same guidance two other ways that need no plugin: as MCP **prompts** (one per
96
+ skill, named `lingochunk-lesson`, `lingochunk-cards`, ...) in the client's
97
+ prompt/slash picker, and via the **`get_authoring_guide`** tool the model can
98
+ call itself before composing.
49
99
 
50
100
  ## Prerequisites
51
101
 
52
102
  - Node.js >= 18.
53
103
  - A LingoChunk **personal access token**: in LingoChunk, open Settings -> API
54
104
  access, create a token, and grant the scopes you need (`vocab:read` +
55
- `content:read` cover the read tools; add `cards:write`, `decks:export` and
56
- `lessons:write` for the write tools). The token is shown once and starts with
57
- `lcp_`. The 403 errors from the tools name the exact scope you are missing.
105
+ `content:read` cover the read tools; add `cards:write`, `decks:export`,
106
+ `lessons:write`, `translations:write` and `annotations:write` for the write
107
+ tools). The token is shown once and starts with `lcp_`. The 403 errors from
108
+ the tools name the exact scope you are missing.
58
109
 
59
110
  ## Use it
60
111
 
@@ -92,6 +143,36 @@ npm install # installs deps and builds dist/ via the prepare script
92
143
  claude mcp add lingochunk --env LINGOCHUNK_TOKEN=lcp_... -- node /absolute/path/to/lingochunk-mcp/dist/index.js
93
144
  ```
94
145
 
146
+ ### Option C - hosted server (no install: claude.ai, ChatGPT, Le Chat, ...)
147
+
148
+ The same server also runs hosted at `https://lingochunk.com/mcp` as a
149
+ standard **remote MCP server** (Streamable HTTP). Nothing to install - paste
150
+ the URL into any client that supports custom remote MCP servers and **sign in
151
+ with your LingoChunk account when the client prompts you** (OAuth 2.1 with a
152
+ consent screen; the grant appears in Settings -> API tokens, revocable like
153
+ any token). Clients with a token field can instead send a personal access
154
+ token as a Bearer credential:
155
+
156
+ | Client | Where |
157
+ |---|---|
158
+ | claude.ai (web/desktop/mobile, incl. Free) | Settings -> Connectors -> *Add custom connector* -> URL `https://lingochunk.com/mcp` -> a LingoChunk sign-in/consent screen opens; approve and you are connected |
159
+ | Claude Code | `claude mcp add --transport http lingochunk https://lingochunk.com/mcp` (OAuth on first use), or pass `--header "Authorization: Bearer lcp_..."` to use a token instead |
160
+ | ChatGPT (paid plans) | Settings -> enable *Developer mode* -> Apps -> "+" -> URL (OAuth), or URL + your token |
161
+ | Mistral Le Chat | *+ Add Connector* -> Custom MCP Connector -> URL (auth auto-detected) |
162
+ | Perplexity (Pro/Max), Grok, Manus | add a custom connector/MCP server by URL, sign in or paste an API key |
163
+
164
+ Differences from the local server: `get_audio_clip` is unavailable (it writes
165
+ files, which only makes sense on your own machine - use `get_audio_url`), and
166
+ skills don't auto-load (the server exposes each skill as an MCP **prompt**,
167
+ and agents can pull the same guidance through the `get_authoring_guide` tool).
168
+
169
+ **If your client offers neither OAuth nor a token field**, embed the token in
170
+ the URL: `https://lingochunk.com/mcp/t/lcp_...`. That URL then IS a
171
+ credential - treat it like a password, prefer a token with only the scopes you
172
+ need, and revoke it in Settings if it ever leaks. OAuth sign-in or a header,
173
+ when your client supports one, is always preferred (URLs end up in access
174
+ logs).
175
+
95
176
  ## Use with other agents
96
177
 
97
178
  Nothing in the server is Claude-specific: it is a standard stdio MCP server,
@@ -201,6 +282,22 @@ when you want the update.
201
282
  The token is only ever sent as an `Authorization: Bearer` header to the
202
283
  configured origin; it is never written to disk or logged.
203
284
 
285
+ ### Hosted (remote) mode
286
+
287
+ `node dist/index.js --http` serves the same tools over Streamable HTTP for
288
+ remote MCP clients (see Option C). The process is stateless and multi-user:
289
+ `LINGOCHUNK_TOKEN` is not read - every request must carry its own
290
+ `Authorization: Bearer lcp_...` header, which is forwarded verbatim to the
291
+ API (the API stays the sole authority; the server stores nothing). A
292
+ `Dockerfile` is included.
293
+
294
+ | Variable | Required | Default | Meaning |
295
+ |---|---|---|---|
296
+ | `LINGOCHUNK_MCP_PORT` | no | `8100` | Listen port (`PORT` honoured as fallback). |
297
+ | `LINGOCHUNK_BASE_URL` | no | `https://lingochunk.com` | API origin; co-located deployments should point at the loopback origin. |
298
+
299
+ Endpoints: `POST /mcp` (the MCP wire), `GET /health` (liveness).
300
+
204
301
  ## Building a lesson
205
302
 
206
303
  Ask your agent something like "build me a lesson from yesterday's German episode"
@@ -217,10 +314,15 @@ lessons side by side under the episode's Lessons tab. See
217
314
 
218
315
  ```
219
316
  src/ the MCP server (TypeScript, stdio)
317
+ skills/lingochunk-overview/ the "what can I do?" tour skill
220
318
  skills/lingochunk-lesson/ the coursebook lesson skill
319
+ skills/lingochunk-course/ the multi-lesson course planner skill
221
320
  skills/lingochunk-cards/ the flashcard (card.v1) skill
222
321
  skills/lingochunk-discuss/ the "discuss an episode" skill
322
+ skills/lingochunk-add-language/ the add-language / draft-translation skill
323
+ skills/lingochunk-annotate/ the useful-expression annotation skill
223
324
  skills/*/examples/ example lesson.v1 documents (CI-validated)
325
+ docs/creator-guide.md the guide for content creators (start here if you make audio)
224
326
  docs/skill-authoring.md how to write a new skill
225
327
  docs/skill-template.md SKILL.md starting point
226
328
  docs/integrations/fluent.md how to plug this into the fluent tutor plugin
@@ -253,7 +355,7 @@ npm run validate:lesson -- <doc.json> # validate a lesson.v1 document (Node 22
253
355
 
254
356
  `spec/openapi-public-v1.json` is the source contract; it is exported from the
255
357
  LingoChunk repo (`make generate-openapi-public`) and refreshed here on each API
256
- release. This copy was taken from LingoChunk commit `0db02377`.
358
+ release. This copy was taken from LingoChunk commit `31c47289`.
257
359
 
258
360
  ### Live smoke test
259
361
 
package/dist/client.d.ts CHANGED
@@ -24,6 +24,139 @@ export interface DeckExportStatus {
24
24
  status: "ready" | "pending" | "failed" | "none";
25
25
  download_url?: string;
26
26
  }
27
+ /** One target language present on a submission's fan-out group. */
28
+ export interface SubmissionLanguage {
29
+ language: string;
30
+ submission_id: string;
31
+ status: string;
32
+ is_primary: boolean;
33
+ }
34
+ /** An in-progress agent-supplied translation draft for one language. */
35
+ export interface DraftSummary {
36
+ language: string;
37
+ sentences_drafted: number;
38
+ sentence_count: number;
39
+ }
40
+ /** Result of GET /submissions/{id}/languages. */
41
+ export interface SubmissionLanguages {
42
+ source_language: string;
43
+ languages: SubmissionLanguage[];
44
+ /** Ordinary Groq targets addable via add_language (source + existing removed). */
45
+ available_targets: string[];
46
+ /** Leveled same-language codes (e.g. de-a2) for the draft flow only. */
47
+ simplify_targets: string[];
48
+ drafts: DraftSummary[];
49
+ }
50
+ /** One source token as the Groq translator would see it. */
51
+ export interface SourceToken {
52
+ surface: string;
53
+ lemma: string;
54
+ pos: string;
55
+ pivot_meaning: string;
56
+ }
57
+ /** One source sentence to translate, with its pivot-language gloss. */
58
+ export interface SourceSentence {
59
+ position: number;
60
+ text: string;
61
+ pivot_translation: string;
62
+ tokens: SourceToken[];
63
+ }
64
+ /** Result of GET /submissions/{id}/translation-source (one page). */
65
+ export interface TranslationSource {
66
+ source_language: string;
67
+ pivot_language: string;
68
+ sentence_count: number;
69
+ sentences: SourceSentence[];
70
+ /** null when the page exhausts the submission. */
71
+ next_from_position: number | null;
72
+ }
73
+ /** Result of POST /submissions/{id}/languages (Groq fan-out trigger). */
74
+ export interface AddLanguagesResult {
75
+ jobs: {
76
+ language: string;
77
+ job_id: string;
78
+ }[];
79
+ skipped: {
80
+ language: string;
81
+ reason: string;
82
+ }[];
83
+ }
84
+ /** One draft sentence in a PUT batch: whole-sentence target text (null = no
85
+ * sentence back) plus one meaning per source token, in order. */
86
+ export interface DraftSentence {
87
+ position: number;
88
+ translation: string | null;
89
+ meanings: string[];
90
+ }
91
+ /** Result of PUT /submissions/{id}/translations/{language}. */
92
+ export interface PutTranslationsResult {
93
+ accepted: number;
94
+ rejected: {
95
+ position: number;
96
+ reason: string;
97
+ expected?: number;
98
+ got?: number;
99
+ }[];
100
+ sentences_drafted: number;
101
+ sentence_count: number;
102
+ }
103
+ /** Result of POST /submissions/{id}/translations/{language}/commit. */
104
+ export interface CommitDraftResult {
105
+ job_id: string;
106
+ language: string;
107
+ }
108
+ /** Result of GET /jobs/{id}: status of a fan-out or draft-apply job. */
109
+ export interface JobStatus {
110
+ status: string;
111
+ progress?: number;
112
+ step?: string | null;
113
+ error?: string | null;
114
+ }
115
+ /** Result of DELETE /submissions/{id}/translations/{language}. */
116
+ export interface DeleteDraftResult {
117
+ deleted_sentences: number;
118
+ }
119
+ /** One creator annotation: a markdown note anchored to a transcript sentence,
120
+ * tinted onto a char span or the whole sentence. */
121
+ export interface AnnotationV1 {
122
+ id: number;
123
+ /** The sentence's stable id (survives split/merge), from get_transcript. */
124
+ sentence_id: number;
125
+ /** null (with char_end) for a whole-sentence note; else a code-point offset. */
126
+ char_start: number | null;
127
+ char_end: number | null;
128
+ /** Server snapshot of display[char_start:char_end]; verify it after create. */
129
+ selected_text: string | null;
130
+ note: string;
131
+ /** The sentence was edited since; the app hides the tint until re-anchored. */
132
+ stale: boolean;
133
+ start_time: number | null;
134
+ end_time: number | null;
135
+ }
136
+ /** Result of GET /submissions/{id}/annotations. */
137
+ export interface AnnotationList {
138
+ /** Ordered by sentence, then char_start. */
139
+ annotations: AnnotationV1[];
140
+ count: number;
141
+ /** The per-submission cap, so an agent can budget how many more to add. */
142
+ max_annotations: number;
143
+ }
144
+ /** Body of POST /submissions/{id}/annotations. char_start/char_end are
145
+ * both-or-neither (neither = a whole-sentence note); offsets are Unicode
146
+ * code points into the sentence's display. */
147
+ export interface CreateAnnotationBody {
148
+ sentence_id: number;
149
+ char_start?: number | null;
150
+ char_end?: number | null;
151
+ note: string;
152
+ start_time?: number | null;
153
+ end_time?: number | null;
154
+ }
155
+ /** Result of DELETE /submissions/{id}/annotations/{annotation_id}. */
156
+ export interface DeleteAnnotationResult {
157
+ deleted: boolean;
158
+ annotation_id: number;
159
+ }
27
160
  export type QueryValue = string | number | boolean | undefined | null;
28
161
  /** How long any single request may take before we abort it. */
29
162
  export declare const REQUEST_TIMEOUT_MS = 30000;
@@ -53,6 +186,12 @@ export declare class LingoChunkClient {
53
186
  private deleteNoContent;
54
187
  /** POST a JSON body to an endpoint and parse the JSON response. */
55
188
  private postJson;
189
+ /** PUT a JSON body to an endpoint and parse the JSON response. */
190
+ private putJson;
191
+ /** PATCH a JSON body to an endpoint and parse the JSON response. */
192
+ private patchJson;
193
+ /** DELETE an endpoint that returns a JSON body (unlike deleteNoContent). */
194
+ private deleteJson;
56
195
  getVocabulary(params: Record<string, QueryValue>): Promise<unknown>;
57
196
  lookupWord(params: Record<string, QueryValue>): Promise<unknown>;
58
197
  listLibrary(params: Record<string, QueryValue>): Promise<unknown>;
@@ -62,6 +201,21 @@ export declare class LingoChunkClient {
62
201
  listDecks(): Promise<unknown>;
63
202
  addCard(body: object): Promise<unknown>;
64
203
  createLesson(body: object): Promise<unknown>;
204
+ /** Dry-run validate a lesson.v1 document without saving it: reports every
205
+ * failing category at once (schema + reference), so a document can be fixed
206
+ * in one pass instead of save -> 400 -> fix cycles. Stores nothing. */
207
+ validateLesson(body: object): Promise<unknown>;
208
+ listLessons(params: Record<string, QueryValue>): Promise<unknown>;
209
+ /** Create a course: a named, ordered series to file lessons under. */
210
+ createCourse(body: object): Promise<unknown>;
211
+ /** The caller's courses, newest first, each with its lesson_count. */
212
+ listCourses(): Promise<unknown>;
213
+ /** Delete a course (owner-scoped). Its lessons survive - the DB sets their
214
+ * course_id NULL, un-grouping them. 404 for a foreign or unknown id. */
215
+ deleteCourse(courseId: string): Promise<void>;
216
+ /** The stored lesson.v1 document. Owner-scoped server-side; 404 for HTML
217
+ * lessons (they have no document) and for foreign/unknown ids. */
218
+ getLessonDocument(lessonId: string): Promise<unknown>;
65
219
  /** Owner-scoped server-side: a foreign or unknown id is a 404, never a leak. */
66
220
  deleteLesson(lessonId: string): Promise<void>;
67
221
  /** Start an Anki export (no body). 400 for a deck with no linked submission. */
@@ -69,4 +223,38 @@ export declare class LingoChunkClient {
69
223
  exportDeckStatus(deckId: number): Promise<DeckExportStatus>;
70
224
  /** GET a clip as raw audio bytes (the endpoint streams audio, not JSON). */
71
225
  getAudioClip(submissionId: string, start: number, end: number): Promise<AudioClip>;
226
+ /** (a) The submission's fan-out group languages, addable targets, leveled
227
+ * simplify targets, and in-progress drafts. */
228
+ listSubmissionLanguages(submissionId: string): Promise<SubmissionLanguages>;
229
+ /** (b) A page of the primary's sentences (source text + pivot glosses) as the
230
+ * Groq translator would see them, for the agent to translate. */
231
+ getTranslationSource(submissionId: string, params: Record<string, QueryValue>): Promise<TranslationSource>;
232
+ /** (c) Trigger the server-side Groq fan-out into extra ordinary target
233
+ * languages; returns a job per accepted language plus per-code skips. */
234
+ addLanguages(submissionId: string, languages: string[]): Promise<AddLanguagesResult>;
235
+ /** (d) Upsert a batch of agent-supplied draft sentences for one language. */
236
+ putTranslations(submissionId: string, language: string, body: {
237
+ generator?: string;
238
+ sentences: DraftSentence[];
239
+ }): Promise<PutTranslationsResult>;
240
+ /** (e) Validate a complete draft and enqueue the apply job that mints the
241
+ * sibling submission. 409 when the draft misses sentence positions. */
242
+ commitTranslationDraft(submissionId: string, language: string): Promise<CommitDraftResult>;
243
+ /** (f) Owner-scoped job status, for polling a fan-out (c) or draft-apply (e)
244
+ * job to completion. */
245
+ getJob(jobId: string): Promise<JobStatus>;
246
+ /** (g) Delete the draft rows for one language (never a committed sibling). */
247
+ deleteTranslationDraft(submissionId: string, language: string): Promise<DeleteDraftResult>;
248
+ /** List a submission's creator annotations (ordered), with the per-submission
249
+ * cap so an agent can budget how many more to add. */
250
+ listAnnotations(submissionId: string): Promise<AnnotationList>;
251
+ /** Create one annotation on a sentence span (or the whole sentence). The
252
+ * response echoes the server's selected_text snapshot so the caller can
253
+ * verify the span it anchored. */
254
+ createAnnotation(submissionId: string, body: CreateAnnotationBody): Promise<AnnotationV1>;
255
+ /** Replace one annotation's markdown note (anchor unchanged; staleness is
256
+ * recomputed against the current sentence). */
257
+ updateAnnotation(submissionId: string, annotationId: number, note: string): Promise<AnnotationV1>;
258
+ /** Delete one annotation. Returns {deleted, annotation_id}. */
259
+ deleteAnnotation(submissionId: string, annotationId: number): Promise<DeleteAnnotationResult>;
72
260
  }
package/dist/client.js CHANGED
@@ -161,6 +161,48 @@ export class LingoChunkClient {
161
161
  }
162
162
  return (await res.json());
163
163
  }
164
+ /** PUT a JSON body to an endpoint and parse the JSON response. */
165
+ async putJson(path, body) {
166
+ const headers = this.authHeaders("application/json");
167
+ headers["Content-Type"] = "application/json";
168
+ const res = await fetch(this.buildUrl(path), {
169
+ method: "PUT",
170
+ headers,
171
+ body: JSON.stringify(body),
172
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
173
+ });
174
+ if (!res.ok) {
175
+ await this.raiseForStatus(res);
176
+ }
177
+ return (await res.json());
178
+ }
179
+ /** PATCH a JSON body to an endpoint and parse the JSON response. */
180
+ async patchJson(path, body) {
181
+ const headers = this.authHeaders("application/json");
182
+ headers["Content-Type"] = "application/json";
183
+ const res = await fetch(this.buildUrl(path), {
184
+ method: "PATCH",
185
+ headers,
186
+ body: JSON.stringify(body),
187
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
188
+ });
189
+ if (!res.ok) {
190
+ await this.raiseForStatus(res);
191
+ }
192
+ return (await res.json());
193
+ }
194
+ /** DELETE an endpoint that returns a JSON body (unlike deleteNoContent). */
195
+ async deleteJson(path) {
196
+ const res = await fetch(this.buildUrl(path), {
197
+ method: "DELETE",
198
+ headers: this.authHeaders("application/json"),
199
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
200
+ });
201
+ if (!res.ok) {
202
+ await this.raiseForStatus(res);
203
+ }
204
+ return (await res.json());
205
+ }
164
206
  // --- Read endpoints (thin pass-throughs; the tools shape the arguments) ---
165
207
  getVocabulary(params) {
166
208
  return this.getJson("/vocab", params);
@@ -190,6 +232,33 @@ export class LingoChunkClient {
190
232
  createLesson(body) {
191
233
  return this.postJson("/lessons", body);
192
234
  }
235
+ /** Dry-run validate a lesson.v1 document without saving it: reports every
236
+ * failing category at once (schema + reference), so a document can be fixed
237
+ * in one pass instead of save -> 400 -> fix cycles. Stores nothing. */
238
+ validateLesson(body) {
239
+ return this.postJson("/lessons/validate", body);
240
+ }
241
+ listLessons(params) {
242
+ return this.getJson("/lessons", params);
243
+ }
244
+ /** Create a course: a named, ordered series to file lessons under. */
245
+ createCourse(body) {
246
+ return this.postJson("/courses", body);
247
+ }
248
+ /** The caller's courses, newest first, each with its lesson_count. */
249
+ listCourses() {
250
+ return this.getJson("/courses");
251
+ }
252
+ /** Delete a course (owner-scoped). Its lessons survive - the DB sets their
253
+ * course_id NULL, un-grouping them. 404 for a foreign or unknown id. */
254
+ deleteCourse(courseId) {
255
+ return this.deleteNoContent(`/courses/${encodeURIComponent(courseId)}`);
256
+ }
257
+ /** The stored lesson.v1 document. Owner-scoped server-side; 404 for HTML
258
+ * lessons (they have no document) and for foreign/unknown ids. */
259
+ getLessonDocument(lessonId) {
260
+ return this.getJson(`/lessons/${encodeURIComponent(lessonId)}/document`);
261
+ }
193
262
  /** Owner-scoped server-side: a foreign or unknown id is a 404, never a leak. */
194
263
  deleteLesson(lessonId) {
195
264
  return this.deleteNoContent(`/lessons/${encodeURIComponent(lessonId)}`);
@@ -226,5 +295,60 @@ export class LingoChunkClient {
226
295
  const contentType = res.headers.get("content-type") ?? "audio/mpeg";
227
296
  return { data, contentType };
228
297
  }
298
+ // --- Language / translation endpoints (phase 4) -------------------------
299
+ /** (a) The submission's fan-out group languages, addable targets, leveled
300
+ * simplify targets, and in-progress drafts. */
301
+ listSubmissionLanguages(submissionId) {
302
+ return this.getJson(`/submissions/${encodeURIComponent(submissionId)}/languages`);
303
+ }
304
+ /** (b) A page of the primary's sentences (source text + pivot glosses) as the
305
+ * Groq translator would see them, for the agent to translate. */
306
+ getTranslationSource(submissionId, params) {
307
+ return this.getJson(`/submissions/${encodeURIComponent(submissionId)}/translation-source`, params);
308
+ }
309
+ /** (c) Trigger the server-side Groq fan-out into extra ordinary target
310
+ * languages; returns a job per accepted language plus per-code skips. */
311
+ addLanguages(submissionId, languages) {
312
+ return this.postJson(`/submissions/${encodeURIComponent(submissionId)}/languages`, { languages });
313
+ }
314
+ /** (d) Upsert a batch of agent-supplied draft sentences for one language. */
315
+ putTranslations(submissionId, language, body) {
316
+ return this.putJson(`/submissions/${encodeURIComponent(submissionId)}/translations/${encodeURIComponent(language)}`, body);
317
+ }
318
+ /** (e) Validate a complete draft and enqueue the apply job that mints the
319
+ * sibling submission. 409 when the draft misses sentence positions. */
320
+ commitTranslationDraft(submissionId, language) {
321
+ return this.postJson(`/submissions/${encodeURIComponent(submissionId)}/translations/${encodeURIComponent(language)}/commit`);
322
+ }
323
+ /** (f) Owner-scoped job status, for polling a fan-out (c) or draft-apply (e)
324
+ * job to completion. */
325
+ getJob(jobId) {
326
+ return this.getJson(`/jobs/${encodeURIComponent(jobId)}`);
327
+ }
328
+ /** (g) Delete the draft rows for one language (never a committed sibling). */
329
+ deleteTranslationDraft(submissionId, language) {
330
+ return this.deleteJson(`/submissions/${encodeURIComponent(submissionId)}/translations/${encodeURIComponent(language)}`);
331
+ }
332
+ // --- Creator annotation endpoints (phase 5) -----------------------------
333
+ /** List a submission's creator annotations (ordered), with the per-submission
334
+ * cap so an agent can budget how many more to add. */
335
+ listAnnotations(submissionId) {
336
+ return this.getJson(`/submissions/${encodeURIComponent(submissionId)}/annotations`);
337
+ }
338
+ /** Create one annotation on a sentence span (or the whole sentence). The
339
+ * response echoes the server's selected_text snapshot so the caller can
340
+ * verify the span it anchored. */
341
+ createAnnotation(submissionId, body) {
342
+ return this.postJson(`/submissions/${encodeURIComponent(submissionId)}/annotations`, body);
343
+ }
344
+ /** Replace one annotation's markdown note (anchor unchanged; staleness is
345
+ * recomputed against the current sentence). */
346
+ updateAnnotation(submissionId, annotationId, note) {
347
+ return this.patchJson(`/submissions/${encodeURIComponent(submissionId)}/annotations/${annotationId}`, { note });
348
+ }
349
+ /** Delete one annotation. Returns {deleted, annotation_id}. */
350
+ deleteAnnotation(submissionId, annotationId) {
351
+ return this.deleteJson(`/submissions/${encodeURIComponent(submissionId)}/annotations/${annotationId}`);
352
+ }
229
353
  }
230
354
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA;;6EAE6E;AAC7E,MAAM,OAAO,QAAS,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uCAEmC;IACnC,gBAAgB,CACd,YAAoB,EACpB,IAA0B;QAE1B,OAAO,IAAI,CAAC,QAAQ,CAClB,gBAAgB,kBAAkB,CAAC,YAAY,CAAC,cAAc,EAC9D,IAAI,CACL,CAAC;IACJ,CAAC;IAED;oDACgD;IAChD,gBAAgB,CACd,YAAoB,EACpB,YAAoB,EACpB,IAAY;QAEZ,OAAO,IAAI,CAAC,SAAS,CACnB,gBAAgB,kBAAkB,CAAC,YAAY,CAAC,gBAAgB,YAAY,EAAE,EAC9E,EAAE,IAAI,EAAE,CACT,CAAC;IACJ,CAAC;IAED,+DAA+D;IAC/D,gBAAgB,CACd,YAAoB,EACpB,YAAoB;QAEpB,OAAO,IAAI,CAAC,UAAU,CACpB,gBAAgB,kBAAkB,CAAC,YAAY,CAAC,gBAAgB,YAAY,EAAE,CAC/E,CAAC;IACJ,CAAC;CACF"}
package/dist/config.d.ts CHANGED
@@ -7,6 +7,29 @@ export interface Config {
7
7
  /** Directory audio clips are written to (get_audio_clip returns the file path). */
8
8
  clipDir: string;
9
9
  }
10
+ /** Configuration for the hosted (Streamable HTTP) mode: no token here - each
11
+ * request carries its own caller's Bearer credential. */
12
+ export interface HttpConfig {
13
+ /** Base origin of the LingoChunk API the server proxies to. */
14
+ baseUrl: string;
15
+ /** TCP port to listen on. */
16
+ port: number;
17
+ /** PUBLIC origin of the deployment, for URLs handed to clients (OAuth
18
+ * discovery). Distinct from baseUrl, which is the in-network upstream. */
19
+ publicOrigin: string;
20
+ }
21
+ /**
22
+ * Build the hosted-mode config from environment variables.
23
+ *
24
+ * - LINGOCHUNK_BASE_URL (optional) API origin; when co-located with the
25
+ * API prefer the loopback origin (e.g. http://127.0.0.1:8000) to skip the
26
+ * reverse proxy.
27
+ * - LINGOCHUNK_MCP_PORT (optional) listen port, default 8100. PORT is
28
+ * honoured as a fallback for PaaS conventions.
29
+ * - LINGOCHUNK_PUBLIC_ORIGIN (optional) the origin clients see (default the
30
+ * production site); used to build OAuth discovery URLs in 401 responses.
31
+ */
32
+ export declare function loadHttpConfig(env?: NodeJS.ProcessEnv): HttpConfig;
10
33
  /**
11
34
  * Build the config from environment variables.
12
35
  *