@buildaharness/aielia 0.3.8 → 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.
Files changed (103) hide show
  1. package/README.md +6 -3
  2. package/dist/_memory-core-generated.d.ts +6 -0
  3. package/dist/action-approval-service.d.ts +2 -0
  4. package/dist/ask-draft.d.ts +22 -0
  5. package/dist/assistant-options.d.ts +35 -0
  6. package/dist/assistant-session.d.ts +1 -1
  7. package/dist/assistant.d.ts +11 -0
  8. package/dist/{bin-DETwedpj.js → bin-Cz3FY6Ew.js} +144 -254
  9. package/dist/bin-Cz3FY6Ew.js.map +1 -0
  10. package/dist/claude-cli-llm-client.d.ts +2 -0
  11. package/dist/claude-cli-prompt.d.ts +7 -0
  12. package/dist/cli-config.d.ts +2 -2
  13. package/dist/cli-session.d.ts +2 -1
  14. package/dist/cli.d.ts +2 -0
  15. package/dist/cli.js +1 -1
  16. package/dist/commands.d.ts +32 -0
  17. package/dist/config-keys.d.ts +43 -0
  18. package/dist/doctor-checks.d.ts +1 -2
  19. package/dist/fact-extraction.d.ts +4 -0
  20. package/dist/fact-repository.contract.d.ts +2 -0
  21. package/dist/fact-repository.d.ts +44 -0
  22. package/dist/file-tools-mcp-server.mjs +29 -0
  23. package/dist/goal-graph-store.d.ts +6 -0
  24. package/dist/harness-bridge.d.ts +5 -5
  25. package/dist/html-to-markdown.d.ts +11 -0
  26. package/dist/index.d.ts +98 -3
  27. package/dist/index.js +5003 -150
  28. package/dist/index.js.map +1 -1
  29. package/dist/layer-settings.d.ts +16 -3
  30. package/dist/llm-client-factory.d.ts +13 -0
  31. package/dist/memory-events.d.ts +177 -0
  32. package/dist/memory-service.d.ts +17 -0
  33. package/dist/model-pricing.d.ts +15 -9
  34. package/dist/node-display-names.d.ts +1 -1
  35. package/dist/project-command.d.ts +16 -0
  36. package/dist/{provider-setup-wX2IBw2X.js → provider-setup-DG8iYm_F.js} +14471 -13032
  37. package/dist/provider-setup-DG8iYm_F.js.map +1 -0
  38. package/dist/proxy-health.d.ts +8 -0
  39. package/dist/redact-url.d.ts +2 -0
  40. package/dist/reply-audit.d.ts +2 -0
  41. package/dist/response-service.d.ts +10 -0
  42. package/dist/run-explain.d.ts +58 -0
  43. package/dist/scripted-llm-client.d.ts +1 -1
  44. package/dist/{tui-app-CcxiwZyM.js → tui-app-oWbIUcBW.js} +3 -3
  45. package/dist/{tui-app-CcxiwZyM.js.map → tui-app-oWbIUcBW.js.map} +1 -1
  46. package/dist/turn-abort.d.ts +5 -0
  47. package/dist/turn-cost.d.ts +12 -0
  48. package/dist/turn-presentation.d.ts +86 -0
  49. package/dist/undo-action-command.d.ts +12 -0
  50. package/dist/undo-plan.d.ts +13 -0
  51. package/dist/version.d.ts +1 -1
  52. package/dist/web-fetch-core.d.ts +0 -14
  53. package/dist/writer/article-autosave.d.ts +12 -0
  54. package/dist/writer/article-change-summary.d.ts +28 -0
  55. package/dist/writer/article-claims.d.ts +49 -0
  56. package/dist/writer/article-comments.d.ts +20 -0
  57. package/dist/writer/article-consistency.d.ts +27 -0
  58. package/dist/writer/article-decorations.d.ts +23 -0
  59. package/dist/writer/article-dependencies.d.ts +44 -0
  60. package/dist/writer/article-draft.d.ts +23 -0
  61. package/dist/writer/article-edit-outline.d.ts +16 -0
  62. package/dist/writer/article-edit-suggest.d.ts +30 -0
  63. package/dist/writer/article-folder.d.ts +29 -0
  64. package/dist/writer/article-history.d.ts +73 -0
  65. package/dist/writer/article-ideas.d.ts +34 -0
  66. package/dist/writer/article-issues.d.ts +47 -0
  67. package/dist/writer/article-marks.d.ts +25 -0
  68. package/dist/writer/article-memory-store.d.ts +3 -0
  69. package/dist/writer/article-model.d.ts +1337 -0
  70. package/dist/writer/article-outline.d.ts +43 -0
  71. package/dist/writer/article-resolver.d.ts +55 -0
  72. package/dist/writer/article-revisions.d.ts +30 -0
  73. package/dist/writer/article-rules.d.ts +60 -0
  74. package/dist/writer/article-sections.d.ts +26 -0
  75. package/dist/writer/article-selection.d.ts +26 -0
  76. package/dist/writer/article-service.d.ts +542 -0
  77. package/dist/writer/article-source-links.d.ts +42 -0
  78. package/dist/writer/article-sources.d.ts +82 -0
  79. package/dist/writer/article-style-derive.d.ts +26 -0
  80. package/dist/writer/article-style.d.ts +31 -0
  81. package/dist/writer/article-suggestions.d.ts +33 -0
  82. package/dist/writer/article-support.d.ts +33 -0
  83. package/dist/writer/article-verify.d.ts +42 -0
  84. package/dist/writer/local-folder.d.ts +49 -0
  85. package/dist/writer/model-failure-hint.d.ts +7 -0
  86. package/dist/writer/repo-reader.d.ts +29 -0
  87. package/dist/writer/repo-search.d.ts +33 -0
  88. package/dist/writer/repo-verify-loop.d.ts +61 -0
  89. package/dist/writer/text-tool-calls.d.ts +11 -0
  90. package/dist/writer/work-progress.d.ts +51 -0
  91. package/dist/writer/write-activity.d.ts +61 -0
  92. package/dist/writer/write-models.d.ts +12 -0
  93. package/dist/writer/write-parameters.d.ts +31 -0
  94. package/dist/writer/write-permissions.d.ts +89 -0
  95. package/dist/writer/write-spend.d.ts +16 -0
  96. package/dist/writer/writer-chat-capture.d.ts +25 -0
  97. package/dist/writer/writer-chat-history.d.ts +17 -0
  98. package/dist/writer/writer-chat-state.d.ts +358 -0
  99. package/dist/writer/writer-chat-turn.d.ts +52 -0
  100. package/dist/writer/writer-intent.d.ts +20 -0
  101. package/package.json +3 -3
  102. package/dist/bin-DETwedpj.js.map +0 -1
  103. package/dist/provider-setup-wX2IBw2X.js.map +0 -1
