@kubohiroya/turbowarp-named-functions 0.1.1 → 0.1.2
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 +6 -2
- package/README.md +18 -7
- package/package.json +3 -2
package/README.ja.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
JSONの引数を受け取りJSONの結果を返す「名前を持つ関数」を定義するTurboWarp機能拡張です。スクリプトから名前で呼び出して結果を待つことも、いくつか開始しておいてあとでまとめて待つこともできます。ツールとして公開する印を付けると、AIのツール呼び出しなど、ほかの拡張から使えるようになります。
|
|
6
6
|
|
|
7
|
-
**利用ガイド:** [English](https://kubohiroya.github.io/turbowarp-named-functions/)
|
|
7
|
+
**利用ガイド:** [English](https://kubohiroya.github.io/turbowarp-named-functions/) | [日本語](https://kubohiroya.github.io/turbowarp-named-functions/ja/)
|
|
8
8
|
|
|
9
9
|
## できること
|
|
10
10
|
|
|
@@ -35,7 +35,7 @@ JSONの引数を受け取りJSONの結果を返す「名前を持つ関数」を
|
|
|
35
35
|
npm packageとして使う場合は、検証済みのversionをexact pinします。
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
pnpm add --save-exact @kubohiroya/turbowarp-named-functions@0.1.
|
|
38
|
+
pnpm add --save-exact @kubohiroya/turbowarp-named-functions@0.1.2
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
## クイックスタート
|
|
@@ -197,6 +197,10 @@ define schema [Player] version [1.0.0]
|
|
|
197
197
|
|
|
198
198
|
ネストしたobjectやarrayのpropertyは別の名前付きSchemaを参照できるようにし、同じSchemaを関数の引数・戻り値・名前付きデータに選べるようにします。ブロック列は`validateAgainstSchema`が扱うcanonical JSON Schemaへ変換し、別の検証形式を作らず、既存のJSON文字列プロジェクトもそのまま使います。これはブロック仕様案であり、まだ実装されていません。実装境界はSchema定義と変換層です。リテラルのブロック項目を読み、重複・不正な定義を報告してcanonical schemaを生成します。Schema読み込み時に任意のブロックを実行しません。ブロックのmutation UIやネストSchemaの編集体験は別の実装作業です。
|
|
199
199
|
|
|
200
|
+
### named dataとのSchema identity
|
|
201
|
+
|
|
202
|
+
named-dataが運ぶのはstructured valueの`{id, version}` identityだけです。IDは`^[a-z][a-z0-9.-]{0,127}$`に一致し、versionは完全なSemVerである必要があります。Schema catalogはconsumerが所有します。戻されたJSON値を検証する前にidentityと完全一致するSchemaを解決してください。IDやversionが見つからない場合は明示的に失敗し、別versionへfallbackしません。このpackageの関数引数/戻り値Schemaは引き続きinlineのcanonical JSON Schemaです。対応subsetは`type`、`properties`、`required`、Boolean形式の`additionalProperties`、`items`、`enum`、`const`、`minimum`、`maximum`、`minLength`、`maxLength`、`minItems`、`maxItems`です。その他のkeywordは検証動作を追加しません。
|
|
203
|
+
|
|
200
204
|
## Composition API
|
|
201
205
|
|
|
202
206
|
Composition APIをimportしても、単独のTurboWarp機能拡張は登録されません。利用する側の拡張が自分のブロックと`define function`ハットのopcodeを持ち、ハットの条件判定と、引数・戻り値のブロックの処理をこのAPIに渡します。使い方は[英語版README](README.md#composition-api)を参照してください。
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
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.
|
|
6
6
|
|
|
7
|
-
**User guide:** [English](https://kubohiroya.github.io/turbowarp-named-functions/)
|
|
7
|
+
**User guide:** [English](https://kubohiroya.github.io/turbowarp-named-functions/) | [日本語](https://kubohiroya.github.io/turbowarp-named-functions/ja/)
|
|
8
8
|
|
|
9
9
|
## What it does
|
|
10
10
|
|
|
@@ -38,7 +38,7 @@ A TurboWarp extension for defining named functions that take JSON arguments and
|
|
|
38
38
|
### npm package
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
pnpm add --save-exact @kubohiroya/turbowarp-named-functions@0.1.
|
|
41
|
+
pnpm add --save-exact @kubohiroya/turbowarp-named-functions@0.1.2
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Standalone bundle:
|
|
@@ -216,6 +216,17 @@ layer: it reads literal block fields, reports duplicate/invalid definitions, and
|
|
|
216
216
|
canonical schema. It does not execute arbitrary blocks while loading a schema. Editor block
|
|
217
217
|
mutation and nested-schema UX remain separate implementation work.
|
|
218
218
|
|
|
219
|
+
### Schema identity with named data
|
|
220
|
+
|
|
221
|
+
Named-data carries only a structured value's `{id, version}` schema identity; IDs must match
|
|
222
|
+
`^[a-z][a-z0-9.-]{0,127}$` and versions must be complete SemVer values. The consumer owns the
|
|
223
|
+
schema catalog. Resolve the exact identity before validating the returned JSON value with
|
|
224
|
+
`validateAgainstSchema`. An unknown ID or version must fail explicitly, with no fallback to a
|
|
225
|
+
different version. This package continues to use inline canonical JSON Schema for function
|
|
226
|
+
arguments and returns. Its supported subset is `type`, `properties`, `required`,
|
|
227
|
+
`additionalProperties` (boolean), `items`, `enum`, `const`, `minimum`, `maximum`, `minLength`,
|
|
228
|
+
`maxLength`, `minItems`, and `maxItems`; other keywords do not add validation behavior.
|
|
229
|
+
|
|
219
230
|
## Composition API
|
|
220
231
|
|
|
221
232
|
Importing the Composition API does not register the standalone TurboWarp extension. The consumer
|
|
@@ -279,14 +290,14 @@ SCRATCH_VM_PATH=/path/to/TurboWarp/scratch-vm pnpm test
|
|
|
279
290
|
|
|
280
291
|
[Mozilla Public License 2.0](LICENSE) (SPDX: `MPL-2.0`).
|
|
281
292
|
|
|
282
|
-
##
|
|
293
|
+
## Fixed-input editing form
|
|
283
294
|
|
|
284
|
-
|
|
295
|
+
When the shared editor's `blockEditorFixedInputs` startup flag and Dialogs are both ON in the GUI, only the `EXPORT` input of `defineFunction` is registered as a fixed-input form. An older GUI, or a GUI with the flag OFF, registers nothing extra. The canonical Schema is `schemas/block-editor-fixed-inputs.schema.json#/$defs/defineFunction/properties/EXPORT`; the codec and registration live in `src/fixed-input-editors.ts`. Existing raw values, unchanged aliases, and unknown enum values are not rewritten by a save without edits, and reporters are not evaluated. Only explicit changes are validated, and other arguments, block declarations, and the saved format are left unchanged.
|
|
285
296
|
|
|
286
|
-
|
|
297
|
+
The hat's inline EXPORT dropdown stores `none` or `tool`. The form does not edit or run NAME, DESCRIPTION, SCHEMA, or RETURNS, and its validation never scans functions, starts hats, or publishes tools.
|
|
287
298
|
|
|
288
|
-
|
|
299
|
+
Registration is limited to the optional API (`apiVersion: 1`) and is removed on `RUNTIME_DISPOSED` or an explicit dispose. Turning the startup flag OFF and reloading restores the previous path. To roll back the dependency, restore the manifest, the lockfile, and the actual resolution together. This does not include npm publishing or the dynamic candidates planned for later stages.
|
|
289
300
|
|
|
290
|
-
Schema
|
|
301
|
+
The contract described by the Schema is grounded in the real `getInfo` declarations and the existing pure runtime conversion. The SchemaBundle `retrievalUri` identifies this local document only; it does not mean the Schema is served from that URL or that `$ref`s are resolved over HTTP. The Schema compiles from the bundled documents alone.
|
|
291
302
|
|
|
292
303
|
Registration uses the optional editor API available when the extension instance is constructed. Adding or replacing that API later is not followed automatically; reload the GUI and reconstruct the extension instance after changing the startup configuration.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-named-functions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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
5
|
"author": "Hiroya Kubo <hiroya@cuc.ac.jp>",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -48,8 +48,9 @@
|
|
|
48
48
|
"docs": "node scripts/generate-readme.ts && node scripts/generate-fixed-input-docs.mjs",
|
|
49
49
|
"docs:check": "node scripts/generate-readme.ts --check && node scripts/generate-fixed-input-docs.mjs --check",
|
|
50
50
|
"repo:check": "node scripts/check-repo.ts",
|
|
51
|
+
"site:check": "node scripts/check-site.ts",
|
|
51
52
|
"pack:check": "npm pack --dry-run --ignore-scripts",
|
|
52
|
-
"check": "pnpm run typecheck && pnpm run lint && pnpm run test && pnpm run docs:check && pnpm run check:dist && pnpm run types:composition:check && pnpm run repo:check && pnpm run pack:check",
|
|
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",
|
|
53
54
|
"check:dist": "pnpm run build && node scripts/check-dist.ts",
|
|
54
55
|
"types:composition:check": "tsc --project tsconfig.composition-consumer.json"
|
|
55
56
|
},
|