modkh 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/agent/bundled-skills.d.ts +1 -1
- package/dist/agent/bundled-skills.js +1 -1
- package/dist/agent/compaction.d.ts +53 -0
- package/dist/agent/compaction.js +191 -0
- package/dist/agent/loop.d.ts +55 -8
- package/dist/agent/loop.js +119 -7
- package/dist/agent/skills.d.ts +7 -1
- package/dist/agent/skills.js +26 -5
- package/dist/agent/types.d.ts +14 -9
- package/dist/cli/agenticreplay.d.ts +1 -0
- package/dist/cli/agenticreplay.js +66 -0
- package/dist/cli/answer-markdown.d.ts +3 -0
- package/dist/cli/answer-markdown.js +29 -0
- package/dist/cli/approval.d.ts +2 -0
- package/dist/cli/approval.js +35 -5
- package/dist/cli/catalog.d.ts +30 -32
- package/dist/cli/catalog.js +37 -67
- package/dist/cli/chat.js +406 -78
- package/dist/cli/clipboard.d.ts +2 -0
- package/dist/cli/clipboard.js +28 -0
- package/dist/cli/color.d.ts +20 -3
- package/dist/cli/color.js +87 -19
- package/dist/cli/compaction-settings.d.ts +21 -0
- package/dist/cli/compaction-settings.js +54 -0
- package/dist/cli/completion-art.d.ts +2 -0
- package/dist/cli/completion-art.js +62 -0
- package/dist/cli/config.d.ts +9 -0
- package/dist/cli/config.js +5 -1
- package/dist/cli/editor.d.ts +7 -0
- package/dist/cli/editor.js +43 -5
- package/dist/cli/file-mentions.d.ts +14 -0
- package/dist/cli/file-mentions.js +141 -0
- package/dist/cli/head-checks.d.ts +41 -0
- package/dist/cli/head-checks.js +146 -0
- package/dist/cli/initial-connection.d.ts +7 -0
- package/dist/cli/initial-connection.js +20 -0
- package/dist/cli/keys.d.ts +12 -1
- package/dist/cli/keys.js +29 -4
- package/dist/cli/model-catalog.d.ts +16 -0
- package/dist/cli/model-catalog.js +130 -0
- package/dist/cli/models.d.ts +2 -2
- package/dist/cli/models.js +51 -19
- package/dist/cli/official-models.d.ts +6 -0
- package/dist/cli/official-models.js +77 -0
- package/dist/cli/pdf.d.ts +8 -0
- package/dist/cli/pdf.js +71 -0
- package/dist/cli/providers.d.ts +6 -42
- package/dist/cli/providers.js +44 -38
- package/dist/cli/shell-display.d.ts +6 -0
- package/dist/cli/shell-display.js +35 -0
- package/dist/cli/stateright.d.ts +1 -0
- package/dist/cli/stateright.js +37 -0
- package/dist/cli/terminal-mouse.d.ts +21 -0
- package/dist/cli/terminal-mouse.js +51 -0
- package/dist/cli/terminal.d.ts +95 -7
- package/dist/cli/terminal.js +783 -108
- package/dist/cli/tool-display.d.ts +9 -0
- package/dist/cli/tool-display.js +87 -0
- package/dist/cli/transcript-selection.d.ts +22 -0
- package/dist/cli/transcript-selection.js +75 -0
- package/dist/cli/usage.d.ts +9 -16
- package/dist/cli/usage.js +60 -18
- package/dist/cli/waiting-nyan.d.ts +3 -0
- package/dist/cli/waiting-nyan.js +17 -0
- package/dist/cli/waiting-whales.d.ts +3 -0
- package/dist/cli/waiting-whales.js +24 -0
- package/dist/index.js +30 -8
- package/dist/language/commonlisp-install.d.ts +1 -0
- package/dist/language/commonlisp-install.js +3 -2
- package/dist/language/lsp/client.js +4 -1
- package/dist/language/lsp/pool.d.ts +8 -0
- package/dist/language/lsp/pool.js +21 -3
- package/dist/language/lsp/service.d.ts +8 -4
- package/dist/language/lsp/service.js +51 -15
- package/dist/language/syntax/parser.d.ts +10 -1
- package/dist/language/syntax/parser.js +34 -16
- package/dist/lisp/builtin-agents.d.ts +5 -0
- package/dist/lisp/builtin-agents.js +52 -0
- package/dist/lisp/config.d.ts +9 -0
- package/dist/lisp/config.js +50 -7
- package/dist/lisp/routing.js +2 -2
- package/dist/lisp/runtime.d.ts +5 -0
- package/dist/lisp/runtime.js +26 -2
- package/dist/model/ai-sdk.js +13 -8
- package/dist/model/chatgpt/login.js +1 -1
- package/dist/model/chatgpt/responses.js +56 -4
- package/dist/model/connection.js +2 -0
- package/dist/model/context-window.d.ts +3 -0
- package/dist/model/context-window.js +64 -0
- package/dist/model/context.d.ts +3 -1
- package/dist/model/context.js +24 -24
- package/dist/model/factory.d.ts +3 -1
- package/dist/model/factory.js +28 -27
- package/dist/model/harness-profile.d.ts +6 -0
- package/dist/model/harness-profile.js +23 -0
- package/dist/model/providers.d.ts +32 -0
- package/dist/model/providers.js +72 -0
- package/dist/model/reasoning.d.ts +3 -3
- package/dist/model/reasoning.js +30 -8
- package/dist/model/record-fetch.d.ts +2 -0
- package/dist/model/record-fetch.js +19 -0
- package/dist/plugins/manager.d.ts +2 -1
- package/dist/plugins/manager.js +21 -2
- package/dist/session/store.d.ts +11 -0
- package/dist/session/store.js +27 -1
- package/dist/subagents/head-assignment.d.ts +11 -0
- package/dist/subagents/head-assignment.js +47 -0
- package/dist/subagents/limits.d.ts +4 -0
- package/dist/subagents/limits.js +6 -0
- package/dist/subagents/request.js +18 -1
- package/dist/subagents/service.d.ts +36 -2
- package/dist/subagents/service.js +331 -38
- package/dist/subagents/types.d.ts +20 -0
- package/dist/subagents/verification.d.ts +5 -2
- package/dist/subagents/verification.js +59 -22
- package/dist/tools/browse.d.ts +13 -0
- package/dist/tools/browse.js +117 -0
- package/dist/tools/browser-capability.d.ts +3 -0
- package/dist/tools/browser-capability.js +29 -0
- package/dist/tools/formal-input.d.ts +6 -0
- package/dist/tools/formal-input.js +29 -0
- package/dist/tools/formal.d.ts +3 -2
- package/dist/tools/formal.js +54 -52
- package/dist/tools/jobs.d.ts +2 -0
- package/dist/tools/jobs.js +5 -0
- package/dist/tools/language.js +25 -27
- package/dist/tools/lean-proof.d.ts +38 -0
- package/dist/tools/lean-proof.js +83 -0
- package/dist/tools/registry.d.ts +5 -3
- package/dist/tools/registry.js +13 -5
- package/dist/tools/run.js +13 -9
- package/dist/tools/shell-process.js +17 -6
- package/dist/tools/stateright-runtime.d.ts +3 -0
- package/dist/tools/stateright-runtime.js +16 -0
- package/dist/tools/stateright.d.ts +3 -0
- package/dist/tools/stateright.js +78 -0
- package/dist/tools/web.js +7 -2
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/docs/commonlisp-build-output.md +14 -0
- package/docs/context-efficiency.md +25 -3
- package/docs/input.md +63 -3
- package/docs/languages.md +3 -3
- package/docs/models.md +30 -6
- package/docs/modkh.md +11 -7
- package/docs/presets.md +45 -0
- package/docs/setup.md +3 -16
- package/docs/stateright.md +45 -0
- package/docs/subagents.md +21 -3
- package/docs/web.md +1 -1
- package/experiments/presets/formal.lisp +15 -4
- package/experiments/presets/language-microagents.lisp +29 -0
- package/native/stateright/Cargo.lock +478 -0
- package/native/stateright/Cargo.toml +11 -0
- package/native/stateright/src/lib.rs +163 -0
- package/native/stateright/src/main.rs +38 -0
- package/package.json +10 -2
package/dist/cli/terminal.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { type UsageTotals } from './usage.ts';
|
|
2
2
|
export { textWidth, fitText } from './editor.ts';
|
|
3
|
-
import { type ClipboardReader } from './clipboard.ts';
|
|
3
|
+
import { writeClipboardText, type ClipboardReader } from './clipboard.ts';
|
|
4
4
|
import { type ImageAttachment } from '../agent/images.ts';
|
|
5
5
|
import type { ReadStream, WriteStream } from 'node:tty';
|
|
6
|
+
import type { SubagentActivity } from '../subagents/service.ts';
|
|
7
|
+
import type { RunningServer } from '../language/lsp/pool.ts';
|
|
8
|
+
import { type TranscriptKind } from './color.ts';
|
|
6
9
|
/** `pinned` rows stay on top and are never filtered away; they are actions, not selections. */
|
|
7
10
|
export interface Choice {
|
|
8
11
|
value: string;
|
|
@@ -14,14 +17,28 @@ export interface ChatTerminal {
|
|
|
14
17
|
readonly interactive: boolean;
|
|
15
18
|
readonly imageCount?: number;
|
|
16
19
|
takeImages?(): ImageAttachment[];
|
|
17
|
-
write(text: string): void;
|
|
20
|
+
write(text: string, kind?: TranscriptKind): void;
|
|
18
21
|
next(signal?: AbortSignal): Promise<string | null>;
|
|
19
22
|
unread(line: string): void;
|
|
23
|
+
/** Restore a failed submission as editable text, without resubmitting it. */
|
|
24
|
+
restoreDraft?(text: string): void;
|
|
20
25
|
ask(title: string, signal?: AbortSignal, secret?: boolean): Promise<string | null>;
|
|
26
|
+
confirm(title: string, signal?: AbortSignal): Promise<string | null>;
|
|
21
27
|
choose(title: string, choices: readonly Choice[], query?: string): Promise<string | null>;
|
|
28
|
+
/** Show a read-only page, returning when it is dismissed (or printed in line mode). */
|
|
29
|
+
showPage(title: string, text: string): Promise<void>;
|
|
22
30
|
setModel(model: string | null): void;
|
|
23
31
|
setActivity?(activity: string | null): void;
|
|
32
|
+
setTurnToolCount?(count: number): void;
|
|
33
|
+
setAnimation?(enabled: boolean): void;
|
|
34
|
+
/** Return an error to keep the draft, or null to accept it. */
|
|
35
|
+
beginFollowups?(submit: (text: string) => string | null): (unsent: string[]) => void;
|
|
36
|
+
setSubagent?(activity: SubagentActivity | null, delegationCount: number): void;
|
|
24
37
|
setUsage?(usage: UsageTotals): void;
|
|
38
|
+
/** Running language servers; shown in the side pane next to usage and subagent status. */
|
|
39
|
+
setServers?(servers: readonly RunningServer[]): void;
|
|
40
|
+
/** Whether a browse call is driving the browser right now; shown in the same pane. */
|
|
41
|
+
setBrowse?(active: boolean): void;
|
|
25
42
|
/** Live reasoning text; `null` flushes it into the transcript. Display only, never a message. */
|
|
26
43
|
setReasoning?(delta: string | null): void;
|
|
27
44
|
close(): void;
|
|
@@ -29,12 +46,13 @@ export interface ChatTerminal {
|
|
|
29
46
|
export declare const COMMANDS: readonly Choice[];
|
|
30
47
|
export interface TerminalOptions {
|
|
31
48
|
readClipboardImage?: ClipboardReader;
|
|
49
|
+
writeClipboardText?: typeof writeClipboardText;
|
|
32
50
|
}
|
|
33
51
|
/**
|
|
34
52
|
* メインスクリーンに流し込むストリーミングUI。
|
|
35
53
|
* - 完成したトランスクリプト行は一度だけ出力し、その後は端末のスクロールバックへ流れる
|
|
36
54
|
* - 起動時はロゴと入力欄を中央にまとめ、会話開始後は入力欄を最下部に描画する
|
|
37
|
-
*
|
|
55
|
+
* 通常はメインスクリーンを使う。マウス操作で履歴を開く間だけ別画面に切り替える。
|
|
38
56
|
*/
|
|
39
57
|
export declare class TerminalUI implements ChatTerminal {
|
|
40
58
|
readonly interactive = true;
|
|
@@ -43,11 +61,26 @@ export declare class TerminalUI implements ChatTerminal {
|
|
|
43
61
|
private selection;
|
|
44
62
|
private pending?;
|
|
45
63
|
private queued;
|
|
46
|
-
/**
|
|
64
|
+
/** 描画を待っている、折り返し前の論理行。 */
|
|
47
65
|
private queue;
|
|
66
|
+
private transcriptRows;
|
|
67
|
+
private liveTranscriptRows;
|
|
68
|
+
private drag?;
|
|
69
|
+
private selectionRows;
|
|
70
|
+
private readonly mouseInput?;
|
|
71
|
+
private readonly keyInput?;
|
|
72
|
+
private readonly copyText;
|
|
73
|
+
private copyQueue;
|
|
74
|
+
private historyRows;
|
|
75
|
+
private history?;
|
|
76
|
+
private page?;
|
|
48
77
|
/** まだ改行が来ていない最終行。ライブブロックの一部として再描画する。 */
|
|
49
78
|
private partial;
|
|
79
|
+
private partialKind;
|
|
50
80
|
private started;
|
|
81
|
+
private usageVisible;
|
|
82
|
+
private delegationCount;
|
|
83
|
+
private sidebarPainted;
|
|
51
84
|
/** 会話開始前の案内行(ウェルカムブロックに表示し、会話開始時に本文へ流す)。 */
|
|
52
85
|
private bootLines;
|
|
53
86
|
private bootFlushed;
|
|
@@ -59,11 +92,21 @@ export declare class TerminalUI implements ChatTerminal {
|
|
|
59
92
|
private clearPending;
|
|
60
93
|
private model;
|
|
61
94
|
private activity;
|
|
95
|
+
private followup?;
|
|
96
|
+
private subagent;
|
|
97
|
+
private subagentStarted;
|
|
98
|
+
private activityStarted;
|
|
99
|
+
private progressTimer?;
|
|
62
100
|
private usage;
|
|
101
|
+
/** Running language servers, refreshed by the owner; null means nothing is running. */
|
|
102
|
+
private servers;
|
|
103
|
+
/** True while a browse call is driving the browser. Display only. */
|
|
104
|
+
private browse;
|
|
63
105
|
private closed;
|
|
64
106
|
private paste;
|
|
65
107
|
private pasteBuffer;
|
|
66
108
|
private pasteBytes;
|
|
109
|
+
private previousInput;
|
|
67
110
|
private editorScroll;
|
|
68
111
|
private images;
|
|
69
112
|
private clipboardTask?;
|
|
@@ -81,6 +124,8 @@ export declare class TerminalUI implements ChatTerminal {
|
|
|
81
124
|
private colorizerState;
|
|
82
125
|
private palette;
|
|
83
126
|
private panelStyle;
|
|
127
|
+
/** Foreground for text drawn on `panelStyle`; keeps the status line readable on both themes. */
|
|
128
|
+
private panelAccent;
|
|
84
129
|
private backgroundProbe;
|
|
85
130
|
/** 背景プローブ中(返信待ち)。時間による入力抑制には使わない。 */
|
|
86
131
|
private backgroundWaiting;
|
|
@@ -102,31 +147,69 @@ export declare class TerminalUI implements ChatTerminal {
|
|
|
102
147
|
private onResize;
|
|
103
148
|
private columns;
|
|
104
149
|
private rows;
|
|
105
|
-
/**
|
|
150
|
+
/** 会話中は左ペイン、起動時は中央寄せ用に80列まで。 */
|
|
106
151
|
private width;
|
|
107
|
-
write(text: string): void;
|
|
152
|
+
write(text: string, kind?: TranscriptKind): void;
|
|
108
153
|
setModel(model: string | null): void;
|
|
109
154
|
setActivity(activity: string | null): void;
|
|
155
|
+
private turnToolCount?;
|
|
156
|
+
setTurnToolCount(count: number): void;
|
|
157
|
+
private activityLabel;
|
|
158
|
+
private animationEnabled;
|
|
159
|
+
setAnimation(enabled: boolean): void;
|
|
160
|
+
private canAnimate;
|
|
161
|
+
private updateProgressTimer;
|
|
162
|
+
beginFollowups(submit: (text: string) => string | null): (unsent: string[]) => void;
|
|
163
|
+
private sendFollowup;
|
|
164
|
+
private hasUsagePane;
|
|
165
|
+
private controlMargin;
|
|
166
|
+
private controlWidth;
|
|
167
|
+
private editorWidth;
|
|
168
|
+
setSubagent(activity: SubagentActivity | null, delegationCount: number): void;
|
|
110
169
|
setUsage(usage: UsageTotals): void;
|
|
170
|
+
/** Browse activity is display state; the browser itself is never started from here. */
|
|
171
|
+
setBrowse(active: boolean): void;
|
|
172
|
+
/** Re-render only when the list actually changed; the owner polls this during analysis. */
|
|
173
|
+
setServers(servers: readonly RunningServer[]): void;
|
|
111
174
|
/** Accumulate one reasoning delta, or flush the finished block into the transcript with `null`. */
|
|
112
175
|
setReasoning(delta: string | null): void;
|
|
113
176
|
unread(line: string): void;
|
|
177
|
+
restoreDraft(text: string): void;
|
|
114
178
|
get imageCount(): number;
|
|
115
179
|
takeImages(): ImageAttachment[];
|
|
116
180
|
next(signal?: AbortSignal): Promise<string | null>;
|
|
117
181
|
ask(title: string, signal?: AbortSignal, secret?: boolean): Promise<string | null>;
|
|
182
|
+
confirm(title: string, signal?: AbortSignal): Promise<string | null>;
|
|
118
183
|
choose(title: string, choices: readonly Choice[], query?: string): Promise<string | null>;
|
|
184
|
+
showPage(title: string, text: string): Promise<void>;
|
|
119
185
|
private wait;
|
|
120
186
|
private options;
|
|
187
|
+
private fileMenu?;
|
|
188
|
+
private fileOptions;
|
|
189
|
+
private completeFile;
|
|
121
190
|
private insertText;
|
|
122
191
|
private pasteImage;
|
|
192
|
+
private mouseReport;
|
|
193
|
+
private visibleTranscript;
|
|
194
|
+
private drawDragHighlight;
|
|
195
|
+
private clearDragHighlight;
|
|
196
|
+
private cancelDrag;
|
|
197
|
+
private copySelection;
|
|
198
|
+
private scrollTranscriptRows;
|
|
199
|
+
private scrollHistory;
|
|
200
|
+
private renderHistory;
|
|
201
|
+
private leaveHistory;
|
|
202
|
+
private renderPage;
|
|
203
|
+
private dismissPage;
|
|
204
|
+
private pageKey;
|
|
123
205
|
private onEnd;
|
|
124
206
|
private keypress;
|
|
125
207
|
/**
|
|
126
|
-
*
|
|
208
|
+
* トランスクリプトへ追記する。完成行を出力待ちキューへ。装飾と折り返しは描画時に行う。
|
|
127
209
|
* 会話の始まり(`▶`)を検出したら、それ以降の行を広めの幅で折り返す。
|
|
128
210
|
*/
|
|
129
211
|
private appendTranscript;
|
|
212
|
+
private renderTranscriptLine;
|
|
130
213
|
private paint;
|
|
131
214
|
/**
|
|
132
215
|
* 1フレームの描画。
|
|
@@ -136,6 +219,11 @@ export declare class TerminalUI implements ChatTerminal {
|
|
|
136
219
|
* 再描画は最下部ブロックに限るため、過去の履歴が端末のスクロールバックに蓄積する。
|
|
137
220
|
*/
|
|
138
221
|
private render;
|
|
222
|
+
private sidebarSubagent;
|
|
223
|
+
private sidebarLines;
|
|
224
|
+
private paintSidebarRow;
|
|
225
|
+
private drawSidebar;
|
|
226
|
+
private eraseSidebar;
|
|
139
227
|
/** 未完了行の色分け用に、完成行までの状態を複製する。 */
|
|
140
228
|
private fork;
|
|
141
229
|
close: () => void;
|