@kubohiroya/turbowarp-named-functions 0.2.0 → 0.4.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.ja.md +13 -3
- package/README.md +14 -3
- package/assets/block-icon.svg +1 -0
- package/package.json +19 -11
package/README.ja.md
CHANGED
|
@@ -2,12 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
<img src="assets/block-icon.svg" alt="" width="48" height="48">
|
|
4
4
|
|
|
5
|
-
[English](README.md) |
|
|
5
|
+
[English](README.md) | 日本語
|
|
6
6
|
|
|
7
7
|
JSONの引数を受け取りJSONの結果を返す「名前を持つ関数」を定義するTurboWarp機能拡張です。スクリプトから名前で呼び出して結果を待つことも、いくつか開始しておいてあとでまとめて待つこともできます。ツールとして公開する印を付けると、AIのツール呼び出しなど、ほかの拡張から使えるようになります。
|
|
8
8
|
|
|
9
9
|
**利用ガイド:** [English](https://kubohiroya.github.io/turbowarp-named-functions/) | [日本語](https://kubohiroya.github.io/turbowarp-named-functions/ja/)
|
|
10
10
|
|
|
11
|
+
## 実行できるサンプル
|
|
12
|
+
|
|
13
|
+
[**TurboWarp Editorでデモを開く**](https://turbowarp.org/editor?project_url=https%3A%2F%2Fkubohiroya.github.io%2Fturbowarp-named-functions%2Fsamples%2Fcall-greeting-function.sb3) · [SB3をダウンロード](https://kubohiroya.github.io/turbowarp-named-functions/samples/call-greeting-function.sb3)
|
|
14
|
+
|
|
15
|
+
**Run without sandbox**を選んで**Allow**し、緑の旗を押します。
|
|
16
|
+
`defineFunction`で引数を受け、`functionArgument`・`returnValue`・`callFunction`で挨拶を返す。サンプルの元データと期待結果は[`samples/README.md`](samples/README.md)に記載しています。
|
|
17
|
+
|
|
18
|
+
`pnpm run samples:build`でSB3を再生成し、`pnpm run samples:check`で更新漏れと生成処理を確認します。
|
|
19
|
+
|
|
11
20
|
## できること
|
|
12
21
|
|
|
13
22
|
- `define function`ハットで関数を定義する(名前、説明、引数のJSON Schema)
|
|
@@ -37,7 +46,7 @@ JSONの引数を受け取りJSONの結果を返す「名前を持つ関数」を
|
|
|
37
46
|
npm packageとして使う場合は、検証済みのversionをexact pinします。
|
|
38
47
|
|
|
39
48
|
```bash
|
|
40
|
-
pnpm add --save-exact @kubohiroya/turbowarp-named-functions@0.
|
|
49
|
+
pnpm add --save-exact @kubohiroya/turbowarp-named-functions@0.4.0
|
|
41
50
|
```
|
|
42
51
|
|
|
43
52
|
## クイックスタート
|
|
@@ -349,9 +358,10 @@ Composition APIをimportしても、単独のTurboWarp機能拡張は登録さ
|
|
|
349
358
|
|
|
350
359
|
## 開発
|
|
351
360
|
|
|
352
|
-
Node.js
|
|
361
|
+
Node.js 24以上と、`packageManager`で指定したpnpmを使います。
|
|
353
362
|
|
|
354
363
|
```bash
|
|
364
|
+
npm install --global corepack@latest
|
|
355
365
|
corepack enable
|
|
356
366
|
pnpm install --frozen-lockfile
|
|
357
367
|
pnpm check
|
package/README.md
CHANGED
|
@@ -2,12 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
<img src="assets/block-icon.svg" alt="" width="48" height="48">
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
English | [日本語](README.ja.md)
|
|
6
6
|
|
|
7
7
|
A TurboWarp extension for defining named functions that take JSON arguments and return JSON results. Scripts can call them by name, wait for the result, or start several calls and await them later. Functions can be marked for export as tools so that other extensions, such as AI tool calling, can use them.
|
|
8
8
|
|
|
9
9
|
**User guide:** [English](https://kubohiroya.github.io/turbowarp-named-functions/) | [日本語](https://kubohiroya.github.io/turbowarp-named-functions/ja/)
|
|
10
10
|
|
|
11
|
+
## Runnable sample
|
|
12
|
+
|
|
13
|
+
[**Open the demo in TurboWarp Editor**](https://turbowarp.org/editor?project_url=https%3A%2F%2Fkubohiroya.github.io%2Fturbowarp-named-functions%2Fsamples%2Fcall-greeting-function.sb3) · [Download the SB3](https://kubohiroya.github.io/turbowarp-named-functions/samples/call-greeting-function.sb3)
|
|
14
|
+
|
|
15
|
+
Select **Run without sandbox**, then **Allow**, and click the green flag.
|
|
16
|
+
The named function returns Hello, TurboWarp!.
|
|
17
|
+
|
|
18
|
+
Editable sources and expected results: [`samples/README.md`](samples/README.md).
|
|
19
|
+
Run `pnpm run samples:build` after source/bundle changes and `pnpm run samples:check` before committing.
|
|
20
|
+
|
|
11
21
|
## What it does
|
|
12
22
|
|
|
13
23
|
- Defines functions with a `define function` hat: a name, a description, and a JSON Schema for the arguments.
|
|
@@ -40,7 +50,7 @@ A TurboWarp extension for defining named functions that take JSON arguments and
|
|
|
40
50
|
### npm package
|
|
41
51
|
|
|
42
52
|
```bash
|
|
43
|
-
pnpm add --save-exact @kubohiroya/turbowarp-named-functions@0.
|
|
53
|
+
pnpm add --save-exact @kubohiroya/turbowarp-named-functions@0.4.0
|
|
44
54
|
```
|
|
45
55
|
|
|
46
56
|
Standalone bundle:
|
|
@@ -447,9 +457,10 @@ exported for consumers that resolve schemas themselves, and `scanFunctionDefinit
|
|
|
447
457
|
|
|
448
458
|
## Development
|
|
449
459
|
|
|
450
|
-
Use Node.js
|
|
460
|
+
Use Node.js 24 or newer and the pnpm version declared by `packageManager`.
|
|
451
461
|
|
|
452
462
|
```bash
|
|
463
|
+
npm install --global corepack@latest
|
|
453
464
|
corepack enable
|
|
454
465
|
pnpm install --frozen-lockfile
|
|
455
466
|
pnpm check
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><rect x="4" y="8" width="40" height="32" rx="6" fill="#8A55D7"/><text x="24" y="31" font-family="monospace" font-size="16" font-weight="bold" text-anchor="middle" fill="#fff">f(x)</text></svg>
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-named-functions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Named, JSON-in/JSON-out functions for TurboWarp that can be called by name, synchronously or asynchronously, and exported as tools.",
|
|
5
|
-
"author":
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Hiroya Kubo",
|
|
7
|
+
"email": "hiroya@cuc.ac.jp",
|
|
8
|
+
"url": "https://github.com/kubohiroya"
|
|
9
|
+
},
|
|
6
10
|
"license": "MPL-2.0",
|
|
7
11
|
"homepage": "https://github.com/kubohiroya/turbowarp-named-functions#readme",
|
|
8
12
|
"repository": {
|
|
@@ -24,6 +28,7 @@
|
|
|
24
28
|
],
|
|
25
29
|
"type": "module",
|
|
26
30
|
"files": [
|
|
31
|
+
"assets/",
|
|
27
32
|
"dist/",
|
|
28
33
|
"src/",
|
|
29
34
|
"README.md",
|
|
@@ -35,9 +40,9 @@
|
|
|
35
40
|
"access": "public",
|
|
36
41
|
"registry": "https://registry.npmjs.org/"
|
|
37
42
|
},
|
|
38
|
-
"packageManager": "pnpm@11.
|
|
43
|
+
"packageManager": "pnpm@11.28.8",
|
|
39
44
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
45
|
+
"node": ">=24"
|
|
41
46
|
},
|
|
42
47
|
"scripts": {
|
|
43
48
|
"dev": "vite build --watch",
|
|
@@ -50,14 +55,17 @@
|
|
|
50
55
|
"repo:check": "node scripts/check-repo.ts",
|
|
51
56
|
"site:check": "node scripts/check-site.ts",
|
|
52
57
|
"pack:check": "npm pack --dry-run --ignore-scripts",
|
|
53
|
-
"check": "pnpm run typecheck && pnpm run lint && pnpm run test && pnpm run docs:check && pnpm run site:check && pnpm run check:dist && pnpm run types:composition:check && pnpm run repo:check && pnpm run pack:check",
|
|
58
|
+
"check": "pnpm run typecheck && pnpm run lint && pnpm run test && pnpm run docs:check && pnpm run site:check && pnpm run check:dist && pnpm run types:composition:check && pnpm run repo:check && pnpm run pack:check && pnpm run samples:check",
|
|
54
59
|
"check:dist": "pnpm run build && node scripts/check-dist.ts",
|
|
55
|
-
"types:composition:check": "tsc --project tsconfig.composition-consumer.json"
|
|
60
|
+
"types:composition:check": "tsc --project tsconfig.composition-consumer.json",
|
|
61
|
+
"samples:build": "node scripts/build-samples.mjs",
|
|
62
|
+
"samples:check": "node scripts/build-samples.mjs --check && node --test scripts/verify-samples.mjs",
|
|
63
|
+
"pages:build": "node scripts/prepare-pages.mjs"
|
|
56
64
|
},
|
|
57
65
|
"devDependencies": {
|
|
58
66
|
"@eslint/js": "^9.39.5",
|
|
59
|
-
"@kubohiroya/turbowarp-extension-manifest": "^0.
|
|
60
|
-
"@kubohiroya/vite-plugin-turbowarp-extension": "^0.
|
|
67
|
+
"@kubohiroya/turbowarp-extension-manifest": "^0.5.0",
|
|
68
|
+
"@kubohiroya/vite-plugin-turbowarp-extension": "^0.10.0",
|
|
61
69
|
"@types/node": "^24.13.3",
|
|
62
70
|
"eslint": "^9.39.5",
|
|
63
71
|
"jiti": "^2.7.0",
|
|
@@ -75,11 +83,11 @@
|
|
|
75
83
|
"./package.json": "./package.json"
|
|
76
84
|
},
|
|
77
85
|
"dependencies": {
|
|
78
|
-
"@kubohiroya/turbowarp-extension-data-editor": "^0.
|
|
86
|
+
"@kubohiroya/turbowarp-extension-data-editor": "^0.5.0"
|
|
79
87
|
},
|
|
80
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "40ee15fd1870dc4f28ea2dec3f9d8a479671dbb1",
|
|
81
89
|
"x-turbowarp-source": {
|
|
82
|
-
"revision": "
|
|
90
|
+
"revision": "40ee15fd1870dc4f28ea2dec3f9d8a479671dbb1",
|
|
83
91
|
"revisionRole": "base-commit",
|
|
84
92
|
"sourceState": "local-release-overlay"
|
|
85
93
|
}
|