@ccdd/default-tools 3.3.1 → 4.1.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.
package/README.md CHANGED
@@ -1,100 +1,62 @@
1
- # CCDD default tools
2
-
3
- CCDD 3.1.1 supports Node.js 22 LTS (22.19.0 or later). Install published versions with `npm install --ignore-scripts @ccdd/core @ccdd/default-tools`. Install `@ccdd/project` as well to use the project CLI.
4
-
5
- Optional tool implementations for `@ccdd/core`. This library does not register tools automatically. Import a factory and explicitly put its returned definition in your repository's `ccdd.config.ts`:
6
-
7
- ```ts
8
- import { defineConfig } from '@ccdd/core';
9
- import { agent, human } from '@ccdd/default-tools';
10
-
11
- export default defineConfig(() => ({
12
- artifactTypes: {
13
- markdown: {
14
- agentTools: { read: agent.text.read() },
15
- humanTools: { open: human.desktop.open() },
16
- },
17
- code: {
18
- agentTools: { list: agent.files.list(), read: agent.files.read() },
19
- humanTools: { open: human.desktop.open() },
20
- },
21
- },
22
- artifacts: {
23
- why: { type: 'markdown', path: 'why.md', basis: true },
24
- spec: { type: 'markdown', path: 'spec.md' },
25
- },
26
- critics: [{
27
- id: 'spec-matches-why', title: 'Spec matches Why', target: 'spec', deps: ['why'],
28
- profile: { kind: 'agent', provider: 'openai-codex', model: 'gpt-6-astra', reasoning: 'medium' },
29
- payload: { instruction: 'Read both Artifacts and evaluate whether Spec satisfies Why.' },
30
- }],
31
- }));
1
+ # @ccdd/default-tools
2
+
3
+ Optional common view scripts for CCDD 4. Use Node 22 LTS, at least 22.19.0. Install `@ccdd/core@^4`, `@ccdd/project@^4` and `@ccdd/default-tools@^4`. Installation and imports register no tools.
4
+
5
+ Declare each view explicitly in the owning folder's `ccdd.json`:
6
+
7
+ ```json
8
+ {
9
+ "name": "document",
10
+ "basis": true,
11
+ "views": {
12
+ "agentTools": {
13
+ "read": {
14
+ "metadata": {
15
+ "description": "Read UTF-8 lines from {artifactName}.",
16
+ "inputSchema": {
17
+ "type": "object",
18
+ "properties": { "path": { "type": "string" }, "startLine": { "type": "integer", "minimum": 1 }, "lineCount": { "type": "integer", "minimum": 1, "maximum": 500 } },
19
+ "required": ["path"],
20
+ "additionalProperties": false
21
+ },
22
+ "resultKinds": ["json"],
23
+ "observation": "content",
24
+ "executionPaths": ["node_modules/@ccdd/default-tools/dist", "node_modules/@ccdd/core/dist"]
25
+ },
26
+ "script": { "command": "ccdd-view", "args": ["read"] }
27
+ }
28
+ }
29
+ }
30
+ }
32
31
  ```
33
32
 
34
- Factories perform no I/O. Each returns `{ metadata, execute, preflight }`; CCDD connects its Artifact and validates call arguments before execution. Descriptions may contain `{artifactName}`. `description` and `timeoutMs` can be supplied to every factory.
33
+ The shared execution paths are relative to the workspace root. Install dependencies there before evaluation. The runner resolves the nearest installed `ccdd-view` executable and supplies the standard version 1 JSON request on stdin. Stdout is a ToolResult. See the [complete JSON example](examples/document/ccdd.json).
35
34
 
36
- - `agent.text.read()` reads a file Artifact. Arguments: optional `startLine` (default 1), `lineCount` (default 80, maximum 500).
37
- - `agent.files.read()` reads a file inside a directory Artifact; additionally requires an internal `path`.
38
- - `agent.files.list()` lists a directory Artifact or internal `path`; optional `offset` and `limit` (maximum 200).
39
- - `agent.image.view()` returns an actual image block from a file Artifact (`{}`) or an internal file in a directory Artifact (`{path: 'frames/preview.png'}`). Register it with the key `view_image`.
40
- - `human.desktop.open()` opens a file or folder with macOS's default application. A directory Artifact accepts an optional internal `path`. Other platforms require an explicit `command`.
35
+ | Fixed operation | Reviewer arguments | Result |
36
+ | --- | --- | --- |
37
+ | `read` | `path`, optional `startLine`, `lineCount` | UTF-8 line data; default 80, maximum 500 lines. |
38
+ | `list` | optional `path`, `offset`, `limit` | Directory entries and logical mounts; maximum 200 entries. |
39
+ | `image` | `path` | Native PNG/JPEG/WebP image block. |
40
+ | `open` | optional `path` | Desktop launch receipt. |
41
41
 
42
- Agent tools invoke a packaged Node CLI directly, without a shell or a global executable installation. Reads preserve UTF-8 and LF/CRLF, return complete lines, and bound returned text to 64 KiB. Results contain paging information. Invalid UTF-8, binary content, oversized individual lines, symlinks and paths outside the Artifact fail explicitly. Only returned text or a truly empty file counts as content observation; listing and reading beyond EOF do not.
42
+ Paths are logical paths inside the bound Artifact and may pass through children or mounts. They resolve to existing canonical paths before reading or launching. No mount folder, symlink or workspace copy is created. Invalid paths, symlink file traversal and unsupported files fail explicitly.
43
43
 
44
- ## Images
44
+ Reads preserve UTF-8 and LF/CRLF, return complete lines and cap text at 64 KiB. Invalid UTF-8, binary content and oversized individual lines fail. Content reads and truly empty files count as observations; listings and reads beyond EOF do not. Images use the existing packaged Pi read adapter without a Provider call, and validate actual bytes, format and the 4 MiB limit. GIF/BMP/animated PNG are rejected, with no automatic conversion.
45
45
 
46
- `agent.image.view()` is included in v1.1.0. The [image and group example](../../examples/artifact-groups/README.md) includes GitHub Release installation and tool verification instructions.
46
+ Register a Human tool with `"script":{"command":"ccdd-view","args":["open"]}` and `resultKinds:["launch"]`, `observation:"none"`. The default desktop opener uses macOS. Other platforms can provide fixed launcher options as a JSON argv value:
47
47
 
48
- ```ts
49
- // Register this type in ccdd.config.ts.
50
- image: {
51
- agentTools: { view_image: agent.image.view() },
52
- humanTools: { open: human.desktop.open() },
53
- }
48
+ ```json
49
+ {"command":"ccdd-view","args":["open","{\"command\":\"/usr/bin/xdg-open\",\"args\":[\"{artifactPath}\"]}"]}
54
50
  ```
