@noetic-tools/types 1.1.0 → 1.2.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.
@@ -13,6 +13,28 @@ export interface RetryPolicy {
13
13
  /** Upper bound in ms for the computed delay (caps exponential/linear growth). */
14
14
  maxDelay?: number;
15
15
  }
16
+ /**
17
+ * Declares an OpenRouter server-executed tool on an LLM step. OpenRouter runs
18
+ * the tool (web search, web fetch) provider-side and returns the result item in
19
+ * the response — no client-side execute function is involved.
20
+ *
21
+ * `parameters` keys are camelCase (e.g. `maxResults`, `searchContextSize`); the
22
+ * SDK re-serialises them to the wire format and silently drops unknown keys.
23
+ * @public
24
+ */
25
+ export interface ServerToolSpec {
26
+ /** Server tool discriminator. */
27
+ type: 'openrouter:web_search' | 'openrouter:web_fetch';
28
+ /** Optional provider config forwarded to the tool (camelCase keys). */
29
+ parameters?: Record<string, unknown>;
30
+ }
31
+ /**
32
+ * Distinguishes an inline `ServerToolSpec` from a client `Tool` in a
33
+ * heterogeneous `tools` list. A server-tool spec carries a server-tool `type`
34
+ * discriminator and, unlike a `Tool`, has no `execute` method.
35
+ * @public
36
+ */
37
+ export declare function isServerToolSpec(value: unknown): value is ServerToolSpec;
16
38
  /**
17
39
  * Optional parameters forwarded to the model provider during an LLM step.
18
40
  * @public
@@ -1 +1,19 @@
1
- export {};
1
+ /**
2
+ * Distinguishes an inline `ServerToolSpec` from a client `Tool` in a
3
+ * heterogeneous `tools` list. A server-tool spec carries a server-tool `type`
4
+ * discriminator and, unlike a `Tool`, has no `execute` method.
5
+ * @public
6
+ */
7
+ export function isServerToolSpec(value) {
8
+ if (typeof value !== 'object' || value === null) {
9
+ return false;
10
+ }
11
+ if ('execute' in value) {
12
+ return false;
13
+ }
14
+ if (!('type' in value)) {
15
+ return false;
16
+ }
17
+ const { type } = value;
18
+ return type === 'openrouter:web_search' || type === 'openrouter:web_fetch';
19
+ }
@@ -1,6 +1,6 @@
1
1
  import type { ZodType } from 'zod';
2
2
  import type { Channel, ChannelHandle, ExternalChannel } from './channel.js';
3
- import type { LLMResponse, ModelParams } from './common.js';
3
+ import type { LLMResponse, ModelParams, ServerToolSpec } from './common.js';
4
4
  import type { Context, CwdState } from './context.js';
5
5
  import type { DetachedHandle } from './detached.js';
6
6
  import type { FsAdapter } from './fs-adapter.js';
@@ -54,6 +54,16 @@ interface CallModelRequestBase {
54
54
  outputSchema?: ZodType;
55
55
  /** Controls framework event emission. Defaults to `true`. Passed through from `StepLLM.emit`. */
56
56
  emit?: boolean | ((eventType: string, data: Record<string, unknown>) => boolean);
57
+ /**
58
+ * @internal
59
+ * Framework-internal carrier for OpenRouter server tools (web search/fetch).
60
+ * Server tools are an authoring concept inside `StepLLM.tools` — the
61
+ * interpreter partitions those entries out of the client `tools` list and
62
+ * stamps the specs here so the model caller can wrap them via the SDK's
63
+ * `serverTool()` and append them to the SDK tools array. NOT an authored
64
+ * field: public callers declare server tools as `tools` entries, never here.
65
+ */
66
+ _serverTools?: ServerToolSpec[];
57
67
  /** Optional signal for cancelling the in-flight call (used by session abort). */
58
68
  signal?: AbortSignal;
59
69
  /**
@@ -1,6 +1,6 @@
1
1
  import type { ZodType } from 'zod';
2
2
  import type { Channel } from './channel.js';
3
- import type { ModelParams, RetryPolicy, StepMeta } from './common.js';
3
+ import type { ModelParams, RetryPolicy, ServerToolSpec, StepMeta } from './common.js';
4
4
  import type { Context } from './context.js';
5
5
  import type { NoeticError } from './error.js';
6
6
  import type { ContextMemory, MemoryConfig, MemoryLayer, ProjectionPolicy } from './memory.js';
@@ -94,8 +94,14 @@ export interface StepLLM<TMemory = ContextMemory, _I = unknown, O = unknown> {
94
94
  model: Lazy<string, TMemory>;
95
95
  /** System instructions. Eager string or `(ctx) => string | undefined` getter. */
96
96
  instructions?: Lazy<string | undefined, TMemory>;
97
- /** Tools exposed to the LLM. Eager array or `(ctx) => Tool[] | undefined` getter. Function-form tools do not contribute to the pre-computed `ctx.unifiedTools`; they are resolved per execution. */
98
- tools?: Lazy<Tool[] | undefined, TMemory>;
97
+ /**
98
+ * Tools exposed to the LLM. Eager array or `(ctx) => (...)[] | undefined` getter.
99
+ * Entries are either a client `Tool` or an inline `ServerToolSpec` (an
100
+ * OpenRouter server tool the provider executes, e.g. web search/fetch).
101
+ * Function-form tools do not contribute to the pre-computed `ctx.unifiedTools`;
102
+ * they are resolved per execution.
103
+ */
104
+ tools?: Lazy<(Tool | ServerToolSpec)[] | undefined, TMemory>;
99
105
  output?: ZodType<O>;
100
106
  params?: ModelParams;
101
107
  /** Controls framework event emission for this step. Defaults to `true`. Set `false` to suppress all framework events. A filter function receives `(eventType, data)` and returns `boolean`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noetic-tools/types",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "description": "Foundational type contracts and primitives shared across the Noetic framework (items, LLM config, adapters, steering, errors).",
6
6
  "license": "Apache-2.0",