@qilin-agent/tools 0.0.0-stage → 3.1.4

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.
@@ -0,0 +1,48 @@
1
+ /**
2
+ * PTC mode codegen — Python flavor. The pure projection from registered tool schemas to the
3
+ * Python SDK text the model programs against under `runtime.language === 'python'`. Sibling of
4
+ * {@link ./ts-types.ts | ts-types.ts}; the two files are two projections of the same registry
5
+ * store, keyed by the loaded {@link @qilin-agent/ptc-runtime#PtcRuntime.language | PTC
6
+ * runtime's language}.
7
+ *
8
+ * Under `mode: 'ptc'` the native tool schemas are omitted from the request, so this generated
9
+ * SDK is the model's ONLY source for each tool's argument names, required fields, types,
10
+ * descriptions, and canonical output shapes. Object-shaped arguments and outputs therefore render as one
11
+ * named `TypedDict` per tool (and per nested object), not an opaque `dict[str, Any]`, so the
12
+ * shape survives into the program under the mode that has nothing else to carry it.
13
+ * @module @qilin-agent/tools/src/py-types
14
+ */
15
+ import type { ToolSdkSchema } from './ts-types.ts';
16
+ /**
17
+ * Map one JSON-Schema node to a context-free Python type expression from the
18
+ * `typing` module. Handles every unified schema construct — `object` (degraded
19
+ * to `dict[str, Any]`: naming a `TypedDict` requires the render context that
20
+ * {@link renderToolsSdkPy} supplies), `const`/`enum` (→ `Literal[...]`),
21
+ * `oneOf` (→ union), `string`/`number`/`integer`/`boolean`/`null`, `array`
22
+ * (`items` → `list[T]`) — and returns `Any` for an unsupported or malformed
23
+ * schema, matching the TS flavor's `unknown` fallback. Type annotations in the
24
+ * emitted SDK are advisory: Python does not enforce them at runtime.
25
+ * @param schema - the JSON-Schema node.
26
+ * @returns the Python type text.
27
+ */
28
+ export declare function jsonSchemaToPy(schema: unknown): string;
29
+ /**
30
+ * Render the full `tools:sdk` prompt section under `runtime.language ===
31
+ * 'python'`: the Python-flavored usage instructions plus one named `TypedDict`
32
+ * per tool argument or output object (and per nested object) and one awaitable
33
+ * method per visible tool on a `Tools` protocol — typed args in, the tool's
34
+ * canonical output value out — with a `tools: Tools` singleton the model calls
35
+ * into. The `typing` import line lists exactly the symbols the render used.
36
+ * Deterministic — tools are emitted in lexicographic name order, and class
37
+ * declarations precede the protocol in that same order (nested classes before
38
+ * the parent that references them), so an unchanged tool set produces
39
+ * byte-identical text across assemblies. The sort is not a total order on
40
+ * byte-equal names, so two schemas sharing a name would render in argument
41
+ * order; the caller's visible-capability map is keyed by name, so the input
42
+ * never carries a duplicate.
43
+ * @param schemas - the tool schemas plus canonical output schemas to declare
44
+ * (the caller excludes `run_code` itself).
45
+ * @returns the complete section text.
46
+ */
47
+ export declare function renderToolsSdkPy(schemas: ToolSdkSchema[]): string;
48
+ //# sourceMappingURL=py-types.d.ts.map