55
51
 
56
- A `preview` Artifact of this type exposes `view_image_preview` to Agents and `open_preview` to Humans. The image CLI reuses Pi Agent Core 0.85.1's `createReadTool()` with a filesystem adapter exposing only the bound file. It makes no LLM call, starts no Agent session and provides no general filesystem or shell access. The package pins this Pi dependency directly; Pi types are not exposed through the public CCDD tool definition.
52
+ The options are configuration, never reviewer arguments. A successful launch does not prove the person observed content or complete a review. Applications must not write into the workspace. Human review remains local, with a live monitoring worker.
57
53
 
58
- Image contents, rather than filename extensions, determine support. A successful result requires a PNG/JPEG/WebP image block of at most 4MiB and produces a content observation for that leaf. Text-only results, GIF, BMP and animated PNG are rejected. No image processor is installed: the tool does not resize or convert unsupported input. Preflight checks availability and shape without rendering; use `--execute` to verify the actual image result. Agent reviews need a model supporting image input.
54
+ The package also retains optional script-author helpers such as `agent.text.read()`, `agent.files.read()`, `agent.image.view()`, `human.desktop.open()` and `human.project.open()`. They return metadata/execute contracts that a user script may wrap; they are not configuration registration APIs. Core's `defineTool` is likewise an optional authoring/type helper. CCDD never imports those functions during discovery.
59
55
 
60
56
  ```sh
61
- ccdd tools check --artifact preview --for agent --tool view_image --execute
62
- ccdd tools check --artifact frames --for agent --tool view_image --execute --args '{"path":"preview.png"}'
57
+ ccdd-project tools check --artifact document --for agent --tool read --execute --args '{"path":"notes.md"}'
63
58
  ```
64
59
 
