@buildaharness/aielia 0.3.9 → 0.3.10
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/dist/_memory-core-generated.d.ts +6 -0
- package/dist/assistant.d.ts +11 -0
- package/dist/{bin-CCwDFxDe.js → bin-Cz3FY6Ew.js} +30 -11
- package/dist/bin-Cz3FY6Ew.js.map +1 -0
- package/dist/claude-cli-llm-client.d.ts +2 -0
- package/dist/claude-cli-prompt.d.ts +7 -0
- package/dist/cli.js +1 -1
- package/dist/fact-repository.contract.d.ts +2 -0
- package/dist/fact-repository.d.ts +44 -0
- package/dist/file-tools-mcp-server.mjs +29 -0
- package/dist/harness-bridge.d.ts +5 -5
- package/dist/html-to-markdown.d.ts +11 -0
- package/dist/index.d.ts +82 -2
- package/dist/index.js +4975 -173
- package/dist/index.js.map +1 -1
- package/dist/layer-settings.d.ts +16 -3
- package/dist/memory-events.d.ts +177 -0
- package/dist/memory-service.d.ts +15 -0
- package/dist/model-pricing.d.ts +3 -0
- package/dist/{provider-setup-Cy9dwqrd.js → provider-setup-DG8iYm_F.js} +5756 -4787
- package/dist/provider-setup-DG8iYm_F.js.map +1 -0
- package/dist/scripted-llm-client.d.ts +1 -1
- package/dist/{tui-app-Dt72u8vZ.js → tui-app-oWbIUcBW.js} +3 -3
- package/dist/{tui-app-Dt72u8vZ.js.map → tui-app-oWbIUcBW.js.map} +1 -1
- package/dist/turn-abort.d.ts +5 -0
- package/dist/version.d.ts +1 -1
- package/dist/web-fetch-core.d.ts +0 -14
- package/dist/writer/article-autosave.d.ts +12 -0
- package/dist/writer/article-change-summary.d.ts +28 -0
- package/dist/writer/article-claims.d.ts +49 -0
- package/dist/writer/article-comments.d.ts +20 -0
- package/dist/writer/article-consistency.d.ts +27 -0
- package/dist/writer/article-decorations.d.ts +23 -0
- package/dist/writer/article-dependencies.d.ts +44 -0
- package/dist/writer/article-draft.d.ts +23 -0
- package/dist/writer/article-edit-outline.d.ts +16 -0
- package/dist/writer/article-edit-suggest.d.ts +30 -0
- package/dist/writer/article-folder.d.ts +29 -0
- package/dist/writer/article-history.d.ts +73 -0
- package/dist/writer/article-ideas.d.ts +34 -0
- package/dist/writer/article-issues.d.ts +47 -0
- package/dist/writer/article-marks.d.ts +25 -0
- package/dist/writer/article-memory-store.d.ts +3 -0
- package/dist/writer/article-model.d.ts +1337 -0
- package/dist/writer/article-outline.d.ts +43 -0
- package/dist/writer/article-resolver.d.ts +55 -0
- package/dist/writer/article-revisions.d.ts +30 -0
- package/dist/writer/article-rules.d.ts +60 -0
- package/dist/writer/article-sections.d.ts +26 -0
- package/dist/writer/article-selection.d.ts +26 -0
- package/dist/writer/article-service.d.ts +542 -0
- package/dist/writer/article-source-links.d.ts +42 -0
- package/dist/writer/article-sources.d.ts +82 -0
- package/dist/writer/article-style-derive.d.ts +26 -0
- package/dist/writer/article-style.d.ts +31 -0
- package/dist/writer/article-suggestions.d.ts +33 -0
- package/dist/writer/article-support.d.ts +33 -0
- package/dist/writer/article-verify.d.ts +42 -0
- package/dist/writer/local-folder.d.ts +49 -0
- package/dist/writer/model-failure-hint.d.ts +7 -0
- package/dist/writer/repo-reader.d.ts +29 -0
- package/dist/writer/repo-search.d.ts +33 -0
- package/dist/writer/repo-verify-loop.d.ts +61 -0
- package/dist/writer/text-tool-calls.d.ts +11 -0
- package/dist/writer/work-progress.d.ts +51 -0
- package/dist/writer/write-activity.d.ts +61 -0
- package/dist/writer/write-models.d.ts +12 -0
- package/dist/writer/write-parameters.d.ts +31 -0
- package/dist/writer/write-permissions.d.ts +89 -0
- package/dist/writer/write-spend.d.ts +16 -0
- package/dist/writer/writer-chat-capture.d.ts +25 -0
- package/dist/writer/writer-chat-history.d.ts +17 -0
- package/dist/writer/writer-chat-state.d.ts +358 -0
- package/dist/writer/writer-chat-turn.d.ts +52 -0
- package/dist/writer/writer-intent.d.ts +20 -0
- package/package.json +3 -3
- package/dist/bin-CCwDFxDe.js.map +0 -1
- package/dist/provider-setup-Cy9dwqrd.js.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The outline of the text as it is now: the headings with their numbers. Drawn from the text itself (not from saved sections), so it follows the
|
|
3
|
+
* writer while typing, and a heading renamed in the outline is a change of the text, which is where the heading lives.
|
|
4
|
+
*/
|
|
5
|
+
export interface OutlineEntry {
|
|
6
|
+
/** "1", "1.2", … Empty for the title (a single top-level heading at the start). */
|
|
7
|
+
number: string;
|
|
8
|
+
heading: string;
|
|
9
|
+
level: number;
|
|
10
|
+
/** Depth below the title, 0 for the top. */
|
|
11
|
+
depth: number;
|
|
12
|
+
/** Where the heading line starts in the text. */
|
|
13
|
+
start: number;
|
|
14
|
+
/** Where the section ends: just before the next heading of any level. */
|
|
15
|
+
end: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function outlineOf(markdown: string): OutlineEntry[];
|
|
18
|
+
/** The text with the heading line that starts at `start` given a new wording; its level (the hashes) is kept. Unchanged when the new wording is empty. */
|
|
19
|
+
export declare function renameHeadingInText(markdown: string, start: number, heading: string): string;
|
|
20
|
+
/** The outline as plain text the writer edits: one heading per line, written the way it is in the article (`## Name`). */
|
|
21
|
+
export declare function outlineToText(markdown: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* The article after the writer edited its outline as text. A heading kept as it was keeps its section; a heading reworded or moved to another
|
|
24
|
+
* level keeps its section too (matched in order, within the gap between unchanged headings); a heading moved to another place takes its section
|
|
25
|
+
* with it; a new line is a new, empty section; a deleted line removes the heading only, its text stays with the section above. Returns the
|
|
26
|
+
* article unchanged while a line is only hashes.
|
|
27
|
+
*/
|
|
28
|
+
export declare function applyOutlineText(markdown: string, outlineText: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Growing a selection in the outline text: the heading line, then that heading with the headings under it, then the heading it sits under with
|
|
31
|
+
* everything under that, and so on up. The whole outline is never offered, so the largest selection is the one just below it. `range` is in the
|
|
32
|
+
* outline text (`outlineToText`), not in the article.
|
|
33
|
+
*/
|
|
34
|
+
export declare function expandOutlineSelection(outlineText: string, range: {
|
|
35
|
+
start: number;
|
|
36
|
+
end: number;
|
|
37
|
+
}): {
|
|
38
|
+
range: {
|
|
39
|
+
start: number;
|
|
40
|
+
end: number;
|
|
41
|
+
};
|
|
42
|
+
unit: 'heading' | 'section';
|
|
43
|
+
} | undefined;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ILLMClient, TokenUsage } from '@buildaharness/runtime';
|
|
2
|
+
import { ArticleMeta, Link } from './article-model.js';
|
|
3
|
+
/**
|
|
4
|
+
* The resolver (T4, T5, T6): after something changes, a model judges what else is affected. Stored links only choose
|
|
5
|
+
* where to look first; the model reads every section's heading and opening and may find effects, and propose links,
|
|
6
|
+
* beyond them. Every judgement of meaning is the model's; this module validates the ids it returns, applies the rules
|
|
7
|
+
* (the resolver can mark a section needs-review but never clear it, and never touches a confirmed or hand-drawn link)
|
|
8
|
+
* and reports what it did. A failure leaves the article as it was and says so.
|
|
9
|
+
*/
|
|
10
|
+
export type Change = {
|
|
11
|
+
kind: 'text_edited';
|
|
12
|
+
sectionIds: string[];
|
|
13
|
+
summary: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'correction';
|
|
16
|
+
note: string;
|
|
17
|
+
supersedes?: string;
|
|
18
|
+
};
|
|
19
|
+
export interface ResolveResult {
|
|
20
|
+
status: 'resolved' | 'not_resolved';
|
|
21
|
+
meta: ArticleMeta;
|
|
22
|
+
flagged: {
|
|
23
|
+
sectionId: string;
|
|
24
|
+
reason: string;
|
|
25
|
+
}[];
|
|
26
|
+
proposedLinks: Link[];
|
|
27
|
+
/** Model suggestions that named an id that does not exist, or a rule refused. Reported, not applied. */
|
|
28
|
+
skipped: string[];
|
|
29
|
+
}
|
|
30
|
+
/** Section ids connected to the changed ones by a rests_on or repeats link, in either direction. */
|
|
31
|
+
export declare function linkedSectionIds(meta: ArticleMeta, changed: readonly string[]): Set<string>;
|
|
32
|
+
export declare function resolveChange(input: {
|
|
33
|
+
meta: ArticleMeta;
|
|
34
|
+
markdown: string;
|
|
35
|
+
change: Change;
|
|
36
|
+
now: string;
|
|
37
|
+
}, llmClient: ILLMClient, model?: string, onUsage?: (usage: TokenUsage) => void): Promise<ResolveResult>;
|
|
38
|
+
export interface SourceImpact {
|
|
39
|
+
claimId: string;
|
|
40
|
+
impact: 'none' | 'recheck' | 'likely_wrong';
|
|
41
|
+
reason: string;
|
|
42
|
+
}
|
|
43
|
+
export interface SourceChangeResult {
|
|
44
|
+
status: 'assessed' | 'not_assessed';
|
|
45
|
+
meta: ArticleMeta;
|
|
46
|
+
impacts: SourceImpact[];
|
|
47
|
+
}
|
|
48
|
+
/** Whether a changed source matters to the claims that cite it. A claim that matters gets needsRecheck; a likely wrong one also flags its section. */
|
|
49
|
+
export declare function assessSourceChange(input: {
|
|
50
|
+
meta: ArticleMeta;
|
|
51
|
+
sourceId: string;
|
|
52
|
+
before: string;
|
|
53
|
+
after: string;
|
|
54
|
+
now: string;
|
|
55
|
+
}, llmClient: ILLMClient, model?: string, onUsage?: (usage: TokenUsage) => void): Promise<SourceChangeResult>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SelectionRange, SelectionUnit } from './article-selection.js';
|
|
2
|
+
/**
|
|
3
|
+
* The revisions of one piece of the text (a sentence, a paragraph or a section): how that piece read in each saved version. The piece is the unit
|
|
4
|
+
* the selection is (see `unitOfSelection`). In an older version the same piece is the unit of the same kind that shares the most words with it, so
|
|
5
|
+
* a reworded sentence is still found; when nothing shares enough, the piece was not in that version. Pure; versions come from the article's snapshots.
|
|
6
|
+
*/
|
|
7
|
+
export interface VersionText {
|
|
8
|
+
index: number;
|
|
9
|
+
kind: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
at: string;
|
|
12
|
+
markdown: string;
|
|
13
|
+
}
|
|
14
|
+
export interface TextRevision {
|
|
15
|
+
/** The version, or undefined for the text as it is now. */
|
|
16
|
+
index?: number;
|
|
17
|
+
kind?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
at?: string;
|
|
20
|
+
/** How the piece read then; undefined when it was not in that version. */
|
|
21
|
+
text: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
export interface TextRevisions {
|
|
24
|
+
unit: SelectionUnit;
|
|
25
|
+
now: string;
|
|
26
|
+
/** Newest first, starting with now, and only where the wording differs from the revision before it. */
|
|
27
|
+
revisions: TextRevision[];
|
|
28
|
+
}
|
|
29
|
+
/** `versions` in any order. */
|
|
30
|
+
export declare function revisionsOfText(markdown: string, range: SelectionRange, versions: readonly VersionText[]): TextRevisions | undefined;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ArticleMeta, Claim, Section, Source, SourceStatus } from './article-model.js';
|
|
2
|
+
/**
|
|
3
|
+
* The rules the article model must always keep (plans/aielia_write_article_model_plan.html, section 9), as pure functions.
|
|
4
|
+
* Each returns a new value or a refusal with a reason; none mutates its input, and none deletes silently.
|
|
5
|
+
*/
|
|
6
|
+
export type Actor = 'writer' | 'resolver' | 'assistant' | 'editor';
|
|
7
|
+
export type Refusal = {
|
|
8
|
+
ok: false;
|
|
9
|
+
reason: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* What a claim's source status may be shown as. A check only counts if it ran on the claim's current text against the
|
|
13
|
+
* current stored passages; otherwise the verdict is not shown as supported (not_checked), or stale when a source changed.
|
|
14
|
+
*/
|
|
15
|
+
export declare function effectiveSourceStatus(claim: Claim, sources: readonly Source[]): SourceStatus;
|
|
16
|
+
/** Changing a claim's text resets its check result. */
|
|
17
|
+
export declare function editClaimText(claim: Claim, quote: string, by: 'model' | 'writer', now: string): Claim;
|
|
18
|
+
/** The resolver may mark a section needs review; it cannot mark it clean. Only the writer clears it. */
|
|
19
|
+
export declare function setSectionReview(meta: ArticleMeta, sectionId: string, state: Section['review']['state'], reason: string | undefined, by: Actor, now: string): {
|
|
20
|
+
ok: true;
|
|
21
|
+
meta: ArticleMeta;
|
|
22
|
+
} | Refusal;
|
|
23
|
+
/** Confirmed and hand-drawn links are never changed or removed by the assistant; it can only propose a change. */
|
|
24
|
+
export declare function removeLink(meta: ArticleMeta, linkId: string, by: Actor): {
|
|
25
|
+
ok: true;
|
|
26
|
+
meta: ArticleMeta;
|
|
27
|
+
} | Refusal;
|
|
28
|
+
export declare function confirmLink(meta: ArticleMeta, linkId: string, by: Actor): {
|
|
29
|
+
ok: true;
|
|
30
|
+
meta: ArticleMeta;
|
|
31
|
+
} | Refusal;
|
|
32
|
+
export interface Problem {
|
|
33
|
+
where: string;
|
|
34
|
+
message: string;
|
|
35
|
+
}
|
|
36
|
+
/** Every id referenced by a link, comment, claim or suggestion must exist. Broken records are reported and kept, never deleted. */
|
|
37
|
+
export declare function checkIntegrity(meta: ArticleMeta): Problem[];
|
|
38
|
+
export interface Readiness {
|
|
39
|
+
unsourcedFactualClaims: number;
|
|
40
|
+
staleOrUnsupportedClaims: number;
|
|
41
|
+
openComments: number;
|
|
42
|
+
sectionsNeedingReview: number;
|
|
43
|
+
}
|
|
44
|
+
/** Computed, never stored by hand (D3: warn only). Publishing is allowed regardless; a snapshot records these counts. */
|
|
45
|
+
export declare function computeReadiness(meta: ArticleMeta): Readiness;
|
|
46
|
+
export interface Snapshot {
|
|
47
|
+
readonly kind: 'published' | 'checkpoint';
|
|
48
|
+
readonly label?: string;
|
|
49
|
+
readonly at: string;
|
|
50
|
+
readonly markdown: string;
|
|
51
|
+
readonly meta: ArticleMeta;
|
|
52
|
+
readonly readiness: Readiness;
|
|
53
|
+
}
|
|
54
|
+
/** A snapshot is a frozen deep copy: later edits to the working article cannot change it. */
|
|
55
|
+
export declare function createSnapshot(kind: Snapshot['kind'], markdown: string, meta: ArticleMeta, now: string, label?: string): Snapshot;
|
|
56
|
+
/** Restoring creates a new working version from the snapshot; the snapshot itself and the history are untouched. */
|
|
57
|
+
export declare function restoreSnapshot(snapshot: Snapshot): {
|
|
58
|
+
markdown: string;
|
|
59
|
+
meta: ArticleMeta;
|
|
60
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Section } from './article-model.js';
|
|
2
|
+
/**
|
|
3
|
+
* Sections from the Markdown (headings define sections) and their re-anchoring after the text changes. Structure only:
|
|
4
|
+
* a section keeps its id when its heading is unchanged, or when it is the one heading that changed in an otherwise
|
|
5
|
+
* unchanged outline. Anything less certain gets a new id and the old record is reported as removed, never dropped silently.
|
|
6
|
+
*/
|
|
7
|
+
export interface ParsedHeading {
|
|
8
|
+
heading: string;
|
|
9
|
+
level: number;
|
|
10
|
+
start: number;
|
|
11
|
+
end: number;
|
|
12
|
+
}
|
|
13
|
+
/** ATX headings outside fenced code. Text before the first heading becomes a level-0 "lead" section when it is not blank. */
|
|
14
|
+
export declare function parseSections(markdown: string): ParsedHeading[];
|
|
15
|
+
export interface ReconcileResult {
|
|
16
|
+
sections: Section[];
|
|
17
|
+
/** Ids kept, with the new heading when it was renamed. */
|
|
18
|
+
kept: {
|
|
19
|
+
id: string;
|
|
20
|
+
renamedFrom?: string;
|
|
21
|
+
}[];
|
|
22
|
+
created: string[];
|
|
23
|
+
/** Previous sections that no longer match anything; shown to the writer, not deleted without that. */
|
|
24
|
+
removed: Section[];
|
|
25
|
+
}
|
|
26
|
+
export declare function reconcileSections(previous: readonly Section[], markdown: string, newId: (taken: ReadonlySet<string>) => string): ReconcileResult;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Growing a selection by units of writing: a sentence, then the paragraph, then the section (a heading and everything under it, down to the next
|
|
3
|
+
* heading of the same or a higher level), then the whole article. Each step is the next unit that strictly contains the current selection, so a
|
|
4
|
+
* word, a sentence and several sentences all grow sensibly. Pure; the page keeps the earlier selections to shrink back. Units are found in the text
|
|
5
|
+
* as it is now (not from saved sections), so they are right while the writer is typing.
|
|
6
|
+
*/
|
|
7
|
+
export type SelectionUnit = 'sentence' | 'paragraph' | 'section' | 'article';
|
|
8
|
+
export interface SelectionRange {
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The next larger unit around the selection, or undefined when the whole article is already selected. With `wholeArticle: false` the whole article
|
|
14
|
+
* is never offered (nor a section that is all of it), so the largest selection is the one just below it: the writer then starts over from the sentence.
|
|
15
|
+
*/
|
|
16
|
+
export declare function expandSelection(text: string, range: SelectionRange, options?: {
|
|
17
|
+
wholeArticle?: boolean;
|
|
18
|
+
}): {
|
|
19
|
+
range: SelectionRange;
|
|
20
|
+
unit: SelectionUnit;
|
|
21
|
+
} | undefined;
|
|
22
|
+
/** The unit the selection is: a selection that is exactly a sentence, paragraph or section is that unit; a cursor or a phrase is the sentence around it; anything longer, the smallest unit that holds it. */
|
|
23
|
+
export declare function unitOfSelection(text: string, range: SelectionRange): {
|
|
24
|
+
range: SelectionRange;
|
|
25
|
+
unit: SelectionUnit;
|
|
26
|
+
} | undefined;
|