@modelprofile.com/flexharness 10.13.0 → 10.15.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.
@@ -1,9 +1,11 @@
1
1
  import * as plugins from './plugins.js';
2
- import { type IFlexCatalogDescribeInput, type IFlexCatalogDescribeResult, type IFlexCatalogMethod, type IFlexCatalogRunContext, type IFlexCatalogSearchInput, type IFlexCatalogToolDefinition, type IFlexToolCatalog, type IFlexToolCatalogOptions, type TFlexCatalogCallError } from './interfaces.js';
2
+ import { type IFlexCatalogProposal, type IFlexCatalogProposalContext, type IFlexCodeModeLimits, type TFlexCatalogCallDecision, type IFlexCatalogDescribeInput, type IFlexCatalogDescribeResult, type IFlexCatalogMethod, type IFlexCatalogRunContext, type IFlexCatalogSearchInput, type IFlexCatalogToolDefinition, type IFlexToolCatalog, type IFlexToolCatalogOptions, type TFlexCatalogCallError } from './interfaces.js';
3
3
  interface IPreparedCall {
4
4
  readonly success: true;
5
5
  readonly method: string;
6
6
  readonly params: unknown;
7
+ /** The method's `onCall` decision for the call; `run` without the hook. */
8
+ decide(context: IFlexCatalogRunContext<any>): Promise<TFlexCatalogCallDecision>;
7
9
  run(context: IFlexCatalogRunContext<any>): ReturnType<IFlexCatalogMethod['run']>;
8
10
  }
9
11
  interface IFailedCall {
@@ -18,6 +20,12 @@ interface IFailedCall {
18
20
  export declare class FlexToolCatalog<TScope = unknown> {
19
21
  private readonly core;
20
22
  private readonly admitted;
23
+ /** The limits of `run_code`; absent while code mode is off. */
24
+ readonly codeMode: Readonly<IFlexCodeModeLimits> | undefined;
25
+ /** Levels of a result's named types a TypeScript declaration declares. */
26
+ private readonly outputTypeDepth;
27
+ /** `search` follows a clear top match with its declaration. */
28
+ private readonly describeTopMatch;
21
29
  private namespaceTree?;
22
30
  private constructor();
23
31
  /**
@@ -32,10 +40,22 @@ export declare class FlexToolCatalog<TScope = unknown> {
32
40
  /** The same catalog offering only `paths`. */
33
41
  restrict(paths: Iterable<string>): FlexToolCatalog<TScope>;
34
42
  has(path: string): boolean;
35
- /** The three built-in tools as the model sees them. Their text depends only on the catalog. */
43
+ /**
44
+ * The built-in tools as the model sees them: the three catalog tools, and `run_code` in code
45
+ * mode. Their text depends only on the catalog and its options.
46
+ */
36
47
  toolDefinitions(): Record<string, IFlexCatalogToolDefinition>;
37
- /** Search results or a namespace listing as text. */
38
- search(input?: IFlexCatalogSearchInput): string;
48
+ private codeToolDefinition;
49
+ /** Hands proposed calls to the catalog's `onProposals` and returns what the model sees for them. */
50
+ propose(proposals: readonly IFlexCatalogProposal[], context: IFlexCatalogProposalContext<TScope>): Promise<unknown>;
51
+ /**
52
+ * Search results or a namespace listing as text. A clear top match of a query's first page is
53
+ * followed by its declaration, as `describe` gives it with `options`.
54
+ */
55
+ search(input?: IFlexCatalogSearchInput, options?: {
56
+ declaredTypes?: Iterable<string>;
57
+ maxBytes?: number;
58
+ }): string;
39
59
  /**
40
60
  * The declarations of `input.methods` and `input.types`. Method declarations bring the named
41
61
  * types they use, minus `declaredTypes`, which a session already has.
@@ -44,7 +64,7 @@ export declare class FlexToolCatalog<TScope = unknown> {
44
64
  declaredTypes?: Iterable<string>;
45
65
  maxBytes?: number;
46
66
  }): IFlexCatalogDescribeResult;
47
- /** The named types `describe_tools` results in `messages` declared. */
67
+ /** The named types the `describe_tools` and `search_tools` results in `messages` declared. */
48
68
  declaredTypesIn(messages: readonly plugins.ModelMessage[] | undefined): Set<string>;
49
69
  /**
50
70
  * Resolves and validates a call. A failure is the error `execute` reports to the model; success
@@ -68,8 +88,8 @@ export declare class FlexToolCatalog<TScope = unknown> {
68
88
  private foreignIssues;
69
89
  }
70
90
  /**
71
- * While a run has a catalog, its three tool names are reserved, and a method path must differ from
72
- * every tool name.
91
+ * While a run has a catalog, its tool names are reserved (`run_code` in code mode too), and a
92
+ * method path must differ from every tool name.
73
93
  */
74
94
  export declare const assertNoCatalogCollisions: (catalog: FlexToolCatalog<unknown>, tools: Readonly<Record<string, unknown>>) => void;
75
95
  /**