dimcode-windows-x64 0.1.0-alpha.19 → 0.1.0-alpha.20

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.
@@ -1,136 +1,136 @@
1
- ---
2
- name: plugin-authoring
3
- description: Write a TypeScript Dim plugin that adds tools or settings, then install and reload it with the `plugin` tool. Use when asked to write, create, change or install a Dim plugin or a new agent tool.
4
- ---
5
-
6
- # Writing a Dim plugin
7
-
8
- A plugin is a directory. Dim loads its code in its Node runtime; you install it with the
9
- `plugin` tool and reload it after each edit, without restarting Dim.
10
-
11
- ## Layout
12
-
13
- ```
14
- echo-plugin/
15
- dim-plugin.json the manifest
16
- index.ts the entry module (TypeScript, loaded as is; no build step)
17
- package.json pins the rutis SDK
18
- node_modules/ from `npm install`
19
- ```
20
-
21
- `dim-plugin.json`:
22
-
23
- ```json
24
- {
25
- "name": "echo-plugin",
26
- "description": "Adds the echo tool",
27
- "code": { "entry": "index.ts", "inject": ["partRegistry", "settings"] }
28
- }
29
- ```
30
-
31
- - `name`: the plugin's name. Installing a plugin with the name of an existing one replaces it, so
32
- pick a new name.
33
- - `code.entry`: the entry file, relative to the directory.
34
- - `code.inject`: every service the entry's default export injects, the same list as its `inject`.
35
-
36
- `package.json` (the SDK version must be exactly the one Dim runs, 0.17.1):
37
-
38
- ```json
39
- { "name": "echo-plugin", "private": true, "type": "module",
40
- "dependencies": { "@arcships/rutis": "0.17.1" } }
41
- ```
42
-
43
- Run `npm install` in the directory before installing the plugin.
44
-
45
- ## The entry module
46
-
47
- The default export runs once in the process. It registers a Session part with `partRegistry`;
48
- every Session mounts a copy of the part, and the part registers tools with that Session's
49
- `toolRegistry`.
50
-
51
- ```ts
52
- import { definePlugin } from '@arcships/rutis'
53
-
54
- const settings = {
55
- source: 'echo-plugin',
56
- userFile: 'echo-plugin.json',
57
- schema: {
58
- type: 'object',
59
- properties: { prefix: { type: 'string', default: '' } },
60
- additionalProperties: false,
61
- },
62
- }
63
-
64
- const tools = definePlugin({
65
- name: 'EchoTools',
66
- inject: ['toolRegistry', 'settings'],
67
- async apply(ctx: any) {
68
- const store = ctx.use('settings')
69
- await ctx.use('toolRegistry').register(
70
- {
71
- name: 'echo',
72
- description: 'Echo the given text',
73
- source: 'extension',
74
- risk: 'session',
75
- inputSchema: {
76
- type: 'object',
77
- properties: { text: { type: 'string' } },
78
- required: ['text'],
79
- additionalProperties: false,
80
- },
81
- },
82
- async (call: any) => {
83
- if (typeof call.arguments.text !== 'string') {
84
- return { content: 'text must be a string', isError: true }
85
- }
86
- const read = await store.read({ source: 'echo-plugin', scope: 'user' })
87
- const prefix = read.ok ? read.value.document.prefix : ''
88
- return { content: prefix + call.arguments.text }
89
- },
90
- )
91
- },
92
- })
93
-
94
- export default definePlugin({
95
- name: 'EchoPlugin',
96
- inject: ['partRegistry', 'settings'],
97
- async apply(ctx: any) {
98
- await ctx.use('settings').register(settings)
99
- await ctx.use('partRegistry').registerDefinition('session', 'EchoTools', tools)
100
- },
101
- })
102
- ```
103
-
104
- Rules:
105
-
106
- - **Tools.** A tool name is 1–64 letters, digits, `_` or `-`, and must not be taken. `risk` is
107
- required: `read_filesystem`, `write_filesystem`, `execute_process`, `network` or `session`,
108
- whichever matches what the tool does; Permission decides each call by it. The handler gets
109
- `call.arguments` (validate them) and returns `{ content: string, isError?: boolean }`;
110
- `content` is the only text the model reads.
111
- - **Settings** (optional; for values the user may change). Register each source in the default
112
- export's `apply` with `settings.register(declaration)`: `source` (lowercase letters, digits,
113
- `-`, `_`), `userFile` (a file name), `schema` (a JSON Schema whose root is `type: object`;
114
- give members a `default`), and optionally `userOnly` (JSON Pointers of members only the user
115
- may change). Give a secret such as an API key `"writeOnly": true` in its schema and list it in
116
- `userOnly`: `plugin config` then never shows or writes its value. Source names and files are unique on the host. Read the
117
- document when you need it, as the tool above does, so a changed value applies at once.
118
- `read` returns `{ ok: true, value: { revision, document } }` or `{ ok: false, error }`.
119
- - **Lifetime.** Do no work at module top level besides imports and constants. Register in
120
- `apply`; registrations end when the plugin is reloaded, turned off or removed. Write
121
- diagnostics with `console.warn` / `console.error` (they go to Dim's log).
122
- - **Reload** imports `index.ts` again but not the modules it imports, so keep the code you will
123
- edit in `index.ts`.
124
-
125
- ## Install, test, change
126
-
127
- Use the `plugin` tool (`help <command>` shows details):
128
-
129
- 1. `install <path to the directory>`: the result's `status` is `running` when it loaded. On
130
- `failed`, read `error`, fix the code and run `reload <name>`. `pending` with `waitingFor`
131
- means a dependency or the Node runtime is not available yet.
132
- 2. The new tools are offered from your next model request in this Session; call one to test it.
133
- 3. After editing, `reload <name>`.
134
- 4. `config <name>` shows the plugin's Settings; `config <name> set <key> <value>` changes one.
135
- 5. `list` shows every plugin and its status; `disable <name>` turns one off; `remove <id>`
136
- uninstalls one.
1
+ ---
2
+ name: plugin-authoring
3
+ description: Write a TypeScript Dim plugin that adds tools or settings, then install and reload it with the `plugin` tool. Use when asked to write, create, change or install a Dim plugin or a new agent tool.
4
+ ---
5
+
6
+ # Writing a Dim plugin
7
+
8
+ A plugin is a directory. Dim loads its code in its Node runtime; you install it with the
9
+ `plugin` tool and reload it after each edit, without restarting Dim.
10
+
11
+ ## Layout
12
+
13
+ ```
14
+ echo-plugin/
15
+ dim-plugin.json the manifest
16
+ index.ts the entry module (TypeScript, loaded as is; no build step)
17
+ package.json pins the rutis SDK
18
+ node_modules/ from `npm install`
19
+ ```
20
+
21
+ `dim-plugin.json`:
22
+
23
+ ```json
24
+ {
25
+ "name": "echo-plugin",
26
+ "description": "Adds the echo tool",
27
+ "code": { "entry": "index.ts", "inject": ["partRegistry", "settings"] }
28
+ }
29
+ ```
30
+
31
+ - `name`: the plugin's name. Installing a plugin with the name of an existing one replaces it, so
32
+ pick a new name.
33
+ - `code.entry`: the entry file, relative to the directory.
34
+ - `code.inject`: every service the entry's default export injects, the same list as its `inject`.
35
+
36
+ `package.json` (the SDK version must be exactly the one Dim runs, 0.17.1):
37
+
38
+ ```json
39
+ { "name": "echo-plugin", "private": true, "type": "module",
40
+ "dependencies": { "@arcships/rutis": "0.17.1" } }
41
+ ```
42
+
43
+ Run `npm install` in the directory before installing the plugin.
44
+
45
+ ## The entry module
46
+
47
+ The default export runs once in the process. It registers a Session part with `partRegistry`;
48
+ every Session mounts a copy of the part, and the part registers tools with that Session's
49
+ `toolRegistry`.
50
+
51
+ ```ts
52
+ import { definePlugin } from '@arcships/rutis'
53
+
54
+ const settings = {
55
+ source: 'echo-plugin',
56
+ userFile: 'echo-plugin.json',
57
+ schema: {
58
+ type: 'object',
59
+ properties: { prefix: { type: 'string', default: '' } },
60
+ additionalProperties: false,
61
+ },
62
+ }
63
+
64
+ const tools = definePlugin({
65
+ name: 'EchoTools',
66
+ inject: ['toolRegistry', 'settings'],
67
+ async apply(ctx: any) {
68
+ const store = ctx.use('settings')
69
+ await ctx.use('toolRegistry').register(
70
+ {
71
+ name: 'echo',
72
+ description: 'Echo the given text',
73
+ source: 'extension',
74
+ risk: 'session',
75
+ inputSchema: {
76
+ type: 'object',
77
+ properties: { text: { type: 'string' } },
78
+ required: ['text'],
79
+ additionalProperties: false,
80
+ },
81
+ },
82
+ async (call: any) => {
83
+ if (typeof call.arguments.text !== 'string') {
84
+ return { content: 'text must be a string', isError: true }
85
+ }
86
+ const read = await store.read({ source: 'echo-plugin', scope: 'user' })
87
+ const prefix = read.ok ? read.value.document.prefix : ''
88
+ return { content: prefix + call.arguments.text }
89
+ },
90
+ )
91
+ },
92
+ })
93
+
94
+ export default definePlugin({
95
+ name: 'EchoPlugin',
96
+ inject: ['partRegistry', 'settings'],
97
+ async apply(ctx: any) {
98
+ await ctx.use('settings').register(settings)
99
+ await ctx.use('partRegistry').registerDefinition('session', 'EchoTools', tools)
100
+ },
101
+ })
102
+ ```
103
+
104
+ Rules:
105
+
106
+ - **Tools.** A tool name is 1–64 letters, digits, `_` or `-`, and must not be taken. `risk` is
107
+ required: `read_filesystem`, `write_filesystem`, `execute_process`, `network` or `session`,
108
+ whichever matches what the tool does; Permission decides each call by it. The handler gets
109
+ `call.arguments` (validate them) and returns `{ content: string, isError?: boolean }`;
110
+ `content` is the only text the model reads.
111
+ - **Settings** (optional; for values the user may change). Register each source in the default
112
+ export's `apply` with `settings.register(declaration)`: `source` (lowercase letters, digits,
113
+ `-`, `_`), `userFile` (a file name), `schema` (a JSON Schema whose root is `type: object`;
114
+ give members a `default`), and optionally `userOnly` (JSON Pointers of members only the user
115
+ may change). Give a secret such as an API key `"writeOnly": true` in its schema and list it in
116
+ `userOnly`: `plugin config` then never shows or writes its value. Source names and files are unique on the host. Read the
117
+ document when you need it, as the tool above does, so a changed value applies at once.
118
+ `read` returns `{ ok: true, value: { revision, document } }` or `{ ok: false, error }`.
119
+ - **Lifetime.** Do no work at module top level besides imports and constants. Register in
120
+ `apply`; registrations end when the plugin is reloaded, turned off or removed. Write
121
+ diagnostics with `console.warn` / `console.error` (they go to Dim's log).
122
+ - **Reload** imports `index.ts` again but not the modules it imports, so keep the code you will
123
+ edit in `index.ts`.
124
+
125
+ ## Install, test, change
126
+
127
+ Use the `plugin` tool (`help <command>` shows details):
128
+
129
+ 1. `install <path to the directory>`: the result's `status` is `running` when it loaded. On
130
+ `failed`, read `error`, fix the code and run `reload <name>`. `pending` with `waitingFor`
131
+ means a dependency or the Node runtime is not available yet.
132
+ 2. The new tools are offered from your next model request in this Session; call one to test it.
133
+ 3. After editing, `reload <name>`.
134
+ 4. `config <name>` shows the plugin's Settings; `config <name> set <key> <value>` changes one.
135
+ 5. `list` shows every plugin and its status; `disable <name>` turns one off; `remove <id>`
136
+ uninstalls one.
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "version": "0.1.0-alpha.19",
4
- "sourceCommit": "f33a1d84162de2823d80a28e32330d3b62280716",
3
+ "version": "0.1.0-alpha.20",
4
+ "sourceCommit": "d3910d14999119c37d61d5d52139dfa29b81eab3",
5
5
  "platform": "windows-x64",
6
6
  "toolchain": {
7
7
  "rust": "1.98.1"
8
8
  },
9
9
  "account": true,
10
10
  "files": {
11
- "LICENSE": "39100788d88143503514bc617369f1d1c7c0265c3f8742171e6af9701b0511b0",
12
- "NOTICE": "303c748c7c9ad22fc09cb4e5fcfa3347b0de8b59d379ae53a436c97c4f911786",
13
- "default-plugins.json": "4703d6744ff1b2ae094970ff9658786eb3bbca653ec3328f8aa2cf34ec389f46",
14
- "bin/dimcode.exe": "2669208dbf5b8814d88a2898f4aca82af4d25dc31f5bb1a509ef99ebca5df4a0",
15
- "licenses/RUST-THIRD-PARTY-NOTICES.txt": "9d166f95f063a4e4d3dcbbf3e76edb8b5936d337ae9466664c55345d422c7c40",
16
- "licenses/aimux/LICENSE": "39100788d88143503514bc617369f1d1c7c0265c3f8742171e6af9701b0511b0",
17
- "licenses/grok-build/LICENSE": "116f7778b9802e569b7fa3a532b17bd80eb13c67837def01eed093d4ea472f28",
18
- "licenses/grok-build/NOTICE": "8db60f5ffc55a9845974915b1c5bfc7804a9b531ee0ffc6af786b3c0031c71e0",
19
- "plugins/plugin-authoring/dim-plugin.json": "d43d6bd83f3b8ac05192f3ec8cadfe39500ccd541af336108ad1504c14f6ded8",
20
- "licenses/grok-build/xai-ratatui-inline/NOTICE": "0b2ba5c4dcc49e4e17be08fe2980968fc7bce31e41ad5af09bb80097f61483dd",
21
- "licenses/grok-build/xai-ratatui-textarea/NOTICE": "5d310dde613653911ea026b5cb66367600f5a704d299fa0afedbf1d3efd5d493",
22
- "plugins/plugin-authoring/skills/plugin-authoring/SKILL.md": "ea913a5801a58ca2f034982da1a4ceafe6137942a3bc11ed9b454b58361b87db"
11
+ "default-plugins.json": "a5d22f3df655347cdf26a5e23046622a08834b2effa5969f067a730fc4521f27",
12
+ "LICENSE": "a2c9dc2f4c67b2e61f36e57e2071044d0ae4d5f21cd55a14cf9c6644d3d3736d",
13
+ "NOTICE": "4aa2620418b86b682e5da96dc1fb5195ced98fcc143fd1315c22e5fe7b6ee994",
14
+ "bin/dimcode.exe": "d5bda3496bd6782f574ae7446158c16731829d32e8bfb63fab150f48ea544d25",
15
+ "licenses/RUST-THIRD-PARTY-NOTICES.txt": "58643c0cc3818bc1ba15c62fe3e6b16e8a908e71b91035edb2ee0a17590178d2",
16
+ "licenses/aimux/LICENSE": "a2c9dc2f4c67b2e61f36e57e2071044d0ae4d5f21cd55a14cf9c6644d3d3736d",
17
+ "licenses/grok-build/LICENSE": "f481edaaea56bb9fadac0191287f3b243a4bf63114a707a2b2a267fbfea598d5",
18
+ "licenses/grok-build/NOTICE": "68ad4ae1348959ca02ae573c19e3b93fad42d3a57cf8cc865ac5314c5c18d72f",
19
+ "plugins/plugin-authoring/dim-plugin.json": "4a85cb9348e280e524809131dacc8f966b86563e6a57fd66dcc9ff5eada5a0ba",
20
+ "licenses/grok-build/xai-ratatui-inline/NOTICE": "c517c97bb5307d3a8a6f09cd3e12d25abcb0620878b60919fad88d45049ae067",
21
+ "licenses/grok-build/xai-ratatui-textarea/NOTICE": "7905836dbbada5b222198ccd40ae18a269ec9ac334a7c1e6eb05d66c808f12c9",
22
+ "plugins/plugin-authoring/skills/plugin-authoring/SKILL.md": "689242b403453e63dbf9f185e6c2385051ae5cd2deb1d8174233c624582e6bb4"
23
23
  }
24
24
  }