@@ -0,0 +1,25 @@
1
+ import { ILLMClient, TokenUsage } from '@buildaharness/runtime';
2
+ import { ArticleRef, CaptureOp, WriterChatState } from './writer-chat-state.js';
3
+ /**
4
+ * Reads one message from the writer and proposes changes to the article's chat-held state. The meaning is judged by a
5
+ * model; this module only stores the result (no word matching). Only the writer's own message is read, never the
6
+ * assistant's replies. One bounded call; any failure leaves the state unchanged and says so.
7
+ */
8
+ export type CaptureStatus = 'captured' | 'needs_article' | 'not_captured';
9
+ export interface CaptureResult {
10
+ status: CaptureStatus;
11
+ state: WriterChatState;
12
+ /** The article the message concerns, when it could be told. The caller keeps it as the active article. */
13
+ articleId?: string;
14
+ applied: string[];
15
+ skipped: string[];
16
+ /** Set with `needs_article`: apply these with `applyCaptureOps` once the writer names the article. */
17
+ pendingOps?: CaptureOp[];
18
+ question?: string;
19
+ }
20
+ export declare function captureChatState(input: {
21
+ message: string;
22
+ state: WriterChatState;
23
+ articles: readonly ArticleRef[];
24
+ now?: string;
25
+ }, llmClient: ILLMClient, model?: string, onUsage?: (usage: TokenUsage) => void): Promise<CaptureResult>;
@@ -0,0 +1,17 @@
1
+ import { ChatMessage } from '@buildaharness/runtime';
2
+ /**
3
+ * The conversation so far, as the earlier messages of a model call that changes the article. A change is asked for in the middle of a talk
4
+ * ("add the rest of those to the problem section"), so the call must see the talk; it goes before the article and the instruction, so that
5
+ * what is the same from one request to the next stays at the start, where a provider can reuse it.
6
+ */
7
+ export interface ChatTurn {
8
+ from: 'you' | 'aielia';
9
+ text: string;
10
+ }
11
+ /**
12
+ * Alternating user and assistant messages from the newest turns: each clipped, runs by the same side joined, the oldest dropped to fit,
13
+ * starting with the writer and ending with the assistant (the writer's newest message is the instruction, which the caller adds).
14
+ */
15
+ export declare function chatHistoryMessages(turns: readonly ChatTurn[] | undefined): ChatMessage[];
16
+ /** Added to the instructions of a call that is given the conversation. */
17
+ export declare const CHAT_HISTORY_NOTE = " The messages before the last are the conversation so far between the writer and the assistant: the instruction may refer to them (\"those\", \"the rest\", \"what you listed\"); follow the instruction, and take from the conversation only what it points to.";
@@ -0,0 +1,358 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * State the writer gives in chat (T13, plans/aielia_write_article_model_plan.html section 8): reviewer comments,
4
+ * the writer's decisions about them, conflicts between comments, and corrections to facts or sources. It belongs to
5
+ * the article, not to the conversation, so work that resumes in a new session still has it.
6
+ *
7
+ * Pure data and pure functions only (no node:* / DOM imports): the browser bundles this module.
8
+ */
9
+ export declare const WRITER_CHAT_STATE_VERSION = 1;
10
+ export declare const WriterCommentSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ articleId: z.ZodString;
13
+ /** The label the writer or reviewer uses ("C1", "G2"), when there is one. Not unique across articles. */
14
+ label: z.ZodOptional<z.ZodString>;
15
+ reviewer: z.ZodOptional<z.ZodString>;
16
+ text: z.ZodString;
17
+ /** `open` covers "decided but not carried out": a decision is recorded, but the comment is only `addressed` once the text shows it. */
18
+ state: z.ZodEnum<["open", "addressed", "dismissed"]>;
19
+ decision: z.ZodOptional<z.ZodString>;
20
+ /** Ids of comments that cannot be followed together with this one. Always mutual. */
21
+ conflictsWith: z.ZodArray<z.ZodString, "many">;
22
+ origin: z.ZodEnum<["reviewer", "writer", "assistant"]>;
23
+ /** Where the comment applies, when it is tied to one section or claim (article model, "about" link). */
24
+ anchor: z.ZodOptional<z.ZodObject<{
25
+ type: z.ZodEnum<["section", "claim"]>;
26
+ id: z.ZodString;
27
+ }, "strip", z.ZodTypeAny, {
28
+ id: string;
29
+ type: "section" | "claim";
30
+ }, {
31
+ id: string;
32
+ type: "section" | "claim";
33
+ }>>;
34
+ /** The stretch of text the writer highlighted when commenting. Found again by the quote after the text changes. */
35
+ span: z.ZodOptional<z.ZodObject<{
36
+ start: z.ZodNumber;
37
+ end: z.ZodNumber;
38
+ quote: z.ZodString;
39
+ }, "strip", z.ZodTypeAny, {
40
+ quote: string;
41
+ start: number;
42
+ end: number;
43
+ }, {
44
+ quote: string;
45
+ start: number;
46
+ end: number;
47
+ }>>;
48
+ /** The text the comment was on no longer exists as it was. The comment is kept. */
49
+ outdated: z.ZodOptional<z.ZodBoolean>;
50
+ /** The suggestion that addressed it, if any. */
51
+ suggestionId: z.ZodOptional<z.ZodString>;
52
+ capturedAt: z.ZodString;
53
+ }, "strip", z.ZodTypeAny, {
54
+ id: string;
55
+ text: string;
56
+ origin: "reviewer" | "assistant" | "writer";
57
+ articleId: string;
58
+ state: "open" | "addressed" | "dismissed";
59
+ conflictsWith: string[];
60
+ capturedAt: string;
61
+ reviewer?: string | undefined;
62
+ decision?: string | undefined;
63
+ label?: string | undefined;
64
+ span?: {
65
+ quote: string;
66
+ start: number;
67
+ end: number;
68
+ } | undefined;
69
+ anchor?: {
70
+ id: string;
71
+ type: "section" | "claim";
72
+ } | undefined;
73
+ outdated?: boolean | undefined;
74
+ suggestionId?: string | undefined;
75
+ }, {
76
+ id: string;
77
+ text: string;
78
+ origin: "reviewer" | "assistant" | "writer";
79
+ articleId: string;
80
+ state: "open" | "addressed" | "dismissed";
81
+ conflictsWith: string[];
82
+ capturedAt: string;
83
+ reviewer?: string | undefined;
84
+ decision?: string | undefined;
85
+ label?: string | undefined;
86
+ span?: {
87
+ quote: string;
88
+ start: number;
89
+ end: number;
90
+ } | undefined;
91
+ anchor?: {
92
+ id: string;
93
+ type: "section" | "claim";
94
+ } | undefined;
95
+ outdated?: boolean | undefined;
96
+ suggestionId?: string | undefined;
97
+ }>;
98
+ export type WriterComment = z.infer<typeof WriterCommentSchema>;
99
+ /** A correction the writer states in chat. It is the "author's say-so" source kind (D2): lower-trust, and it supersedes what it names. */
100
+ export declare const WriterCorrectionSchema: z.ZodObject<{
101
+ id: z.ZodString;
102
+ articleId: z.ZodString;
103
+ kind: z.ZodLiteral<"say_so">;
104
+ trust: z.ZodLiteral<"lower">;
105
+ /** What is now true, in the writer's terms ("p99 latency is 41 ms after a re-run"). */
106
+ note: z.ZodString;
107
+ /** The earlier value or source it replaces, when the writer names one. */
108
+ supersedes: z.ZodOptional<z.ZodString>;
109
+ capturedAt: z.ZodString;
110
+ }, "strip", z.ZodTypeAny, {
111
+ id: string;
112
+ kind: "say_so";
113
+ note: string;
114
+ articleId: string;
115
+ capturedAt: string;
116
+ trust: "lower";
117
+ supersedes?: string | undefined;
118
+ }, {
119
+ id: string;
120
+ kind: "say_so";
121
+ note: string;
122
+ articleId: string;
123
+ capturedAt: string;
124
+ trust: "lower";
125
+ supersedes?: string | undefined;
126
+ }>;
127
+ export type WriterCorrection = z.infer<typeof WriterCorrectionSchema>;
128
+ export declare const WriterChatStateSchema: z.ZodObject<{
129
+ formatVersion: z.ZodLiteral<1>;
130
+ comments: z.ZodArray<z.ZodObject<{
131
+ id: z.ZodString;
132
+ articleId: z.ZodString;
133
+ /** The label the writer or reviewer uses ("C1", "G2"), when there is one. Not unique across articles. */
134
+ label: z.ZodOptional<z.ZodString>;
135
+ reviewer: z.ZodOptional<z.ZodString>;
136
+ text: z.ZodString;
137
+ /** `open` covers "decided but not carried out": a decision is recorded, but the comment is only `addressed` once the text shows it. */
138
+ state: z.ZodEnum<["open", "addressed", "dismissed"]>;
139
+ decision: z.ZodOptional<z.ZodString>;
140
+ /** Ids of comments that cannot be followed together with this one. Always mutual. */
141
+ conflictsWith: z.ZodArray<z.ZodString, "many">;
142
+ origin: z.ZodEnum<["reviewer", "writer", "assistant"]>;
143
+ /** Where the comment applies, when it is tied to one section or claim (article model, "about" link). */
144
+ anchor: z.ZodOptional<z.ZodObject<{
145
+ type: z.ZodEnum<["section", "claim"]>;
146
+ id: z.ZodString;
147
+ }, "strip", z.ZodTypeAny, {
148
+ id: string;
149
+ type: "section" | "claim";
150
+ }, {
151
+ id: string;
152
+ type: "section" | "claim";
153
+ }>>;
154
+ /** The stretch of text the writer highlighted when commenting. Found again by the quote after the text changes. */
155
+ span: z.ZodOptional<z.ZodObject<{
156
+ start: z.ZodNumber;
157
+ end: z.ZodNumber;
158
+ quote: z.ZodString;
159
+ }, "strip", z.ZodTypeAny, {
160
+ quote: string;
161
+ start: number;
162
+ end: number;
163
+ }, {
164
+ quote: string;
165
+ start: number;
166
+ end: number;
167
+ }>>;
168
+ /** The text the comment was on no longer exists as it was. The comment is kept. */
169
+ outdated: z.ZodOptional<z.ZodBoolean>;
170
+ /** The suggestion that addressed it, if any. */
171
+ suggestionId: z.ZodOptional<z.ZodString>;
172
+ capturedAt: z.ZodString;
173
+ }, "strip", z.ZodTypeAny, {
174
+ id: string;
175
+ text: string;
176
+ origin: "reviewer" | "assistant" | "writer";
177
+ articleId: string;
178
+ state: "open" | "addressed" | "dismissed";
179
+ conflictsWith: string[];
180
+ capturedAt: string;
181
+ reviewer?: string | undefined;
182
+ decision?: string | undefined;
183
+ label?: string | undefined;
184
+ span?: {
185
+ quote: string;
186
+ start: number;
187
+ end: number;
188
+ } | undefined;
189
+ anchor?: {
190
+ id: string;
191
+ type: "section" | "claim";
192
+ } | undefined;
193
+ outdated?: boolean | undefined;
194
+ suggestionId?: string | undefined;
195
+ }, {
196
+ id: string;
197
+ text: string;
198
+ origin: "reviewer" | "assistant" | "writer";
199
+ articleId: string;
200
+ state: "open" | "addressed" | "dismissed";
201
+ conflictsWith: string[];
202
+ capturedAt: string;
203
+ reviewer?: string | undefined;
204
+ decision?: string | undefined;
205
+ label?: string | undefined;
206
+ span?: {
207
+ quote: string;
208
+ start: number;
209
+ end: number;
210
+ } | undefined;
211
+ anchor?: {
212
+ id: string;
213
+ type: "section" | "claim";
214
+ } | undefined;
215
+ outdated?: boolean | undefined;
216
+ suggestionId?: string | undefined;
217
+ }>, "many">;
218
+ corrections: z.ZodArray<z.ZodObject<{
219
+ id: z.ZodString;
220
+ articleId: z.ZodString;
221
+ kind: z.ZodLiteral<"say_so">;
222
+ trust: z.ZodLiteral<"lower">;
223
+ /** What is now true, in the writer's terms ("p99 latency is 41 ms after a re-run"). */
224
+ note: z.ZodString;
225
+ /** The earlier value or source it replaces, when the writer names one. */
226
+ supersedes: z.ZodOptional<z.ZodString>;
227
+ capturedAt: z.ZodString;
228
+ }, "strip", z.ZodTypeAny, {
229
+ id: string;
230
+ kind: "say_so";
231
+ note: string;
232
+ articleId: string;
233
+ capturedAt: string;
234
+ trust: "lower";
235
+ supersedes?: string | undefined;
236
+ }, {
237
+ id: string;
238
+ kind: "say_so";
239
+ note: string;
240
+ articleId: string;
241
+ capturedAt: string;
242
+ trust: "lower";
243
+ supersedes?: string | undefined;
244
+ }>, "many">;
245
+ }, "strip", z.ZodTypeAny, {
246
+ comments: {
247
+ id: string;
248
+ text: string;
249
+ origin: "reviewer" | "assistant" | "writer";
250
+ articleId: string;
251
+ state: "open" | "addressed" | "dismissed";
252
+ conflictsWith: string[];
253
+ capturedAt: string;
254
+ reviewer?: string | undefined;
255
+ decision?: string | undefined;
256
+ label?: string | undefined;
257
+ span?: {
258
+ quote: string;
259
+ start: number;
260
+ end: number;
261
+ } | undefined;
262
+ anchor?: {
263
+ id: string;
264
+ type: "section" | "claim";
265
+ } | undefined;
266
+ outdated?: boolean | undefined;
267
+ suggestionId?: string | undefined;
268
+ }[];
269
+ formatVersion: 1;
270
+ corrections: {
271
+ id: string;
272
+ kind: "say_so";
273
+ note: string;
274
+ articleId: string;
275
+ capturedAt: string;
276
+ trust: "lower";
277
+ supersedes?: string | undefined;
278
+ }[];
279
+ }, {
280
+ comments: {
281
+ id: string;
282
+ text: string;
283
+ origin: "reviewer" | "assistant" | "writer";
284
+ articleId: string;
285
+ state: "open" | "addressed" | "dismissed";
286
+ conflictsWith: string[];
287
+ capturedAt: string;
288
+ reviewer?: string | undefined;
289
+ decision?: string | undefined;
290
+ label?: string | undefined;
291
+ span?: {
292
+ quote: string;
293
+ start: number;
294
+ end: number;
295
+ } | undefined;
296
+ anchor?: {
297
+ id: string;
298
+ type: "section" | "claim";
299
+ } | undefined;
300
+ outdated?: boolean | undefined;
301
+ suggestionId?: string | undefined;
302
+ }[];
303
+ formatVersion: 1;
304
+ corrections: {
305
+ id: string;
306
+ kind: "say_so";
307
+ note: string;
308
+ articleId: string;
309
+ capturedAt: string;
310
+ trust: "lower";
311
+ supersedes?: string | undefined;
312
+ }[];
313
+ }>;
314
+ export type WriterChatState = z.infer<typeof WriterChatStateSchema>;
315
+ export interface ArticleRef {
316
+ id: string;
317
+ title: string;
318
+ /** The short name shown in the header; the title is shown when there is none. */
319
+ name?: string;
320
+ }
321
+ export declare function createEmptyWriterChatState(): WriterChatState;
322
+ /** One change the capture step proposes. `ref` is a comment id, or the label of a comment in the same article. */
323
+ export type CaptureOp = {
324
+ op: 'add_comment';
325
+ label?: string;
326
+ reviewer?: string;
327
+ text: string;
328
+ origin?: 'reviewer' | 'writer';
329
+ } | {
330
+ op: 'decide';
331
+ ref: string;
332
+ decision: string;
333
+ } | {
334
+ op: 'conflict';
335
+ refs: string[];
336
+ } | {
337
+ op: 'set_state';
338
+ ref: string;
339
+ state: 'addressed' | 'dismissed';
340
+ } | {
341
+ op: 'add_correction';
342
+ note: string;
343
+ supersedes?: string;
344
+ };
345
+ export interface ApplyResult {
346
+ state: WriterChatState;
347
+ /** One short line per change that was made. */
348
+ applied: string[];
349
+ /** One short line per op that could not be applied (unknown reference, empty text). Never silent. */
350
+ skipped: string[];
351
+ }
352
+ /** Applies ops to the state for one article. Pure: returns a new state; the input is untouched. */
353
+ export declare function applyCaptureOps(state: WriterChatState, articleId: string, ops: readonly CaptureOp[], now: string): ApplyResult;
354
+ /**
355
+ * The block added to the assistant's system prompt on every call: only the article under discussion, so work on one
356
+ * article never leaks into another. Empty when there is nothing to say.
357
+ */
358
+ export declare function renderWriterChatBlock(state: WriterChatState, articleId: string | undefined, articles: readonly ArticleRef[]): string;
@@ -0,0 +1,52 @@
1
+ import { ILLMClient, MemoryAdapter, TokenUsage } from '@buildaharness/runtime';
2
+ import { CaptureStatus } from './writer-chat-capture.js';
3
+ import { ArticleRef, CaptureOp, WriterChatState } from './writer-chat-state.js';
4
+ /**
5
+ * One turn of the chat-held state (T13): capture what the writer's message adds, store it per article (not per
6
+ * session), and return the block the assistant's system prompt gets. The host supplies a port for storage and for the
7
+ * list of articles; with no port the assistant does none of this.
8
+ */
9
+ export interface WriterChatPort {
10
+ articles(): Promise<ArticleRef[]> | ArticleRef[];
11
+ load(): Promise<WriterChatState>;
12
+ save(state: WriterChatState): Promise<void>;
13
+ getActive(): Promise<string | undefined>;
14
+ setActive(articleId: string | undefined): Promise<void>;
15
+ getPending(): Promise<CaptureOp[] | undefined>;
16
+ setPending(ops: CaptureOp[] | undefined): Promise<void>;
17
+ /** The current text of an article, when the host can give it. Shown to the answering model so it can talk about what is on the page (clipped). */
18
+ articleText?(articleId: string): Promise<string | undefined>;
19
+ /** False when the writer has turned chat capture off: the message is not read, but what is already recorded is still shown. */
20
+ captureEnabled?(): Promise<boolean>;
21
+ /** The ideas on the article's list that are not in the text yet, as plain lines. Shown to the answering model so the writer can talk about them. */
22
+ ideasText?(articleId: string): Promise<string[]>;
23
+ /** The writer's brief and writing profile for the article as plain text, or '' when there is none. */
24
+ styleText?(articleId: string): Promise<string>;
25
+ /** What is still open before the article is ready, as plain lines, or '' when nothing is. */
26
+ openItemsText?(articleId: string): Promise<string>;
27
+ /** The article's stored sources as text (address and passage), or '' when there are none. Shown to the answering model so it can use them. */
28
+ sourcesText?(articleId: string): Promise<string>;
29
+ }
30
+ /** A port backed by the assistant's own memory adapter. The articles list comes from the host (the page that owns the articles). */
31
+ export declare function createMemoryWriterChatPort(memory: MemoryAdapter, articles: () => Promise<ArticleRef[]> | ArticleRef[]): WriterChatPort;
32
+ /**
33
+ * Only the recording half of a turn, for a message that asks for an edit, a draft or suggestions: what the writer says is read and kept in the
34
+ * article's record exactly as in a full turn (the edit reads that record), but no reply is written, so it is one model call instead of the
35
+ * whole turn. Never throws: a failure is reported as `not_captured`.
36
+ */
37
+ export declare function recordWriterMessage(input: {
38
+ message: string;
39
+ port: WriterChatPort;
40
+ now?: string;
41
+ }, llmClient: ILLMClient, model?: string, onUsage?: (usage: TokenUsage) => void): Promise<{
42
+ status: CaptureStatus | 'off';
43
+ }>;
44
+ /**
45
+ * Returns the text to append to the system prompt for this turn (empty when there is nothing to say). Never throws:
46
+ * a failure of any kind returns the not-captured note, so the assistant cannot claim something was saved that was not.
47
+ */
48
+ export declare function processWriterMessage(input: {
49
+ message: string;
50
+ port: WriterChatPort;
51
+ now?: string;
52
+ }, llmClient: ILLMClient, model?: string, onUsage?: (usage: TokenUsage) => void): Promise<string>;
@@ -0,0 +1,20 @@
1
+ import { ILLMClient, TokenUsage } from '@buildaharness/runtime';
2
+ /**
3
+ * What a writer's chat message asks for, judged by a model (no word matching): change the text now, propose changes to review, or just
4
+ * talk. The Write page uses it when the chat is in Auto mode, so the writer never has to set a mode before asking for something.
5
+ * A failure or an unclear message is an answer: the cheaper mistake, since the reply offers to apply the change.
6
+ */
7
+ export type ChatIntent = 'edit' | 'rewrite' | 'suggest' | 'check' | 'answer';
8
+ export type EditScope = 'outline' | 'text' | 'both';
9
+ /** What a message asks for, and the web pages it points to as something to follow or draw on (read by the host, which knows whether it can fetch pages). */
10
+ export interface WriterIntent {
11
+ intent: ChatIntent;
12
+ links: string[];
13
+ /** For an edit: what it changes. The headings alone (add, rename, move or remove sections), the wording alone, or both (e.g. a new section and what it says). */
14
+ scope: EditScope;
15
+ }
16
+ export declare function readWriterIntent(input: {
17
+ message: string;
18
+ articleHasText: boolean;
19
+ lastReply?: string;
20
+ }, llmClient: ILLMClient, model?: string, onUsage?: (usage: TokenUsage) => void, signal?: AbortSignal): Promise<WriterIntent>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildaharness/aielia",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "An open-source AI agent you can hand real work to. Runs the full 11-layer Build A Harness every turn, controlling what it may do, believe and spend, and stages file writes, shell commands and email for your approval. CLI, browser, and desktop.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://myaielia.com",
@@ -48,8 +48,8 @@
48
48
  "shadow-report": "tsx scripts/shadow-report.ts"
49
49
  },
50
50
  "dependencies": {
51
- "@buildaharness/harness": "^0.3.2",
52
- "@buildaharness/runtime": "^0.3.3",
51
+ "@buildaharness/harness": "^0.3.3",
52
+ "@buildaharness/runtime": "^0.3.4",
53
53
  "@dagrejs/dagre": "^3.1.1",
54
54
  "@modelcontextprotocol/sdk": "^1.29.0",
55
55
  "diff": "^8.0.4",