@worldapptechnologies/nulu-agent-tool-presentation 0.0.0-stage → 1.6.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,119 @@
1
- # Temporary Holding Version
1
+ ---
2
+ description: "The agent-plane presentation selector for users and maintainers choosing, configuring, or debugging which form of its tools an agent preset's models see."
3
+ kind: "package-reference"
4
+ ---
2
5
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
6
+ # @worldapptechnologies/nulu-agent-tool-presentation
7
+
8
+
9
+ ## Summary
10
+
11
+ Use `nulu-agent-tool-presentation` in an [agent preset](../../preset/agent-presets/README.md) to fix whether models see every native tool schema, only `run_code` with a generated SDK, or both forms. Each preset can choose independently, so native and PTC agents can share one process without sharing tool catalogs. Selecting `ptc` or `both` requires a compatible PTC runtime; a deployment without one rejects the preset at mount time before its first prompt. The `mode` field is required when this package is present, while omitting the package keeps the deployment default.
12
+
13
+ ## Table of Contents
14
+
15
+ - [Use this package](#use-this-package)
16
+ - [Understand the implementation](#understand-the-implementation)
17
+ - [Further Exploration](#further-exploration)
18
+ - [Model Experience](#model-experience)
19
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
20
+ - [Dev Note](#dev-note)
21
+
22
+ -----
23
+
24
+ <a id="use-this-package"></a>
25
+ ## Use this package
26
+
27
+ Add this row to an agent preset to fix how every agent joined to that preset sees its tools. `native` presents each visible tool schema as a function definition; `ptc` presents only the `run_code` transport plus a generated SDK and the rule that only `run_code` may be called directly; `both` presents both forms. Agents that declare nothing get the deployment-wide `mode` on the [`nulu-tools`](../tools/README.md) row.
28
+
29
+ ### Add the row to a preset
30
+
31
+ ```yaml
32
+ - name: '@worldapptechnologies/nulu-agent-tool-presentation'
33
+ config:
34
+ mode: ptc
35
+ ```
36
+
37
+ | Field | Default | Meaning |
38
+ |---|---|---|
39
+ | `mode` | required | `native` — every schema; `ptc` — `run_code` plus generated SDK; `both` — both forms |
40
+
41
+ The generated [configuration catalog](../../../docs/config-catalog.md#worldapptechnologiesnulu-agent-tool-presentation) is the exhaustive source for every accepted field. `mode` is required rather than defaulted because a preset without this row inherits the deployment default.
42
+
43
+ ### What PTC mode requires
44
+
45
+ Selecting `ptc` or `both` needs a composed PTC runtime (`ctx.ptcRuntime`) whose language has a registered SDK renderer — the TypeScript runtime ships via [`nulu-ptc-runtime-node`](../../ptc-runtime/ptc-runtime-node/README.md), and both the TypeScript and Python SDK renderers are built into `nulu-tools`. A preset that selects a PTC mode against a deployment composing no such runtime refuses to mount, naming this row, so the failure lands where the operator can act instead of at the session's first request.
46
+
47
+ ### One presentation per agent
48
+
49
+ One agent declares one presentation. A second declaration in the same composition is refused rather than merged: two answers to "which form does the model see" is a contradiction, not an override.
50
+
51
+ -----
52
+
53
+ <a id="understand-the-implementation"></a>
54
+ ## Understand the implementation
55
+
56
+ <details>
57
+ <summary>Implementation internals — click to expand</summary>
58
+
59
+ This section explains how the package realizes the behavior above; the observable contract is covered in [Use this package](#use-this-package).
60
+
61
+ ### Design concept
62
+
63
+ The tool registry cannot move into a preset: its consumers are all host-plane — the agent loop reads its scheduler, the API proxy reads its presenters, and every tool plugin registers into it — and a service only moves down when all of its consumers move with it. What a preset can own is the presentation of that registry. `ctx.tools.presentAs()` declares it for the mounting scope, which is the preset's standing mount, so the declaration covers every agent joined to that preset and a PTC mode preset runs beside native ones in one process. One row per composition, not one per session.
64
+
65
+ ### Source map
66
+
67
+ | File | Role |
68
+ |---|---|
69
+ | [`src/index.ts`](src/index.ts) | Plugin entry: `mode` config, `apply` wiring `ctx.tools.presentAs` for the mounting scope |
70
+ | — | No runtime invariant companion is published; this package makes exactly one scoped call into `ctx.tools` and owns no event or snapshot of its own; the relation it establishes — which presentation one agent's assembly uses — is the tool registry's to hold, and `nulu-tools` observes it there. |
71
+
72
+ ### Behavior notes
73
+
74
+ `native` applies immediately. A PTC mode instead waits for `ctx.ptcRuntime`, a host-plane service: a preset selecting PTC mode against a deployment composing no runtime holds this row pending, and `nulu-agent-presets` refuses the mount naming this id. `presentAs` is itself the effect, so the declaration unwinds with this row without a second wrapper owning it.
75
+
76
+ </details>
77
+
78
+ -----
79
+
80
+ <a id="further-exploration"></a>
81
+ ## Further Exploration
82
+
83
+ The package-level contract is enough for most consumers; read these when you need the surrounding domain.
84
+
85
+ - [tools package](../tools/README.md) — the tool presentation modes and `presentAs` API.
86
+ - [agent-presets package](../../preset/agent-presets/README.md) — how presets compose agents and their standing mounts.
87
+ - [Node ptc-runtime package](../../ptc-runtime/ptc-runtime-node/README.md) — the TypeScript runtime a PTC mode needs.
88
+ - [PTC mode executor-collapse note](../../../.agents/notes/implemented/bug-fix/2026-08-07-ptc-executor-collapse.md) — why the announced and callable surfaces stay the same.
89
+ - [Core group map](../README.md) — how the core packages compose.
90
+
91
+ -----
92
+
93
+ <a id="model-experience"></a>
94
+ ## Model Experience
95
+
96
+ Indirectly, through the tool presentation it selects in `nulu-tools` — the row only chooses between the two projections `nulu-tools` owns and registers no prompt, schema, or result of its own.
97
+
98
+ #### KV Cache effect
99
+
100
+ No direct invalidation; the presentation is fixed when the agent is composed, so its request prefix is stable for the session's life.
101
+
102
+ ## Known Limitations and Deferred Work
103
+
104
+ <a id="known-limitations-and-deferred-work"></a>
105
+
106
+
107
+ These limits define when this row needs special care. They are current package constraints, not a task backlog.
108
+
109
+ - **The runtime stays host-plane** — a preset can select PTC mode but cannot supply the TypeScript runtime it needs; a deployment that composes none can compose no PTC preset.
110
+
111
+ <a id="dev-note"></a>
112
+ ### Dev Note
113
+
114
+ <details>
115
+ <summary>Working context for maintainers — click to expand</summary>
116
+
117
+ None.
118
+
119
+ </details>
package/lib/index.js ADDED
@@ -0,0 +1,51 @@
1
+ import z from "@worldapptechnologies/schemastery";
2
+ //#region lib/types/index.js
3
+ /**
4
+ * Agent-plane presentation selector: the row an agent preset carries to say
5
+ * which form of its tools the model sees.
6
+ *
7
+ * The tool registry itself stays on the host plane — the agent loop's
8
+ * scheduler, the API proxy's presenters, and every tool plugin are all its
9
+ * consumers, so it cannot move into a preset. What a preset CAN own is the
10
+ * presentation: `ctx.tools.presentAs()` declares it for the mounting SCOPE,
11
+ * which is the preset's standing mount, so the declaration covers every agent
12
+ * joined to that preset and a PTC mode preset runs beside native ones in one
13
+ * process. One row per composition, not one per session.
14
+ *
15
+ * A PTC mode needs a TypeScript PTC runtime, which is a host-plane service
16
+ * ([`nulu-ptc-runtime-node`](../../../ptc-runtime/ptc-runtime-node/README.md)).
17
+ * This row therefore waits for it rather than assuming it: a preset selecting
18
+ * PTC mode against a deployment that composes no runtime fails at mount, named
19
+ * in the preset's own activation audit, instead of at the first prompt.
20
+ * @module @worldapptechnologies/nulu-agent-tool-presentation
21
+ */
22
+ /** Cordis plugin name. */
23
+ const name = "tool-presentation";
24
+ /**
25
+ * Required services. `ptcRuntime` is NOT listed: a `native` row must mount in
26
+ * a deployment that composes no runtime, and the mode-dependent wait is
27
+ * declared inside {@link apply} instead.
28
+ */
29
+ const inject = ["tools"];
30
+ /** Runtime schema. */
31
+ const Config = z.object({ mode: z.union([
32
+ "native",
33
+ "ptc",
34
+ "both"
35
+ ]).required() });
36
+ /**
37
+ * Declare the tool presentation for every agent this composition covers.
38
+ * @param ctx - the mounting composition's scope context (a preset's standing scope).
39
+ * @param config - the selected presentation.
40
+ */
41
+ function apply(ctx, config) {
42
+ if (config.mode === "native") {
43
+ ctx.tools.presentAs("native");
44
+ return;
45
+ }
46
+ ctx.inject(["ptcRuntime"], (runtimeCtx) => {
47
+ runtimeCtx.tools.presentAs(config.mode);
48
+ });
49
+ }
50
+ //#endregion
51
+ export { Config, apply, inject, name };
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Agent-plane presentation selector: the row an agent preset carries to say
3
+ * which form of its tools the model sees.
4
+ *
5
+ * The tool registry itself stays on the host plane — the agent loop's
6
+ * scheduler, the API proxy's presenters, and every tool plugin are all its
7
+ * consumers, so it cannot move into a preset. What a preset CAN own is the
8
+ * presentation: `ctx.tools.presentAs()` declares it for the mounting SCOPE,
9
+ * which is the preset's standing mount, so the declaration covers every agent
10
+ * joined to that preset and a PTC mode preset runs beside native ones in one
11
+ * process. One row per composition, not one per session.
12
+ *
13
+ * A PTC mode needs a TypeScript PTC runtime, which is a host-plane service
14
+ * ([`nulu-ptc-runtime-node`](../../../ptc-runtime/ptc-runtime-node/README.md)).
15
+ * This row therefore waits for it rather than assuming it: a preset selecting
16
+ * PTC mode against a deployment that composes no runtime fails at mount, named
17
+ * in the preset's own activation audit, instead of at the first prompt.
18
+ * @module @worldapptechnologies/nulu-agent-tool-presentation
19
+ */
20
+ import type { Context } from '@worldapptechnologies/cordis';
21
+ import z from '@worldapptechnologies/schemastery';
22
+ import type { ToolPresentationMode } from '@worldapptechnologies/nulu-tools';
23
+ /** Cordis plugin name. */
24
+ export declare const name = "tool-presentation";
25
+ /**
26
+ * Required services. `ptcRuntime` is NOT listed: a `native` row must mount in
27
+ * a deployment that composes no runtime, and the mode-dependent wait is
28
+ * declared inside {@link apply} instead.
29
+ */
30
+ export declare const inject: string[];
31
+ /** Plugin config. */
32
+ export interface Config {
33
+ /**
34
+ * The form this agent's model sees. `native` sends every visible schema,
35
+ * `ptc` sends only `run_code` plus a generated SDK, `both` sends both.
36
+ * Required rather than defaulted: the deployment default is what a preset
37
+ * without this row already gets, so an omitted value would mean the row was
38
+ * composed for nothing.
39
+ */
40
+ mode: ToolPresentationMode;
41
+ }
42
+ /** Runtime schema. */
43
+ export declare const Config: z<Config>;
44
+ /**
45
+ * Declare the tool presentation for every agent this composition covers.
46
+ * @param ctx - the mounting composition's scope context (a preset's standing scope).
47
+ * @param config - the selected presentation.
48
+ */
49
+ export declare function apply(ctx: Context, config: Config): void;
50
+ //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "@worldapptechnologies/nulu-agent-tool-presentation",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "Agent-plane presentation selector: composes one agent's tools as PTC mode, native, or both",
4
+ "version": "1.6.4",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/worldapptechnologies/nulu-harness.git",
11
+ "directory": "packages/core/agent-tool-presentation"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./src/*": "./src/*",
22
+ "./package.json": "./package.json"
23
+ },
24
+ "files": [
25
+ "lib/index.js",
26
+ "lib/types/**/*.d.ts"
27
+ ],
28
+ "license": "MIT",
29
+ "dependencies": {
30
+ "@worldapptechnologies/schemastery": "^3.18.2"
31
+ },
32
+ "peerDependencies": {
33
+ "@worldapptechnologies/nulu-tools": "^1.6.4",
34
+ "@worldapptechnologies/cordis": "^4.0.2"
35
+ },
36
+ "devDependencies": {
37
+ "@worldapptechnologies/nulu-agent": "^1.6.4",
38
+ "@worldapptechnologies/nulu-ptc-runtime": "^1.6.4",
39
+ "@worldapptechnologies/nulu-scope": "^1.6.4",
40
+ "@worldapptechnologies/nulu-session": "^1.6.4",
41
+ "@worldapptechnologies/nulu-system-prompt": "^1.6.4",
42
+ "@worldapptechnologies/nulu-tools": "^1.6.4",
43
+ "@worldapptechnologies/cordis": "^4.0.2"
44
+ }
6
45
  }