@ggui-ai/negotiator 0.22.0 → 0.23.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.
@@ -24,9 +24,10 @@
24
24
  * model text. Implementations MUST NOT inject tool-use blocks when
25
25
  * the caller didn't request them — the text path is used as a
26
26
  * regex-JSON fallback.
27
- * - `callStructured?<T>(...)` is OPTIONAL. When present, it MUST
28
- * return the input of the supplied `ToolSchema`'s tool, parsed as
29
- * `T`, or THROW — never return anything else. It forces the tool
27
+ * - `callStructured?(...)` is OPTIONAL. When present, it MUST
28
+ * return the input of the supplied `ToolSchema`'s tool, as the model
29
+ * produced it (`unknown`: the caller parses it; ggui#1317), or THROW —
30
+ * never return anything else. It forces the tool
30
31
  * where the model allows that; a model that refuses a forced tool
31
32
  * (the always-thinking family) is asked for it without forcing, so
32
33
  * the call can end with no tool input, and that ending is a throw.
@@ -60,7 +61,7 @@ export interface LLMCaller {
60
61
  * this method — consumers detect absence and fall back to regex JSON
61
62
  * extraction on the text path.
62
63
  */
63
- callStructured?<T>(systemPrompt: string, userMessage: string, tool: ToolSchema, maxTokens?: number): Promise<T>;
64
+ callStructured?(systemPrompt: string, userMessage: string, tool: ToolSchema, maxTokens?: number): Promise<unknown>;
64
65
  }
65
66
  /**
66
67
  * Provider + model selector for factory-style LLM caller
@@ -1 +1 @@
1
- {"version":3,"file":"llm-caller.d.ts","sourceRoot":"","sources":["../src/llm-caller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,6DAA6D;AAC7D,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,uFAAuF;AACvF,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,IAAI,CACF,YAAY,EAAE,MAAM,E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AY,GAAG,SAAS,CAAC;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -24,9 +24,10 @@
24
24
  * model text. Implementations MUST NOT inject tool-use blocks when
25
25
  * the caller didn't request them — the text path is used as a
26
26
  * regex-JSON fallback.
27
- * - `callStructured?<T>(...)` is OPTIONAL. When present, it MUST
28
- * return the input of the supplied `ToolSchema`'s tool, parsed as
29
- * `T`, or THROW — never return anything else. It forces the tool
27
+ * - `callStructured?(...)` is OPTIONAL. When present, it MUST
28
+ * return the input of the supplied `ToolSchema`'s tool, as the model
29
+ * produced it (`unknown`: the caller parses it; ggui#1317), or THROW —
30
+ * never return anything else. It forces the tool
30
31
  * where the model allows that; a model that refuses a forced tool
31
32
  * (the always-thinking family) is asked for it without forcing, so
32
33
  * the call can end with no tool input, and that ending is a throw.
@@ -1 +1 @@
1
- {"version":3,"file":"llm-rerank.d.ts","sourceRoot":"","sources":["../src/llm-rerank.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,0CAA0C;AAC1C,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;;;;;OAQG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,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;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;;;;;OAQG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACzE;AAED,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,QAAA,MAAM,oBAAoB,03DAQ6U,CAAC;AAExW,QAAA,MAAM,WAAW,EAAE,UA4BlB,CAAC;AA8EF;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE;IAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAA;CAAE,EACjC,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,SAAS,eAAe,EAAE,GACrC,OAAO,CAAC,cAAc,CAAC,CAwDzB;AAGD,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ggui-ai/negotiator",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "Contract-synthesis + match-judge engine for ggui's handshake. Synthesizes or repairs a conforming DataContract from an agent's draft, judges blueprint-match candidates for reuse, and validates contract structure + novelty — the primitives composed by decideHandshake in @ggui-ai/mcp-server-handlers. Deployment-agnostic: concrete embedding and vector-store bindings plug in via the storage interfaces from @ggui-ai/mcp-server-core.",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -47,8 +47,8 @@
47
47
  }
48
48
  },
49
49
  "dependencies": {
50
- "@ggui-ai/mcp-server-core": "0.22.0",
51
- "@ggui-ai/protocol": "0.22.0"
50
+ "@ggui-ai/mcp-server-core": "0.23.0",
51
+ "@ggui-ai/protocol": "0.23.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^24.0.0",
package/src/llm-caller.ts CHANGED
@@ -24,9 +24,10 @@
24
24
  * model text. Implementations MUST NOT inject tool-use blocks when
25
25
  * the caller didn't request them — the text path is used as a
26
26
  * regex-JSON fallback.
27
- * - `callStructured?<T>(...)` is OPTIONAL. When present, it MUST
28
- * return the input of the supplied `ToolSchema`'s tool, parsed as
29
- * `T`, or THROW — never return anything else. It forces the tool
27
+ * - `callStructured?(...)` is OPTIONAL. When present, it MUST
28
+ * return the input of the supplied `ToolSchema`'s tool, as the model
29
+ * produced it (`unknown`: the caller parses it; ggui#1317), or THROW —
30
+ * never return anything else. It forces the tool
30
31
  * where the model allows that; a model that refuses a forced tool
31
32
  * (the always-thinking family) is asked for it without forcing, so
32
33
  * the call can end with no tool input, and that ending is a throw.
@@ -67,12 +68,12 @@ export interface LLMCaller {
67
68
  * this method — consumers detect absence and fall back to regex JSON
68
69
  * extraction on the text path.
69
70
  */
70
- callStructured?<T>(
71
+ callStructured?(
71
72
  systemPrompt: string,
72
73
  userMessage: string,
73
74
  tool: ToolSchema,
74
75
  maxTokens?: number,
75
- ): Promise<T>;
76
+ ): Promise<unknown>;
76
77
  }