65
- Artifact groups are configured in the core as `{kind:'group',members:[ID,...]}`. Tools stay registered on individual Artifact types, and shared leaf members receive one tool binding per operation. `tools check --artifact GROUP` preflights the member tools; execution explicitly selects a leaf.
66
-
67
- ## Desktop opening
68
-
69
- Human tools launch a desktop program and return a launch receipt, never decoded file contents. A successful launcher exit does not prove the person read the file and does not complete a review. Input snapshots are managed and retained by CCDD. Launchers should return after opening the application; avoid a wait-for-editor-exit flag. Preparation checks executable availability without launching the application.
70
-
71
- ```ts
72
- human.desktop.open({ app: 'TextEdit' }); // macOS
73
- human.desktop.open({ command: '/path/to/viewer', args: ['--read-only', '{artifactPath}'] });
74
- ```
75
-
76
- `args` are fixed repository configuration and require a standalone `{artifactPath}` token; without `args`, an explicit command receives the Artifact path as its only argument. Reviewers cannot supply a command, argv or environment. The process receives only a small desktop environment allowlist, excluding Provider secrets and `NODE_OPTIONS`. CCDD configuration and custom executables are trusted repository code, not an OS sandbox.
77
-
78
- The package contains no runtime import from CCDD and owns no Broker state. Its peer dependency supplies only the shared public tool contract; custom tools may implement that same contract without installing this library.
79
-
80
- ## Bundled project applications
81
-
82
- `human.project.open({ runtime: 'tools/blender', executable: 'blender' })` opens an
83
- Artifact with a portable application included in the project. `runtime` is a
84
- project-relative directory and `executable` is relative to it. Optional fixed
85
- `args` must include `{artifactPath}`; the default passes the Artifact path alone.
86
- The complete runtime directory participates in the tool's input identity, including
87
- supported internal relative symlinks. Reviewers cannot choose a different program.
88
-
89
- The actual application is launched with isolated writable home/config/cache
90
- directories in the review output. After successful process launch and the brief
91
- startup handoff, the reviewer owns the desktop session; it remains open after the
92
- tool host exits. A launch receipt does not prove rendered content or review
93
- completion. The immutable input copy remains available for the application.
94
-
95
- Use project `envRequirements` for external prerequisites that cannot be bundled.
96
- See [remote Human review](../../docs/remote-human-review.md) for the full workflow.
97
-
98
60
  ## License
99
61
 
