narrarium-engine 0.1.17 → 0.1.21
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 +44 -20
- package/dist/ai/config.d.ts +91 -0
- package/dist/ai/config.d.ts.map +1 -1
- package/dist/ai/config.js +150 -0
- package/dist/ai/config.js.map +1 -1
- package/dist/ai/fetch-client.d.ts +27 -3
- package/dist/ai/fetch-client.d.ts.map +1 -1
- package/dist/ai/fetch-client.js +228 -126
- package/dist/ai/fetch-client.js.map +1 -1
- package/dist/ai/memory.d.ts +34 -0
- package/dist/ai/memory.d.ts.map +1 -0
- package/dist/ai/memory.js +27 -0
- package/dist/ai/memory.js.map +1 -0
- package/dist/ai/provider-error.d.ts +50 -0
- package/dist/ai/provider-error.d.ts.map +1 -0
- package/dist/ai/provider-error.js +197 -0
- package/dist/ai/provider-error.js.map +1 -0
- package/dist/ai/redact.js +1 -1
- package/dist/ai/redact.js.map +1 -1
- package/dist/ai/request.d.ts +98 -9
- package/dist/ai/request.d.ts.map +1 -1
- package/dist/ai/request.js +153 -23
- package/dist/ai/request.js.map +1 -1
- package/dist/ai/responses.d.ts +106 -0
- package/dist/ai/responses.d.ts.map +1 -0
- package/dist/ai/responses.js +226 -0
- package/dist/ai/responses.js.map +1 -0
- package/dist/ai/router.d.ts +16 -6
- package/dist/ai/router.d.ts.map +1 -1
- package/dist/ai/router.js +41 -12
- package/dist/ai/router.js.map +1 -1
- package/dist/ai/routing.d.ts.map +1 -1
- package/dist/ai/routing.js +11 -5
- package/dist/ai/routing.js.map +1 -1
- package/dist/ai/types.d.ts +40 -2
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/types.js +16 -0
- package/dist/ai/types.js.map +1 -1
- package/dist/autopilot/attempt.d.ts +11 -0
- package/dist/autopilot/attempt.d.ts.map +1 -0
- package/dist/autopilot/attempt.js +53 -0
- package/dist/autopilot/attempt.js.map +1 -0
- package/dist/autopilot/calls/recorder.d.ts.map +1 -1
- package/dist/autopilot/calls/recorder.js +5 -1
- package/dist/autopilot/calls/recorder.js.map +1 -1
- package/dist/autopilot/calls/run-calls.d.ts.map +1 -1
- package/dist/autopilot/calls/run-calls.js +5 -0
- package/dist/autopilot/calls/run-calls.js.map +1 -1
- package/dist/autopilot/calls/types.d.ts +10 -3
- package/dist/autopilot/calls/types.d.ts.map +1 -1
- package/dist/autopilot/calls/types.js +2 -2
- package/dist/autopilot/calls/types.js.map +1 -1
- package/dist/autopilot/errors.d.ts.map +1 -1
- package/dist/autopilot/errors.js +42 -0
- package/dist/autopilot/errors.js.map +1 -1
- package/dist/autopilot/estimate-texts.js +4 -4
- package/dist/autopilot/estimate-texts.js.map +1 -1
- package/dist/autopilot/frozen.d.ts.map +1 -1
- package/dist/autopilot/frozen.js +14 -9
- package/dist/autopilot/frozen.js.map +1 -1
- package/dist/autopilot/live.d.ts +11 -1
- package/dist/autopilot/live.d.ts.map +1 -1
- package/dist/autopilot/live.js +17 -2
- package/dist/autopilot/live.js.map +1 -1
- package/dist/autopilot/outline-check.js +4 -4
- package/dist/autopilot/outline-check.js.map +1 -1
- package/dist/autopilot/planner.js +4 -4
- package/dist/autopilot/planner.js.map +1 -1
- package/dist/autopilot/runner.d.ts +5 -0
- package/dist/autopilot/runner.d.ts.map +1 -1
- package/dist/autopilot/runner.js +40 -1
- package/dist/autopilot/runner.js.map +1 -1
- package/dist/autopilot/session.d.ts +8 -0
- package/dist/autopilot/session.d.ts.map +1 -1
- package/dist/autopilot/session.js +10 -2
- package/dist/autopilot/session.js.map +1 -1
- package/dist/autopilot/tasks.js +4 -4
- package/dist/autopilot/tasks.js.map +1 -1
- package/dist/autopilot/types.d.ts +81 -6
- package/dist/autopilot/types.d.ts.map +1 -1
- package/dist/autopilot/types.js.map +1 -1
- package/dist/book/outline.d.ts.map +1 -1
- package/dist/book/outline.js +7 -6
- package/dist/book/outline.js.map +1 -1
- package/dist/book/paths.d.ts +5 -0
- package/dist/book/paths.d.ts.map +1 -1
- package/dist/book/paths.js +5 -0
- package/dist/book/paths.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/server/client.js +1 -1
- package/dist/server/client.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,12 +20,12 @@ npm install narrarium-engine
|
|
|
20
20
|
| Director | `askDirector`, `listDirectorOpinions`, `parseDirector`, `serializeDirector`, `directorPrompt` |
|
|
21
21
|
| Readers | `readerPersonaSystemPrompt`, `mergeReaderPersonas`, `READER_EVALUATION_TOOL`, `chapterReaderText` |
|
|
22
22
|
| Ghostwriters | `parseGhostwriter`, `ghostwriterPrompt` |
|
|
23
|
-
| Outline (
|
|
23
|
+
| Outline (the Synopsis) | `parseOutline`, `serializeOutlineChapter`, `serializeOutlineBook`, `outlineChanges`, `outlineEntryDigest`, `outlineBookDigest`, `outlineIndex`, `OutlineReader`, `OutlineCache`, `outlineChapterPath`, `parseOutlineChapterPath`, `outlinePlanStatus`, `composeOutlineEdits`, `remapOutlineNumber`, `changeOfWritten`, `groupOutlineChanges`, `effectiveTargetChapters`: see *Outline (the Synopsis)* |
|
|
24
24
|
| Evaluation style | `parseEvaluationStyle`, `loadEvaluationStyle`, `evaluationStyleBlock`, `EVALUATION_STYLE_MAX_CHARS`: see *Evaluation style* |
|
|
25
25
|
| Estimate of a run | `estimateAutopilotRun` (calls, tokens, cost, minutes, warnings and assumptions of a brief and its options, before the run), `estimateModelsFromConfig`, `estimateProgressFromState`, `estimateProgressFromChapters`, `estimateContextFromState`, `ESTIMATE_TYPICAL`, `ESTIMATE_CAPABILITIES`, `ESTIMATE_CALL_KINDS`; `AUTOPILOT_PRESETS`, `matchAutopilotPreset`, `autopilotPreset`; `measuredSpeed`, `TWO_CALL_TASKS`: see *Estimating a run* |
|
|
26
26
|
| Markdown | `parseMarkdown` (with `error`), `splitFrontmatter`, `stripFrontmatter`, `renderMarkdown`, `FrontmatterError` |
|
|
27
27
|
| Text | `clipMiddle`, `truncate`, `tail`, `countWords`, `languageCode`, `formatBookDate`, `tokensPerWord`, `scaleOutputTokens`, `sceneCharacterLimit` |
|
|
28
|
-
| AI | `AiPort` (the only door to language models), `createFetchAi` (OpenAI, Azure OpenAI, GitHub Models), `buildChatRequest`, `resolveAiCandidates`, `pickAiRuntimeConfig`, `redactAiRuntimeConfig`, `AI_THINKING_LEVELS`, `AI_REASONING_PARAMETERS`, `suggestedReasoningParameter`, `AiToolsRequiredError`, `effectiveAiBase`, `endpointOrigin`, `redactSecrets`, the deadlines and limits of a call (`DEFAULT_REQUEST_TIMEOUT_MS`, `MIN_REQUEST_TIMEOUT_MS`, `DEFAULT_IDLE_TIMEOUT_MS`, `TOTAL_REQUEST_CAP_MS`, `MAX_STREAM_TRANSPORT_BYTES`…) |
|
|
28
|
+
| AI | `AiPort` (the only door to language models), `createFetchAi` (OpenAI, Azure OpenAI, GitHub Models), `buildChatRequest`, `resolveAiCandidates`, `pickAiRuntimeConfig`, `redactAiRuntimeConfig`, `AI_THINKING_LEVELS`, `AI_REASONING_PARAMETERS`, `suggestedReasoningParameter`, `AiToolsRequiredError`, `COPILOT_CAPABILITY`, `BRAINSTORMING_CAPABILITY`, `AI_CAPABILITY_FOLLOWS`, `effectiveAiBase`, `endpointOrigin`, `redactSecrets`, the deadlines and limits of a call (`DEFAULT_REQUEST_TIMEOUT_MS`, `MIN_REQUEST_TIMEOUT_MS`, `DEFAULT_IDLE_TIMEOUT_MS`, `TOTAL_REQUEST_CAP_MS`, `MAX_STREAM_TRANSPORT_BYTES`…) |
|
|
29
29
|
| Model catalog | `fetchModelCatalog` (the models of an OpenAI-compatible endpoint, with the window, the largest answer and the capabilities its gateway declares), `probeEndpoint` (does it answer, and how), `fetchLmStudioModels`, the pure parsers `parseModelList`, `parseModelDetails`, `parseModalities`, `tokenLimitsFromDetails`, `modelFieldsFromCatalogEntry`, `parseLmStudioModels`, `lmStudioContext`, `AiCatalogError`, `AI_MODEL_TYPES`, `catalogTarget`: see *Model catalog and declared capabilities* |
|
|
30
30
|
| Personal server | `NarrariumServerClient`, `pairWithServer`, `pairWithServerDetailed`, `verifyServerIdentity`, `serverCompatibility`, `serverSupportsAutopilotControls`, `serverSupportsAutopilotRules`, `serverSupportsFrozenChapters`, `serverSupportsAutopilotRetry`, `serverSupportsGithubConflicts`, `remoteBookStore`, protocol types (scopes, pairing, updates, the conflicts with GitHub), `ServerSentEventParser` |
|
|
31
31
|
| Sync | `planFileSync`, `syncBookStores` (three-way sync of two book stores, with the files it leaves out in `skipped`) |
|
|
@@ -77,7 +77,7 @@ A run whose heartbeat is older than `RUNNER_STALE_MINUTES` (20) is taken for dea
|
|
|
77
77
|
|
|
78
78
|
1. **Concept** — story design, world context, characters, locations, factions and secrets (skipped when the book already has a design or prose). The author's outline, when there is one, is binding for it too.
|
|
79
79
|
2. **Summaries of the author's chapters** — only for a book with chapters written by the author: see *Chapters the author wrote*.
|
|
80
|
-
3. **Plan** — chapter plan, following the author's outline as binding when there is one, and filling the outline with what it planned; simulated readers react to it and the director approves it or asks for changes (judging with the method and the severity of the evaluation style). The run can pause here for the author. See *Outline (
|
|
80
|
+
3. **Plan** — chapter plan, following the author's outline as binding when there is one, and filling the outline with what it planned; simulated readers react to it and the director approves it or asks for changes (judging with the method and the severity of the evaluation style). The run can pause here for the author. See *Outline (the Synopsis)*.
|
|
81
81
|
4. **Per chapter** — when the author changed the outline of the chapter since it was planned, the chapter is planned again (`replan`); then the scene plan, prose scene by scene (streamed), then the review cycle:
|
|
82
82
|
- blind simulated readers (no canon, no secrets) and a panel summary;
|
|
83
83
|
- specialists (continuity, canon, secrets, timeline, voice, style, pacing) with evidence anchored in the text, and the criteria of the evaluation style;
|
|
@@ -129,7 +129,7 @@ The engine applies it, so a host only says *how* to publish: `hooks.afterCommit`
|
|
|
129
129
|
|
|
130
130
|
**What the summary says.** `AutopilotStateSummary`, which the `state` events carry and `snapshot().summary` holds for a client that connects later, has five fields that are never saved: `frozenChanges` (how many chapters have a change that waits for the author, absent when none does: see *Frozen chapters*), `pausePending` (`"after-step"`, `"after-chapter"` or `null`), `limits` (`{ steps?, chapters?, stepsDone, chaptersDone }` of the run in progress, `null` when it has none or is over; `chapters` is the stricter of the run's limit and `chaptersPerRun`), `publish` (`effectivePublish` of the options and the host's default) and `retry` (the retry the run is waiting for, present only while it is, with `longTerm` in a wait of «Retry later»: see *What the interface reads*). A summary made from the state file alone (`summarizeAutopilotState(state)`) has no `frozenChanges`, no `pausePending`, no `limits` and no `retry`: nothing in the file says them, so a client takes them from the events and the snapshot. They change without the state being written, so `updatedAt` does not move: every change of the pause that waits, and every saved step, is a `state` event, and a client keeps the newest event it has seen, whatever its `updatedAt`.
|
|
131
131
|
|
|
132
|
-
**Message codes.** `run-ended` and `insight` events carry a `code` when a client can say it in its own language: `chapterPause`, `stepLimit` and `chapterLimit` join `takenOver` and the others (`AutopilotMessageCode`). The `message` of the event, and of the saved state, is always in the language of the book. The insights about the outline have codes of their own and say which chapter they are about (`chapterNumber`, and `ghostwriter` for one that does not exist): `outlineGhostwriter`, `outlineChanged`, `outlineRemoved`, `outlineChangedWhileWriting`, `outlineWrittenChanged`, `outlineRemovedWritten`, `outlineWrittenAuto` and `outlineWarnings` (see *Outline (
|
|
132
|
+
**Message codes.** `run-ended` and `insight` events carry a `code` when a client can say it in its own language: `chapterPause`, `stepLimit` and `chapterLimit` join `takenOver` and the others (`AutopilotMessageCode`). The `message` of the event, and of the saved state, is always in the language of the book. The insights about the outline have codes of their own and say which chapter they are about (`chapterNumber`, and `ghostwriter` for one that does not exist): `outlineGhostwriter`, `outlineChanged`, `outlineRemoved`, `outlineChangedWhileWriting`, `outlineWrittenChanged`, `outlineRemovedWritten`, `outlineWrittenAuto` and `outlineWarnings` (see *Outline (the Synopsis)*); so do the insights about the frozen chapters: `frozenMigrated`, `frozenChanged`, `frozenAuto`, `frozenReviewed`, `frozenCleared` and `frozenInvalid` (see *Frozen chapters*). The retries have theirs: `failureRetry` (a quick retry), `longRetryWait` (a wait of «Retry later», with `cycle`, `cycles` and `waitMs`), `retrySkipped` («Retry now» ended a wait, with the `waitMs` that was left), and two that end a run, as the `code` of `run-ended` (and, the first, as an insight with the last `cycle` and `cycles`): `longRetryExhausted` (the cycles are used up) and `longRetryOff` («Retry later» was turned off while the run waited for it). See *Retries*. A restart of the server has two: `serverShutdown` (the `code` of `run-ended` when the server's stop paused the run) and `resumedAfterRestart` (an insight: the server resumed the run by itself). See *Resume after a restart*.
|
|
133
133
|
|
|
134
134
|
### What the interface reads
|
|
135
135
|
|
|
@@ -157,7 +157,7 @@ Data the web app's pages used to have to guess (from the text of a step, from th
|
|
|
157
157
|
| `conflict` | A file changed under the step and the retries are used up (`BookConflictError`); or, on a personal server, the server's work conflicts with GitHub (code `github_conflict`, with `githubConflicts` in the detail: the author chooses the version of each file, see *The personal server client*). |
|
|
158
158
|
| `unknown` | Everything else. |
|
|
159
159
|
|
|
160
|
-
`errorDetail` is `{ status?, endpoint?, model?, provider?, integration?, retryAfterMs?, attempt?, retries?, timeoutMs?, timeoutPhase?, githubConflicts?, transport?, route? }` (`route`: every candidate of the route of the call that failed, in the order the author wrote it: see *The route of a call*), short and with no secret in any field: `githubConflicts` is there only for a conflict with GitHub (an error whose `code` is `GITHUB_CONFLICT_CODE`, `"github_conflict"`, and whose `total` says how many files: never retried, the author chooses), a whole number from 1 (read back from a file the same way); `status` is the HTTP status when the provider answered; `retryAfterMs` is what the provider asked for with `Retry-After` in milliseconds, on a 429 or a 503 only and only when it said (the engine's client keeps at most five minutes of it, `0` is a value, and a value read from a file is a whole number from 0 to a day, else it is dropped), so that a client can say *the provider asks to wait 30 s* without guessing it from the retry; `endpoint` is only the **origin** of the integration's address (`new URL(address).origin`: never a path, a query, a fragment or credentials, and nothing at all for an address that is not a web address); `model`, `provider` and `integration` (the id) are passed through `redactSecrets` and cut at 160 characters. `attempt` and `retries` are there only for a failure that is retried: the retry it belongs to (the one that followed it, or the last one made when the run gave up) and how many retries this kind of failure gets, the numbers of the `failureRetry` insight; a failure that is never retried (a 401) has neither. `timeoutPhase` (`"start"`, `"idle"` or `"total"`) and `timeoutMs` are there only for a timeout of the engine's client: which deadline ran out (the provider did not begin answering, it went silent while it answered, or the call took longer than any call may) and how long it was, in milliseconds (a value read from a file is a whole number from 1 ms to a day, else it is dropped); see *Timeouts and streaming*. Where an error came from is `AiProviderError.target` (`{ provider, model, integrationId, endpoint? }`, the endpoint already an origin), which the engine's client sets on the error of the last candidate it tried; it is separate from the error's own `model`, `provider` and `integrationId`, whose presence means that the model had started to answer and is billed. `transport` is there for a call that failed after the provider answered and whose response said something beyond its status (it carried bytes, a request id, an end or a finish reason): `{ status?, bytes?, chunks?, events?, lastChunkAfterMs?, silentMs?, end?, finishReason?, usageReceived?, usageRequested?, tail?, requestId?, partialCharacters? }`, the numbers of `AiTransportDiagnostics`, the last 300 characters of the stream (credentials replaced, no reasoning) and how many characters of the reply had arrived; every field is checked when a state is read, and a file cannot make one longer or put a key in it. A state written before the errors were classified has `lastError` with a message and no kind: `summary.lastError` then has none either.
|
|
160
|
+
`errorDetail` is `{ status?, endpoint?, model?, provider?, integration?, retryAfterMs?, attempt?, retries?, timeoutMs?, timeoutPhase?, githubConflicts?, transport?, route?, body? }` (`route`: every candidate of the route of the call that failed, in the order the author wrote it: see *The route of a call*; `body`: what the provider answered, in its own words: see *What the provider said*), short and with no secret in any field: `githubConflicts` is there only for a conflict with GitHub (an error whose `code` is `GITHUB_CONFLICT_CODE`, `"github_conflict"`, and whose `total` says how many files: never retried, the author chooses), a whole number from 1 (read back from a file the same way); `status` is the HTTP status when the provider answered; `retryAfterMs` is what the provider asked for with `Retry-After` in milliseconds, on a 429 or a 503 only and only when it said (the engine's client keeps at most five minutes of it, `0` is a value, and a value read from a file is a whole number from 0 to a day, else it is dropped), so that a client can say *the provider asks to wait 30 s* without guessing it from the retry; `endpoint` is only the **origin** of the integration's address (`new URL(address).origin`: never a path, a query, a fragment or credentials, and nothing at all for an address that is not a web address); `model`, `provider` and `integration` (the id) are passed through `redactSecrets` and cut at 160 characters. `attempt` and `retries` are there only for a failure that is retried: the retry it belongs to (the one that followed it, or the last one made when the run gave up) and how many retries this kind of failure gets, the numbers of the `failureRetry` insight; a failure that is never retried (a 401) has neither. `timeoutPhase` (`"start"`, `"idle"` or `"total"`) and `timeoutMs` are there only for a timeout of the engine's client: which deadline ran out (the provider did not begin answering, it went silent while it answered, or the call took longer than any call may) and how long it was, in milliseconds (a value read from a file is a whole number from 1 ms to a day, else it is dropped); see *Timeouts and streaming*. Where an error came from is `AiProviderError.target` (`{ provider, model, integrationId, endpoint? }`, the endpoint already an origin), which the engine's client sets on the error of the last candidate it tried; it is separate from the error's own `model`, `provider` and `integrationId`, whose presence means that the model had started to answer and is billed. `transport` is there for a call that failed after the provider answered and whose response said something beyond its status (it carried bytes, a request id, an end or a finish reason): `{ status?, bytes?, chunks?, events?, lastChunkAfterMs?, silentMs?, end?, finishReason?, usageReceived?, usageRequested?, tail?, requestId?, partialCharacters? }`, the numbers of `AiTransportDiagnostics`, the last 300 characters of the stream (credentials replaced, no reasoning) and how many characters of the reply had arrived; every field is checked when a state is read, and a file cannot make one longer or put a key in it. A state written before the errors were classified has `lastError` with a message and no kind: `summary.lastError` then has none either.
|
|
161
161
|
|
|
162
162
|
**The retry that is waiting.** While the run waits to try a failed step again, `summary.retry` is `{ at, attempt, retries }`: `at` is the ISO time of the next attempt, `attempt` and `retries` those of the `failureRetry` insight (`retry 2 of 3`). In a wait of «Retry later» it is `{ at, attempt, retries, longTerm: { cycle, cycles } }`: `attempt` and `retries` are then the quick retries that were made, `cycle` the cycle of the wait (from 1) and `cycles` how many there are, `null` for no limit (the numbers of the `longRetryWait` insight: «ripartenza 2 di 3», *restart 2 of 3*); the rest of the summary is what it always was. It is never saved, and it is the fourth field of the summary that only a live session knows (see *What the summary says*). Every change is a `state` event, so a client counts down without guessing: one event when the wait begins (right after the `failureRetry` or `longRetryWait` insight), one when it is over and the attempt starts (the summary has no `retry` then; after «Retry now» that event follows the `retrySkipped` insight at once), and the last summary of a run that ends, or is paused, during the wait has none. A host that gets the state from a `state` event replaces its summary by the newest one it has seen, and so the retry goes away. A client offers «Retry now» (`session.retryNow()`, or `retryNow(bookId)` of the server's client) while `retry` is there.
|
|
163
163
|
|
|
@@ -169,9 +169,11 @@ Data the web app's pages used to have to guess (from the text of a step, from th
|
|
|
169
169
|
|
|
170
170
|
**The step that is answering.** `task-progress` says that the model of the running step is answering. A step that writes prose says it as it always did: `preview` (the tail of the text so far) and `characters`, at most about three times a second. A step that answers with a structured value (the concept, the plan, a reader's evaluation, the director's decisions, the summary of a scene) says it with numbers only: `{ type: "task-progress", activityId, characters, bytes, preview: "" }`, where `bytes` is what has arrived of the reply and `characters` the characters of its function arguments, never a word of the reply, and **one event a second** for each step at most (the client reports up to four times a second, and the stream of a server is not flooded). It only exists while the provider streams: with `streamMode: "off"` there is nothing to say until the reply is whole. Like every `task-progress` it is never saved (not in `state.json`, not in the log, not a commit) and never replayed to a client that connects later; `snapshot().live` carries what a client shows of the step (see below). The event is the same one the prose steps have: `preview` stays a string (empty here), and `bytes` is the only new field, so a client that knows nothing of it reads `characters` and an empty preview. A step that writes a scene and then asks for its summary says both kinds one after the other, as two calls of the step. A client of the personal server gets the events as they are (the engine's client hands over every message of the stream, and a type it does not know is the host's to ignore). **What a client shows of it** (`AutopilotLive`, which `snapshot().live` is) follows the events by one rule, `applyLiveProgress(live, event)` (`startLive(activity)` at `task-started`, `normalizeLive(value)` for a live part read from another host), which the web app uses too: every progress says which call of the step it is (`callSeq`, from 1; `callId` when the book keeps records), and a call starts from nothing, so nothing of a scene is shown while its summary streams and nothing of one call while the next answers (an engine that names no calls is read by the kind and the bytes: prose after a structured reply, a structured reply after prose, or numbers whose bytes went back, are another call). The text of a call (its prose, or the JSON of a structured reply, `json: true`) replaces what was shown and never goes back to nothing until the call ends: the empty text that says a new attempt begins changes nothing, and the new attempt takes the place of the old one when it writes. A progress without a `preview` keeps the text shown. The numbers of a structured reply set `bytes` and never touch the text (a shorter JSON, the next attempt's, drops the bytes of the one before), and its count is the JSON's (`characters` of the numbers event is the JSON's once it streams, the client's own count before), so a reply that streams its JSON keeps it on screen while its numbers arrive, and one that does not says «answering» with its bytes.
|
|
171
171
|
|
|
172
|
+
**Which candidate answers.** `call-attempt` says which candidate of the AI Router the call of the running step asks now, as its request is sent: `{ type: "call-attempt", activityId, callSeq, callId?, attempt, attempts, candidateIndex, candidateCount, fallback, integrationId, integrationName, provider, model, thinking, thinkingWhy?, streamMode }`. `attempt` is which request of the call this is (from 1: every request counts, the ones that failed before it too) of `attempts`, the most the call can make (the candidates of its route that the plan did not leave out); `candidateIndex` is the place of the candidate in the route as the author wrote it (0 is the primary, anything above is a fallback: `fallback`) of `candidateCount`. `thinking` is what the request does of the thinking level: the level that is sent (`low`, `medium`, `high`, `xhigh`), `automatic` when none is chosen (nothing is sent and the model decides) or `not-sent` when one is chosen and the model does not take it (`supportsReasoning: false`, or a thinking parameter `none`, or, with `thinkingWhy: "tools"`, a request that carries function tools to a model that refuses a level with them), or `none` when `reasoning_effort: "none"` is what the request carries (with `thinkingWhy: "tools"`: a model that takes function tools with `none` only). It names its call as `task-progress` does (`callSeq` always, `callId` when the book keeps records) and is said whether or not the book keeps records, at the start of every attempt: a call that goes on to its fallback says the next candidate, and the next replaces the one before. It is kept in the replay of the session like `call-started`, and it is names and numbers only: never a prompt, a reply, a key or an endpoint. `snapshot().live.trying` is the last one of the call in flight, by the same rule that follows the text (`applyLiveAttempt(live, event)`, next to `applyLiveProgress`; `normalizeLive` reads it from another host and keeps only what it may say): it stays through the text and the numbers of the call, the next attempt of the call replaces it (the text of the attempt before stays until the new one writes), the text of another call takes it away until that call says its own, and the step that ends clears it with the rest of the live part, so a client that connects in the middle of a step shows the candidate at once. A host that does not say it (a server older than this engine) leaves `trying` out, and a client shows nothing for it. What a client shows of it is the web app's: the band, the live panel and the card of the step that runs say the model, the integration, `Primary` or `Fallback N`, the thinking and, for a call that went on, `attempt 2/3`.
|
|
173
|
+
|
|
172
174
|
**What a model declares.** The safe view of the AI configuration (`redactAiRuntimeConfig(config).integrations[].models[]`, which the personal server's `GET /ai` forwards as it is) says, for every model, what its configuration declares: `supportsToolCalls`, `supportsStreaming`, `supportsReasoning`, `supportsVision`, `maxInputTokens` and `maxOutputTokens`, and the `reasoningParameter` that says how its thinking level is sent (the "Thinking parameter" of the model, «Parametro del thinking»: `reasoning_effort`, `chat_template_kwargs.reasoning_strength` or `none`, with `AI_REASONING_PARAMETERS` for the list and `suggestedReasoningParameter(name, underlyingModel?)` for a hint that a screen may offer, which the engine never applies by itself), each only when it is declared or set (a model that declares nothing is `{ name, capabilities }`, as it always was). An attempt says what it did not do because of it: `onAttempt.notes` (English, absent when there is nothing to say; `ChatRequest.notes` for a host that builds the request itself), and `onAttempt.reasoningParameter` where the level went when it did not go as `reasoning_effort`. A reply cut with nothing written by a model declared as reasoning is a `truncated` error with `reasoningOnly`, so its `errorKind` is `truncated` like any cut reply. What an endpoint says of its models, and whether it answers at all, is what `fetchModelCatalog` and `probeEndpoint` return: see *Model catalog and declared capabilities*. All of it is additive: a configuration that declares nothing reads and runs as it always did.
|
|
173
175
|
|
|
174
|
-
**The outline and the ghostwriter of every chapter.** `PlannedChapter.ghostwriter` is the ghostwriter the outline gives the chapter (the slug of `ghostwriters/<slug>.md`), absent when it is the book's; the chapter's `chapter.md` says it too, so a page that shows the chapter reads it where it always did. `PlannedChapter.outlineDigest` is the digest of the chapter's entry of the outline (`outlineEntryDigest`) as it was when the plan followed it, or wrote it: an entry whose `contentDigest` is not the chapter's `outlineDigest` has been changed by the author since (`outlinePlanStatus(reader, state, language)` says which ones, for a chapter not written yet and for the written ones). `plan.removedChapters` lists the chapters taken out of the plan because the author deleted their entry. `options.fillOutline` (on by default, saved with the other options, not changeable while a run is active) says whether the plan fills the outline. `state.concept.logline` is the pitch of the concept, which becomes the description of the outline. New task kind: `replan` (a chapter planned again from its new entry, or taken out of the plan). New insight codes: `outlineGhostwriter`, `outlineChanged`, `outlineRemoved`, `outlineChangedWhileWriting` (the entry of a chapter still being written changed: it is decided once the chapter is closed), `outlineWrittenChanged` (the entry of a written chapter changed, and with `frozenEdits: "notify"` it is only said), `outlineRemovedWritten` (a written chapter is no longer in the outline: it stays in the book), `outlineWarnings`, each with `chapterNumber` (see *Outline (
|
|
176
|
+
**The outline and the ghostwriter of every chapter.** `PlannedChapter.ghostwriter` is the ghostwriter the outline gives the chapter (the slug of `ghostwriters/<slug>.md`), absent when it is the book's; the chapter's `chapter.md` says it too, so a page that shows the chapter reads it where it always did. `PlannedChapter.outlineDigest` is the digest of the chapter's entry of the outline (`outlineEntryDigest`) as it was when the plan followed it, or wrote it: an entry whose `contentDigest` is not the chapter's `outlineDigest` has been changed by the author since (`outlinePlanStatus(reader, state, language)` says which ones, for a chapter not written yet and for the written ones). `plan.removedChapters` lists the chapters taken out of the plan because the author deleted their entry. `options.fillOutline` (on by default, saved with the other options, not changeable while a run is active) says whether the plan fills the outline. `state.concept.logline` is the pitch of the concept, which becomes the description of the outline. New task kind: `replan` (a chapter planned again from its new entry, or taken out of the plan). New insight codes: `outlineGhostwriter`, `outlineChanged`, `outlineRemoved`, `outlineChangedWhileWriting` (the entry of a chapter still being written changed: it is decided once the chapter is closed), `outlineWrittenChanged` (the entry of a written chapter changed, and with `frozenEdits: "notify"` it is only said), `outlineRemovedWritten` (a written chapter is no longer in the outline: it stays in the book), `outlineWarnings`, each with `chapterNumber` (see *Outline (the Synopsis)*). An engine from before them said the first and the third with `outlineWrittenChanged` as well. An engine from before these fields drops them on its first write; the outline files stay, the next plan of a newer engine reads them again, and a chapter whose plan lost its digest is not planned again from an entry the autopilot wrote (only from one of the author).
|
|
175
177
|
|
|
176
178
|
**Frozen chapters.** What the pages read of them (see *Frozen chapters* for what they mean): `summary.frozenChanges` (not saved: how many chapters have a change that waits for the author's decision, as the run found it before its last step or the last `frozenStatus()`; absent when none waits, as `retry` is, until one of them looked, and from a summary made from the state file alone); `options.frozenEdits` (`"ask"`, `"auto"`, `"notify"`); `state.pendingReviews` (the decisions recorded: `{ id, kind, number, action, fingerprint, at, note?, auto?, started? }`, `started` while one is carried out, with `phase` and the chapter as it was `before`); `state.question` of kind `frozen-change` or `outline-change`, with `choices` (`{ id, label }`, the labels in the language of the book), `options` (the same labels) and `frozen` (`{ kind, number, slug, fingerprint, title?, by?, frozenAt?, changed?, others? }`); `QuestionAnswer.choice`; `state.frozenSince` and `state.frozenSeen` (the engine's bookkeeping); `state.review.authorEdit` (the round of review of an author's change); `state.revision.afterChapter`, `onlyChapter` and `source` (a revision that comes from a change: `{ kind, chapterNumber, note?, auto?, before?, after? }`); the snapshot's `ChapterInfo.frozen`, `frozenProblem`, `bodyDigest` and `document`, and `ParagraphInfo.bodyDigest`. New task kind: `freeze` (without the model). New insight codes to say in the language of the interface, each with `chapterNumber` but the first: `frozenMigrated` (the chapters an older engine approved are frozen now), `frozenChanged` (`notify`: a frozen chapter changed), `frozenAuto` (`auto`: a change is reviewed and the book updated from it), `outlineWrittenAuto` (`auto`: a chapter is rewritten to follow its outline), `frozenReviewed` (a decision was carried out, or a change was marked as reviewed), `frozenCleared` (a change is gone: its question, or its decision, is dropped), `frozenInvalid` (a record that cannot be read; a warning). New kinds of question: `frozen-change`, `outline-change`; their choices are the actions, by id: `review-and-update`, `review-only`, `mark-reviewed`, `rewrite-to-outline`, `keep-text`.
|
|
177
179
|
|
|
@@ -209,9 +211,9 @@ A profile with warnings is not what the author wrote, so the engine never goes o
|
|
|
209
211
|
- `askDirector` still gives its opinion, and reports the problems of `director.md` in `warnings` next to it.
|
|
210
212
|
- a host that saves a profile should not do it over a file that has warnings.
|
|
211
213
|
|
|
212
|
-
## Outline (
|
|
214
|
+
## Outline (the Synopsis)
|
|
213
215
|
|
|
214
|
-
The outline is the author's chapter-by-chapter trace of the book: the idea, promise or pitch of the book (its description) and, for every chapter, a hypothetical title, what happens in it and, when it is not the book's, the ghostwriter that writes it. It is a main part of the book, useful without the autopilot too, kept in files of the book, and the autopilot follows it as binding. It is not `plot.md`, which the autopilot generates from the chapters it closes.
|
|
216
|
+
The outline (the Synopsis of the app, «Sinossi» in Italian; once called the Scaletta) is the author's chapter-by-chapter trace of the book: the idea, promise or pitch of the book (its description) and, for every chapter, a hypothetical title, what happens in it and, when it is not the book's, the ghostwriter that writes it. It is a main part of the book, useful without the autopilot too, kept in files of the book, and the autopilot follows it as binding. It is not `plot.md`, which the autopilot generates from the chapters it closes.
|
|
215
217
|
|
|
216
218
|
### The files
|
|
217
219
|
|
|
@@ -220,6 +222,7 @@ The outline is the author's chapter-by-chapter trace of the book: the idea, prom
|
|
|
220
222
|
| `outline/book.md` | `type: outline`, `id: outline:book`, `title?` (a working title: the book's own stays in `book.md`), `origin?`, `digest?` | The idea, promise or pitch of the book (the description), free Markdown, at most 1 000 000 characters. It is the brief's idea too: stored here and nowhere else. |
|
|
221
223
|
| `outline/_brief.md` | `type: outline-brief`, `id: outline:brief`, `genre?`, `audience?`, `wordsPerScene` (a whole number from 200 to 8 000; 1 400 when absent) | The synopsis, free Markdown. An `idea` key found here is ignored and never written. It is the brief of the autopilot, not an entry: see *The brief*. |
|
|
222
224
|
| `outline/chapters/<NNN>.md` | `type: outline-chapter`, `id: outline-chapter:<NNN>`, `number`, `title?` (the hypothetical title), `ghostwriter?` (the slug of `ghostwriters/<slug>.md`; absent: the book's), `origin: author \| autopilot`, `digest?` | What happens in the chapter, plain text. |
|
|
225
|
+
| `outline/brainstorm.md` (`OUTLINE_BRAINSTORM_FILE`) | none | The notes of Brainstorming (the Copilot's mode on the Synopsis page of the app): the decisions the author saved from a brainstorm, one dated section after the other. Never an entry: `parseOutline` and `outlineIndex` skip it as they skip the brief, so it has no number and is never a warning, and no outline edit writes, moves or deletes it. |
|
|
223
226
|
|
|
224
227
|
One file per chapter: the outline has no maximum, and no file grows with the book. `<NNN>` has the zero-padding of the chapter folders (`formatOrdinal`): `outlineChapterPath(7)` is `outline/chapters/007.md`, `outlineChapterPath(1500)` is `outline/chapters/1500.md`, and `parseOutlineChapterPath(path)` reads the number back. The number of an entry is the one of its file's name; a frontmatter that says another is a warning, and the name wins. The keys the format does not know are kept whenever the engine rewrites a file. The core (`narrarium`) has the same paths (`OUTLINE_BOOK_FILE`, `OUTLINE_CHAPTERS_DIRECTORY`, `outlineChapterPath`, `parseOutlineChapterPath`), validates the files with `outlineBookSchema` and `outlineChapterSchema` (passthrough), searches them and renames references in them with the rest of the book (`CONTENT_GLOB`), and its doctor warns, never errs, about a number that is not the file's and a ghostwriter that does not exist.
|
|
225
228
|
|
|
@@ -273,7 +276,7 @@ An entry that cannot be read changes nothing until the author corrects it, and n
|
|
|
273
276
|
### What the autopilot does with it
|
|
274
277
|
|
|
275
278
|
- **What binds.** The outline binds through the entries of the author (every entry but the autopilot's intact ones) and the description of the author. A book whose outline has nothing of the author, none at all or only the autopilot's intact entries, is asked exactly what it was asked before the outline existed.
|
|
276
|
-
- **As many chapters as it has.** The book is `bookChapters(outline)` long: the number of its last chapter entry (the entries are the chapters; a number between two entries that has none is planned freely). An entry the author adds after the last chapter of a finished book extends it. With no chapter entry and no approved plan the run stops with «The
|
|
279
|
+
- **As many chapters as it has.** The book is `bookChapters(outline)` long: the number of its last chapter entry (the entries are the chapters; a number between two entries that has none is planned freely). An entry the author adds after the last chapter of a finished book extends it. With no chapter entry and no approved plan the run stops with «The synopsis has no chapters: write the chapters in the Synopsis, then resume.»
|
|
277
280
|
- **The plan follows it.** The request of every batch of the plan carries the description of the book (at most 3000 characters), the entries of the chapters it plans (whole, as far as their share of 24 000 characters allows) and, condensed like every list of chapters, the entries of the chapters not planned yet, with the rule: the same chapters, in the same order, with the same hypothetical titles (the model refines a title only where the entry has none: the engine keeps the entry's own) and the same events; enrich, never change. `brief.synopsis` stays the fallback: alone it binds as it always did; next to an outline it applies where the outline says nothing, and the outline wins. The concept is told that the outline binds it, and the director is told not to ask the plan to change it.
|
|
278
281
|
- **The ghostwriter of a chapter.** A chapter takes the ghostwriter of its entry (`PlannedChapter.ghostwriter`) and the `chapter.md` the plan creates says it, when it is not the book's: the chain scene, chapter, book is the one it always was. An entry that names a ghostwriter that does not exist is said (`outlineGhostwriter`, with `chapterNumber` and `ghostwriter`), and the book's writes the chapter; when the author creates it before the chapter starts, the chapter takes it.
|
|
279
282
|
- **The plan fills it.** After every plan, and every revision of it, the plan writes, in the same commit, the entries of the chapters it planned that have none: the title, and as text the summary of the plan followed by its key events as a list, with `origin: autopilot` and the `digest` of what it wrote; and `outline/book.md` when it is missing, with the logline of the concept (or the brief's idea). The chapters the author wrote get an entry only when they have none, with their summary. An entry of the author is never touched; an intact one of the autopilot follows the plan when the director has it revised. `options.fillOutline: false` writes nothing. Every chapter keeps the digest of its entry (`outlineDigest`).
|
|
@@ -282,7 +285,7 @@ An entry that cannot be read changes nothing until the author corrects it, and n
|
|
|
282
285
|
|
|
283
286
|
### The brief (`outline/_brief.md`)
|
|
284
287
|
|
|
285
|
-
The brief the autopilot starts from is kept in two files of the
|
|
288
|
+
The brief the autopilot starts from is kept in two files of the Synopsis, and each text has one home. The **idea** (the idea, promise or pitch of the book) is the description of the book: the body of `outline/book.md`, stored there and nowhere else. `outline/_brief.md` keeps `genre`, `audience`, `wordsPerScene` and the **synopsis** (its body). Two functions compose and split them:
|
|
286
289
|
|
|
287
290
|
- `readOutlineBrief(store, sources?)` → `{ brief: { idea, genre, audience, wordsPerScene, synopsis }, hash?, unreadable?, bookUnreadable?, frontmatter }`. `brief.idea` is the body of `outline/book.md`, or `""` when there is none or the autopilot wrote it (a logline of its own is not the author's idea). `hash` is the hash of `_brief.md` (absent when the file does not exist). `sources` says what is known already (`book`: the description already read, `null` for none; `brief: false`: the brief file is known not to exist), so that a host reads each file once.
|
|
288
291
|
- `writeOutlineBrief(store, fields, message?)` → `OutlineBrief` (the brief as saved). `fields` is any part of `{ idea, genre, audience, wordsPerScene, synopsis }`; the rest is kept. The idea goes to `outline/book.md` through the outline's own builder (`serializeOutlineBook`: the working title and the other keys of the file are kept; the author is the writer), the fields to `_brief.md`, in ONE commit, compare-and-swap on both files (a change made meanwhile is merged, never overwritten; five attempts). A file whose frontmatter cannot be read is never written over. `outlineBriefChanges(store, fields)` → `{ changes, brief }` is the same write, not committed: the start uses it.
|
|
@@ -293,11 +296,11 @@ The brief the autopilot starts from is kept in two files of the Scaletta, and ea
|
|
|
293
296
|
**Legacy.** A state saved with a brief idea, in a book whose `outline/book.md` has no author's description, gets that idea written into `book.md` once, in the start commit (with the state, in the same commit). A description the author wrote is never overwritten. The fields of a state move to `_brief.md` only when that file does not exist yet.
|
|
294
297
|
|
|
295
298
|
- **The name starts with an underscore, and it is no entry.** `OUTLINE_BRIEF_FILE` is `outline/_brief.md`. `outlineIndex` and `parseOutline` never read it as a chapter, so it has no number, is never counted, and is never a warning. `write_file` refuses the whole `outline/` folder, so the brief changes only through the brief's own routes; `edit_outline` writes only the chapter entries and `outline/book.md` (the description, which is also the idea), so it can neither delete, renumber nor move `_brief.md`.
|
|
296
|
-
- **The brief has no number of chapters.** The chapters are the chapter entries of the
|
|
299
|
+
- **The brief has no number of chapters.** The chapters are the chapter entries of the Synopsis: `bookChapters(outline)` is the number of the last entry (its number; the entries are the chapters). `targetChapters` and `scenesPerChapter` are not read any more.
|
|
297
300
|
- **The scenes are the planner's.** `scenesForChapter(text)` gives a chapter 2 scenes when its outline entry is up to 40 words, 3 up to 100 words, and 4 above (`SCENES_PER_CHAPTER` is 2 to 4). The text is the entry's body; a chapter without an entry is read from its summary, goal and key events. `wordsPerScene` is the target of every scene.
|
|
298
301
|
- **The run reads it at every start and configuration.** `AutopilotSession.start({ brief })` and `configure({ brief })` save a brief sent to the file first; the run then reads the file (`readBrief`). `state.brief` is the snapshot the run uses, and it is refreshed when the run starts or the author configures it. A book whose brief is only in its state (saved before the brief had a file) gets the file in the start commit, once.
|
|
299
|
-
- **No chapter entries, no run.** With no chapter entry and no approved plan, the planner stops: «The
|
|
300
|
-
- **Legacy states.** A state saved with `targetChapters` and `scenesPerChapter` in its brief still loads and runs: the two counts are not read. A plan of N chapters runs to the end of ITS plan. A completed book is not extended unless the author adds chapter entries to the
|
|
302
|
+
- **No chapter entries, no run.** With no chapter entry and no approved plan, the planner stops: «The synopsis has no chapters: write the chapters in the Synopsis, then resume.» A plan that is already approved keeps going to the end of its own chapters.
|
|
303
|
+
- **Legacy states.** A state saved with `targetChapters` and `scenesPerChapter` in its brief still loads and runs: the two counts are not read. A plan of N chapters runs to the end of ITS plan. A completed book is not extended unless the author adds chapter entries to the Synopsis: the highest planned chapter number is compared with the last chapter entry, never the number of chapters planned (a book may go on from chapter 1 200, and no chapter past its last entry is ever planned).
|
|
301
304
|
- **Presets.** The brief has none: `autopilotPresetSkeleton(id)` gives the chapter entries a new book's outline starts with (see *Presets*).
|
|
302
305
|
|
|
303
306
|
## Frozen chapters
|
|
@@ -357,8 +360,8 @@ The option is saved with the others, read tolerantly (any case; a value nobody k
|
|
|
357
360
|
| `review-and-update` ("Review and update the book from this change") | The changed chapter goes back to review, before the plan: one round of the director (and of the specialists when they are on), without readers, whose accepted fixes are advice for the author and are **never applied** (the author's change stands); the round joins its `rounds`, and the chapter is closed (summary, story so far) and frozen again. Then the later chapters already written are checked: a revision (`state.revision` with `afterChapter`, analyzed with the tool `revision_impact`) is given BEFORE (what the autopilot knew of the chapter when it was frozen: its summary, key events and story so far at its close) and AFTER (its new closing), and chooses the scenes of the later chapters to rewrite; they are rewritten (`revise`), reviewed, closed and frozen again. The book's final judgement is made again. |
|
|
358
361
|
| `review-only` ("Only review the chapter") | The same round of the director on the changed chapter, and its closing, frozen again: nothing is rewritten and the later chapters are not checked. A complete book stays complete. |
|
|
359
362
|
| `mark-reviewed` ("Mark as reviewed") | Frozen again as it is, at once, without the model. For an outline entry, the same as `keep-text`. |
|
|
360
|
-
| `rewrite-to-outline` ("Rewrite the chapter to follow the
|
|
361
|
-
| `keep-text` ("Keep the text, update only the
|
|
363
|
+
| `rewrite-to-outline` ("Rewrite the chapter to follow the synopsis") | The plan of the chapter follows the new entry (its purpose becomes the entry's text, its key events are dropped, `outlineDigest` is the entry's), and a revision limited to the chapter (`onlyChapter`) rewrites the scenes the new entry requires; the chapter is reviewed as usual (fixes applied), closed and frozen again, and then the later chapters are checked as for `review-and-update` (unless nothing was rewritten). |
|
|
364
|
+
| `keep-text` ("Keep the text, update only the synopsis") | The plan follows the new entry (`outlineDigest`), nothing is rewritten. |
|
|
362
365
|
|
|
363
366
|
A decision that needs the model is recorded in `state.pendingReviews` and carried out by the next run before it goes on with the plan (by a run in progress, at its next step), one at a time, in the order of the book; one whose change is gone by then is dropped (`frozenCleared`), and when it is over the run says it (`frozenReviewed`).
|
|
364
367
|
|
|
@@ -556,7 +559,8 @@ An activity records the model of its **last** call and the tokens of all of them
|
|
|
556
559
|
|---|---|
|
|
557
560
|
| `director.md` | Director profile (`type: director`). |
|
|
558
561
|
| `evaluation-guidelines.md` | The evaluation style: criteria, method and severity. See *Evaluation style*. |
|
|
559
|
-
| `outline/book.md`, `outline/chapters/<NNN>.md` | The outline (
|
|
562
|
+
| `outline/book.md`, `outline/chapters/<NNN>.md` | The outline (the Synopsis): the description of the book and one entry per chapter. See *Outline (the Synopsis)*. |
|
|
563
|
+
| `outline/brainstorm.md` | The notes of Brainstorming: the decisions the author saved from a brainstorm. Never an entry of the outline. |
|
|
560
564
|
| `autopilot/state.json` | Autopilot state: brief, options, plan (with the compact `rounds` of review of every chapter), review cycle, rules, interventions, statistics (with `workedMs`), the final review of the book (`finalReview`) and the last error with its kind. |
|
|
561
565
|
| `autopilot/activity.json` | Last 200 activities (what, why, next, result, model, tokens, cost). |
|
|
562
566
|
| `autopilot/plan.md` | Human-readable mirror of the plan. |
|
|
@@ -599,15 +603,17 @@ What every host gets, whatever its options:
|
|
|
599
603
|
| What | How |
|
|
600
604
|
|---|---|
|
|
601
605
|
| Request | `buildChatRequest(candidate, request, { githubModelsBaseUrl })` is the only place a request is built: URL, headers, body, streaming, tools or JSON-in-prompt, and the output limit parameter of the model family. Where the thinking level goes (`reasoning_effort`, or the chat-template argument the model says: see *Thinking*) is decided there too. Pure and exported, so hosts can test their configuration against it. Every request streams (`stream: true`, `stream_options: { include_usage: true }`), a structured one included, unless the integration's `streamMode` is `"off"` or the model declares `supportsStreaming: false`: see *Timeouts and streaming* and *Declared capabilities of a model*. A host that has a conversation (the web app's Copilot: its history, and the images the author attached) gives `AiRequest.messages` (`{ role: "system" | "user" | "assistant", content }`, the content text or a list of parts, `{ type: "text", text }` and `{ type: "image", dataUrl }`) and that is what is sent, in place of `system` and `user` (give empty text); a part of text goes out as a text part and an image as an `image_url` with its data URL, and an image weighs `IMAGE_TOKEN_ESTIMATE` (4096) tokens of the prompt, whatever its size. With a structured request the JSON instruction of a model without tool calls goes into the first system message (into one of its own, placed first, when there is none). The messages are never changed. A request without `messages` is built exactly as it always was. |
|
|
606
|
+
| API version | Azure OpenAI only. A request carries the API version of the model that is asked: `AiChatModelConfig.apiVersion` (the model's own), else `AiIntegrationConfig.apiVersion` (the default of the models that do not have their own), else `DEFAULT_AZURE_API_VERSION`; `effectiveApiVersion(integration, model)` is the one place that says which (`v1` for the v1 API, whose address has no `api-version`, and `undefined` for a provider that has none), and the address, the output-limit parameter and the shape of `tool_choice` follow it, so a model with an old version is asked as an old API wants and its neighbour as a new one. A fallback in another integration or another model is asked with its own. `AiCandidate.apiVersion` is the model's own, and `onAttempt(attempt).apiVersion`, `AiProviderError.target.apiVersion`, `AiRouteStep.apiVersion`, `errorDetail.apiVersion` and the `apiVersion` of the attempts of a call record say the one that was sent. An empty field is no field, so a configuration saved before it existed asks as it always did, and `pickAiRuntimeConfig` and `redactAiRuntimeConfig` (the safe view of a personal server's configuration) carry it. |
|
|
607
|
+
| API protocol | `AiChatModelConfig.apiProtocol` is `chat-completions` (what no value means: the configurations saved before it existed ask as they always did) or `responses` (`AI_API_PROTOCOLS`, `normalizeApiProtocol`); `AiChatModelConfig.endpointUrl` is an address of the model's own, used **exactly as written** (query included) with the key of its integration (`api-key` for Azure OpenAI, a bearer token for the others) and with no API version of ours (`effectiveApiVersion` and `effectiveResponsesApiVersion` say `undefined` for it); only an http or https address with no user name or password is one (`endpointUrlProblem`, `normalizeEndpointUrl`), and `endpointUrlSecretKeys` names the parameters of its query that look like a key (`key`, `api-key`, `token`, `sig`, `code`…), which an editor warns of, since the address is saved with the settings. `pickAiRuntimeConfig` and `redactAiRuntimeConfig` carry both (the safe view says the protocol and `describeUrl(endpointUrl)`: the host and the path, never the query), so a personal server's configuration does, and `AiCandidate` has them. `modelRequestTarget(integration, model)` is the one rule of where a model's requests go, which a client and an editor both ask: the address of the model, or built from the integration (`<base>/chat/completions`, `…/openai/deployments/<model>/chat/completions?api-version=…` for Azure OpenAI; for the Responses API `<base>/responses`, `…/openai/responses?api-version=…` and `…/openai/v1/responses`; GitHub Models has no Responses API: `{ problem: "no-responses-api" }`, and the request is refused with those words unless the model has an address of its own). The API version of a request to the Responses API is `effectiveResponsesApiVersion`: `v1` for the v1 API; else the model's own; else the integration's when it has the Responses API (`azureVersionHasResponses`: `v1`, `preview`, or a date from `2025-03-01`); else `DEFAULT_AZURE_RESPONSES_API_VERSION` (`2025-04-01-preview`, the one of the Azure portal's playground). `buildChatRequest` builds either request (`ChatRequest.protocol`; `ChatRequest.messages` are the messages in the engine's form, whichever protocol they go in): for the Responses API `model`, `input` (the system prompt as a `developer` message, `input_text` and `input_image` parts, `output_text` for an assistant), `max_output_tokens` (what Chat Completions calls `max_completion_tokens`: the same limit, with the same floor and margin), `temperature` under the same rule, `reasoning: { effort }`, `store: false`, `stream: true`, and, for the forced function, `tools: [{ type: "function", name, description, parameters, strict: false }]` with `tool_choice: "required"`; `text.format` is not sent (a structured reply is the call of the function, as with Chat Completions) nor `include` (no reasoning item is ever sent back). With the Responses API a thinking level and function tools go together, so `noThinkingWithTools` is not used (`withToolsRule`) and a refusal of the kind is no refusal to ask again without a level; a model whose level goes in the chat template (`reasoningParameter: "chat_template_kwargs.reasoning_strength"`) is sent none, since the Responses API has one field for it. The reply is read by `ResponsesStreamReader` and `readResponse` (`responses.ts`), which tell the events of the Responses API (`response.output_text.delta`, `response.reasoning_summary_text.delta`, `response.function_call_arguments.delta` and `.done`, `response.output_item.added` and `.done`, `response.completed`, `response.incomplete`, `response.failed`, `error`; any other event is ignored) as the pieces that the client reads a Chat Completions stream by, so the deadlines, the live JSON (`onStructuredText`), the progress, the tokens (`input_tokens`, `input_tokens_details.cached_tokens`, `output_tokens`: the reasoning tokens are inside the output tokens, so they are priced as output) and the failures are the same code for both protocols; a stream ends with its last event (there is no `[DONE]`: `transport.end` is `done` once the provider sent it, `closed` when the stream stopped before it), what a server says twice (deltas, then the whole in a `done` event, then in the last event) is read once, `incomplete` with `max_output_tokens` is a reply cut by the output limit (`reasoningOnly` when only reasoning tokens were spent), `content_filter` and a refusal are failures with the provider's words, and an `error` event or a `failed` response is the failure of the call, retried or not by what its words say. `onAttempt(attempt).protocol`, `AiProviderError.target.protocol` and `.path`, `AiRouteStep.protocol` and `.path` (the path of an address of the model's own: the trail says the host and the path of the address, never its query), `errorDetail.protocol` and `.path`, and the `protocol` of the attempts of a call record say how a request was made. |
|
|
602
608
|
| Output limit | A structured request gets at least `STRUCTURED_OUTPUT_FLOOR` (4096) tokens. A model known to reason by name (o1/o3/o4, gpt-5, codex-mini; for Azure the declared underlying model, else the deployment name) gets `REASONING_OUTPUT_MARGIN` (12 000) more, because its reasoning is counted in the limit; so does a model whose configuration declares `supportsReasoning: true` (a declaration never takes away the margin of a model known by its name). Never above the model's own `maxOutputTokens`. An Azure deployment of unknown identity gets `max_completion_tokens` from API version 2024-09-01, `max_tokens` before. |
|
|
603
609
|
| Prompt size | A candidate whose `maxInputTokens` (context window) cannot hold the prompt (estimated with `likelyMessageTokens`, the tool schema included, against `resolveModelTokenBudgets`: window minus the output reserve minus a 5% margin) is skipped. If no candidate can, `AiPromptTooLargeError` (not retryable) gives the estimate and the largest budget. A prompt is never cut. |
|
|
604
610
|
| Privacy of fallbacks | `fallbackDisclosure.sameBoundaryOnly` excludes fallbacks outside the primary's integration (the boundary). `requireAcknowledgement` asks `options.acknowledgeFallback(from, to, { capability, label })` before content goes to an integration it has not gone to: only `true` allows it, a throw cancels the call, and a host without the hook (the server) never crosses (fail closed). The engine asks at every call that needs the crossing (once per pair of accounts within a call), so a host that remembers acknowledgements answers from its memory. When nothing is left to call, the error names the setting and how to change it. |
|
|
605
611
|
| Routing limits | `routingExecution`: `maxCandidates`, `maxTotalDurationMs`, `maxTokenAttempts`, `maxEstimatedCost`. The total time never interrupts the first candidate before its own timeout; later candidates start only while time remains and run for what remains. Tokens and cost are estimated per attempt from the real prompt and the output limit (reasoning margin included): candidates are kept while the sum fits, and a first attempt that alone exceeds a limit gives `AiRoutingBudgetError`. A configuration without these fields (saved by an older host) has no such limits and no privacy policy. |
|
|
606
612
|
| Timeouts | Three, in every host: how long the provider has to begin answering (an integration's `requestTimeoutMs`, else `options.defaultTimeoutMs`, else `DEFAULT_REQUEST_TIMEOUT_MS`, 600 s; never under 30 s), the longest silence while it answers (`idleTimeoutMs`, 600 s) and the most one call may take (4 h). See *Timeouts and streaming*. |
|
|
607
|
-
| Hooks | `onAttempt(attempt)`: `attemptId`, the effective `messages` (with the JSON instruction a model without tools receives), the output limit, `stream`, `streamMode`, `tools`, `endpoint`, `timeoutMs` and `timeouts` (the three deadlines: see *Timeouts and streaming*), `toolsOnly` (whether Tools only was in force), `thinking` (the level sent, absent when none was), `reasoningParameter` (where it went, only when it went as the chat-template argument: see *Thinking*), `skipped` (the models left out, absent when none was: see *Tools only* and *Thinking*) and `notes` (what the attempt does not do that the configuration asked, because of what the model declares, in English; absent when there is nothing to say: see *Declared capabilities of a model*). `onAttemptEnd(end)`: the same `attemptId`, `outcome` (`ok`, `failed`, `cancelled`), `usage`, `cost`, `usageKnown`, `costKnown`, the reply `text` or the `error` (without credentials), `failureKind` (`timeout`, `cancelled`, `provider`), `status`, `retryAfterMs`, `timeoutMs` and `timeoutPhase` (for a timeout), `streamed`, `firstByteMs`, `toolCalled`, `durationMs` and, once a reply was read, `finishReason` (the provider's own word, empty when it said none), `replyCharacters` (its text without the reasoning, and the arguments of its function, `{}` being none) and `reasoningCharacters` (the reasoning field of the provider, and a `<think>` block in the text: the count, never the words), for every attempt that was sent, failed ones included; the three facts are there also for a reply the engine refused after reading it (one that was cut, or filtered), and absent for an attempt that never got one (a refusal, a connection that failed, a deadline that ran out first). The `messages` of `onAttempt` are copies and carry the roles and the parts (an image with its data URL), so a listener cannot change what is sent. A hook that throws never breaks a call. |
|
|
613
|
+
| Hooks | `onAttempt(attempt)`: `attemptId`, `integrationName` (as the author wrote it, cleaned of credentials), `index` of `candidates` (the place of the candidate in the route as written, 0 the primary, of how many it has) and `attempt` of `attempts` (which request of the call this is, from 1, of the most it can make: the candidates its plan did not leave out), the effective `messages` (with the JSON instruction a model without tools receives), the output limit, `stream`, `streamMode`, `tools`, `endpoint`, `timeoutMs` and `timeouts` (the three deadlines: see *Timeouts and streaming*), `toolsOnly` (whether Tools only was in force), `thinking` (the level sent, absent when none was), `thinkingMode` (the same in three words: the level that is sent, `automatic` when none is chosen, `not-sent` when one is chosen and the model does not take it), `reasoningParameter` (where it went, only when it went as the chat-template argument: see *Thinking*), `skipped` (the models left out, absent when none was: see *Tools only* and *Thinking*) and `notes` (what the attempt does not do that the configuration asked, because of what the model declares, in English; absent when there is nothing to say: see *Declared capabilities of a model*). `onAttemptEnd(end)`: the same `attemptId`, `outcome` (`ok`, `failed`, `cancelled`), `usage`, `cost`, `usageKnown`, `costKnown`, the reply `text` or the `error` (without credentials), `failureKind` (`timeout`, `cancelled`, `provider`), `status`, `retryAfterMs`, `timeoutMs` and `timeoutPhase` (for a timeout), `streamed`, `firstByteMs`, `toolCalled`, `durationMs` and, once a reply was read, `finishReason` (the provider's own word, empty when it said none), `replyCharacters` (its text without the reasoning, and the arguments of its function, `{}` being none) and `reasoningCharacters` (the reasoning field of the provider, and a `<think>` block in the text: the count, never the words), for every attempt that was sent, failed ones included; the three facts are there also for a reply the engine refused after reading it (one that was cut, or filtered), and absent for an attempt that never got one (a refusal, a connection that failed, a deadline that ran out first). The `messages` of `onAttempt` are copies and carry the roles and the parts (an image with its data URL), so a listener cannot change what is sent. A hook that throws never breaks a call. |
|
|
608
614
|
| Approving endpoints | `effectiveAiBase(integration, githubModelsBaseUrl?)` is the origin and path every request of an integration starts with, defaults included (`https://api.openai.com/v1`, `https://models.github.ai/inference`). A host that approves where API keys may be sent should compare these. |
|
|
609
615
|
| Wire format | Server-sent events with several `data:` lines are joined with a newline; the pieces of a forced function call (`delta.tool_calls[].function.arguments`) are joined into the arguments of the reply, and a last piece that carries the whole `message.tool_calls` is read too; a JSON reply to a streaming request (a server that ignores `stream`) is read as the reply; an `error` in a 200 reply is a provider error, and so is an `event: error` whatever its data is. A line ends with LF, CR or CRLF (the three that the SSE specification allows, a CRLF cut between two chunks included); a `data:` with no space after it, a last line with no newline, and `: comments`, `id:` and `retry:` lines are read as they should be; a character that a chunk cuts in two is kept until the rest comes. The tokens are read from whichever chunk carries `usage` (`prompt_tokens`/`completion_tokens`, or `input_tokens`/`output_tokens`; the cached ones from `prompt_tokens_details.cached_tokens`, `input_tokens_details.cached_tokens`, `prompt_cache_hit_tokens` or `cache_read_input_tokens`); a count of zero never replaces a real one. |
|
|
610
|
-
| Errors | `AiProviderError` carries `status`, `retryable`, `transient` (it depends on the moment: 408, 429, 502, 503, 504, Cloudflare's 520-524, network, a stream that stopped), `transport` and `partialText` (what the transport saw of the call, and the reply that had arrived: see *A stream that stops halfway*), `retryAfterMs` (the `Retry-After` of a 429 or 503, at most five minutes), `timedOut` with `timeout` (which deadline ran out, for how long), `truncated` and `reasoningOnly` (the reply was cut while the model reasoned: seen as reasoning, or, with nothing written at all, from a model declared as reasoning). `AiToolsRequiredError` (nothing can be asked: Tools only is on and no model can call a function; see *Tools only*) is the error of a call that was never sent. Keys, `Bearer …`, `api-key: …`, `?key=…` and `sk-…` are removed from every message (`redactSecrets`), also before the runner saves it. The error of a candidate that was tried carries `target` (`{ provider, model, integrationId, endpoint? }`, the endpoint only an origin: see *What the interface reads*). |
|
|
616
|
+
| Errors | `AiProviderError` carries `status`, `body` (what the provider said, in its own words: see *What the provider said*), `retryable`, `transient` (it depends on the moment: 408, 429, 502, 503, 504, Cloudflare's 520-524, network, a stream that stopped), `transport` and `partialText` (what the transport saw of the call, and the reply that had arrived: see *A stream that stops halfway*), `retryAfterMs` (the `Retry-After` of a 429 or 503, at most five minutes), `timedOut` with `timeout` (which deadline ran out, for how long), `truncated` and `reasoningOnly` (the reply was cut while the model reasoned: seen as reasoning, or, with nothing written at all, from a model declared as reasoning). `AiToolsRequiredError` (nothing can be asked: Tools only is on and no model can call a function; see *Tools only*) is the error of a call that was never sent. Keys, `Bearer …`, `api-key: …`, `?key=…` and `sk-…` are removed from every message (`redactSecrets`), also before the runner saves it. The error of a candidate that was tried carries `target` (`{ provider, model, integrationId, endpoint? }`, the endpoint only an origin: see *What the interface reads*). |
|
|
611
617
|
|
|
612
618
|
### Timeouts and streaming
|
|
613
619
|
|
|
@@ -658,13 +664,29 @@ An integration without its own value says `the default provider timeout` or `the
|
|
|
658
664
|
|
|
659
665
|
The route is the author's, place by place: the primary is position 0 and the fallbacks follow, in the order they wrote them. `describeAiRoute(config, capability)` answers it as `AiRouteEntry[]`: the candidate that stands in each place, or, for a target that cannot be called (its integration is gone, its provider cannot chat here, its model is not in the integration, the model is not allowed the task), the target and why (`unusable`: `integration-missing`, `provider-unsupported`, `model-missing`, `task-not-allowed`). `resolveAiCandidates` is what is left of it, as it always was. A candidate that cannot be called keeps its place, so that the fallback that is asked instead is never taken for the primary: `attempt.index` (`onAttempt`, `onAttemptEnd`) is the place in the route as written, 0 for the primary.
|
|
660
666
|
|
|
667
|
+
A task may follow another while it has no route of its own (`AI_CAPABILITY_FOLLOWS`): **Brainstorming** (`BRAINSTORMING_CAPABILITY`, `brainstorming`, the Copilot's mode on the Synopsis page of the web app) follows the Copilot (`COPILOT_CAPABILITY`, `copilot`). Its own route is used alone when it has one; without one, the Copilot's route is, with the thinking levels of its targets (Brainstorming has no default level of its own: it is the Copilot's, the target's level, else the integration's); without that either, it is resolved as the Copilot is, from the models tagged `brainstorming`, then those tagged `copilot`, then the default writing integration and the `default` models. A model the author allows the Copilot is allowed Brainstorming too (not the other way round), so a configuration written before the task existed needs nothing to keep working. The name of the task is stable, for whatever classifies a call by its task (the debug history of the web app, the costs).
|
|
668
|
+
|
|
661
669
|
What became of every candidate is an `AiRouteStep`: `{ position, integrationId, integrationName, provider, model, outcome, endpoint?, status?, durationMs?, message?, timeoutPhase?, timeoutMs?, routing?, leftOut?, why?, promptTokens?, windowTokens? }`. `outcome` is `ok`, `failed`, `timeout`, `cancelled` for a candidate that was asked (with what the provider said, cleaned of credentials and cut at 240 characters, and for a timeout which deadline ran out and, with `routing`, that it was the routing time that was left and not a limit of the call), or `left-out` for one that was not, with `leftOut` saying why: `unusable`, `no-tool-calls` (Tools only), `boundary` (`sameBoundaryOnly`), `context-window` (the prompt needs `promptTokens` and the model's window leaves `windowTokens`), `budget` (`maxTokenAttempts` or `maxEstimatedCost`), `not-acknowledged` (`requireAcknowledgement`) or `out-of-time` (`maxTotalDurationMs` was used up).
|
|
662
670
|
|
|
663
|
-
- **The error of a call that failed has the whole route.** `AiProviderError.route` (also `AiUnavailableError.route`, for a route written and none of it callable, whose message then names each target and why) is every step in the order of the route: the primary that failed at once, then the fallback that ran out of time. `error.target`, `error.model` and the rest of the error are still the last candidate's. The notes that the message ends with now also say a candidate that the context window or the routing limits left out, and a target that cannot be called. `classifyAutopilotError(error).detail.route` and `errorDetail.route` keep it, cleaned (valid steps only, no credential, an endpoint only as an origin, at most `MAX_ROUTE_STEPS`, 12).
|
|
671
|
+
- **The error of a call that failed has the whole route.** `AiProviderError.route` (also `AiUnavailableError.route`, for a route written and none of it callable, whose message then names each target and why) is every step in the order of the route: the primary that failed at once, then the fallback that ran out of time. `error.target`, `error.model` and the rest of the error are still the last candidate's. The notes that the message ends with now also say a candidate that the context window or the routing limits left out, and a target that cannot be called. `classifyAutopilotError(error).detail.route` and `errorDetail.route` keep it, cleaned (valid steps only, no credential, an endpoint only as an origin, at most `MAX_ROUTE_STEPS`, 12). A step that was refused has `body` too, the words of its own attempt.
|
|
664
672
|
- **The attempts say what was left out.** `onAttempt(attempt).leftOut` is every candidate the plan leaves out, each as a step (the same list on every attempt of the call, with a fallback that the author did not acknowledge added to the attempts after it). It is in addition to `skipped`, which keeps its shape.
|
|
665
673
|
- **The records keep it.** The record of a call (`AiCallRecord.attempts`) lists the candidates that were left out beside the attempts that were asked, in the order of the route, numbered from 1 together: an entry with `outcome: "skipped"` and `skip: { reason, why?, promptTokens?, windowTokens? }`, no duration, no usage, no error. `CallEndInfo.attempts` and the `call-ended` event count only the attempts that were asked.
|
|
666
674
|
- **A host that is ending.** `createFetchAi(config, { interrupted })`: while it answers `true` (a browser page that is being reloaded or closed), a request that fails is a failure of the host and not of the provider. The attempt is closed as `cancelled` and the call ends with the failure: the next candidate is not asked, because it would be sent the whole prompt, and billed, by a host that is no longer there.
|
|
667
675
|
|
|
676
|
+
### What the provider said
|
|
677
|
+
|
|
678
|
+
An HTTP failure becomes an `AiProviderError` in one place (the client), and the provider's answer is read there, once, the same way whatever its shape: `AiProviderError.body` is an `AiErrorBody`, `{ status, shape, message?, type?, param?, code?, raw? }`. The shapes read are OpenAI's (`{ error: { message, type, param, code } }`, which most gateways speak), Azure's (`{ error: { code, message, innererror } }`: the code of the inner error is the `type` it lacks), Anthropic's (`{ type: "error", error: { type, message } }`), Gemini's (`{ error: { code, message, status } }`, also in a list: `status` is the `type`) and the plain ones: `{ message }`, `{ detail }` (a text, or the list of problems of FastAPI), `{ error: "text" }`. A body that is none of those is kept as it is: a text, the page of a gateway (`shape: "html"`, its title in the message, the page itself in `raw`) or a JSON that nobody knows are `raw`, cut at `MAX_ERROR_RAW_CHARACTERS` (2048) with an ellipsis; a response with no body says only its status (`shape: "empty"`, `HTTP 400, no body`). The message is the provider's own words, whole, and is never cut but with an ellipsis (at `MAX_ERROR_MESSAGE_CHARACTERS`, 2000); the keys of the integrations, bearer tokens, the signature and the keys of a query and `sk-…` are taken out of every word (`redactSecrets`), and the request, the headers it carried and the `Authorization` among them are never read nor kept. The text of the error is one line, `describeErrorBody(body)`: `HTTP 400 — Function tools with reasoning_effort are not supported for gpt-6-luna in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'. [type: invalid_request_error, param: reasoning_effort]`; an error inside a stream that answered 200 says its words the same way (`errorBodyOfObject`).
|
|
679
|
+
|
|
680
|
+
`body` goes where the error goes: `onAttemptEnd(end).errorBody` (and so the route: `AiRouteStep.body`), `errorDetail.body` and `route[].body` of a failed step (cleaned again, `normalizeErrorBody`, when it is read back from a file), and the `error.body` of an attempt of a call record (whose message is kept up to `AI_CALL_ERROR_CHARACTERS`, 2400, with an ellipsis). Every field is optional: an older engine and an older file have none, and read as they did.
|
|
681
|
+
|
|
682
|
+
#### A provider that refuses thinking with tools
|
|
683
|
+
|
|
684
|
+
Some models refuse a thinking level only when the request carries function tools: `Function tools with reasoning_effort are not supported for gpt-6-luna in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'.` (a 400, `param: reasoning_effort`). `refusesThinkingWithTools(body)` says whether an answer is that, and it reads the words and the parameter, never the name of the model: a 400 or a 422 that names the level (or whose `param` is it), speaks of tools and says it is refused. The value of a level that is not accepted (`Unsupported value: 'reasoning_effort' does not support 'none' with this model.`), a model that takes no level at all (the remedy of *A provider that does not accept it* below) and any other 400 are not that, and are not asked again.
|
|
685
|
+
|
|
686
|
+
What a model takes with tools differs by family, and the documentation of Azure OpenAI (*Azure OpenAI reasoning models*, «Tool calling with reasoning models») says so: `gpt-5.6-*` take function tools on Chat Completions with the level left out (and still reason) or with `none`; `gpt-6-sol`, `gpt-6-luna` and `gpt-6.1-terra` refuse a request with tools that leaves the level out as well, and take `none` only; `gpt-6-astra`, `gpt-6.1-sol`, `gpt-6.2-astra` and `gpt-6.2-sol` take function tools on the Responses API only, and refuse `none`. The engine finds out which, by asking, and never by the name: the client asks that call again **without the level** (a new attempt of the same candidate; the request that was refused stays in the trail with the provider's words, and `attempt` counts every request), and if that is refused too, **with `none`** (`reasoning_effort: "none"`, for a model that takes its level in `reasoning_effort`); each way once, a way that the first request already was is not asked again, and a refusal of the value of `none` is the end. The error of a call that no way answered is the provider's last words, then what was tried and, when the provider says it, that it takes function tools on `/v1/responses` only: `Narrarium asked again without a thinking level and with "none", and the model still refuses function tools on this endpoint: the provider says to use /v1/responses for them. Set the "API protocol" of the model to "Responses API" in AI Integrations to use them.` Nothing is learned from it: the model needs the Responses API (`apiProtocol: "responses"`; see *API protocol*).
|
|
687
|
+
|
|
688
|
+
When a way answers, the model is remembered by it, once: `AiModelMemory` (`createModelMemory()`) is what a host keeps of its models between calls, given to the client as `options.memory` or per call as `request.memory`, and every later request **with tools** to that model (same integration and model) goes the way that answered from the start (`thinkingMode: "not-sent"` for the level left out, `"none"` for none, and `thinkingWhy: "tools"` in both, with a note in the attempt), while a request **without tools** to the same model keeps its level. `AiChatModelConfig.noThinkingWithTools` is the same fact set by the author: `true` leaves the level out, `"none"` sends `none`; it is read from the configuration (and kept by `pickAiRuntimeConfig`, any other value dropped, and shown by `redactAiRuntimeConfig`), so that no request is wasted to learn it, and what the memory learned (`none`) wins over a `true` that was wrong. `onLearned(learning)` (on the client's options or on the request) says it once, when a call learns it: `{ kind: "no-thinking-with-tools", integrationId, integrationName, model, off, body }` (`off`: `omit` or `none`; `body`: what the provider said the first time). The `AutopilotSession` owns one memory (or takes the host's, `config.memory`) and gives it to every call of its runs: a server-hosted run learns it at once, and `snapshot().learned` lists what the session has learned, for a client that connects later. The runner says it as the `model-learned` event and as an `insight` with the code `modelLearned`, whose words are the provider's, what was done (thinking off for the requests with tools, for this model only; asked with `none` when that is the way) and the two ways out: the Responses API first, when the provider's words tell to use `/v1/responses` (`suggestsResponsesApi`), then turning thinking off, which is what was done. The author's choice of the Responses API is the model's `apiProtocol`, which the host sets (the web app does it with a button of the notice); it is never set by the engine.
|
|
689
|
+
|
|
668
690
|
### Tools only
|
|
669
691
|
|
|
670
692
|
Every autopilot agent answers through a function of its own (the concept, the plan, a reader's evaluation, the director's decisions, the summary of a scene… each has its schema, and the request forces the call with `tool_choice`): the answer is a field that is parsed, not a JSON that the message asked for and that the engine had to find in some text. *Tools only* makes that the only way. It is on unless the configuration turns it off: `AiRuntimeConfig.toolsOnly`, which `pickAiRuntimeConfig` reads from `settings.aiToolsOnly` (and from `toolsOnly` in a configuration that was already picked, which is what a personal server stores and reads back; the settings' own word wins when both are there, and a value that is not a boolean is ignored). A host with no such setting has it on. `redactAiRuntimeConfig(config).toolsOnly` says what is in force.
|
|
@@ -883,6 +905,8 @@ The runner writes one call per `ai()` call of a task: `begin` before the request
|
|
|
883
905
|
- `call-started`: `activityId`, `callId`, `seq` (the call's number in its task, from 1), `label`, `capability`, `structured`, `systemBytes`, `userBytes`.
|
|
884
906
|
- `call-ended`: `activityId`, `callId`, `status` (`ok`, `failed`, `interrupted` or `aborted`), `attempts`, `characters`, `storedBytes`, `partial`, `durationMs`, `dropped` (`limit` or `null`). Neither event carries text.
|
|
885
907
|
- `task-progress` gains `callId` (when the book keeps records) and `callSeq` (always: the call's number in its step, from 1). A structured step that streams its JSON says it with `kind: "json"`, `preview` (the last 700 characters of the JSON so far) and `characters`, and without `bytes`; a shorter JSON (`""` too) is a new attempt, said at once. The numbers event of a structured step keeps its shape (`bytes`, `characters`), with the same `preview` and, once the JSON streams, the JSON's `characters`: the tail, the pace and the count are the call's own, never the ones of the call before. See *The step that is answering* for how a client follows them (`applyLiveProgress`).
|
|
908
|
+
- `call-attempt`: `activityId`, `callSeq`, `callId` (with records), `attempt`, `attempts`, `candidateIndex`, `candidateCount`, `fallback`, `integrationId`, `integrationName`, `provider`, `model`, `thinking`, `thinkingWhy?`, `streamMode`: which candidate of the route the call asks now, said at the start of every attempt, with or without records (see *Which candidate answers*). Names and numbers, never text.
|
|
909
|
+
- `model-learned`: `activityId?`, `learned` (`no-thinking-with-tools`), `integrationId`, `integrationName`, `model`, `off` (`omit` or `none`: the way that answered), `body` (what the provider said, in its own words), `responses` (its words tell to use the Responses API): a call learned from a refusal that the model does not take a thinking level when the request carries tools, was asked again without it (or with `none`), and the session remembers it (see *A provider that refuses thinking with tools*). Kept in the replay of the session; a host that keeps settings persists it as the model's `noThinkingWithTools`. An `insight` with the code `modelLearned` says it in words (it carries the `model`).
|
|
886
910
|
- `insight` with the code `callsStoreFailed`: the store failed or is full (`AiCallDiskFullError`). The run goes on without records until the next run. It is said once per run.
|
|
887
911
|
|
|
888
912
|
The status `aborted` is what a call that the run stopped in the middle of its reply ends as (a «Pause now», or a server stopping), with the text that arrived, `partial` set.
|
|
@@ -958,7 +982,7 @@ A skipped file is not recorded as synced (a file that was never synced stays out
|
|
|
958
982
|
| `configureAutopilot(bookId, { options: { longRetry } })`, `startAutopilot(bookId, { options: { longRetry } })` | As always: the options go to the engine as they are. | As always. The engine reads them as it reads every option there: a value that is not a policy changes nothing. |
|
|
959
983
|
| `retryNow(bookId)` | `POST /api/v1/books/:id/autopilot/retry-now`, no body (or `{}`). | `200` the snapshot with `skipped` (`RetryNowResponse`): `true` when the run was waiting and the attempt starts now (the snapshot's `summary.retry` is gone), `false` when there was nothing to skip (no run, or a run that is not waiting: nothing happens). `400 invalid_request` for any other body; `503 maintenance` while the server is about to restart (unlike a pause, which is never refused: «Retry now» sets the run going again). |
|
|
960
984
|
|
|
961
|
-
- **The length of the book comes from its
|
|
985
|
+
- **The length of the book comes from its Synopsis.** A server that takes the chapters from the outline and the brief from `outline/_brief.md` announces `SERVER_FEATURE_AUTOPILOT_OUTLINE_BRIEF` (`"autopilot-outline-brief"`), and `serverHasOutlineBrief(infoOrFeatures)` reads it (never throws). An older server plans the default number of chapters and ignores the Synopsis, so `startAutopilot` and `configureAutopilot` refuse it before sending anything: a `ServerRequestError` with status 501 and code `feature_unavailable`, which says to update the server. The client asks the server's `info` once for both checks.
|
|
962
986
|
- **Resume after a restart.** A server that resumes a run by itself when it starts again announces `SERVER_FEATURE_AUTOPILOT_AUTO_RESUME` (`"autopilot-auto-resume"`), and `serverSupportsAutopilotAutoResume(infoOrFeatures)` reads it (it takes the info or the list of its features; never throws). Such a server takes `options.resumeAfterRestart` (`true` or `false`) in the options route, `configure` and `start`; it pauses every run with `session.stopForShutdown()` when it stops, and when it starts again it resumes, one book at a time, the runs that `session.restartResumeCause()` names (with `session.start({ afterRestart: true })`, through every check a start of the author has: the AI configuration, the number of runs, the owner's switch and caps), at most three times a day per book (see the server's README). **The client never sends `resumeAfterRestart` to a server that does not announce the feature** (`false` included), for the same reason as `longRetry`: `updateAutopilotOptions`, `configureAutopilot` and `startAutopilot` ask the server's `info()` first and refuse with `501 feature_unavailable` before anything is sent. A request without the setting asks nothing more.
|
|
963
987
|
|
|
964
988
|
- **Conflicts with GitHub.** When the server's commits and GitHub's changed the same files, the server's run stops with a `conflict` (`errorDetail.githubConflicts`: how many files), its sync answers `409 github_conflict` (with `conflicts` in the `details` of the `ServerRequestError`), and `lastSync.conflicts` says it in the summary of the book. The author chooses which version of each file to keep, the server's or GitHub's, through two calls of a server that announces `SERVER_FEATURE_GITHUB_CONFLICTS` (`"github-conflicts"`), which `serverSupportsGithubConflicts(infoOrFeatures)` reads (never throws). **The client refuses a server without the feature before sending anything**: it asks `info()` once (and again until the server says yes, so that an update is noticed) and throws a `ServerRequestError` with status `501` and code `feature_unavailable`, whose message says to update the server. A refusal of the server keeps what it said with it in `ServerRequestError.details` (the fields of the answer other than `code` and `message`). Every call also answers `401 unauthorized`, `403 scope`, `404 book_not_found` and `409 no_remote` (a book that is not on GitHub). The rules (which version a deleted file follows, the autopilot's own files that are never asked about, the names the server does not write, the push that GitHub refuses) are in the server's README, *Conflicts with GitHub*.
|
package/dist/ai/config.d.ts
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
export type AiProviderKind = "azure_openai" | "openai" | "github_models" | "m365_copilot";
|
|
2
|
+
/**
|
|
3
|
+
* How a model is asked without thinking when the request carries function tools (`AiChatModelConfig.noThinkingWithTools`): `true` leaves the level out of the request (a model of the GPT-5.6 family still
|
|
4
|
+
* reasons then), `"none"` sends `reasoning_effort: "none"` (the GPT-6 models that take function tools on Chat Completions refuse a request that leaves the level out, and take `none`).
|
|
5
|
+
*/
|
|
6
|
+
export type AiNoThinkingWithTools = true | "none";
|
|
2
7
|
/** The Azure OpenAI API version used when an integration does not name one. */
|
|
3
8
|
export declare const DEFAULT_AZURE_API_VERSION = "2024-10-21";
|
|
9
|
+
/** Whether an endpoint is the v1 API of Azure OpenAI (`https://<resource>.openai.azure.com/openai/v1`), which takes no `api-version` in its address. */
|
|
10
|
+
export declare function isAzureV1Endpoint(endpoint: string | undefined): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The API version a request to a model is sent with, and the one place that says it (the client, the diagnostics, the editor and the configuration of a personal server all ask here): the
|
|
13
|
+
* model's own (`AiChatModelConfig.apiVersion`), else its integration's, else `DEFAULT_AZURE_API_VERSION`. `v1` for the v1 API of Azure OpenAI, which has none in its address, and
|
|
14
|
+
* `undefined` for a provider that has no API version. Whitespace is no version: an empty field inherits. `model` is the model's entry, or a candidate that carries its `apiVersion`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function effectiveApiVersion(integration: Pick<AiIntegrationConfig, "provider" | "endpoint" | "apiVersion">, model?: {
|
|
17
|
+
apiVersion?: string;
|
|
18
|
+
endpointUrl?: unknown;
|
|
19
|
+
} | null): string | undefined;
|
|
20
|
+
/** The API version of Azure OpenAI that a request to the Responses API carries when neither the model nor its integration names one that the Responses API takes: the one the Azure portal's playground sends. */
|
|
21
|
+
export declare const DEFAULT_AZURE_RESPONSES_API_VERSION = "2025-04-01-preview";
|
|
22
|
+
/** Whether an Azure OpenAI API version can take a request to the Responses API: `v1`, `preview`, or a dated version from 2025-03-01 on. */
|
|
23
|
+
export declare function azureVersionHasResponses(version: string | undefined): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The API version a request to the Responses API of a model is sent with (`effectiveApiVersion` is the one of Chat Completions): `v1` for the v1 API of Azure OpenAI; else the model's own version, which
|
|
26
|
+
* is the author's word for it whatever it is; else its integration's when the Responses API has it (an integration that keeps `2024-10-21` for its Chat Completions models is not made to ask the Responses API
|
|
27
|
+
* with a version that predates it); else `DEFAULT_AZURE_RESPONSES_API_VERSION`. `undefined` for a provider that has no API version. A model with an address of its own (`endpointUrl`) has none: the
|
|
28
|
+
* address says everything.
|
|
29
|
+
*/
|
|
30
|
+
export declare function effectiveResponsesApiVersion(integration: Pick<AiIntegrationConfig, "provider" | "endpoint" | "apiVersion">, model?: {
|
|
31
|
+
apiVersion?: string;
|
|
32
|
+
endpointUrl?: unknown;
|
|
33
|
+
} | null): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* How the requests of a model are made: `chat-completions` (the default, and what a model that says nothing gets) or `responses`, the Responses API (`/responses`, `input` and `output` items, function tools that work
|
|
36
|
+
* together with reasoning). It is the author's word for the model and is never changed by itself.
|
|
37
|
+
*/
|
|
38
|
+
export declare const AI_API_PROTOCOLS: readonly ["chat-completions", "responses"];
|
|
39
|
+
export type AiApiProtocol = (typeof AI_API_PROTOCOLS)[number];
|
|
40
|
+
/** The protocol a configuration says: `responses` exactly, and nothing for anything else (Chat Completions is what no value means, so the settings of before are the settings they were). */
|
|
41
|
+
export declare function normalizeApiProtocol(value: unknown): "responses" | undefined;
|
|
42
|
+
/** What is wrong with an address typed for a model, or `undefined` when it is fine or empty (no address of its own): it is not an address, it is not http or https, or it carries a user name or a password. */
|
|
43
|
+
export type EndpointUrlProblem = "invalid" | "scheme" | "credentials";
|
|
44
|
+
export declare function endpointUrlProblem(value: unknown): EndpointUrlProblem | undefined;
|
|
45
|
+
/** The address of a model as the engine keeps it: exactly what was written, without the spaces around it, when it is an http or https address with no credentials; nothing for anything else. */
|
|
46
|
+
export declare function normalizeEndpointUrl(value: unknown): string | undefined;
|
|
47
|
+
/** The names of the parameters of the query of an address that look like a key, in the order they are written, each once: the editor warns of them, since the address is saved with the settings and travels to a personal server. */
|
|
48
|
+
export declare function endpointUrlSecretKeys(value: unknown): string[];
|
|
49
|
+
/** Whether the query of an address carries what looks like a key (see `endpointUrlSecretKeys`). */
|
|
50
|
+
export declare function endpointUrlHasSecret(value: unknown): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Where an address goes, and nothing else: its host and its path (`oai-gw.openai.azure.com/openai/responses`), never its query, its fragment or the credentials in it, which is what may be shown and saved about it.
|
|
53
|
+
* `undefined` for anything that is not an http or https address.
|
|
54
|
+
*/
|
|
55
|
+
export declare function describeUrl(value: unknown): string | undefined;
|
|
56
|
+
/** The path of an address, and nothing else (`/openai/responses`): never its query, its fragment or the credentials in it. `undefined` for anything that is not an http or https address, and for an address that has no path. */
|
|
57
|
+
export declare function addressPath(value: unknown): string | undefined;
|
|
58
|
+
/** Whether the path of an address ends with `/responses`: the address of the Responses API, which a model whose address is that is likely to be asked through. */
|
|
59
|
+
export declare function looksLikeResponsesUrl(value: unknown): boolean;
|
|
4
60
|
export interface AiPricingConfig {
|
|
5
61
|
inputPerMTok?: number;
|
|
6
62
|
cachedPerMTok?: number;
|
|
@@ -30,6 +86,30 @@ export interface AiChatModelConfig {
|
|
|
30
86
|
* `suggestedReasoningParameter` says what the documented sources know of a model name; the engine never applies it by itself.
|
|
31
87
|
*/
|
|
32
88
|
reasoningParameter?: AiReasoningParameter;
|
|
89
|
+
/**
|
|
90
|
+
* The model refuses a thinking level when the request carries function tools («Function tools with reasoning_effort are not supported for gpt-6-luna…»): a request with tools is asked without thinking,
|
|
91
|
+
* and a request without tools keeps its level. `true` leaves the level out of the request; `"none"` sends `reasoning_effort: "none"`, for a model that refuses a request with tools that leaves it out
|
|
92
|
+
* (the GPT-6 models that take function tools on Chat Completions do). The author sets it, and the engine learns it from the refusal (`AiModelMemory`) when the provider says so. Any other value is no value.
|
|
93
|
+
* It is a rule of Chat Completions: a model asked through the Responses API (`apiProtocol`) is sent its level with tools, whatever this says.
|
|
94
|
+
*/
|
|
95
|
+
noThinkingWithTools?: AiNoThinkingWithTools;
|
|
96
|
+
/**
|
|
97
|
+
* The API version this model's requests carry (Azure OpenAI's `api-version`): each deployment may need its own. Absent or empty: the integration's `apiVersion`, else
|
|
98
|
+
* `DEFAULT_AZURE_API_VERSION`. `effectiveApiVersion` is the one place that says which is used; it only has an effect for an Azure OpenAI integration.
|
|
99
|
+
*/
|
|
100
|
+
apiVersion?: string;
|
|
101
|
+
/**
|
|
102
|
+
* How this model's requests are made (`AI_API_PROTOCOLS`): absent or `chat-completions`, Chat Completions, as always; `responses`, the Responses API. The key of the integration is sent the way its provider
|
|
103
|
+
* takes it (the `api-key` header of Azure OpenAI, a bearer token for the others), whichever protocol it is. With the Responses API a thinking level and function tools work together, so `noThinkingWithTools` is not used,
|
|
104
|
+
* and its one field for the level (`reasoning.effort`) leaves the chat-template parameter of `reasoningParameter` without a use.
|
|
105
|
+
*/
|
|
106
|
+
apiProtocol?: AiApiProtocol;
|
|
107
|
+
/**
|
|
108
|
+
* The address this model's requests go to, used exactly as it was written (its query included): for a gateway whose address is not the one the engine would build from the integration. It has to be an http or
|
|
109
|
+
* https address with no user name or password in it; anything else is no value. It is the address of the request, not a base: `…/openai/responses?api-version=2025-04-01-preview`. The API version of the
|
|
110
|
+
* model and of its integration are not used for it. The key of the integration is sent as ever. Do not put a key in it: it is saved with the settings, and travels to a personal server.
|
|
111
|
+
*/
|
|
112
|
+
endpointUrl?: string;
|
|
33
113
|
/** The context window of the model: what a prompt and its answer may be together. The engine subtracts the answer and a margin itself. */
|
|
34
114
|
maxInputTokens?: number;
|
|
35
115
|
/** The largest answer that can be asked of the model. */
|
|
@@ -71,6 +151,7 @@ export interface AiIntegrationConfig {
|
|
|
71
151
|
provider: AiProviderKind;
|
|
72
152
|
endpoint?: string;
|
|
73
153
|
apiKey: string;
|
|
154
|
+
/** The API version of the integration's models that do not name their own (`AiChatModelConfig.apiVersion`): Azure OpenAI's `api-version`. Absent: `DEFAULT_AZURE_API_VERSION`. */
|
|
74
155
|
apiVersion?: string;
|
|
75
156
|
/**
|
|
76
157
|
* How long the provider has to begin answering (the connection and the headers), as the author wrote it. A call raises a value
|
|
@@ -152,6 +233,8 @@ export interface RedactedAiIntegration {
|
|
|
152
233
|
streamMode?: AiStreamMode;
|
|
153
234
|
/** The thinking level of the integration, when it sets one. */
|
|
154
235
|
thinking?: AiThinking;
|
|
236
|
+
/** The API version of the integration (Azure OpenAI), when it names one: the default of its models that do not name their own. */
|
|
237
|
+
apiVersion?: string;
|
|
155
238
|
models: RedactedAiModel[];
|
|
156
239
|
}
|
|
157
240
|
/** A model as the safe view shows it: its name and routes, and what its configuration declares of it (only what it declares). */
|
|
@@ -164,6 +247,14 @@ export interface RedactedAiModel {
|
|
|
164
247
|
supportsVision?: boolean;
|
|
165
248
|
/** How the thinking level reaches the model, when the model says (absent: `reasoning_effort`). */
|
|
166
249
|
reasoningParameter?: AiReasoningParameter;
|
|
250
|
+
/** Whether the model refuses thinking when the request carries tools, and how it is asked then (see `AiChatModelConfig.noThinkingWithTools`); absent: it does not, as far as is known. */
|
|
251
|
+
noThinkingWithTools?: AiNoThinkingWithTools;
|
|
252
|
+
/** The API version of the model, when it names its own (Azure OpenAI): absent, it takes the integration's. */
|
|
253
|
+
apiVersion?: string;
|
|
254
|
+
/** The Responses API, when the model is asked through it (absent: Chat Completions). */
|
|
255
|
+
apiProtocol?: "responses";
|
|
256
|
+
/** Where the model's requests go, when it has an address of its own: its host and its path, never its query (which may hold a key) or credentials. */
|
|
257
|
+
endpointUrl?: string;
|
|
167
258
|
maxInputTokens?: number;
|
|
168
259
|
maxOutputTokens?: number;
|
|
169
260
|
}
|
package/dist/ai/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../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