@gajae-code/coding-agent 0.9.2 → 0.9.4
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/CHANGELOG.md +19 -0
- package/dist/types/build-metadata.d.ts +7 -0
- package/dist/types/capability/mcp.d.ts +3 -1
- package/dist/types/commands/mcp.d.ts +1 -1
- package/dist/types/config/keybindings.d.ts +2 -2
- package/dist/types/modes/components/hook-selector.d.ts +1 -0
- package/dist/types/modes/components/status-line/types.d.ts +6 -0
- package/dist/types/modes/components/status-line.d.ts +1 -0
- package/dist/types/modes/components/welcome.d.ts +1 -0
- package/dist/types/modes/rpc/rpc-client.d.ts +7 -2
- package/dist/types/modes/utils/ui-helpers.d.ts +12 -0
- package/dist/types/notifications/telegram-daemon.d.ts +2 -0
- package/dist/types/runtime-mcp/config-writer.d.ts +4 -3
- package/dist/types/runtime-mcp/types.d.ts +5 -4
- package/dist/types/session/agent-session.d.ts +16 -0
- package/dist/types/session/session-manager.d.ts +1 -0
- package/dist/types/tools/skill.d.ts +9 -8
- package/dist/types/utils/linkedom.d.ts +4 -0
- package/dist/types/utils/pasted-image-path.d.ts +5 -3
- package/package.json +11 -7
- package/scripts/build-binary.ts +2 -40
- package/scripts/compile-args.ts +96 -0
- package/scripts/generate-docs-index.ts +1 -0
- package/src/build-metadata.ts +104 -0
- package/src/capability/mcp.ts +3 -1
- package/src/cli/mcp-cli.ts +108 -26
- package/src/cli.ts +21 -0
- package/src/commands/mcp.ts +8 -8
- package/src/commands/stats.ts +6 -2
- package/src/config/keybindings.ts +2 -2
- package/src/config/mcp-schema.json +21 -17
- package/src/coordinator-mcp/server.ts +7 -4
- package/src/discovery/builtin.ts +14 -0
- package/src/discovery/mcp-json.ts +14 -0
- package/src/eval/js/executor.ts +7 -1
- package/src/gjc-runtime/state-runtime.ts +105 -12
- package/src/gjc-runtime/workflow-manifest.generated.json +4 -28
- package/src/gjc-runtime/workflow-manifest.ts +1 -7
- package/src/internal-urls/docs-index.generated.ts +3 -2
- package/src/internal-urls/gjc-protocol.ts +14 -1
- package/src/modes/components/assistant-message.ts +1 -1
- package/src/modes/components/hook-selector.ts +4 -0
- package/src/modes/components/session-selector.ts +2 -2
- package/src/modes/components/status-line/presets.ts +5 -7
- package/src/modes/components/status-line/segments.ts +14 -0
- package/src/modes/components/status-line/types.ts +6 -0
- package/src/modes/components/status-line.ts +13 -6
- package/src/modes/components/tool-execution.ts +1 -1
- package/src/modes/components/welcome.ts +4 -1
- package/src/modes/controllers/command-controller.ts +1 -1
- package/src/modes/controllers/event-controller.ts +9 -9
- package/src/modes/controllers/input-controller.ts +8 -2
- package/src/modes/controllers/selector-controller.ts +7 -3
- package/src/modes/interactive-mode.ts +12 -4
- package/src/modes/rpc/rpc-client.ts +30 -6
- package/src/modes/utils/ui-helpers.ts +154 -32
- package/src/notifications/telegram-daemon.ts +28 -2
- package/src/prompts/tools/skill.md +2 -2
- package/src/runtime-mcp/config-writer.ts +4 -3
- package/src/runtime-mcp/config.ts +1 -0
- package/src/runtime-mcp/types.ts +5 -4
- package/src/session/agent-session.ts +117 -3
- package/src/session/session-manager.ts +68 -40
- package/src/slash-commands/builtin-registry.ts +9 -4
- package/src/tools/bash-interactive.ts +9 -4
- package/src/tools/browser/readable.ts +2 -2
- package/src/tools/fetch.ts +5 -5
- package/src/tools/skill.ts +14 -11
- package/src/utils/linkedom.ts +14 -0
- package/src/utils/pasted-image-path.ts +23 -9
- package/src/web/scrapers/arxiv.ts +2 -2
- package/src/web/scrapers/go-pkg.ts +2 -2
- package/src/web/scrapers/iacr.ts +2 -2
- package/src/web/scrapers/readthedocs.ts +2 -2
- package/src/web/scrapers/twitter.ts +3 -2
- package/src/web/scrapers/wikipedia.ts +2 -2
- package/src/export/html/template.css +0 -1060
- package/src/export/html/template.html +0 -47
- package/src/export/html/template.js +0 -2314
- package/vendor/insane-search/engine/tests/test_hardening.py +0 -57
- package/vendor/insane-search/engine/tests/test_smoke.py +0 -152
- package/vendor/insane-search/engine/tests/test_u1.py +0 -200
- package/vendor/insane-search/engine/tests/test_u4.py +0 -131
- package/vendor/insane-search/engine/tests/test_u5.py +0 -163
- package/vendor/insane-search/engine/tests/test_u7.py +0 -124
- package/vendor/insane-search/engine/tests/test_u8.py +0 -216
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resolve pasted editor text to an image file path.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* Some terminal/clipboard integrations paste a temporary filesystem path after a
|
|
5
|
+
* copied image is pasted into the editor (for example `/tmp/clipboard-...png`).
|
|
6
|
+
* Only those recognized clipboard temp files are auto-attached and replaced with
|
|
7
|
+
* an `[image N] source="/path"` reference so the model receives both the image
|
|
8
|
+
* payload and the raw temp file path. Ordinary image paths remain literal prompt
|
|
9
|
+
* text; users attach saved files explicitly with `@path/to/image.png`.
|
|
10
10
|
*/
|
|
11
11
|
import * as fs from "node:fs";
|
|
12
12
|
import * as os from "node:os";
|
|
@@ -14,6 +14,7 @@ import * as path from "node:path";
|
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
15
|
|
|
16
16
|
const IMAGE_FILE_EXTENSION_PATTERN = /\.(?:png|jpe?g|gif|webp)$/i;
|
|
17
|
+
const CLIPBOARD_TEMP_BASENAME_PATTERN = /^clipboard-\d{4}-\d{2}-\d{2}-\d{6}-[A-Za-z0-9-]+\.(?:png|jpe?g|gif|webp)$/i;
|
|
17
18
|
|
|
18
19
|
export interface DecodePastedPathOptions {
|
|
19
20
|
/**
|
|
@@ -150,16 +151,25 @@ function hasSupportedImageMagic(filePath: string): boolean {
|
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
|
|
154
|
+
function isRecognizedClipboardTempPath(filePath: string): boolean {
|
|
155
|
+
const resolved = path.resolve(filePath);
|
|
156
|
+
const tempRoot = path.resolve(os.tmpdir());
|
|
157
|
+
if (resolved !== tempRoot && !resolved.startsWith(`${tempRoot}${path.sep}`)) return false;
|
|
158
|
+
return CLIPBOARD_TEMP_BASENAME_PATTERN.test(path.basename(resolved));
|
|
159
|
+
}
|
|
160
|
+
|
|
153
161
|
/**
|
|
154
|
-
* Returns the resolved path when the whole pasted text is a
|
|
155
|
-
* existing image file
|
|
156
|
-
*
|
|
162
|
+
* Returns the resolved path when the whole pasted text is a recognized clipboard
|
|
163
|
+
* temp path to an existing image file, otherwise `undefined` (the paste is
|
|
164
|
+
* inserted as text). Arbitrary saved image paths are not auto-attached here;
|
|
165
|
+
* users attach them explicitly with `@path/to/image.png`.
|
|
157
166
|
*/
|
|
158
167
|
export function resolvePastedImagePath(text: string, options?: ResolvePastedImagePathOptions): string | undefined {
|
|
159
168
|
const candidate = decodePastedPathCandidate(text, options);
|
|
160
169
|
if (!candidate || !IMAGE_FILE_EXTENSION_PATTERN.test(candidate)) return undefined;
|
|
161
170
|
|
|
162
171
|
const resolved = path.resolve(options?.cwd ?? process.cwd(), candidate);
|
|
172
|
+
if (!isRecognizedClipboardTempPath(resolved)) return undefined;
|
|
163
173
|
try {
|
|
164
174
|
if (!fs.statSync(resolved).isFile()) return undefined;
|
|
165
175
|
} catch {
|
|
@@ -168,3 +178,7 @@ export function resolvePastedImagePath(text: string, options?: ResolvePastedImag
|
|
|
168
178
|
if (!hasSupportedImageMagic(resolved)) return undefined;
|
|
169
179
|
return resolved;
|
|
170
180
|
}
|
|
181
|
+
|
|
182
|
+
export function formatPastedImageReference(placeholder: string, imagePath: string): string {
|
|
183
|
+
return `${placeholder} source=${JSON.stringify(imagePath)}`;
|
|
184
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseHtmlLazy } from "../../utils/linkedom";
|
|
2
2
|
import type { RenderResult, SpecialHandler } from "./types";
|
|
3
3
|
import { buildResult, loadPage } from "./types";
|
|
4
4
|
import { convertWithMarkit, fetchBinary } from "./utils";
|
|
@@ -31,7 +31,7 @@ export const handleArxiv: SpecialHandler = async (
|
|
|
31
31
|
if (!result.ok) return null;
|
|
32
32
|
|
|
33
33
|
// Parse the Atom feed response
|
|
34
|
-
const doc =
|
|
34
|
+
const doc = (await parseHtmlLazy(result.content)).document;
|
|
35
35
|
const entry = doc.querySelector("entry");
|
|
36
36
|
|
|
37
37
|
if (!entry) return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tryParseJson } from "@gajae-code/utils";
|
|
2
|
-
import {
|
|
2
|
+
import { parseHtmlLazy } from "../../utils/linkedom";
|
|
3
3
|
import type { RenderResult, SpecialHandler } from "./types";
|
|
4
4
|
import { buildResult, htmlToBasicMarkdown, loadPage } from "./types";
|
|
5
5
|
|
|
@@ -97,7 +97,7 @@ export const handleGoPkg: SpecialHandler = async (
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
const doc =
|
|
100
|
+
const doc = (await parseHtmlLazy(pageResult.content)).document;
|
|
101
101
|
|
|
102
102
|
// Extract actual module path from breadcrumb or header
|
|
103
103
|
const breadcrumb = doc.querySelector(".go-Breadcrumb");
|
package/src/web/scrapers/iacr.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseHtmlLazy } from "../../utils/linkedom";
|
|
2
2
|
import type { RenderResult, SpecialHandler } from "./types";
|
|
3
3
|
import { buildResult, loadPage } from "./types";
|
|
4
4
|
import { convertWithMarkit, fetchBinary } from "./utils";
|
|
@@ -30,7 +30,7 @@ export const handleIacr: SpecialHandler = async (
|
|
|
30
30
|
|
|
31
31
|
if (!result.ok) return null;
|
|
32
32
|
|
|
33
|
-
const doc =
|
|
33
|
+
const doc = (await parseHtmlLazy(result.content)).document;
|
|
34
34
|
|
|
35
35
|
// Extract metadata from the page
|
|
36
36
|
const title =
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Read the Docs handler for web-fetch
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { parseHtmlLazy } from "../../utils/linkedom";
|
|
5
5
|
import { buildResult, htmlToBasicMarkdown, loadPage, type RenderResult, type SpecialHandler } from "./types";
|
|
6
6
|
|
|
7
7
|
export const handleReadTheDocs: SpecialHandler = async (
|
|
@@ -39,7 +39,7 @@ export const handleReadTheDocs: SpecialHandler = async (
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Parse HTML
|
|
42
|
-
const root =
|
|
42
|
+
const root = (await parseHtmlLazy(result.content)).document;
|
|
43
43
|
|
|
44
44
|
// Extract main content from common Read the Docs selectors
|
|
45
45
|
let mainContent =
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { HTMLElement } from "linkedom";
|
|
2
2
|
import { ToolAbortError } from "../../tools/tool-errors";
|
|
3
|
+
import { parseHtmlLazy } from "../../utils/linkedom";
|
|
3
4
|
import type { RenderResult, SpecialHandler } from "./types";
|
|
4
5
|
import { buildResult, loadPage } from "./types";
|
|
5
6
|
|
|
@@ -33,7 +34,7 @@ export const handleTwitter: SpecialHandler = async (
|
|
|
33
34
|
|
|
34
35
|
if (result.ok && result.content.length > 500) {
|
|
35
36
|
// Parse the Nitter HTML
|
|
36
|
-
const doc =
|
|
37
|
+
const doc = (await parseHtmlLazy(result.content)).document;
|
|
37
38
|
|
|
38
39
|
// Extract tweet content
|
|
39
40
|
const tweetContent = doc.querySelector(".tweet-content")?.textContent?.trim();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseHtmlLazy } from "../../utils/linkedom";
|
|
2
2
|
import type { RenderResult, SpecialHandler } from "./types";
|
|
3
3
|
import { buildResult, loadPage } from "./types";
|
|
4
4
|
|
|
@@ -45,7 +45,7 @@ export const handleWikipedia: SpecialHandler = async (
|
|
|
45
45
|
const contentResult = await loadPage(contentUrl, { timeout, signal });
|
|
46
46
|
|
|
47
47
|
if (contentResult.ok) {
|
|
48
|
-
const doc =
|
|
48
|
+
const doc = (await parseHtmlLazy(contentResult.content)).document;
|
|
49
49
|
|
|
50
50
|
// Extract main content sections
|
|
51
51
|
const sections = doc.querySelectorAll("section");
|