@qilin-agent/tool-working-directory 0.0.0-stage → 3.1.5

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kkutysllb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,46 @@
1
+ # Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
2
+ # section, a hash of its English and Chinese blocks outside code blocks and generated regions.
3
+ # After editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write packages/session/tool-working-directory/README.md
5
+ /:
6
+ en: 98cfd91158449dab
7
+ zh: 3614603639d0b7e5
8
+ /qilin-agent-tool-working-directory:
9
+ en: 314feb2ff5e94a32
10
+ zh: 65fb2c8bad738b87
11
+ /qilin-agent-tool-working-directory/summary:
12
+ en: 9a02398f19196e04
13
+ zh: af829ecc71225ad3
14
+ /qilin-agent-tool-working-directory/table-of-contents:
15
+ en: d152484eb41ac6b4
16
+ zh: 9f0336825ccdaacd
17
+ /qilin-agent-tool-working-directory/use-this-package:
18
+ en: bb750522dbdb3fef
19
+ zh: 6e498c24c7ad557e
20
+ /qilin-agent-tool-working-directory/understand-the-implementation:
21
+ en: 89bbb00f9a795dbc
22
+ zh: 672c4374edc21e62
23
+ /qilin-agent-tool-working-directory/further-exploration:
24
+ en: 7889612b1e9c9549
25
+ zh: 65b74a3d8471ade7
26
+ /qilin-agent-tool-working-directory/model-experience:
27
+ en: 215e7ba838619b7b
28
+ zh: a311da3843709f90
29
+ /qilin-agent-tool-working-directory/model-experience/tool-schema-and-result:
30
+ en: bc924247b1806144
31
+ zh: af4cc374d7d16917
32
+ /qilin-agent-tool-working-directory/model-experience/tool-schema-and-result/what-the-model-sees:
33
+ en: a625e5cf6a9f7185
34
+ zh: 1db8cb09ae88203d
35
+ /qilin-agent-tool-working-directory/model-experience/tool-schema-and-result/token-effect:
36
+ en: a8379dea8db4e2a2
37
+ zh: cdd9b7c6b7fe9bae
38
+ /qilin-agent-tool-working-directory/model-experience/tool-schema-and-result/kv-cache-effect:
39
+ en: 8a3ea858b739464c
40
+ zh: 432f48203586282e
41
+ /qilin-agent-tool-working-directory/known-limitations-and-deferred-work:
42
+ en: faad28f483bfb52b
43
+ zh: 16027ea8cb6c3420
44
+ /qilin-agent-tool-working-directory/known-limitations-and-deferred-work/dev-note:
45
+ en: 0a1253c6f7b5e8b9
46
+ zh: 9f56528562c7c914
package/README.md CHANGED
@@ -1,3 +1,78 @@
1
- # Temporary Holding Version
1
+ ---
2
+ description: "Read the Session’s current directory or enter an existing directory with the same tool. Relative changes use the current directory. The returned absolute path can be passed to other tools."
3
+ kind: "package-reference"
4
+ ---
2
5
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
6
+ # @qilin-agent/tool-working-directory
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ Read the Session’s current directory or enter an existing directory with the same tool. Relative changes use the current directory. The returned absolute path can be passed to other tools.
13
+
14
+ ## Table of Contents
15
+
16
+ - [Use this package](#use-this-package)
17
+ - [Understand the implementation](#understand-the-implementation)
18
+ - [Further Exploration](#further-exploration)
19
+ - [Model Experience](#model-experience)
20
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
21
+ - [Dev Note](#dev-note)
22
+
23
+ -----
24
+
25
+ <a id="use-this-package"></a>
26
+ ## Use this package
27
+
28
+ Mount alongside `tools` and `workingDirectory`. Call `working_directory({})` to read or `working_directory({ cd: "src" })` to change directory. The tool has no configuration fields.
29
+
30
+ ```yaml
31
+ - name: '@qilin-agent/tool-working-directory'
32
+ ```
33
+
34
+ -----
35
+
36
+ <a id="understand-the-implementation"></a>
37
+ ## Understand the implementation
38
+
39
+ The tool delegates validation, recovery, persistence, and context notices to the directory owner. Its canonical result contains `cwd`; native rendering returns that path. The generic tool card displays the arguments and result without a separate GUI renderer.
40
+
41
+ -----
42
+
43
+ <a id="further-exploration"></a>
44
+ ## Further Exploration
45
+
46
+ - [Session group](../README.md) — durable Session services.
47
+ - [Tool catalog](../../../docs/tool-catalog.md) — the model-facing tool schemas.
48
+ - [Testing](../../../docs/testing.md) — composition and replay verification.
49
+
50
+ -----
51
+
52
+ <a id="model-experience"></a>
53
+ ## Model Experience
54
+
55
+ ### Tool schema and result
56
+
57
+ #### What the model sees
58
+
59
+ The [tool catalog](../../../docs/tool-catalog.md#qilin-agenttool-working-directory) defines the optional `cd` argument and canonical `cwd` result. Directory notices are owned by `@qilin-agent/working-directory`.
60
+
61
+ #### Token effect
62
+
63
+ The registered schema and returned path contribute tokens when the tool is available and invoked.
64
+
65
+ #### KV Cache effect
66
+
67
+ Changing tool availability changes its schema in the request; a directory change itself adds no schema tokens.
68
+
69
+ ## Known Limitations and Deferred Work
70
+
71
+ <a id="known-limitations-and-deferred-work"></a>
72
+
73
+ - **Directory changes are per Session** — existing shells, background jobs, and sandbox grants keep their own directories; the tool does not move them.
74
+
75
+ <a id="dev-note"></a>
76
+ ### Dev Note
77
+
78
+ None.
package/README.zh.md ADDED
@@ -0,0 +1,78 @@
1
+ ---
2
+ description: "用同一个工具读取 Session 当前目录或进入既有目录。相对路径基于当前目录解析。返回的绝对路径可传给其他工具。"
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @qilin-agent/tool-working-directory
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ 用同一个工具读取 Session 当前目录或进入既有目录。相对路径基于当前目录解析。返回的绝对路径可传给其他工具。
13
+
14
+ ## 目录
15
+
16
+ - [使用本包](#use-this-package)
17
+ - [理解实现](#understand-the-implementation)
18
+ - [延伸阅读](#further-exploration)
19
+ - [模型体验](#model-experience)
20
+ - [已知限制与延后工作](#known-limitations-and-deferred-work)
21
+ - [开发备注](#dev-note)
22
+
23
+ -----
24
+
25
+ <a id="use-this-package"></a>
26
+ ## 使用本包
27
+
28
+ 与 `tools`、`workingDirectory` 一同挂载。调用 `working_directory({})` 读取,或 `working_directory({ cd: "src" })` 切换目录。本工具没有配置字段。
29
+
30
+ ```yaml
31
+ - name: '@qilin-agent/tool-working-directory'
32
+ ```
33
+
34
+ -----
35
+
36
+ <a id="understand-the-implementation"></a>
37
+ ## 理解实现
38
+
39
+ 本工具把校验、恢复、持久化与上下文通知全部委托给目录所有者。其规范结果包含 `cwd`;原生渲染返回该路径。通用工具卡片展示参数与结果,不需要单独的 GUI 渲染器。
40
+
41
+ -----
42
+
43
+ <a id="further-exploration"></a>
44
+ ## 延伸阅读
45
+
46
+ - [Session 组](../README.zh.md) — 持久 Session 服务。
47
+ - [工具目录](../../../docs/tool-catalog.zh.md) — 面向模型的工具 schema。
48
+ - [测试](../../../docs/testing.zh.md) — 组合与回放验收。
49
+
50
+ -----
51
+
52
+ <a id="model-experience"></a>
53
+ ## 模型体验
54
+
55
+ ### 工具 schema 与结果
56
+
57
+ #### 模型看到什么
58
+
59
+ [工具目录](../../../docs/tool-catalog.zh.md#qilin-agenttool-working-directory)定义了可选参数 `cd` 与规范结果 `cwd`。目录通知由 `@qilin-agent/working-directory` 持有。
60
+
61
+ #### token 影响
62
+
63
+ 工具可用并被调用时,注册的 schema 与返回路径计入 token。
64
+
65
+ #### KV Cache 影响
66
+
67
+ 工具可用性变化会改变请求中的 schema;目录变更本身不增加 schema token。
68
+
69
+ ## 已知限制与延后工作
70
+
71
+ <a id="known-limitations-and-deferred-work"></a>
72
+
73
+ - **目录变更按 Session 隔离** —— 既有 shell、后台任务与沙箱授权保持各自目录,本工具不会移动它们。
74
+
75
+ <a id="dev-note"></a>
76
+ ### 开发备注
77
+
78
+ 无。
package/lib/index.js ADDED
@@ -0,0 +1,45 @@
1
+ import { defineTool } from "@qilin-agent/tools";
2
+ //#region lib/types/index.js
3
+ /**
4
+ * Read or change the calling Session's working directory.
5
+ * @module @qilin-agent/tool-working-directory
6
+ */
7
+ /** Cordis plugin name. */
8
+ const name = "tool-working-directory";
9
+ /** Services used by the tool. */
10
+ const inject = ["tools", "workingDirectory"];
11
+ /**
12
+ * Register the working-directory tool for this composition.
13
+ * @param ctx - context providing the tool registry and directory owner.
14
+ */
15
+ function apply(ctx) {
16
+ ctx.tools.register(defineTool({
17
+ name: "working_directory",
18
+ description: "Read the current working directory, or change it with cd. Relative paths use the current directory. Existing shells and running processes keep their own directories.",
19
+ parameters: { cd: {
20
+ type: "string",
21
+ description: "Existing directory to enter. Omit to read the current directory."
22
+ } },
23
+ output: {
24
+ schema: {
25
+ type: "object",
26
+ additionalProperties: false,
27
+ properties: { cwd: {
28
+ type: "string",
29
+ required: true,
30
+ description: "Current absolute working directory."
31
+ } }
32
+ },
33
+ render: (_args, value) => [{
34
+ type: "text",
35
+ text: value.cwd
36
+ }]
37
+ },
38
+ async execute(args, exec) {
39
+ if (exec.agent === void 0) throw new Error("working_directory requires an agent Session");
40
+ return { cwd: args.cd === void 0 ? await ctx.workingDirectory.ensure(exec.agent, exec.signal) : await ctx.workingDirectory.set(exec.agent, args.cd, exec.signal) };
41
+ }
42
+ }));
43
+ }
44
+ //#endregion
45
+ export { apply, inject, name };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Read or change the calling Session's working directory.
3
+ * @module @qilin-agent/tool-working-directory
4
+ */
5
+ import type { Context } from '@qilin-agent/kylin';
6
+ /** Cordis plugin name. */
7
+ export declare const name = "tool-working-directory";
8
+ /** Services used by the tool. */
9
+ export declare const inject: string[];
10
+ /**
11
+ * Register the working-directory tool for this composition.
12
+ * @param ctx - context providing the tool registry and directory owner.
13
+ */
14
+ export declare function apply(ctx: Context): void;
15
+ //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,43 @@
1
1
  {
2
2
  "name": "@qilin-agent/tool-working-directory",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "Read and change the active Session working directory",
4
+ "version": "3.1.5",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/kkutysllb/QiLin.git",
11
+ "directory": "packages/session/tool-working-directory"
12
+ },
13
+ "engines": {
14
+ "node": "^22.19.0 || >=24.0.0"
15
+ },
16
+ "type": "module",
17
+ "main": "lib/index.js",
18
+ "types": "lib/types/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./lib/types/index.d.ts",
22
+ "default": "./lib/index.js"
23
+ },
24
+ "./src/*": "./src/*",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "files": [
28
+ "lib/index.js",
29
+ "lib/types/**/*.d.ts"
30
+ ],
31
+ "license": "MIT",
32
+ "peerDependencies": {
33
+ "@qilin-agent/kylin": "~4.0.3",
34
+ "@qilin-agent/working-directory": "3.1.5",
35
+ "@qilin-agent/tools": "3.1.5"
36
+ },
37
+ "dependencies": {},
38
+ "devDependencies": {
39
+ "@qilin-agent/kylin": "~4.0.3",
40
+ "@qilin-agent/tools": "3.1.5",
41
+ "@qilin-agent/working-directory": "3.1.5"
42
+ }
6
43
  }