100
- Licensed under the [MIT License](LICENSE).
62
+ [MIT](LICENSE).
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import type { ScriptToolRequest, ToolResult } from '@ccdd/core';
3
+ /** Standard language-neutral tool entry point. Fixed argv selects the operation. */
4
+ export declare function scriptRequest(operation: string, input: ScriptToolRequest, options?: Record<string, unknown>): Promise<ToolResult>;
package/dist/script.js ADDED
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ import { readdir } from 'node:fs/promises';
3
+ import { resolveScopePath } from '@ccdd/core';
4
+ import { readerRequest, scopedTarget, objectArguments, internalPath } from './reader.js';
5
+ import { imageRequest } from './image.js';
6
+ import { imageContent } from './image-result.js';
7
+ import { human } from './index.js';
8
+ /** Standard language-neutral tool entry point. Fixed argv selects the operation. */
9
+ export async function scriptRequest(operation, input, options = {}) {
10
+ if (input.version !== 1 || !input.context || !input.args || Array.isArray(input.args))
11
+ throw new Error('Expected a version 1 CCDD script request.');
12
+ const { context, args } = input;
13
+ if (!Object.hasOwn(context.scope, context.artifactId) || context.scope[context.artifactId].path !== context.artifactPath)
14
+ throw new Error('Invalid Artifact scope.');
15
+ const logical = internalPath(args.path), resolved = resolveScopePath(context.scope, context.artifactId, logical);
16
+ const root = context.scope[resolved.artifactId].path;
17
+ const target = await scopedTarget(root, true, resolved.path);
18
+ if (operation === 'read') {
19
+ objectArguments(args, ['path', 'startLine', 'lineCount']);
20
+ if (!logical)
21
+ throw new Error('read requires a file path inside the Artifact.');
22
+ const data = await readerRequest({ operation: 'read', root: target, directory: false, args: { ...(args.startLine === undefined ? {} : { startLine: args.startLine }), ...(args.lineCount === undefined ? {} : { lineCount: args.lineCount }) } });
23
+ return { content: [{ type: 'json', data: { ...data, artifactId: context.artifactId, resolvedArtifactId: resolved.artifactId, path: logical } }],
24
+ ...(typeof data.lineCount === 'number' && data.lineCount > 0 ? { observation: { kind: 'content' } } : data.totalLines === 0 ? { observation: { kind: 'empty' } } : {}) };
25
+ }
26
+ if (operation === 'list') {
27
+ objectArguments(args, ['path', 'offset', 'limit']);
28
+ const offset = args.offset ?? 0, limit = args.limit ?? 200;
29
+ if (!Number.isSafeInteger(offset) || Number(offset) < 0 || !Number.isSafeInteger(limit) || Number(limit) < 1 || Number(limit) > 200)
30
+ throw new Error('Invalid listing pagination.');
31
+ const entries = (await readdir(target, { withFileTypes: true })).map(entry => ({ name: entry.name, kind: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : entry.isSymbolicLink() ? 'symlink' : 'other' }));
32
+ if (!resolved.path)
33
+ for (const name of Object.keys(context.scope[resolved.artifactId].mounts))
34
+ entries.push({ name, kind: 'mount' });
35
+ entries.sort((a, b) => a.name.localeCompare(b.name, 'en'));
36
+ const selected = entries.slice(Number(offset), Number(offset) + Number(limit)).map(entry => ({ ...entry, path: logical ? `${logical}/${entry.name}` : entry.name }));
37
+ return { content: [{ type: 'json', data: { artifactId: context.artifactId, path: logical, entries: selected, totalEntries: entries.length, nextOffset: Number(offset) + selected.length < entries.length ? Number(offset) + selected.length : null } }] };
38
+ }
39
+ if (operation === 'image') {
40
+ objectArguments(args, ['path']);
41
+ if (!logical)
42
+ throw new Error('image requires a file path inside the Artifact.');
43
+ return { content: [imageContent(await imageRequest({ operation: 'view_image', root: target, directory: false, args: {} }))], observation: { kind: 'content' } };
44
+ }
45
+ if (operation === 'open') {
46
+ objectArguments(args, ['path']);
47
+ const tool = human.desktop.open(options);
48
+ return tool.execute({ ...context, signal: new AbortController().signal, artifactDirectory: true,
49
+ resolvePath: async (name = '') => { const entry = resolveScopePath(context.scope, context.artifactId, name); return scopedTarget(context.scope[entry.artifactId].path, true, entry.path); } }, args);
50
+ }
51
+ throw new Error('Select read, list, image or open.');
52
+ }
53
+ try {
54
+ let text = '';
55
+ for await (const chunk of process.stdin) {
56
+ text += chunk;
57
+ if (Buffer.byteLength(text) > 8 * 1024 * 1024)
58
+ throw new Error('Script request exceeds 8 MiB.');
59
+ }
60
+ const result = await scriptRequest(process.argv[2], JSON.parse(text), process.argv[3] ? JSON.parse(process.argv[3]) : {});
61
+ process.stdout.write(`${JSON.stringify(result)}\n`);
62
+ }
63
+ catch (error) {
64
+ process.stderr.write(`${error instanceof Error ? error.message : 'Artifact tool failed.'}\n`);
65
+ process.exitCode = 1;
66
+ }
67
+ //# sourceMappingURL=script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script.js","sourceRoot":"","sources":["../src/script.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,oFAAoF;AACpF,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,SAAiB,EAAE,KAAwB,EAAE,OAAO,GAA4B,EAAE;IACpH,IAAI,KAAK,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO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it registration
2
+
3
+ Copy `document/ccdd.json` into a real Artifact folder and adapt its name and Critic. Install the package at the workspace root. All paths in `metadata.executionPaths` are relative to that root. `ccdd-view` resolves from the nearest installed `node_modules/.bin`, then PATH. The caller supplies `path` to select a document or image inside this Artifact, a contained Artifact or a mount. Importing or installing the package registers no tools.
@@ -0,0 +1,139 @@
1
+ {
2
+ "name": "document",
3
+ "views": {
4
+ "agentTools": {
5
+ "read": {
6
+ "metadata": {
7
+ "description": "Inspect {artifactName} with read.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "path": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "additionalProperties": false,
16
+ "required": [
17
+ "path"
18
+ ]
19
+ },
20
+ "resultKinds": [
21
+ "json"
22
+ ],
23
+ "observation": "content",
24
+ "executionPaths": [
25
+ "node_modules/@ccdd/core/dist",
26
+ "node_modules/@ccdd/default-tools/dist"
27
+ ]
28
+ },
29
+ "script": {
30
+ "command": "ccdd-view",
31
+ "args": [
32
+ "read"
33
+ ]
34
+ }
35
+ },
36
+ "list": {
37
+ "metadata": {
38
+ "description": "Inspect {artifactName} with list.",
39
+ "inputSchema": {
40
+ "type": "object",
41
+ "properties": {
42
+ "path": {
43
+ "type": "string"
44
+ }
45
+ },
46
+ "additionalProperties": false
47
+ },
48
+ "resultKinds": [
49
+ "json"
50
+ ],
51
+ "observation": "none",
52
+ "executionPaths": [
53
+ "node_modules/@ccdd/core/dist",
54
+ "node_modules/@ccdd/default-tools/dist"
55
+ ]
56
+ },
57
+ "script": {
58
+ "command": "ccdd-view",
59
+ "args": [
60
+ "list"
61
+ ]
62
+ }
63
+ },
64
+ "image": {
65
+ "metadata": {
66
+ "description": "Inspect {artifactName} with image.",
67
+ "inputSchema": {
68
+ "type": "object",
69
+ "properties": {
70
+ "path": {
71
+ "type": "string"
72
+ }
73
+ },
74
+ "additionalProperties": false,
75
+ "required": [
76
+ "path"
77
+ ]
78
+ },
79
+ "resultKinds": [
80
+ "image"
81
+ ],
82
+ "observation": "content",
83
+ "executionPaths": [
84
+ "node_modules/@ccdd/core/dist",
85
+ "node_modules/@ccdd/default-tools/dist"
86
+ ]
87
+ },
88
+ "script": {
89
+ "command": "ccdd-view",
90
+ "args": [
91
+ "image"
92
+ ]
93
+ }
94
+ }
95
+ },
96
+ "humanTools": {
97
+ "open": {
98
+ "metadata": {
99
+ "description": "Inspect {artifactName} with open.",
100
+ "inputSchema": {
101
+ "type": "object",
102
+ "properties": {
103
+ "path": {
104
+ "type": "string"
105
+ }
106
+ },
107
+ "additionalProperties": false
108
+ },
109
+ "resultKinds": [
110
+ "launch"
111
+ ],
112
+ "observation": "none",
113
+ "executionPaths": [
114
+ "node_modules/@ccdd/core/dist",
115
+ "node_modules/@ccdd/default-tools/dist"
116
+ ]
117
+ },
118
+ "script": {
119
+ "command": "ccdd-view",
120
+ "args": [
121
+ "open"
122
+ ]
123
+ }
124
+ }
125
+ }
126
+ },
127
+ "critics": [
128
+ {
129
+ "id": "review",
130
+ "title": "Review the document",
131
+ "profile": {
132
+ "kind": "human"
133
+ },
134
+ "payload": {
135
+ "instruction": "Read {document} and assess whether its requirements are clear and verifiable."
136
+ }
137
+ }
138
+ ]
139
+ }
package/package.json CHANGED
@@ -1,20 +1,48 @@
1
1
  {
2
2
  "name": "@ccdd/default-tools",
3
- "version": "3.3.1",
3
+ "version": "4.1.0",
4
4
  "license": "MIT",
5
- "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
6
- "repository": { "type": "git", "url": "git+https://github.com/lhj6102/ccdd.git", "directory": "packages/default-tools" },
5
+ "publishConfig": {
6
+ "access": "public",
7
+ "registry": "https://registry.npmjs.org/"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/lhj6102/ccdd.git",
12
+ "directory": "packages/default-tools"
13
+ },
7
14
  "description": "Explicitly registered Agent CLI and Human desktop Artifact tools for CCDD",
8
15
  "type": "module",
9
- "engines": { "node": "^22.19.0" },
10
- "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" } },
16
+ "engines": {
17
+ "node": "^22.19.0"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
11
25
  "types": "./dist/index.d.ts",
12
- "files": ["dist/", "LICENSE", "README.md"],
26
+ "files": [
27
+ "dist/",
28
+ "LICENSE",
29
+ "README.md",
30
+ "examples/"
31
+ ],
13
32
  "scripts": {
14
33
  "build": "node ../../node_modules/typescript/bin/tsc -p tsconfig.json",
15
34
  "prepack": "npm run build"
16
35
  },
17
- "peerDependencies": { "@ccdd/core": ">=3.0.0 <4" },
18
- "dependencies": { "@earendil-works/pi-agent-core": "0.85.1" },
19
- "devDependencies": { "@ccdd/core": "file:../.." }
36
+ "peerDependencies": {
37
+ "@ccdd/core": ">=4.0.0 <5"
38
+ },
39
+ "dependencies": {
40
+ "@earendil-works/pi-agent-core": "0.85.1"
41
+ },
42
+ "devDependencies": {
43
+ "@ccdd/core": "file:../.."
44
+ },
45
+ "bin": {
46
+ "ccdd-view": "./dist/script.js"
47
+ }
20
48
  }