@sensigo/realm-cli 0.35.0 → 0.37.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.
- package/dist/agent/fixtures/tool-schemas.d.ts +42 -0
- package/dist/agent/fixtures/tool-schemas.d.ts.map +1 -0
- package/dist/agent/fixtures/tool-schemas.js +150 -0
- package/dist/agent/fixtures/tool-schemas.js.map +1 -0
- package/dist/agent/mcp/mcp-extensions.d.ts +40 -4
- package/dist/agent/mcp/mcp-extensions.d.ts.map +1 -1
- package/dist/agent/providers/agent-utils.d.ts +22 -0
- package/dist/agent/providers/agent-utils.d.ts.map +1 -1
- package/dist/agent/providers/agent-utils.js +36 -0
- package/dist/agent/providers/agent-utils.js.map +1 -1
- package/dist/agent/providers/anthropic-provider.d.ts +12 -1
- package/dist/agent/providers/anthropic-provider.d.ts.map +1 -1
- package/dist/agent/providers/anthropic-provider.js +115 -23
- package/dist/agent/providers/anthropic-provider.js.map +1 -1
- package/dist/agent/providers/llm-provider.d.ts +49 -4
- package/dist/agent/providers/llm-provider.d.ts.map +1 -1
- package/dist/agent/providers/llm-provider.js +25 -5
- package/dist/agent/providers/llm-provider.js.map +1 -1
- package/dist/agent/providers/openai-provider.d.ts +51 -1
- package/dist/agent/providers/openai-provider.d.ts.map +1 -1
- package/dist/agent/providers/openai-provider.js +216 -9
- package/dist/agent/providers/openai-provider.js.map +1 -1
- package/dist/agent/providers/openai-reasoning-provider.d.ts +8 -1
- package/dist/agent/providers/openai-reasoning-provider.d.ts.map +1 -1
- package/dist/agent/providers/openai-reasoning-provider.js +9 -0
- package/dist/agent/providers/openai-reasoning-provider.js.map +1 -1
- package/dist/agent/run-agent.d.ts +7 -0
- package/dist/agent/run-agent.d.ts.map +1 -1
- package/dist/agent/run-agent.js +275 -1
- package/dist/agent/run-agent.js.map +1 -1
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +22 -4
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/listen.d.ts +12 -0
- package/dist/commands/listen.d.ts.map +1 -1
- package/dist/commands/listen.js +16 -1
- package/dist/commands/listen.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REAL, unmodified: GitHub's `list_pull_requests` tool.
|
|
3
|
+
*
|
|
4
|
+
* Ineligible for strict, and it fails for BOTH of the census's dominant reasons at once:
|
|
5
|
+
* - no `additionalProperties: false` anywhere (G1 — near-universal in the wild: 192/193
|
|
6
|
+
* measured schemas), and
|
|
7
|
+
* - `minimum`/`maximum` on the pagination parameters (G2-hard — the dominant github class,
|
|
8
|
+
* 54 of 116 tools).
|
|
9
|
+
* Neither is realm's to fix: this schema belongs to the MCP server that publishes it.
|
|
10
|
+
*/
|
|
11
|
+
export declare const GITHUB_LIST_PULL_REQUESTS_SCHEMA: Record<string, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* SYNTHETIC, strict-eligible with ZERO optional properties — the only shape that draws no
|
|
14
|
+
* caveats at all. Every property is `required`, so it also consumes zero of the 24-optional
|
|
15
|
+
* budget, which makes it the neutral element in the budget-composition pins.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ELIGIBLE_NO_OPTIONALS_SCHEMA: Record<string, unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* SYNTHETIC, ineligible (no `additionalProperties: false`) and carrying ZERO optional properties.
|
|
20
|
+
*
|
|
21
|
+
* The zero-optional part is load-bearing for test isolation: it lets a pin use an ineligible tool
|
|
22
|
+
* WITHOUT that tool's optional count being able to disturb the budget arithmetic, so a mutation
|
|
23
|
+
* to the eligible-only budget rule reds only the pin that targets that rule.
|
|
24
|
+
*/
|
|
25
|
+
export declare const INELIGIBLE_NO_OPTIONALS_SCHEMA: Record<string, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Builds a synthetic strict-eligible schema with exactly `optionalCount` optional properties —
|
|
28
|
+
* the budget pins need precise, arbitrary optional counts (up to and across the API's 24 limit)
|
|
29
|
+
* that no real corpus schema happens to provide.
|
|
30
|
+
*/
|
|
31
|
+
export declare function eligibleWithOptionals(optionalCount: number): Record<string, unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* CONVERTER-DERIVED: the shape a zod-v3-style `toJSONSchema` emits — an explicit
|
|
34
|
+
* `additionalProperties: false` (which is why this class is strict-attachable at all) alongside a
|
|
35
|
+
* `$schema` dialect stamp and optional properties.
|
|
36
|
+
*
|
|
37
|
+
* Eligible WITH caveats, and it is the realistic caveat cell: the census found the `$schema`
|
|
38
|
+
* stamp to be the universal caveat driver, and any optional property additionally draws
|
|
39
|
+
* `optional_emission`. Both are informational — neither blocks strict.
|
|
40
|
+
*/
|
|
41
|
+
export declare const CONVERTER_DERIVED_WITH_CAVEATS_SCHEMA: Record<string, unknown>;
|
|
42
|
+
//# sourceMappingURL=tool-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-schemas.d.ts","sourceRoot":"","sources":["../../../src/agent/fixtures/tool-schemas.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;GASG;AACH,eAAO,MAAM,gCAAgC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CA0DpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAQhE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAIlE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWpF;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qCAAqC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CASzE,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// Tool-argument schema fixtures for issue #311 (strict MCP tool-call arguments).
|
|
2
|
+
//
|
|
3
|
+
// Three populations, each earning its place:
|
|
4
|
+
// 1. REAL, third-party, ineligible — proves the verdict function's behaviour against a schema
|
|
5
|
+
// realm did not author and cannot change.
|
|
6
|
+
// 2. SYNTHETIC eligible — no public MCP server in the census ships a clean strict-attachable
|
|
7
|
+
// schema (0/238 clean; 21/238 attachable, 20 of those from one server via a converter
|
|
8
|
+
// accident), so the eligible cells MUST be synthetic. They are honest clones in shape, not
|
|
9
|
+
// inventions of a schema style nobody uses.
|
|
10
|
+
// 3. CONVERTER-DERIVED with caveats — the shape a zod-v3-style converter emits: explicit
|
|
11
|
+
// `additionalProperties: false` plus a `$schema` dialect stamp and optional properties.
|
|
12
|
+
//
|
|
13
|
+
// ATTRIBUTION — the fixture in population 1 is copied VERBATIM from:
|
|
14
|
+
// github/github-mcp-server, pkg/github/__toolsnaps__/list_pull_requests.snap
|
|
15
|
+
// Licence: MIT (Copyright (c) 2024 GitHub, Inc.)
|
|
16
|
+
// Snapshot: commit 0ea1f775a7c73eff1bd2e25904d01136756bbfe2, fetched 2026-08-16.
|
|
17
|
+
// It is a SNAPSHOT, deliberately frozen: it pins how realm assesses a real published tool schema
|
|
18
|
+
// as of that date. If upstream changes its schema, this fixture must NOT be silently refreshed —
|
|
19
|
+
// re-snapshot it deliberately, with the commit and date updated here, and re-read the pins.
|
|
20
|
+
/**
|
|
21
|
+
* REAL, unmodified: GitHub's `list_pull_requests` tool.
|
|
22
|
+
*
|
|
23
|
+
* Ineligible for strict, and it fails for BOTH of the census's dominant reasons at once:
|
|
24
|
+
* - no `additionalProperties: false` anywhere (G1 — near-universal in the wild: 192/193
|
|
25
|
+
* measured schemas), and
|
|
26
|
+
* - `minimum`/`maximum` on the pagination parameters (G2-hard — the dominant github class,
|
|
27
|
+
* 54 of 116 tools).
|
|
28
|
+
* Neither is realm's to fix: this schema belongs to the MCP server that publishes it.
|
|
29
|
+
*/
|
|
30
|
+
export const GITHUB_LIST_PULL_REQUESTS_SCHEMA = {
|
|
31
|
+
type: 'object',
|
|
32
|
+
required: ['owner', 'repo'],
|
|
33
|
+
properties: {
|
|
34
|
+
base: { description: 'Filter by base branch', type: 'string' },
|
|
35
|
+
direction: { description: 'Sort direction', enum: ['asc', 'desc'], type: 'string' },
|
|
36
|
+
fields: {
|
|
37
|
+
description: "Subset of fields to return for each pull request. If omitted, all fields are returned. Use this to reduce response size when you only need specific fields; omitting 'body' in particular drops the largest per-result data.",
|
|
38
|
+
items: {
|
|
39
|
+
enum: [
|
|
40
|
+
'number',
|
|
41
|
+
'title',
|
|
42
|
+
'body',
|
|
43
|
+
'state',
|
|
44
|
+
'draft',
|
|
45
|
+
'merged',
|
|
46
|
+
'mergeable_state',
|
|
47
|
+
'html_url',
|
|
48
|
+
'user',
|
|
49
|
+
'labels',
|
|
50
|
+
'assignees',
|
|
51
|
+
'requested_reviewers',
|
|
52
|
+
'merged_by',
|
|
53
|
+
'head',
|
|
54
|
+
'base',
|
|
55
|
+
'additions',
|
|
56
|
+
'deletions',
|
|
57
|
+
'changed_files',
|
|
58
|
+
'commits',
|
|
59
|
+
'comments',
|
|
60
|
+
'created_at',
|
|
61
|
+
'updated_at',
|
|
62
|
+
'closed_at',
|
|
63
|
+
'merged_at',
|
|
64
|
+
'milestone',
|
|
65
|
+
],
|
|
66
|
+
type: 'string',
|
|
67
|
+
},
|
|
68
|
+
type: 'array',
|
|
69
|
+
},
|
|
70
|
+
head: { description: 'Filter by head user/org and branch', type: 'string' },
|
|
71
|
+
owner: { description: 'Repository owner', type: 'string' },
|
|
72
|
+
page: { description: 'Page number for pagination (min 1)', minimum: 1, type: 'number' },
|
|
73
|
+
perPage: {
|
|
74
|
+
description: 'Results per page for pagination (min 1, max 100)',
|
|
75
|
+
maximum: 100,
|
|
76
|
+
minimum: 1,
|
|
77
|
+
type: 'number',
|
|
78
|
+
},
|
|
79
|
+
repo: { description: 'Repository name', type: 'string' },
|
|
80
|
+
sort: {
|
|
81
|
+
description: 'Sort by',
|
|
82
|
+
enum: ['created', 'updated', 'popularity', 'long-running'],
|
|
83
|
+
type: 'string',
|
|
84
|
+
},
|
|
85
|
+
state: { description: 'Filter by state', type: 'string' },
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* SYNTHETIC, strict-eligible with ZERO optional properties — the only shape that draws no
|
|
90
|
+
* caveats at all. Every property is `required`, so it also consumes zero of the 24-optional
|
|
91
|
+
* budget, which makes it the neutral element in the budget-composition pins.
|
|
92
|
+
*/
|
|
93
|
+
export const ELIGIBLE_NO_OPTIONALS_SCHEMA = {
|
|
94
|
+
type: 'object',
|
|
95
|
+
additionalProperties: false,
|
|
96
|
+
required: ['owner', 'repo'],
|
|
97
|
+
properties: {
|
|
98
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
99
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* SYNTHETIC, ineligible (no `additionalProperties: false`) and carrying ZERO optional properties.
|
|
104
|
+
*
|
|
105
|
+
* The zero-optional part is load-bearing for test isolation: it lets a pin use an ineligible tool
|
|
106
|
+
* WITHOUT that tool's optional count being able to disturb the budget arithmetic, so a mutation
|
|
107
|
+
* to the eligible-only budget rule reds only the pin that targets that rule.
|
|
108
|
+
*/
|
|
109
|
+
export const INELIGIBLE_NO_OPTIONALS_SCHEMA = {
|
|
110
|
+
type: 'object',
|
|
111
|
+
required: ['x'],
|
|
112
|
+
properties: { x: { type: 'string' } },
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Builds a synthetic strict-eligible schema with exactly `optionalCount` optional properties —
|
|
116
|
+
* the budget pins need precise, arbitrary optional counts (up to and across the API's 24 limit)
|
|
117
|
+
* that no real corpus schema happens to provide.
|
|
118
|
+
*/
|
|
119
|
+
export function eligibleWithOptionals(optionalCount) {
|
|
120
|
+
const properties = { id: { type: 'string' } };
|
|
121
|
+
for (let i = 0; i < optionalCount; i += 1) {
|
|
122
|
+
properties[`opt_${i}`] = { type: 'string' };
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
type: 'object',
|
|
126
|
+
additionalProperties: false,
|
|
127
|
+
required: ['id'], // `id` is required, so exactly `optionalCount` properties are optional
|
|
128
|
+
properties,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* CONVERTER-DERIVED: the shape a zod-v3-style `toJSONSchema` emits — an explicit
|
|
133
|
+
* `additionalProperties: false` (which is why this class is strict-attachable at all) alongside a
|
|
134
|
+
* `$schema` dialect stamp and optional properties.
|
|
135
|
+
*
|
|
136
|
+
* Eligible WITH caveats, and it is the realistic caveat cell: the census found the `$schema`
|
|
137
|
+
* stamp to be the universal caveat driver, and any optional property additionally draws
|
|
138
|
+
* `optional_emission`. Both are informational — neither blocks strict.
|
|
139
|
+
*/
|
|
140
|
+
export const CONVERTER_DERIVED_WITH_CAVEATS_SCHEMA = {
|
|
141
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
142
|
+
type: 'object',
|
|
143
|
+
additionalProperties: false,
|
|
144
|
+
required: ['url'],
|
|
145
|
+
properties: {
|
|
146
|
+
url: { type: 'string', description: 'Target URL' },
|
|
147
|
+
timeout: { type: 'number', description: 'Optional timeout in milliseconds' },
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=tool-schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-schemas.js","sourceRoot":"","sources":["../../../src/agent/fixtures/tool-schemas.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,EAAE;AACF,6CAA6C;AAC7C,gGAAgG;AAChG,+CAA+C;AAC/C,+FAA+F;AAC/F,2FAA2F;AAC3F,gGAAgG;AAChG,iDAAiD;AACjD,2FAA2F;AAC3F,6FAA6F;AAC7F,EAAE;AACF,qEAAqE;AACrE,+EAA+E;AAC/E,mDAAmD;AACnD,mFAAmF;A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AAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,uEAAuE;QACzF,UAAU;KACX,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAA4B;IAC5E,OAAO,EAAE,8CAA8C;IACvD,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,UAAU,EAAE;QACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE;QAClD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kCAAkC,EAAE;KAC7E;CACF,CAAC"}
|
|
@@ -11,6 +11,16 @@ export interface ToolDefinition {
|
|
|
11
11
|
name: string;
|
|
12
12
|
description: string;
|
|
13
13
|
inputSchema: Record<string, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* Issue #311: attach `strict: true` to THIS tool on the wire. Additive-optional; absent (the
|
|
16
|
+
* default) is today's behaviour byte-identical.
|
|
17
|
+
*
|
|
18
|
+
* The SELECTION decision lives entirely in run-agent (per-tool eligibility verdict + the
|
|
19
|
+
* declared-order budget walk) and rides down per tool here, rather than as a name list in the
|
|
20
|
+
* options object, so the marker can never drift out of sync with the tools array it describes.
|
|
21
|
+
* A provider that ignores this field simply sends every tool unconstrained.
|
|
22
|
+
*/
|
|
23
|
+
strict?: boolean;
|
|
14
24
|
}
|
|
15
25
|
export type ToolExecutor = (toolName: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
16
26
|
export interface StepWithToolsResult {
|
|
@@ -25,12 +35,38 @@ export interface StepWithToolsResult {
|
|
|
25
35
|
*/
|
|
26
36
|
correctionCount?: number;
|
|
27
37
|
/**
|
|
28
|
-
* Issue #236: additive, present only on the tools-path leg
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
38
|
+
* Issue #236: additive, present only on the tools-path leg.
|
|
39
|
+
*
|
|
40
|
+
* Issue #311 truth-fix: the original note here claimed this "is never populated by
|
|
41
|
+
* AnthropicProvider in v1" because "G6 makes every tools-bearing step ineligible for strict
|
|
42
|
+
* end-to-end". That premise died with #311's Phase-A gate change — strict is now genuinely
|
|
43
|
+
* reachable on a tools-bearing step, applied to TOOL-CALL ARGUMENTS. This field still carries
|
|
44
|
+
* the step-OUTPUT meta only; the tool-arguments story is assembled by run-agent from the
|
|
45
|
+
* per-tool verdicts plus `toolArgsStrictDrop` below.
|
|
32
46
|
*/
|
|
33
47
|
structuredOutput?: StructuredOutputMeta;
|
|
48
|
+
/**
|
|
49
|
+
* Issue #311: what the WIRE did to strict during this call, when a live 400/503 forced realm to
|
|
50
|
+
* drop it part-way through the attempt. Absent when nothing was dropped.
|
|
51
|
+
*
|
|
52
|
+
* The provider reports only what it observed (status class + captured message + how many
|
|
53
|
+
* strict-decorated requests had already returned 200); it never assembles evidence. run-agent
|
|
54
|
+
* owns the `tool_args` block, because only it knows the declared tool order, each tool's
|
|
55
|
+
* eligibility verdict, and which tools the budget walk selected.
|
|
56
|
+
*/
|
|
57
|
+
toolArgsStrictDrop?: {
|
|
58
|
+
/** Status-derived label ONLY — never parsed out of the message body. */
|
|
59
|
+
reason: 'api_rejected_schema' | 'grammar_unavailable' | 'service_unavailable';
|
|
60
|
+
/** The raw API error text, verbatim, for the operator to compare against the provider's own. */
|
|
61
|
+
api_message?: string;
|
|
62
|
+
/** Issue #313: the provider's machine-readable error fields, captured verbatim. `null` is
|
|
63
|
+
* preserved and meaningful (OpenAI returns both null for the model-unsupported class).
|
|
64
|
+
* Never keyed on — capture-only, same discipline as the step-level pair. */
|
|
65
|
+
api_param?: string | null;
|
|
66
|
+
api_code?: string | null;
|
|
67
|
+
/** Strict-decorated requests that returned 200 before the drop; 0 = the first one was rejected. */
|
|
68
|
+
strict_turns_before_drop: number;
|
|
69
|
+
};
|
|
34
70
|
}
|
|
35
71
|
export interface McpClient {
|
|
36
72
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-extensions.d.ts","sourceRoot":"","sources":["../../../src/agent/mcp/mcp-extensions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAGhD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAGD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-extensions.d.ts","sourceRoot":"","sources":["../../../src/agent/mcp/mcp-extensions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAGhD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAGD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC;;;;;;;;OAQG;IACH,MAA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AC;CAC7B"}
|
|
@@ -79,4 +79,26 @@ export declare function summarizeAgentValidationErrors(rawErrors: RawValidationE
|
|
|
79
79
|
export declare function renderValidationSummaryEntry(entry: AgentValidationErrorEntry): string;
|
|
80
80
|
/** Returns a Promise that rejects with a timeout error after `ms` milliseconds. */
|
|
81
81
|
export declare function rejectAfter(ms: number): Promise<never>;
|
|
82
|
+
/**
|
|
83
|
+
* Issue #313: the ONE shared HTTP-status extractor, hoisted verbatim from anthropic-provider.ts
|
|
84
|
+
* so both provider ladders key on the same duck-type instead of maintaining a copy each.
|
|
85
|
+
*
|
|
86
|
+
* Duck-typed by necessity — both `@anthropic-ai/sdk` and `openai` are consumer-supplied peer
|
|
87
|
+
* dependencies (absent from this repo and CI), so neither SDK's real error class can be
|
|
88
|
+
* imported or `instanceof`-checked here. `.status` is the documented public `APIError` contract
|
|
89
|
+
* of both SDKs. ACCEPTED RESIDUAL, on record and owner-ratified: this shape cannot be verified
|
|
90
|
+
* in CI. It inherits exactly the class the owner ratified for the Anthropic SDK in #236 — if a
|
|
91
|
+
* future SDK major renamed the field, the ladder would stop engaging and every strict failure
|
|
92
|
+
* would surface as a plain error rather than a silent wrong downgrade (fail-loud, not fail-quiet).
|
|
93
|
+
*/
|
|
94
|
+
export declare function extractHttpStatus(err: unknown): number | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Issue #313: the provider's machine-readable error fields, captured VERBATIM for evidence.
|
|
97
|
+
* `null` is preserved and meaningful — OpenAI returns `param: null, code: null` for the
|
|
98
|
+
* model-unsupported class, where the message is prose-only. Realm never keys on these.
|
|
99
|
+
*/
|
|
100
|
+
export declare function extractApiErrorFields(err: unknown): {
|
|
101
|
+
api_param?: string | null;
|
|
102
|
+
api_code?: string | null;
|
|
103
|
+
};
|
|
82
104
|
//# sourceMappingURL=agent-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-utils.d.ts","sourceRoot":"","sources":["../../../src/agent/providers/agent-utils.ts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G,OAAO,CAAC,KAAK,CAAC,CAItD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAMlE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG;IACnD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAOA"}
|
|
@@ -255,4 +255,40 @@ export function renderValidationSummaryEntry(entry) {
|
|
|
255
255
|
export function rejectAfter(ms) {
|
|
256
256
|
return new Promise((_, reject) => setTimeout(() => reject(new Error(`tool call timed out after ${ms}ms`)), ms));
|
|
257
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Issue #313: the ONE shared HTTP-status extractor, hoisted verbatim from anthropic-provider.ts
|
|
260
|
+
* so both provider ladders key on the same duck-type instead of maintaining a copy each.
|
|
261
|
+
*
|
|
262
|
+
* Duck-typed by necessity — both `@anthropic-ai/sdk` and `openai` are consumer-supplied peer
|
|
263
|
+
* dependencies (absent from this repo and CI), so neither SDK's real error class can be
|
|
264
|
+
* imported or `instanceof`-checked here. `.status` is the documented public `APIError` contract
|
|
265
|
+
* of both SDKs. ACCEPTED RESIDUAL, on record and owner-ratified: this shape cannot be verified
|
|
266
|
+
* in CI. It inherits exactly the class the owner ratified for the Anthropic SDK in #236 — if a
|
|
267
|
+
* future SDK major renamed the field, the ladder would stop engaging and every strict failure
|
|
268
|
+
* would surface as a plain error rather than a silent wrong downgrade (fail-loud, not fail-quiet).
|
|
269
|
+
*/
|
|
270
|
+
export function extractHttpStatus(err) {
|
|
271
|
+
if (typeof err === 'object' && err !== null && 'status' in err) {
|
|
272
|
+
const status = err.status;
|
|
273
|
+
if (typeof status === 'number')
|
|
274
|
+
return status;
|
|
275
|
+
}
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Issue #313: the provider's machine-readable error fields, captured VERBATIM for evidence.
|
|
280
|
+
* `null` is preserved and meaningful — OpenAI returns `param: null, code: null` for the
|
|
281
|
+
* model-unsupported class, where the message is prose-only. Realm never keys on these.
|
|
282
|
+
*/
|
|
283
|
+
export function extractApiErrorFields(err) {
|
|
284
|
+
if (typeof err !== 'object' || err === null)
|
|
285
|
+
return {};
|
|
286
|
+
const e = err;
|
|
287
|
+
const out = {};
|
|
288
|
+
if ('param' in e)
|
|
289
|
+
out.api_param = typeof e.param === 'string' ? e.param : null;
|
|
290
|
+
if ('code' in e)
|
|
291
|
+
out.api_code = typeof e.code === 'string' ? e.code : null;
|
|
292
|
+
return out;
|
|
293
|
+
}
|
|
258
294
|
//# sourceMappingURL=agent-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-utils.js","sourceRoot":"","sources":["../../../src/agent/providers/agent-utils.ts"],"names":[],"mappings":"AAGA,MAAM,kBAAkB,GACtB,kEAAkE;IAClE,8FAA8F,CAAC;AAEjG,mGAAmG;AACnG,mGAAmG;AACnG,2GAA2G;AAC3G,MAAM,4BAA4B,GAChC,kEAAkE;IAClE,8FAA8F;IAC9F,wDAAwD,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,WAAqC,EACrC,wBAAiC,EACjC,qBAA+B;IAE/B,MAAM,UAAU,GACd,qBAAqB,KAAK,IAAI,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,kBAAkB,CAAC;IACrF,MAAM,IAAI,GACR,wBAAwB,KAAK,SAAS;QACpC,CAAC,CAAC,GAAG,wBAAwB,OAAO,UAAU,EAAE;QAChD,CAAC,CAAC,UAAU,CAAC;IACjB,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC3C,OAAO,GAAG,IAAI,2CAA2C,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;AACzF,CAAC;AAED;;;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,QAAQ,GAAG,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StructuredOutputMeta } from '@sensigo/realm';
|
|
2
|
-
import { ToolCapableLlmProvider } from './llm-provider.js';
|
|
2
|
+
import { ToolCapableLlmProvider, type ProviderCapabilities } from './llm-provider.js';
|
|
3
3
|
import type { ToolDefinition, ToolExecutor, StepWithToolsResult } from '../mcp/mcp-extensions.js';
|
|
4
4
|
/**
|
|
5
5
|
* Thrown when the ladder's OWN drop-strict retry ALSO fails — design §4 [R2-7]: (a) carries the
|
|
@@ -23,6 +23,17 @@ export declare class StructuredOutputLadderError extends Error {
|
|
|
23
23
|
export declare class AnthropicProvider extends ToolCapableLlmProvider {
|
|
24
24
|
private readonly model;
|
|
25
25
|
constructor(model: string);
|
|
26
|
+
/**
|
|
27
|
+
* Issue #311 (capability guard). AnthropicProvider is the ONLY provider that reads
|
|
28
|
+
* `ToolDefinition.strict` and threads it onto the request (see the `anthropicTools.push` in
|
|
29
|
+
* `callStepWithTools`). Declaring `toolArgsStrict` here is what authorizes run-agent to mark
|
|
30
|
+
* tools and to record `strict_sent: true` in evidence — a provider whose wire builder ignores
|
|
31
|
+
* the marker must never produce that claim.
|
|
32
|
+
*
|
|
33
|
+
* `jsonMode` keeps the base value: this provider constrains output via the submit TOOL, never
|
|
34
|
+
* via a `response_format` json_object mode.
|
|
35
|
+
*/
|
|
36
|
+
capabilities(): ProviderCapabilities;
|
|
26
37
|
private getClient;
|
|
27
38
|
/**
|
|
28
39
|
* Shared body for `callStep`/`callStepWithMeta` (issue #236). `strictRequested` is `undefined`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic-provider.d.ts","sourceRoot":"","sources":["../../../src/agent/providers/anthropic-provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"anthropic-provider.d.ts","sourceRoot":"","sources":["../../../src/agent/providers/anthropic-provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,KAAK,EAEV,cAAc,EACd,YAAY,EACZ,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAuFlC;;;;;;;GAOG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,QAAQ,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;gBAE9C,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,oBAAoB,EACtC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAMhC;AA8DD;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,sBAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,MAAM;IAI1C;;;;;;;;;OASG;IACH,YAAY,IAAI,oBAAoB;YAKtB,SAAS;IAoBvB;;;;;OAKG;YACW,gBAAgB;IA0GxB,QAAQ,CACZ,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,wBAAwB,CAAC,EAAE,MAAM,GAChC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAUnC;yFACqF;IACtE,gBAAgB,CAC7B,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,wBAAwB,CAAC,EAAE,MAAM,EACjC,IAAI,CAAC,EAAE;QAAE,sBAAsB,CAAC,EAAE,OAAO,CAAA;KAAE,GAC1C,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,oBAAoB,CAAA;KAAE,CAAC;IAS5E;;;;OAIG;IACG,iBAAiB,CACrB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,cAAc,EAAE,EACvB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACtC,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChD,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,wBAAwB,CAAC,EAAE,MAAM,CAAC;KACnC,GACA,OAAO,CAAC,mBAAmB,CAAC;CAmZhC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Requires @anthropic-ai/sdk >= 0.20.0 as an optional peer dependency (npm install @anthropic-ai/sdk).
|
|
3
3
|
import { WorkflowError, validateAgentSubmission, } from '@sensigo/realm';
|
|
4
4
|
import { ToolCapableLlmProvider } from './llm-provider.js';
|
|
5
|
-
import { sanitizeError, serializeToolResult, parseNamespacedId, extractJsonObject, rejectAfter, buildSystemPrompt, summarizeAgentValidationErrors, renderValidationSummaryEntry, } from './agent-utils.js';
|
|
5
|
+
import { sanitizeError, serializeToolResult, parseNamespacedId, extractJsonObject, rejectAfter, buildSystemPrompt, summarizeAgentValidationErrors, renderValidationSummaryEntry, extractHttpStatus, } from './agent-utils.js';
|
|
6
6
|
/** The tool offered at `tool_choice:'auto'` so the model can return structured output directly —
|
|
7
7
|
* `tool_use.input` arrives pre-parsed, eliminating the fenced/prefaced-JSON parse-failure class by
|
|
8
8
|
* construction. `auto` (never forced) preserves reason-then-answer: a workflow whose output schema
|
|
@@ -59,17 +59,8 @@ function resolveMaxTokens(model) {
|
|
|
59
59
|
* — the label match keys on THIS string only, never a broader "any 503" heuristic). A stale/
|
|
60
60
|
* non-matching message degrades to the generic `service_unavailable` label (fail-safe). */
|
|
61
61
|
const GRAMMAR_UNAVAILABLE_TEXT = 'Grammar compilation is temporarily unavailable';
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* checked here. `.status`/`.message` are the SDK's own long-stable public `APIError` contract. */
|
|
65
|
-
function extractHttpStatus(err) {
|
|
66
|
-
if (typeof err === 'object' && err !== null && 'status' in err) {
|
|
67
|
-
const status = err.status;
|
|
68
|
-
if (typeof status === 'number')
|
|
69
|
-
return status;
|
|
70
|
-
}
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
62
|
+
// Issue #313: `extractHttpStatus` now lives in agent-utils.ts, shared with the OpenAI ladder —
|
|
63
|
+
// a pure move, zero behaviour change. `extractErrorMessage` deliberately stays local.
|
|
73
64
|
function extractErrorMessage(err) {
|
|
74
65
|
return err instanceof Error ? err.message : String(err);
|
|
75
66
|
}
|
|
@@ -139,6 +130,19 @@ export class AnthropicProvider extends ToolCapableLlmProvider {
|
|
|
139
130
|
super();
|
|
140
131
|
this.model = model;
|
|
141
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Issue #311 (capability guard). AnthropicProvider is the ONLY provider that reads
|
|
135
|
+
* `ToolDefinition.strict` and threads it onto the request (see the `anthropicTools.push` in
|
|
136
|
+
* `callStepWithTools`). Declaring `toolArgsStrict` here is what authorizes run-agent to mark
|
|
137
|
+
* tools and to record `strict_sent: true` in evidence — a provider whose wire builder ignores
|
|
138
|
+
* the marker must never produce that claim.
|
|
139
|
+
*
|
|
140
|
+
* `jsonMode` keeps the base value: this provider constrains output via the submit TOOL, never
|
|
141
|
+
* via a `response_format` json_object mode.
|
|
142
|
+
*/
|
|
143
|
+
capabilities() {
|
|
144
|
+
return { jsonMode: false, toolArgsStrict: true, providerId: 'anthropic' };
|
|
145
|
+
}
|
|
142
146
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
147
|
async getClient() {
|
|
144
148
|
// Dynamically import @anthropic-ai/sdk to keep it an optional peer dependency.
|
|
@@ -276,6 +280,10 @@ export class AnthropicProvider extends ToolCapableLlmProvider {
|
|
|
276
280
|
name: tool.name,
|
|
277
281
|
description: tool.description,
|
|
278
282
|
input_schema: tool.inputSchema, // note: input_schema, not parameters
|
|
283
|
+
// issue #311: per-tool strict, same spread SHAPE as buildSubmitTool's own `strict` option
|
|
284
|
+
// — the key only ever appears when run-agent selected this tool, so a non-selected tool's
|
|
285
|
+
// wire entry stays byte-identical to today's.
|
|
286
|
+
...(tool.strict === true ? { strict: true } : {}),
|
|
279
287
|
});
|
|
280
288
|
}
|
|
281
289
|
const maxCalls = options.maxToolCalls ?? 20;
|
|
@@ -291,8 +299,15 @@ export class AnthropicProvider extends ToolCapableLlmProvider {
|
|
|
291
299
|
let correction_count = 0;
|
|
292
300
|
const tool_call_records = [];
|
|
293
301
|
const system = buildSystemPrompt(options.inputSchema, options.agentProfileInstructions);
|
|
294
|
-
/** Attaches `correctionCount` to a result only when at least one correction happened
|
|
295
|
-
|
|
302
|
+
/** Attaches `correctionCount` to a result only when at least one correction happened, plus
|
|
303
|
+
* (issue #311) the tool-args drop facts when the ladder below dropped strict mid-attempt.
|
|
304
|
+
* This is the single result chokepoint for `callStepWithTools` — every successful return
|
|
305
|
+
* goes through it, so neither field can be forgotten on a new exit path. */
|
|
306
|
+
const withCorrectionCount = (result) => ({
|
|
307
|
+
...result,
|
|
308
|
+
...(correction_count > 0 ? { correctionCount: correction_count } : {}),
|
|
309
|
+
...(toolArgsStrictDrop !== undefined ? { toolArgsStrictDrop } : {}),
|
|
310
|
+
});
|
|
296
311
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
312
|
const history = [{ role: 'user', content: prompt }];
|
|
298
313
|
const buildMainCallOpts = () => {
|
|
@@ -302,10 +317,79 @@ export class AnthropicProvider extends ToolCapableLlmProvider {
|
|
|
302
317
|
system,
|
|
303
318
|
messages: history,
|
|
304
319
|
};
|
|
305
|
-
if (anthropicTools.length > 0)
|
|
306
|
-
|
|
320
|
+
if (anthropicTools.length > 0) {
|
|
321
|
+
// issue #311: once strict has been dropped, every later turn sends STRIPPED COPIES rather
|
|
322
|
+
// than the mutated originals. Mutating the shared objects in place would retroactively
|
|
323
|
+
// rewrite the request objects already handed to the SDK for earlier turns — an aliasing
|
|
324
|
+
// hazard, and it makes the wire history unreadable (a request that genuinely carried
|
|
325
|
+
// strict would appear never to have). Pre-drop — which includes every step that never
|
|
326
|
+
// opted in — the original array is passed exactly as before, with no copy.
|
|
327
|
+
opts['tools'] = toolArgsStrictStripped
|
|
328
|
+
? anthropicTools.map(({ strict: _strict, ...rest }) => rest)
|
|
329
|
+
: anthropicTools;
|
|
330
|
+
}
|
|
307
331
|
return opts;
|
|
308
332
|
};
|
|
333
|
+
// -----------------------------------------------------------------------------------------
|
|
334
|
+
// issue #311 — the tool-arguments fallback ladder. ONE wrap point on the main agentic loop's
|
|
335
|
+
// only `messages.create`, which covers every turn of the loop including the #224
|
|
336
|
+
// in-conversation correction turns.
|
|
337
|
+
//
|
|
338
|
+
// Deliberately SEPARATE from the #236 ladder above (which owns the step-OUTPUT dimension on
|
|
339
|
+
// the callStep/callStepWithMeta path): the two dimensions fail independently, and the
|
|
340
|
+
// stickiness rules differ (see below). Status-only, exactly like #236 — the arm keys on HTTP
|
|
341
|
+
// status ∧ strict-carried, NEVER on message text.
|
|
342
|
+
// -----------------------------------------------------------------------------------------
|
|
343
|
+
let toolArgsStrictActive = anthropicTools.some((t) => t.strict === true);
|
|
344
|
+
let toolArgsStrictStripped = false;
|
|
345
|
+
let strictTurnsBeforeDrop = 0;
|
|
346
|
+
let toolArgsStrictDrop;
|
|
347
|
+
/** Stops sending strict for the REST of this invocation (the immediate retry included). */
|
|
348
|
+
const dropToolArgsStrict = () => {
|
|
349
|
+
toolArgsStrictActive = false;
|
|
350
|
+
toolArgsStrictStripped = true;
|
|
351
|
+
};
|
|
352
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
353
|
+
const createMainTurn = async () => {
|
|
354
|
+
const carriedStrict = toolArgsStrictActive;
|
|
355
|
+
try {
|
|
356
|
+
const response = await // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
357
|
+
client.messages.create(buildMainCallOpts());
|
|
358
|
+
// Only a strict-DECORATED request that came back 200 counts toward the disclosed
|
|
359
|
+
// "turns before drop" — that is exactly what the number claims.
|
|
360
|
+
if (carriedStrict)
|
|
361
|
+
strictTurnsBeforeDrop += 1;
|
|
362
|
+
return response;
|
|
363
|
+
}
|
|
364
|
+
catch (err) {
|
|
365
|
+
// A turn that carried NO strict is none of this ladder's business: its 400 is a real
|
|
366
|
+
// failure of the request itself and must propagate untouched, never be re-attributed to
|
|
367
|
+
// structured output.
|
|
368
|
+
if (!carriedStrict)
|
|
369
|
+
throw err;
|
|
370
|
+
const status = extractHttpStatus(err);
|
|
371
|
+
if (status !== 400 && status !== 503)
|
|
372
|
+
throw err; // unrelated failure — never engage
|
|
373
|
+
const api_message = extractErrorMessage(err);
|
|
374
|
+
const reason = status === 400
|
|
375
|
+
? 'api_rejected_schema'
|
|
376
|
+
: api_message.includes(GRAMMAR_UNAVAILABLE_TEXT)
|
|
377
|
+
? 'grammar_unavailable'
|
|
378
|
+
: 'service_unavailable';
|
|
379
|
+
// Recorded BEFORE the drop so `strict_turns_before_drop` reports the 200s that preceded
|
|
380
|
+
// this rejection (0 = the first strict-carrying turn of the attempt was rejected).
|
|
381
|
+
toolArgsStrictDrop = {
|
|
382
|
+
reason,
|
|
383
|
+
api_message,
|
|
384
|
+
strict_turns_before_drop: strictTurnsBeforeDrop,
|
|
385
|
+
};
|
|
386
|
+
dropToolArgsStrict();
|
|
387
|
+
// Retry the SAME turn once, unconstrained. A failure here is a genuine call failure and
|
|
388
|
+
// propagates — realm does not swallow it behind the ladder.
|
|
389
|
+
return await // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
390
|
+
client.messages.create(buildMainCallOpts());
|
|
391
|
+
}
|
|
392
|
+
};
|
|
309
393
|
// Forces a final answer: offers the __realm_submit__ tool at tool_choice:'auto' when a schema is
|
|
310
394
|
// available (mirrors callStep's P0 mechanism — tool_use.input arrives pre-parsed, no parse step);
|
|
311
395
|
// otherwise forces a plain text answer (tool_choice:'none', no tools array — can't type a tool
|
|
@@ -313,11 +397,20 @@ export class AnthropicProvider extends ToolCapableLlmProvider {
|
|
|
313
397
|
// history ends with a valid user turn. NOT restructuring the agentic loop / MCP tools array —
|
|
314
398
|
// this synthetic tool only ever appears on this ONE isolated extraction call.
|
|
315
399
|
const performFinalExtraction = async () => {
|
|
316
|
-
// issue #236: buildSubmitTool's `strict` option is never threaded here — BY
|
|
317
|
-
//
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
//
|
|
400
|
+
// issue #236 + #311: buildSubmitTool's `strict` option is never threaded here — BY DESIGN
|
|
401
|
+
// now, no longer by construction.
|
|
402
|
+
//
|
|
403
|
+
// The old reasoning was that G6 made every tools-bearing step ineligible for strict, so a
|
|
404
|
+
// `true` could never reach this path at all. #311 killed that premise: a tools-bearing step
|
|
405
|
+
// CAN now be strict-declared, and its tools do carry strict on the wire. What #311 does NOT
|
|
406
|
+
// change is this call: the final extraction asks the model for the STEP'S OUTPUT, which on
|
|
407
|
+
// the tools fork is deliberately never grammar-constrained (that is precisely what the
|
|
408
|
+
// step-level `unsupported_context_tools` disclosure reports). Constraining it here would
|
|
409
|
+
// make that disclosure a lie.
|
|
410
|
+
//
|
|
411
|
+
// The old "no end-to-end pin is possible here — do not add one" instruction is therefore
|
|
412
|
+
// obsolete and is REPLACED: the pin is now both possible and required (test plan pin 15 —
|
|
413
|
+
// on an opted-in tools step, this call's opts never contain `strict`).
|
|
321
414
|
const finalSubmitTool = options.inputSchema !== undefined ? buildSubmitTool(options.inputSchema) : undefined;
|
|
322
415
|
const finalOpts = {
|
|
323
416
|
model: this.model,
|
|
@@ -376,8 +469,7 @@ export class AnthropicProvider extends ToolCapableLlmProvider {
|
|
|
376
469
|
});
|
|
377
470
|
};
|
|
378
471
|
while (true) {
|
|
379
|
-
const response = await
|
|
380
|
-
client.messages.create(buildMainCallOpts());
|
|
472
|
+
const response = await createMainTurn();
|
|
381
473
|
const toolUseBlocks = response.content.filter((b) => b.type === 'tool_use');
|
|
382
474
|
if (toolUseBlocks.length > 0) {
|
|
383
475
|
history.push({ role: 'assistant', content: response.content });
|