77
78
 
78
79
  /**
package/src/llm-rerank.ts CHANGED
@@ -153,6 +153,7 @@ function truncate(text: string, max: number): string {
153
153
  return `${text.slice(0, max - 1)}…`;
154
154
  }
155
155
 
156
+ /** The rerank tool's input once {@link parseToolInput} has validated it. */
156
157
  interface RerankToolInput {
157
158
  matchId: string | null;
158
159
  confidence: number;
@@ -169,7 +170,7 @@ function clampConfidence(value: unknown): number {
169
170
  function parseToolInput(
170
171
  raw: unknown,
171
172
  candidateIds: ReadonlySet<string>,
172
- ): { matchId: string | null; confidence: number; reason: string } {
173
+ ): RerankToolInput {
173
174
  if (raw === null || typeof raw !== 'object') {
174
175
  return { matchId: null, confidence: 0, reason: 'parse-failed: non-object tool input' };
175
176
  }
@@ -241,7 +242,7 @@ export async function rerankCandidates(
241
242
 
242
243
  let toolInput: unknown;
243
244
  try {
244
- toolInput = await deps.llm.callStructured<RerankToolInput>(
245
+ toolInput = await deps.llm.callStructured(
245
246
  RERANK_SYSTEM_PROMPT,
246
247
  userMessage,
247
248
  RERANK_TOOL,
@@ -99,12 +99,12 @@ export function buildAnthropicLlmCaller(
99
99
  'negotiator dev caller: text-mode not exercised — use callStructured',
100
100
  );
101
101
  },
102
- async callStructured<T>(
102
+ async callStructured(
103
103
  systemPrompt: string,
104
104
  userMessage: string,
105
105
  tool: ToolSchema,
106
106
  maxTokens?: number,
107
- ): Promise<T> {
107
+ ): Promise<unknown> {
108
108
  // `temperature` deprecated on Haiku 4.5+ — Anthropic rejects with
109
109
  // HTTP 400. Residual stochasticity stays bounded via canonical-key
110
110
  // normalization downstream.
@@ -162,7 +162,7 @@ export function buildAnthropicLlmCaller(
162
162
  `anthropic: no tool_use block in response (stop_reason=${json.stop_reason ?? 'unknown'})`,
163
163
  );
164
164
  }
165
- return toolBlock.input as T;
165
+ return toolBlock.input;
166
166
  },
167
167
  };
168
168
  }
@@ -634,7 +634,7 @@ async function callSynthesizeTool(
634
634
  user: string,
635
635
  ): Promise<unknown> {
636
636
  if (typeof llm.callStructured === 'function') {
637
- return llm.callStructured<SynthesizeToolInput>(
637
+ return llm.callStructured(
638
638
  system,
639
639
  user,
640
640
  SYNTHESIZE_TOOL,