koneck 2.25.76 → 2.26.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.
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Sessions that live in this process, so the web client talks to an agent rather than to a
3
+ * subprocess.
4
+ *
5
+ * The old /run spawned `node dist/index.js <task>` per request. That meant no state between
6
+ * messages — every message was a fresh agent with no memory of the last one — no permission
7
+ * prompts, because there was no terminal to ask at, and no structure, because the only channel was
8
+ * stdout. Holding the session here gives all three: the conversation continues, a tool call can
9
+ * wait for an answer from the browser, and every callback becomes an event.
10
+ */
11
+ import type { AgentConfig } from '../types.js';
12
+ import { EventBus } from './events.js';
13
+ export interface WebSessionInfo {
14
+ id: string;
15
+ cwd: string;
16
+ title: string;
17
+ provider: string;
18
+ model: string;
19
+ createdAt: number;
20
+ turns: number;
21
+ totalTokens: number;
22
+ busy: boolean;
23
+ watchers: number;
24
+ }
25
+ export declare class WebSession {
26
+ readonly id: string;
27
+ private config;
28
+ readonly bus: EventBus;
29
+ readonly createdAt: number;
30
+ /**
31
+ * Where this session sits in the order they were made.
32
+ *
33
+ * The listing sorted on createdAt, and two sessions created in the same millisecond have the
34
+ * same one — so "newest first" was arbitrary between them. Found by a test that made two in a
35
+ * row, which is exactly what clicking New twice does.
36
+ */
37
+ order: number;
38
+ title: string;
39
+ turns: number;
40
+ totalTokens: number;
41
+ busy: boolean;
42
+ private agent;
43
+ private readonly pending;
44
+ private askCounter;
45
+ private toolCounter;
46
+ /** Start times by tool call, so a duration can be reported without the engine providing one. */
47
+ private readonly toolStarted;
48
+ constructor(id: string, config: AgentConfig);
49
+ info(): WebSessionInfo;
50
+ /** Answers a permission request. Returns false if nothing was waiting on that id. */
51
+ answer(askId: string, allowed: boolean): boolean;
52
+ /** Every request still waiting, so a reconnecting client can show them again. */
53
+ outstandingAsks(): string[];
54
+ private ensureAgent;
55
+ /** Runs one message. Rejects if a turn is already in flight. */
56
+ send(text: string): Promise<void>;
57
+ /** Stops a run in progress, if the engine supports it. */
58
+ abort(): void;
59
+ /** Changes the model or endpoint, which means a new agent on the next message. */
60
+ reconfigure(patch: Partial<AgentConfig>): void;
61
+ }
62
+ /** Every live session, by id. */
63
+ export declare class SessionRegistry {
64
+ private readonly sessions;
65
+ private counter;
66
+ create(config: AgentConfig): WebSession;
67
+ get(id: string): WebSession | undefined;
68
+ list(): WebSessionInfo[];
69
+ remove(id: string): boolean;
70
+ get size(): number;
71
+ }
72
+ /** A workspace is a directory; this is what a picker needs to show one. */
73
+ export declare function workspaceLabel(cwd: string): string;
74
+ //# sourceMappingURL=sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/web/sessions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AAGtD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAQD,qBAAa,UAAU;IAuBT,QAAQ,CAAC,EAAE,EAAE,MAAM;IAAE,OAAO,CAAC,MAAM;IAtB/C,QAAQ,CAAC,GAAG,WAAkB;IAC9B,QAAQ,CAAC,SAAS,SAAc;IAChC;;;;;;OAMG;IACH,KAAK,SAAK;IACV,KAAK,SAAiB;IACtB,KAAK,SAAK;IACV,WAAW,SAAK;IAChB,IAAI,UAAS;IAEb,OAAO,CAAC,KAAK,CAA+D;IAC5E,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IACtD,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,WAAW,CAAK;IACxB,gGAAgG;IAChG,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;gBAEpC,EAAE,EAAE,MAAM,EAAU,MAAM,EAAE,WAAW;IAE5D,IAAI,IAAI,cAAc;IAStB,qFAAqF;IACrF,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO;IAShD,iFAAiF;IACjF,eAAe,IAAI,MAAM,EAAE;YAEb,WAAW;IAqEzB,gEAAgE;IAC1D,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BvC,0DAA0D;IAC1D,KAAK,IAAI,IAAI;IAIb,kFAAkF;IAClF,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;CAM/C;AAED,iCAAiC;AACjC,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAC1D,OAAO,CAAC,OAAO,CAAK;IAEpB,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU;IAUvC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IACvC,IAAI,IAAI,cAAc,EAAE;IAKxB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAC3B,IAAI,IAAI,IAAI,MAAM,CAA+B;CAClD;AAED,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD"}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Sessions that live in this process, so the web client talks to an agent rather than to a
3
+ * subprocess.
4
+ *
5
+ * The old /run spawned `node dist/index.js <task>` per request. That meant no state between
6
+ * messages — every message was a fresh agent with no memory of the last one — no permission
7
+ * prompts, because there was no terminal to ask at, and no structure, because the only channel was
8
+ * stdout. Holding the session here gives all three: the conversation continues, a tool call can
9
+ * wait for an answer from the browser, and every callback becomes an event.
10
+ */
11
+ import path from 'path';
12
+ import { createAgentSession } from '../engine.js';
13
+ import { estimateCost } from '../pricing.js';
14
+ import { EventBus } from './events.js';
15
+ import { redactSecrets } from '../redact.js';
16
+ export class WebSession {
17
+ id;
18
+ config;
19
+ bus = new EventBus();
20
+ createdAt = Date.now();
21
+ /**
22
+ * Where this session sits in the order they were made.
23
+ *
24
+ * The listing sorted on createdAt, and two sessions created in the same millisecond have the
25
+ * same one — so "newest first" was arbitrary between them. Found by a test that made two in a
26
+ * row, which is exactly what clicking New twice does.
27
+ */
28
+ order = 0;
29
+ title = 'New session';
30
+ turns = 0;
31
+ totalTokens = 0;
32
+ busy = false;
33
+ agent = null;
34
+ pending = new Map();
35
+ askCounter = 0;
36
+ toolCounter = 0;
37
+ /** Start times by tool call, so a duration can be reported without the engine providing one. */
38
+ toolStarted = new Map();
39
+ constructor(id, config) {
40
+ this.id = id;
41
+ this.config = config;
42
+ }
43
+ info() {
44
+ return {
45
+ id: this.id, cwd: this.config.cwd, title: this.title,
46
+ provider: this.config.provider, model: this.config.model,
47
+ createdAt: this.createdAt, turns: this.turns, totalTokens: this.totalTokens,
48
+ busy: this.busy, watchers: this.bus.watchers,
49
+ };
50
+ }
51
+ /** Answers a permission request. Returns false if nothing was waiting on that id. */
52
+ answer(askId, allowed) {
53
+ const waiting = this.pending.get(askId);
54
+ if (!waiting)
55
+ return false;
56
+ this.pending.delete(askId);
57
+ waiting.resolve(allowed);
58
+ this.bus.emit({ t: 'ask-done', askId, allowed });
59
+ return true;
60
+ }
61
+ /** Every request still waiting, so a reconnecting client can show them again. */
62
+ outstandingAsks() { return [...this.pending.keys()]; }
63
+ async ensureAgent() {
64
+ if (this.agent)
65
+ return this.agent;
66
+ const bus = this.bus;
67
+ this.agent = await createAgentSession({
68
+ ...this.config,
69
+ silent: true, // nothing goes to this process's stdout
70
+ // Approval travels to the browser and back. Without a resolver the engine would either
71
+ // block for ever or auto-allow, and auto-allowing a write because the UI is a web page
72
+ // rather than a terminal is not a decision anyone made.
73
+ approve: async (tool, args) => {
74
+ const askId = `ask-${++this.askCounter}`;
75
+ return new Promise(resolve => {
76
+ this.pending.set(askId, { id: askId, resolve });
77
+ bus.emit({ t: 'ask', askId, tool, args: redactSecrets(args),
78
+ waiting: this.pending.size - 1 });
79
+ });
80
+ },
81
+ onChunk: (text) => bus.emit({ t: 'chunk', text }),
82
+ onThinking: (text, chars) => bus.emit({ t: 'thinking', text, chars }),
83
+ onToolCall: (name, detail) => {
84
+ const id = `tool-${++this.toolCounter}`;
85
+ this.toolStarted.set(name, Date.now());
86
+ bus.emit({ t: 'tool', callId: id, name, detail: redactSecrets(detail ?? '') });
87
+ },
88
+ onToolOutput: (name, line) => bus.emit({ t: 'tool-output', name, line: redactSecrets(line) }),
89
+ onToolResult: (name, ok, ms, detail) => {
90
+ const started = this.toolStarted.get(name);
91
+ this.toolStarted.delete(name);
92
+ bus.emit({ t: 'tool-done', callId: `tool-${this.toolCounter}`, name, ok,
93
+ ms: ms || (started ? Date.now() - started : 0), detail: redactSecrets(detail ?? '') });
94
+ },
95
+ onPlan: (plan) => bus.emit({ t: 'plan', steps: plan.steps.map(s => ({ text: s.text, state: s.state })) }),
96
+ onTokens: (s) => {
97
+ this.totalTokens = s.totalTokens;
98
+ bus.emit({ t: 'tokens', prompt: s.promptTokens, completion: s.completionTokens,
99
+ total: s.totalTokens,
100
+ cost: estimateCost(this.config.model, s.promptTokens, s.completionTokens).total });
101
+ },
102
+ // Everything the engine says about its own condition, in one place: the browser shows these
103
+ // the way the terminal shows a warning, rather than dropping them because there is no
104
+ // obvious home for them in a web layout.
105
+ onLeanMode: (_d, _l, notice) => bus.emit({ t: 'notice', level: 'warn', text: notice }),
106
+ onTruncation: (_w, notice) => bus.emit({ t: 'notice', level: 'warn', text: notice }),
107
+ onCrowdedWindow: (_f, _l, advice) => bus.emit({ t: 'notice', level: 'warn', text: advice }),
108
+ onPromptTrimmed: (_d, _t, notice) => bus.emit({ t: 'notice', level: 'warn', text: notice }),
109
+ onWindowDetected: (limit, source) => bus.emit({ t: 'notice', level: 'info', text: `Context window ${limit.toLocaleString()} (${source}).` }),
110
+ onLooping: (copies) => bus.emit({ t: 'notice', level: 'warn',
111
+ text: `The model repeated itself ${copies} times, so the reply was cut short.` }),
112
+ onIncomplete: (reason) => bus.emit({ t: 'notice', level: 'warn', text: reason }),
113
+ onCompress: (before, after) => bus.emit({ t: 'notice', level: 'info',
114
+ text: `Conversation summarised: ${before} messages to ${after}.` }),
115
+ });
116
+ this.bus.emit({ t: 'session', sessionId: this.id, cwd: this.config.cwd,
117
+ provider: this.config.provider, model: this.config.model });
118
+ return this.agent;
119
+ }
120
+ /** Runs one message. Rejects if a turn is already in flight. */
121
+ async send(text) {
122
+ if (this.busy)
123
+ throw new Error('This session is already working. Wait for it to finish.');
124
+ this.busy = true;
125
+ const started = Date.now();
126
+ if (this.title === 'New session')
127
+ this.title = redactSecrets(text).slice(0, 80);
128
+ this.bus.emit({ t: 'user', text });
129
+ try {
130
+ const agent = await this.ensureAgent();
131
+ const completed = await agent.send(text);
132
+ this.turns++;
133
+ this.bus.emit({ t: 'turn-end', ms: Date.now() - started, completed });
134
+ }
135
+ catch (err) {
136
+ this.bus.emit({ t: 'error', text: redactSecrets(err.message) });
137
+ throw err;
138
+ }
139
+ finally {
140
+ this.busy = false;
141
+ // Anything still waiting on an answer cannot be answered now, and a promise left unresolved
142
+ // holds the turn open for ever.
143
+ for (const [askId, p] of this.pending) {
144
+ p.resolve(false);
145
+ this.bus.emit({ t: 'ask-done', askId, allowed: false });
146
+ }
147
+ this.pending.clear();
148
+ }
149
+ }
150
+ /** Stops a run in progress, if the engine supports it. */
151
+ abort() {
152
+ this.agent?.abort?.();
153
+ }
154
+ /** Changes the model or endpoint, which means a new agent on the next message. */
155
+ reconfigure(patch) {
156
+ this.config = { ...this.config, ...patch };
157
+ this.agent = null;
158
+ this.bus.emit({ t: 'notice', level: 'info',
159
+ text: `Switched to ${this.config.model} via ${this.config.provider}.` });
160
+ }
161
+ }
162
+ /** Every live session, by id. */
163
+ export class SessionRegistry {
164
+ sessions = new Map();
165
+ counter = 0;
166
+ create(config) {
167
+ // Readable and unique without a clock, since two created in the same millisecond used to
168
+ // collide — the same fault the CLI's session ids had.
169
+ const id = `w${Date.now().toString(36)}-${(++this.counter).toString(36)}`;
170
+ const session = new WebSession(id, config);
171
+ session.order = this.counter;
172
+ this.sessions.set(id, session);
173
+ return session;
174
+ }
175
+ get(id) { return this.sessions.get(id); }
176
+ list() {
177
+ return [...this.sessions.values()]
178
+ .sort((a, b) => b.order - a.order)
179
+ .map(s => s.info());
180
+ }
181
+ remove(id) { return this.sessions.delete(id); }
182
+ get size() { return this.sessions.size; }
183
+ }
184
+ /** A workspace is a directory; this is what a picker needs to show one. */
185
+ export function workspaceLabel(cwd) {
186
+ return path.basename(cwd) || cwd;
187
+ }
188
+ //# sourceMappingURL=sessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../src/web/sessions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAqB7C,MAAM,OAAO,UAAU;IAuBA;IAAoB;IAtBhC,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAC;IACrB,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAChC;;;;;;OAMG;IACH,KAAK,GAAG,CAAC,CAAC;IACV,KAAK,GAAG,aAAa,CAAC;IACtB,KAAK,GAAG,CAAC,CAAC;IACV,WAAW,GAAG,CAAC,CAA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jB,CAAC;IAED,GAAG,CAAC,EAAU,IAA4B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACzE,IAAI;QACF,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;aAC/B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;aACjC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACxB,CAAC;IACD,MAAM,CAAC,EAAU,IAAa,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChE,IAAI,IAAI,KAAa,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;CAClD;AAED,2EAA2E;AAC3E,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;AACnC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The single page, as a string.
3
+ *
4
+ * No build step and no dependencies: one HTML document with its styles and script inline, served
5
+ * from memory. A web UI that needs bundling is a web UI that rots — and KONECK is installed with
6
+ * `npm i -g koneck`, so anything requiring a second toolchain would be broken for most people on
7
+ * the day they first tried it.
8
+ *
9
+ * Nothing is fetched from the network either. A page that pulls a font or a script from a CDN does
10
+ * not work on a machine that is offline, which is the machine most likely to be running a local
11
+ * model in the first place.
12
+ */
13
+ export declare function page(): string;
14
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/web/ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAaH,wBAAgB,IAAI,IAAI,MAAM,CAsN7B"}