teapot-coding-agent 0.37.59 → 0.37.61
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/acp/adapter.js +4 -72
- package/dist/agent/agent.js +61 -2247
- package/dist/agent/compact-rules.js +0 -53
- package/dist/agent/editorconfig.js +4 -56
- package/dist/agent/goal-audit.js +0 -34
- package/dist/agent/key-pool.js +0 -52
- package/dist/agent/kill.js +1 -13
- package/dist/agent/llm.js +9 -310
- package/dist/agent/mcp-oauth-manager.js +2 -255
- package/dist/agent/mcp-registry.js +1 -188
- package/dist/agent/mcp.js +1 -85
- package/dist/agent/meta-tools.js +0 -26
- package/dist/agent/plugins.js +1 -81
- package/dist/agent/provider-headers.js +1 -28
- package/dist/agent/skills.js +8 -94
- package/dist/agent/tools.js +16 -809
- package/dist/bus.js +1 -2
- package/dist/config-schema.js +0 -40
- package/dist/home.js +1 -19
- package/dist/index.js +0 -136
- package/dist/log/events.js +3 -195
- package/dist/master.js +31 -1180
- package/dist/migrations/index.js +0 -55
- package/dist/migrations/providers.js +0 -13
- package/dist/migrations/registry.js +0 -9
- package/dist/migrations/session-titles.js +3 -43
- package/dist/migrations/sessions.js +2 -20
- package/dist/model-meta.js +166 -142
- package/dist/scheduler/cron.js +2 -17
- package/dist/server/api.js +12 -778
- package/dist/server/image-resize.js +1 -64
- package/dist/server/term-size.js +1 -120
- package/dist/server/terminals.js +0 -159
- package/dist/session-title.js +2 -35
- package/package.json +1 -1
- package/public/assets/{index-KzHw4Sqo.js → index-C1eqcSbW.js} +4 -4
- package/public/assets/index-C1eqcSbW.js.map +1 -0
- package/public/assets/{shiki-BwDjoZdu.js → shiki-DaLn_bCe.js} +2 -2
- package/public/assets/shiki-DaLn_bCe.js.map +1 -0
- package/public/index.html +1 -1
- package/public/assets/index-KzHw4Sqo.js.map +0 -1
- package/public/assets/shiki-BwDjoZdu.js.map +0 -1
package/dist/session-title.js
CHANGED
|
@@ -1,33 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session titles (#155) — "いろんなチャットアプリが実装してる、CodexやDSHとかも実装してそう /
|
|
3
|
-
* 自動生成とかサブエージェント名とかだとわかりにくい".
|
|
4
|
-
*
|
|
5
|
-
* The sidebar renders the raw session id, so `teapot-10-16854917` and
|
|
6
|
-
* `teapot-10-sub-trim-…` read as machinery: an operator with several sessions
|
|
7
|
-
* cannot tell which is which, and the timeline in front of them is the only clue.
|
|
8
|
-
*
|
|
9
|
-
* ## Why the FIRST USER PROMPT, and not a model call
|
|
10
|
-
*
|
|
11
|
-
* Every harness that does this derives the title from the opening request — it is
|
|
12
|
-
* already written by the human, it costs nothing, and it is stable (the first
|
|
13
|
-
* message of a session never changes, so the title never churns under the reader).
|
|
14
|
-
* A generated title would need an LLM call at exactly the moment the session starts,
|
|
15
|
-
* and would then drift as the session's real subject emerges.
|
|
16
|
-
*
|
|
17
|
-
* ## This is a DISPLAY rule, so it is deliberately lossy
|
|
18
|
-
*
|
|
19
|
-
* The input is arbitrary operator text: markdown, fenced code, URLs, a pasted
|
|
20
|
-
* 200-line log. A sidebar row is ~40 characters wide. So the rule takes the first
|
|
21
|
-
* MEANINGFUL line and trims it, rather than trying to summarise — a title that
|
|
22
|
-
* silently reorders what the operator wrote would be worse than a truncated one.
|
|
23
|
-
*/
|
|
24
1
|
export function sessionTitleFrom(firstUserPrompt) {
|
|
25
2
|
if (typeof firstUserPrompt !== "string")
|
|
26
3
|
return null;
|
|
27
4
|
const lines = firstUserPrompt.split("\n");
|
|
28
|
-
// A fenced block is CONTENT, not a subject: the operator pasted a log or a diff
|
|
29
|
-
// and the prose follows it. Taking the first line inside the fence titled a
|
|
30
|
-
// session "log" (measured). So skip from an opening fence to its closing one.
|
|
31
5
|
let inFence = false;
|
|
32
6
|
let fence = "";
|
|
33
7
|
for (const raw of lines) {
|
|
@@ -40,14 +14,12 @@ export function sessionTitleFrom(firstUserPrompt) {
|
|
|
40
14
|
continue;
|
|
41
15
|
}
|
|
42
16
|
if (marker[0] === fence) {
|
|
43
|
-
inFence = false;
|
|
17
|
+
inFence = false;
|
|
44
18
|
continue;
|
|
45
19
|
}
|
|
46
20
|
}
|
|
47
21
|
if (inFence)
|
|
48
|
-
continue;
|
|
49
|
-
// strip the markdown that would otherwise eat the visible width: ATX headings,
|
|
50
|
-
// bullets/ordered markers, blockquotes, and emphasis characters
|
|
22
|
+
continue;
|
|
51
23
|
const line = raw
|
|
52
24
|
.replace(/^\s{0,3}#{1,6}\s*/, "")
|
|
53
25
|
.replace(/^\s{0,3}>\s?/, "")
|
|
@@ -56,8 +28,6 @@ export function sessionTitleFrom(firstUserPrompt) {
|
|
|
56
28
|
.trim();
|
|
57
29
|
if (!line)
|
|
58
30
|
continue;
|
|
59
|
-
// a bare URL or a lone issue/PR reference carries no subject — the NEXT line
|
|
60
|
-
// usually does (a prompt may OPEN with "https://…" or a lone "2.")
|
|
61
31
|
if (/^https?:\/\/\S+$/.test(line))
|
|
62
32
|
continue;
|
|
63
33
|
if (/^#?\d+[.)]?$/.test(line))
|
|
@@ -66,13 +36,10 @@ export function sessionTitleFrom(firstUserPrompt) {
|
|
|
66
36
|
}
|
|
67
37
|
return null;
|
|
68
38
|
}
|
|
69
|
-
/** Trim to `max` characters on a word boundary, with an ellipsis when cut. */
|
|
70
39
|
function clip(text, max) {
|
|
71
40
|
if (text.length <= max)
|
|
72
41
|
return text;
|
|
73
42
|
const cut = text.slice(0, max);
|
|
74
|
-
// prefer the last space so a word is not sliced in half; fall back to a hard cut
|
|
75
|
-
// when the line has no space at all (a single long token / CJK run)
|
|
76
43
|
const at = cut.lastIndexOf(" ");
|
|
77
44
|
const body = at > max * 0.6 ? cut.slice(0, at) : cut;
|
|
78
45
|
return `${body.trimEnd()}…`;
|