@slopus/happy-providers 0.0.35 → 0.0.36
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 +11 -0
- package/dist/core/ProviderModelCompatibility.d.ts +1 -1
- package/dist/core/ProviderModelCompatibility.d.ts.map +1 -1
- package/dist/core/ProviderModelCompatibility.js +2 -2
- package/dist/core/ProviderModelCompatibility.js.map +1 -1
- package/dist/core/providerModelFamily.d.ts.map +1 -1
- package/dist/core/providerModelFamily.js +4 -0
- package/dist/core/providerModelFamily.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/protocol/chatCompletions/ChatCompletionsConnection.d.ts +42 -0
- package/dist/protocol/chatCompletions/ChatCompletionsConnection.d.ts.map +1 -0
- package/dist/protocol/chatCompletions/ChatCompletionsConnection.js +110 -0
- package/dist/protocol/chatCompletions/ChatCompletionsConnection.js.map +1 -0
- package/dist/protocol/chatCompletions/ChatCompletionsSession.d.ts +32 -0
- package/dist/protocol/chatCompletions/ChatCompletionsSession.d.ts.map +1 -0
- package/dist/protocol/chatCompletions/ChatCompletionsSession.js +247 -0
- package/dist/protocol/chatCompletions/ChatCompletionsSession.js.map +1 -0
- package/dist/protocol/chatCompletions/createChatCompletionsRequest.d.ts +15 -0
- package/dist/protocol/chatCompletions/createChatCompletionsRequest.d.ts.map +1 -0
- package/dist/protocol/chatCompletions/createChatCompletionsRequest.js +119 -0
- package/dist/protocol/chatCompletions/createChatCompletionsRequest.js.map +1 -0
- package/dist/protocol/chatCompletions/mapChatCompletionsStream.d.ts +5 -0
- package/dist/protocol/chatCompletions/mapChatCompletionsStream.d.ts.map +1 -0
- package/dist/protocol/chatCompletions/mapChatCompletionsStream.js +127 -0
- package/dist/protocol/chatCompletions/mapChatCompletionsStream.js.map +1 -0
- package/dist/vendors/glm/GlmProvider.d.ts +25 -0
- package/dist/vendors/glm/GlmProvider.d.ts.map +1 -0
- package/dist/vendors/glm/GlmProvider.js +60 -0
- package/dist/vendors/glm/GlmProvider.js.map +1 -0
- package/dist/vendors/glm/impl/createGlmCompactedContext.d.ts +7 -0
- package/dist/vendors/glm/impl/createGlmCompactedContext.d.ts.map +1 -0
- package/dist/vendors/glm/impl/createGlmCompactedContext.js +24 -0
- package/dist/vendors/glm/impl/createGlmCompactedContext.js.map +1 -0
- package/dist/vendors/glm/prompts/glm_5_3_system_prompt.d.ts +3 -0
- package/dist/vendors/glm/prompts/glm_5_3_system_prompt.d.ts.map +1 -0
- package/dist/vendors/glm/prompts/glm_5_3_system_prompt.js +13 -0
- package/dist/vendors/glm/prompts/glm_5_3_system_prompt.js.map +1 -0
- package/dist/vendors/glm/prompts/glm_compaction_instructions.d.ts +4 -0
- package/dist/vendors/glm/prompts/glm_compaction_instructions.d.ts.map +1 -0
- package/dist/vendors/glm/prompts/glm_compaction_instructions.js +101 -0
- package/dist/vendors/glm/prompts/glm_compaction_instructions.js.map +1 -0
- package/dist/vendors/kimi/KimiProvider.d.ts +25 -0
- package/dist/vendors/kimi/KimiProvider.d.ts.map +1 -0
- package/dist/vendors/kimi/KimiProvider.js +57 -0
- package/dist/vendors/kimi/KimiProvider.js.map +1 -0
- package/dist/vendors/kimi/impl/createKimiCompactedContext.d.ts +7 -0
- package/dist/vendors/kimi/impl/createKimiCompactedContext.d.ts.map +1 -0
- package/dist/vendors/kimi/impl/createKimiCompactedContext.js +124 -0
- package/dist/vendors/kimi/impl/createKimiCompactedContext.js.map +1 -0
- package/dist/vendors/kimi/prompts/kimi_compaction_instructions.d.ts +4 -0
- package/dist/vendors/kimi/prompts/kimi_compaction_instructions.d.ts.map +1 -0
- package/dist/vendors/kimi/prompts/kimi_compaction_instructions.js +77 -0
- package/dist/vendors/kimi/prompts/kimi_compaction_instructions.js.map +1 -0
- package/dist/vendors/kimi/prompts/kimi_k3_system_prompt.d.ts +3 -0
- package/dist/vendors/kimi/prompts/kimi_k3_system_prompt.d.ts.map +1 -0
- package/dist/vendors/kimi/prompts/kimi_k3_system_prompt.js +85 -0
- package/dist/vendors/kimi/prompts/kimi_k3_system_prompt.js.map +1 -0
- package/dist/vendors/kimi/tools/bash.d.ts +3 -0
- package/dist/vendors/kimi/tools/bash.d.ts.map +1 -0
- package/dist/vendors/kimi/tools/bash.js +25 -0
- package/dist/vendors/kimi/tools/bash.js.map +1 -0
- package/dist/vendors/kimi/tools/edit.d.ts +3 -0
- package/dist/vendors/kimi/tools/edit.d.ts.map +1 -0
- package/dist/vendors/kimi/tools/edit.js +21 -0
- package/dist/vendors/kimi/tools/edit.js.map +1 -0
- package/dist/vendors/kimi/tools/glob.d.ts +3 -0
- package/dist/vendors/kimi/tools/glob.d.ts.map +1 -0
- package/dist/vendors/kimi/tools/glob.js +28 -0
- package/dist/vendors/kimi/tools/glob.js.map +1 -0
- package/dist/vendors/kimi/tools/grep.d.ts +3 -0
- package/dist/vendors/kimi/tools/grep.d.ts.map +1 -0
- package/dist/vendors/kimi/tools/grep.js +60 -0
- package/dist/vendors/kimi/tools/grep.js.map +1 -0
- package/dist/vendors/kimi/tools/index.d.ts +2 -0
- package/dist/vendors/kimi/tools/index.d.ts.map +1 -0
- package/dist/vendors/kimi/tools/index.js +17 -0
- package/dist/vendors/kimi/tools/index.js.map +1 -0
- package/dist/vendors/kimi/tools/read.d.ts +3 -0
- package/dist/vendors/kimi/tools/read.d.ts.map +1 -0
- package/dist/vendors/kimi/tools/read.js +32 -0
- package/dist/vendors/kimi/tools/read.js.map +1 -0
- package/dist/vendors/kimi/tools/read_media_file.d.ts +3 -0
- package/dist/vendors/kimi/tools/read_media_file.d.ts.map +1 -0
- package/dist/vendors/kimi/tools/read_media_file.js +39 -0
- package/dist/vendors/kimi/tools/read_media_file.js.map +1 -0
- package/dist/vendors/kimi/tools/write.d.ts +3 -0
- package/dist/vendors/kimi/tools/write.d.ts.map +1 -0
- package/dist/vendors/kimi/tools/write.js +19 -0
- package/dist/vendors/kimi/tools/write.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
export const kimi_grep_tool = {
|
|
3
|
+
name: "Grep",
|
|
4
|
+
description: "Search file contents using regular expressions (powered by ripgrep).\n\nUse Grep when the task is to find unknown content or unknown file locations. Do not use shell `grep` or `rg` directly; this tool applies workspace path policy, output limits, and sensitive-file filtering.\nALWAYS use Grep tool instead of running `grep` or `rg` from a shell — direct shell calls bypass workspace policy, output limits, and sensitive-file filtering.\nIf you already know a concrete file path and need to inspect its contents, use Read directly instead.\n\nWrite patterns in ripgrep regex syntax, which differs from POSIX `grep` syntax. For example, braces are special, so escape them as `\\{` to match a literal `{`.\n\nHidden files (dotfiles such as `.gitlab-ci.yml` or `.eslintrc.json`) are searched by default. To also search files excluded by `.gitignore` (such as `node_modules` or build outputs), set `include_ignored` to `true`. Sensitive files (such as `.env`) are always skipped for safety, even when `include_ignored` is `true`.\n",
|
|
5
|
+
parameters: Type.Object({
|
|
6
|
+
pattern: Type.String({ description: "Regular expression to search for." }),
|
|
7
|
+
path: Type.Optional(Type.String({
|
|
8
|
+
description: "File or directory to search. Accepts an absolute path, or a path relative to the current working directory. Omit to search the current working directory. Use Read instead when you already know a concrete file path and need its contents.",
|
|
9
|
+
})),
|
|
10
|
+
glob: Type.Optional(Type.String({
|
|
11
|
+
description: "Optional glob filter for which files to search, e.g. `*.ts`. Matched against each file's full absolute path, so a path-anchored pattern like `src/**/*.ts` silently matches nothing — use a basename pattern (`*.ts`), or anchor with `**/` (`**/src/**/*.ts`). To scope the search to a directory, use `path` instead.",
|
|
12
|
+
})),
|
|
13
|
+
type: Type.Optional(Type.String({
|
|
14
|
+
description: "Optional ripgrep file type filter, such as ts or py. Prefer this over `glob` when filtering by language or file kind: it is more efficient and less error-prone than an equivalent glob pattern.",
|
|
15
|
+
})),
|
|
16
|
+
output_mode: Type.Optional(Type.Unsafe({
|
|
17
|
+
description: "Shape of the result. `content` shows matching lines (honors `-A`, `-B`, `-C`, `-n`, and `head_limit`); `files_with_matches` shows only the paths of files that contain a match, most-recently-modified first (honors `head_limit`); `count_matches` shows per-file match counts as `path:count` lines, preceded by an aggregate total line. Defaults to `files_with_matches`.",
|
|
18
|
+
type: "string",
|
|
19
|
+
enum: ["content", "files_with_matches", "count_matches"],
|
|
20
|
+
})),
|
|
21
|
+
"-i": Type.Optional(Type.Boolean({
|
|
22
|
+
description: "Perform a case-insensitive search. Defaults to false.",
|
|
23
|
+
})),
|
|
24
|
+
"-n": Type.Optional(Type.Boolean({
|
|
25
|
+
description: "Prefix each matching line with its line number. Applies only when `output_mode` is `content`. Defaults to true.",
|
|
26
|
+
})),
|
|
27
|
+
"-A": Type.Optional(Type.Integer({
|
|
28
|
+
description: "Number of lines to show after each match. Applies only when `output_mode` is `content`.",
|
|
29
|
+
minimum: 0,
|
|
30
|
+
maximum: 9007199254740991,
|
|
31
|
+
})),
|
|
32
|
+
"-B": Type.Optional(Type.Integer({
|
|
33
|
+
description: "Number of lines to show before each match. Applies only when `output_mode` is `content`.",
|
|
34
|
+
minimum: 0,
|
|
35
|
+
maximum: 9007199254740991,
|
|
36
|
+
})),
|
|
37
|
+
"-C": Type.Optional(Type.Integer({
|
|
38
|
+
description: "Number of lines to show before and after each match. Applies only when `output_mode` is `content`; takes precedence over `-A` and `-B`.",
|
|
39
|
+
minimum: 0,
|
|
40
|
+
maximum: 9007199254740991,
|
|
41
|
+
})),
|
|
42
|
+
head_limit: Type.Optional(Type.Integer({
|
|
43
|
+
description: "Limit output to the first N lines/entries after offset. Defaults to 250. Pass 0 for unlimited.",
|
|
44
|
+
minimum: 0,
|
|
45
|
+
maximum: 9007199254740991,
|
|
46
|
+
})),
|
|
47
|
+
offset: Type.Optional(Type.Integer({
|
|
48
|
+
description: "Number of leading lines/entries to skip before applying `head_limit`. Use it together with `head_limit` to page through large result sets. Defaults to 0.",
|
|
49
|
+
minimum: 0,
|
|
50
|
+
maximum: 9007199254740991,
|
|
51
|
+
})),
|
|
52
|
+
multiline: Type.Optional(Type.Boolean({
|
|
53
|
+
description: "Enable multiline matching, where the pattern can span line boundaries and `.` also matches newlines. Defaults to false.",
|
|
54
|
+
})),
|
|
55
|
+
include_ignored: Type.Optional(Type.Boolean({
|
|
56
|
+
description: "Also search files excluded by ignore files such as `.gitignore`, `.ignore`, and `.rgignore` (for example `node_modules` or build outputs). Sensitive files (such as `.env`) remain filtered out for safety. VCS metadata directories (`.git` and similar) are always skipped, even when this is true. Defaults to false.",
|
|
57
|
+
})),
|
|
58
|
+
}, { $schema: "http://json-schema.org/draft-07/schema#", additionalProperties: false }),
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=grep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grep.js","sourceRoot":"","sources":["../../../../sources/vendors/kimi/tools/grep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIzC,MAAM,CAAC,MAAM,cAAc,GAAgB;IACvC,IAAI,EAAE,MAAM;IACZ,WAAW,EACP,qgCAAqgC;IACzgC,UAAU,EAAE,IAAI,CAAC,MAAM,CACnB;QACI,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;QAC1E,IAAI,EAAE,IAAI,CAAC,QAAQ,CACf,IAAI,CAAC,MAAM,CAAC;YACR,WAAW,EACP,8OAA8O;SACrP,CAAC,CACL;QACD,IAAI,EAAE,IAAI,CAAC,QAAQ,CACf,IAAI,CAAC,MAAM,CAAC;YACR,WAAW,EACP,yTAAyT;SAChU,CAAC,CACL;QACD,IAAI,EAAE,IAAI,CAAC,QAAQ,CACf,IAAI,CAAC,MAAM,CAAC;YACR,WAAW,EACP,kMAAkM;SACzM,CAAC,CACL;QACD,WAAW,EAAE,IAAI,CAAC,QAAQ,CACtB,IAAI,CAAC,MAAM,CAAqD;YAC5D,WAAW,EACP,+WAA+W;YACnX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,SAAS,EAAE,oBAAoB,EAAE,eAAe,CAAC;SAC3D,CAAC,CACL;QACD,IAAI,EAAE,IAAI,CAAC,QAAQ,CACf,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EAAE,uDAAuD;SACvE,CAAC,CACL;QACD,IAAI,EAAE,IAAI,CAAC,QAAQ,CACf,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,iHAAiH;SACxH,CAAC,CACL;QACD,IAAI,EAAE,IAAI,CAAC,QAAQ,CACf,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,yFAAyF;YAC7F,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,gBAAgB;SAC5B,CAAC,CACL;QACD,IAAI,EAAE,IAAI,CAAC,QAAQ,CACf,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,0FAA0F;YAC9F,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,gBAAgB;SAC5B,CAAC,CACL;QACD,IAAI,EAAE,IAAI,CAAC,QAAQ,CACf,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,yIAAyI;YAC7I,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,gBAAgB;SAC5B,CAAC,CACL;QACD,UAAU,EAAE,IAAI,CAAC,QAAQ,CACrB,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,gGAAgG;YACpG,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,gBAAgB;SAC5B,CAAC,CACL;QACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CACjB,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,2JAA2J;YAC/J,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,gBAAgB;SAC5B,CAAC,CACL;QACD,SAAS,EAAE,IAAI,CAAC,QAAQ,CACpB,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,yHAAyH;SAChI,CAAC,CACL;QACD,eAAe,EAAE,IAAI,CAAC,QAAQ,CAC1B,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,0TAA0T;SACjU,CAAC,CACL;KACJ,EACD,EAAE,OAAO,EAAE,yCAAyC,EAAE,oBAAoB,EAAE,KAAK,EAAE,CACtF;CACJ,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const kimi_tools: readonly [import("../../../index.js").SessionTool, import("../../../index.js").SessionTool, import("../../../index.js").SessionTool, import("../../../index.js").SessionTool, import("../../../index.js").SessionTool, import("../../../index.js").SessionTool, import("../../../index.js").SessionTool];
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/kimi/tools/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU,0SAQb,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { kimi_bash_tool } from "../../../vendors/kimi/tools/bash.js";
|
|
2
|
+
import { kimi_read_tool } from "../../../vendors/kimi/tools/read.js";
|
|
3
|
+
import { kimi_write_tool } from "../../../vendors/kimi/tools/write.js";
|
|
4
|
+
import { kimi_edit_tool } from "../../../vendors/kimi/tools/edit.js";
|
|
5
|
+
import { kimi_glob_tool } from "../../../vendors/kimi/tools/glob.js";
|
|
6
|
+
import { kimi_grep_tool } from "../../../vendors/kimi/tools/grep.js";
|
|
7
|
+
import { kimi_read_media_file_tool } from "../../../vendors/kimi/tools/read_media_file.js";
|
|
8
|
+
export const kimi_tools = [
|
|
9
|
+
kimi_bash_tool,
|
|
10
|
+
kimi_read_tool,
|
|
11
|
+
kimi_write_tool,
|
|
12
|
+
kimi_edit_tool,
|
|
13
|
+
kimi_glob_tool,
|
|
14
|
+
kimi_grep_tool,
|
|
15
|
+
kimi_read_media_file_tool,
|
|
16
|
+
];
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../sources/vendors/kimi/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAEpF,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,cAAc;IACd,cAAc;IACd,eAAe;IACf,cAAc;IACd,cAAc;IACd,cAAc;IACd,yBAAyB;CACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/kimi/tools/read.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,cAAc,EAAE,WAiD5B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
export const kimi_read_tool = {
|
|
3
|
+
name: "Read",
|
|
4
|
+
description: "Read a text file from the local filesystem.\n\nThe path may be a `kimi-file://` attachment reference. Its bytes come from the current session's storage, independently of the workspace runtime. Next Read keeps the reference so pagination also works after a fork. For a binary attachment, the error includes a server-local path when available; a converter must be able to access that filesystem. ReadMediaFile accepts the same reference for images and videos.\n\nIf the user provides a concrete file path to a text file, call Read directly. Do not `Glob`, `ls`, or otherwise pre-check known text file paths; missing or invalid file paths return errors you can handle. Do not use Read for directories; use `ls` via Bash for a known directory, or Glob when you need files matching a name pattern (Glob lists files only, never directories). Use `Grep` only when the task is to search for unknown content or locations.\n\nWhen you need several files, prefer to read them in parallel: emit multiple `Read` calls in a single response instead of reading one file per turn.\n\n- Relative paths resolve against the working directory; a path outside the working directory must be absolute.\n- Returns text within `max_chars`, including line numbers and the status block, preferring complete lines. The configured default is 100000 characters; calls can request up to 500000. Characters use JavaScript string length, not UTF-8 bytes or tokens. Read results are not spilled or shortened again by the general tool-output limit.\n- Omit `n_lines` to read toward the end of the file. There is no fixed line-count cap. When the task requires the full text of a large file, request a larger `max_chars`, up to 500000, in the first call.\n- Page larger files with `line_offset` (1-based start line) and `n_lines`. If the result is incomplete, copy the `Next Read` arguments in the status block to continue without gaps or overlaps. Do not answer from a partial page when the task requires the remaining content.\n- If a single line cannot fit on its own page, Read returns a fragment and reports its column range. Continue on the same line with the supplied `column_offset`; do not insert a newline between fragments of one source line. A partial line still counts toward the remaining `n_lines` until its ending is returned.\n- `column_offset` is a zero-based position in the first line's displayed text, excluding its line-number prefix. It is supported only for forward reads. Offsets past the line or inside a Unicode surrogate pair return an error. Continuation refers to the current file contents; start a new read if the file changed.\n- Kimi Code agent event logs (`wire.jsonl` under the sessions directory) follow the same character budget; locate a record with Grep, read it with `n_lines=1`, and follow `Next Read` to retrieve every fragment of a long record.\n- Sensitive files (`.env` files, credential stores, SSH private keys, and similar secrets) are refused to protect secrets; do not attempt to read them. Templates and public keys are exempt: `.env.example` / `.env.sample` / `.env.template` and public SSH keys such as `id_rsa.pub` read normally.\n- UTF-8 text files are read directly. UTF-16 LE/BE text files (with or without a BOM) are detected automatically and checked with strict decoding first. If malformed sequences are found, Read returns readable text with U+FFFD replacements and a lossy-decoding warning on every page; do not treat this view as exact original text. The status block notes the detected encoding, and Edit/Write on such a file still expect UTF-8 — convert its encoding first (e.g. with `iconv`). Other encodings (e.g. GBK), binary files, and files containing NUL bytes are refused.\n- Negative `line_offset` reads from the end of the file (for example, -100 reads the last 100 lines). If the requested tail range exceeds the character budget, the newest complete lines in that range are returned first; `Next Read` covers the omitted earlier range. If no complete line fits, Read reports this and supplies forward `Next Read` arguments for the entire unread range. Omit `column_offset` when using a negative `line_offset`.\n- Output format: `<line-number>\\t<content>` per line.\n- A `<system>...</system>` status block is appended after the file content. It reports the actual returned range, total lines, effective character budget, whether the requested range is complete, and whether EOF was reached. The block is not part of the file itself.\n- Pure CRLF files are displayed with LF line endings; `Edit` matches this output and preserves CRLF when writing back.\n- Mixed or lone carriage-return line endings are shown as `\\r` and require exact `Edit.old_string` escapes.\n- After a successful `Edit`/`Write`, do not re-read solely to prove the write landed. When the task depends on an exact file, API, or output shape, inspect the final external contract before finishing.\n",
|
|
5
|
+
parameters: Type.Object({
|
|
6
|
+
path: Type.String({
|
|
7
|
+
description: "Path to a text file or a kimi-file:// attachment reference in the current session. Relative filesystem paths resolve against the working directory; a path outside the working directory must be absolute. Directories are not supported; use `ls` via Bash for a known directory, or Glob for pattern search.",
|
|
8
|
+
}),
|
|
9
|
+
line_offset: Type.Optional(Type.Union([
|
|
10
|
+
Type.Integer({ minimum: 1, maximum: 9007199254740991 }),
|
|
11
|
+
Type.Integer({ minimum: -9007199254740991, exclusiveMaximum: 0 }),
|
|
12
|
+
], {
|
|
13
|
+
description: "The line number to start reading from. Omit to start at line 1. Negative values read from the end of the file (for example, -100 reads the last 100 lines).",
|
|
14
|
+
})),
|
|
15
|
+
column_offset: Type.Optional(Type.Integer({
|
|
16
|
+
description: "Zero-based character offset within the first line of a forward read, excluding its line-number prefix. Uses JavaScript string length in the displayed text. Copy continuation arguments from the previous result to resume a long line.",
|
|
17
|
+
minimum: 0,
|
|
18
|
+
maximum: 9007199254740991,
|
|
19
|
+
})),
|
|
20
|
+
n_lines: Type.Optional(Type.Integer({
|
|
21
|
+
description: "The number of lines to read. Omit to read toward the end of the file. Results are bounded by max_chars, with continuation arguments when the requested range is incomplete.",
|
|
22
|
+
exclusiveMinimum: 0,
|
|
23
|
+
maximum: 9007199254740991,
|
|
24
|
+
})),
|
|
25
|
+
max_chars: Type.Optional(Type.Integer({
|
|
26
|
+
description: "Maximum characters in the returned text, including line numbers and status. Omit for the configured default; requests above the configured maximum are capped.",
|
|
27
|
+
exclusiveMinimum: 0,
|
|
28
|
+
maximum: 9007199254740991,
|
|
29
|
+
})),
|
|
30
|
+
}, { $schema: "http://json-schema.org/draft-07/schema#", additionalProperties: false }),
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../sources/vendors/kimi/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIzC,MAAM,CAAC,MAAM,cAAc,GAAgB;IACvC,IAAI,EAAE,MAAM;IACZ,WAAW,EACP,8yJAA8yJ;IAClzJ,UAAU,EAAE,IAAI,CAAC,MAAM,CACnB;QACI,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EACP,gTAAgT;SACvT,CAAC;QACF,WAAW,EAAE,IAAI,CAAC,QAAQ,CACtB,IAAI,CAAC,KAAK,CACN;YACI,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;YACvD,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC;SACpE,EACD;YACI,WAAW,EACP,6JAA6J;SACpK,CACJ,CACJ;QACD,aAAa,EAAE,IAAI,CAAC,QAAQ,CACxB,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,yOAAyO;YAC7O,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,gBAAgB;SAC5B,CAAC,CACL;QACD,OAAO,EAAE,IAAI,CAAC,QAAQ,CAClB,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,6KAA6K;YACjL,gBAAgB,EAAE,CAAC;YACnB,OAAO,EAAE,gBAAgB;SAC5B,CAAC,CACL;QACD,SAAS,EAAE,IAAI,CAAC,QAAQ,CACpB,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,gKAAgK;YACpK,gBAAgB,EAAE,CAAC;YACnB,OAAO,EAAE,gBAAgB;SAC5B,CAAC,CACL;KACJ,EACD,EAAE,OAAO,EAAE,yCAAyC,EAAE,oBAAoB,EAAE,KAAK,EAAE,CACtF;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read_media_file.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/kimi/tools/read_media_file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,yBAAyB,EAAE,WAkDvC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
export const kimi_read_media_file_tool = {
|
|
3
|
+
name: "ReadMediaFile",
|
|
4
|
+
description: "Read media content from a file.\n\nThe path may be a `kimi-file://` attachment reference. Its bytes come from the current session's storage, independently of the workspace runtime, including after a fork. Any reported local attachment path belongs to the server; external converters must be able to access that filesystem.\n\n**Tips:**\n- Make sure you follow the description of each tool parameter.\n- A `<system>` tag accompanies the media content; it summarizes the mime type, byte size and, for images, the original pixel dimensions, and states how the image was delivered (untouched, downsampled, cropped, or native resolution). When outputting coordinates, give relative coordinates first and compute absolute coordinates from the original image size. After generating or editing media via commands or scripts, read the result back before continuing.\n- Large images are downsampled by default when automatic compression can safely fit them within model limits, which can blur fine detail (small text, dense UI). Compute absolute coordinates from the original dimensions reported in the `<system>` block, never by measuring the displayed copy. When the `<system>` tag reports downsampling and you need that detail, call this tool again with the `region` parameter (original-image pixel coordinates) to view a crop at full fidelity, or set `full_resolution` to true when the whole file fits the per-image byte limit. Re-reading the same file without these parameters just reproduces the same downsampled image.\n- If automatic compression cannot safely produce an image within model limits, the tool returns an error and does not send the original image. Follow the error: use Bash or an available image-processing tool to create a smaller copy, then read that copy. Do not retry the unchanged file.\n- The system will notify you when there is anything wrong when reading the file.\n- This tool is a tool that you typically want to use in parallel. Always read multiple files in one response when possible.\n- This tool can only read image or video files. To read text files, use the Read tool. To list directories, use `ls` via Bash for a known directory, or Glob for pattern search.\n- If the file doesn't exist or path is invalid, an error will be returned.\n- The maximum size that can be read is 100MB. An error will be returned if the file is larger than this limit.\n- The media content will be returned in a form that you can directly view and understand.\n\n**Capabilities**\n\n- This tool supports image and video files for the current model.",
|
|
5
|
+
parameters: Type.Object({
|
|
6
|
+
path: Type.String({
|
|
7
|
+
description: "Path to an image or video file, or a kimi-file:// attachment reference in the current session. Relative filesystem paths resolve against the working directory; a path outside the working directory must be absolute. Directories and text files are not supported.",
|
|
8
|
+
}),
|
|
9
|
+
region: Type.Optional(Type.Object({
|
|
10
|
+
x: Type.Integer({
|
|
11
|
+
minimum: 0,
|
|
12
|
+
maximum: 9007199254740991,
|
|
13
|
+
description: "Left edge of the crop, in original-image pixels.",
|
|
14
|
+
}),
|
|
15
|
+
y: Type.Integer({
|
|
16
|
+
minimum: 0,
|
|
17
|
+
maximum: 9007199254740991,
|
|
18
|
+
description: "Top edge of the crop, in original-image pixels.",
|
|
19
|
+
}),
|
|
20
|
+
width: Type.Integer({
|
|
21
|
+
minimum: 1,
|
|
22
|
+
maximum: 9007199254740991,
|
|
23
|
+
description: "Crop width, in original-image pixels.",
|
|
24
|
+
}),
|
|
25
|
+
height: Type.Integer({
|
|
26
|
+
minimum: 1,
|
|
27
|
+
maximum: 9007199254740991,
|
|
28
|
+
description: "Crop height, in original-image pixels.",
|
|
29
|
+
}),
|
|
30
|
+
}, {
|
|
31
|
+
description: "Images only: view just this rectangle of the image (original-image pixel coordinates). Use after a downsampled full view to inspect fine detail — a region within the size limits is delivered at full fidelity.",
|
|
32
|
+
additionalProperties: false,
|
|
33
|
+
})),
|
|
34
|
+
full_resolution: Type.Optional(Type.Boolean({
|
|
35
|
+
description: "Images only: skip the default downscaling and view at native resolution. Fails with an explicit error when the payload would exceed the per-image byte limit; use region for files that large.",
|
|
36
|
+
})),
|
|
37
|
+
}, { $schema: "http://json-schema.org/draft-07/schema#", additionalProperties: false }),
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=read_media_file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read_media_file.js","sourceRoot":"","sources":["../../../../sources/vendors/kimi/tools/read_media_file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIzC,MAAM,CAAC,MAAM,yBAAyB,GAAgB;IAClD,IAAI,EAAE,eAAe;IACrB,WAAW,EACP,+/EAA+/E;IACngF,UAAU,EAAE,IAAI,CAAC,MAAM,CACnB;QACI,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EACP,sQAAsQ;SAC7Q,CAAC;QACF,MAAM,EAAE,IAAI,CAAC,QAAQ,CACjB,IAAI,CAAC,MAAM,CACP;YACI,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC;gBACZ,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,gBAAgB;gBACzB,WAAW,EAAE,kDAAkD;aAClE,CAAC;YACF,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC;gBACZ,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,gBAAgB;gBACzB,WAAW,EAAE,iDAAiD;aACjE,CAAC;YACF,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;gBAChB,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,gBAAgB;gBACzB,WAAW,EAAE,uCAAuC;aACvD,CAAC;YACF,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;gBACjB,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,gBAAgB;gBACzB,WAAW,EAAE,wCAAwC;aACxD,CAAC;SACL,EACD;YACI,WAAW,EACP,kNAAkN;YACtN,oBAAoB,EAAE,KAAK;SAC9B,CACJ,CACJ;QACD,eAAe,EAAE,IAAI,CAAC,QAAQ,CAC1B,IAAI,CAAC,OAAO,CAAC;YACT,WAAW,EACP,gMAAgM;SACvM,CAAC,CACL;KACJ,EACD,EAAE,OAAO,EAAE,yCAAyC,EAAE,oBAAoB,EAAE,KAAK,EAAE,CACtF;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/kimi/tools/write.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,eAAe,EAAE,WAyB7B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
export const kimi_write_tool = {
|
|
3
|
+
name: "Write",
|
|
4
|
+
description: "Create, append to, or replace a file entirely.\n\n- Missing parent directories are created automatically (like `mkdir(parents=True, exist_ok=True)`).\n- Mode defaults to overwrite; append adds content at EOF without adding a newline.\n- Write is NOT ALLOWED for incremental changes to existing files, including trivial, one-line, quick, or cosmetic edits. Use Edit instead.\n- Use Write only when the file does not exist, you intend a complete replacement, or the new contents have little continuity with the old contents.\n- Do not create unsolicited documentation files (`*.md` write-ups, `README`s, summaries) just because a task finished — write one only when the user asks for it, or when a task or project instruction requires it (e.g. the plan-mode plan file, created with Write when plan mode directs you to, or a changeset the repo mandates).\n- Read before overwriting an existing file.\n- Write ignores the Read/Edit line-number view. NEVER include line prefixes.\n- Write outputs content literally, including supplied line endings: \\n stays LF, \\r\\n stays CRLF.\n- For new content too large for one call, overwrite the first chunk, then append subsequent chunks. Never chunk Write to modify an existing file.\n",
|
|
5
|
+
parameters: Type.Object({
|
|
6
|
+
path: Type.String({
|
|
7
|
+
description: "Path to the file to create, append to, or completely overwrite. Relative paths resolve against the working directory; a path outside the working directory must be absolute. Missing parent directories are created automatically.",
|
|
8
|
+
}),
|
|
9
|
+
content: Type.String({
|
|
10
|
+
description: "Raw full file content to write exactly as provided. This does not use the Read/Edit text view.",
|
|
11
|
+
}),
|
|
12
|
+
mode: Type.Optional(Type.Unsafe({
|
|
13
|
+
description: "Write mode. Defaults to overwrite. append adds content to the end exactly as provided and does not add a newline.",
|
|
14
|
+
type: "string",
|
|
15
|
+
enum: ["overwrite", "append"],
|
|
16
|
+
})),
|
|
17
|
+
}, { $schema: "http://json-schema.org/draft-07/schema#", additionalProperties: false }),
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../../../sources/vendors/kimi/tools/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIzC,MAAM,CAAC,MAAM,eAAe,GAAgB;IACxC,IAAI,EAAE,OAAO;IACb,WAAW,EACP,2sCAA2sC;IAC/sC,UAAU,EAAE,IAAI,CAAC,MAAM,CACnB;QACI,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EACP,oOAAoO;SAC3O,CAAC;QACF,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC;YACjB,WAAW,EACP,gGAAgG;SACvG,CAAC;QACF,IAAI,EAAE,IAAI,CAAC,QAAQ,CACf,IAAI,CAAC,MAAM,CAAyB;YAChC,WAAW,EACP,mHAAmH;YACvH,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC;SAChC,CAAC,CACL;KACJ,EACD,EAAE,OAAO,EAAE,yCAAyC,EAAE,oBAAoB,EAAE,KAAK,EAAE,CACtF;CACJ,CAAC"}
|