@vostride/agent-qa-model 0.2.2 → 0.2.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/README.md +78 -0
- package/dist/index.cjs +5 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -48
- package/dist/index.d.ts +0 -48
- package/dist/index.js +5 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -51,54 +51,18 @@ type LogEntry = {
|
|
|
51
51
|
level?: string;
|
|
52
52
|
message: string;
|
|
53
53
|
};
|
|
54
|
-
/**
|
|
55
|
-
* Compact a log-shaped burst into a deterministic, bounded string (D-13/D-15).
|
|
56
|
-
* Groups typed `{source, level, message}` entries by `source::level::normalized`,
|
|
57
|
-
* counts each class, and renders it with the first ≤5 raw samples seen (monotonic:
|
|
58
|
-
* once a class has 5 samples, growing the burst never changes which 5 are shown;
|
|
59
|
-
* the onset occurrence is always retained). Classes render in sorted-key order.
|
|
60
|
-
*/
|
|
61
54
|
declare function compactLogs(entries: LogEntry[]): string;
|
|
62
|
-
/**
|
|
63
|
-
* Bound a single structured value for prompt inclusion (D-14). Safe-stringifies the
|
|
64
|
-
* value verbatim (variable tokens preserved — the planner may need them exactly) and,
|
|
65
|
-
* only if it exceeds `BLOB_CEILING`, slices and appends the visible truncation marker.
|
|
66
|
-
* `undefined` in ⇒ `undefined` out. Never throws on cyclic input (V5).
|
|
67
|
-
*/
|
|
68
55
|
declare function guardBlob(value: unknown): string | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* The composed pre-prompt guard for one tool-output value (CTXB-06): a burst of
|
|
71
|
-
* log-shaped entries (console `{level, text}` / network `{url, method, status}` /
|
|
72
|
-
* generic `{source?, level?, message}`) routes through {@link compactLogs};
|
|
73
|
-
* anything else through {@link guardBlob}. Compacted output is still bounded by
|
|
74
|
-
* the blob ceiling so a burst of all-distinct classes cannot flood the prompt.
|
|
75
|
-
*/
|
|
76
56
|
declare function guardToolOutput(value: unknown): string | undefined;
|
|
77
57
|
|
|
78
58
|
declare function parseRealWindow(error: unknown): number | undefined;
|
|
79
59
|
declare function isContextOverflow(error: unknown): boolean;
|
|
80
60
|
|
|
81
|
-
/**
|
|
82
|
-
* Caller-supplied degrade controls (D-07/D-09). Policy-free: no default/safety margin is
|
|
83
|
-
* baked here — Phase 355 supplies the concrete budget and pin predicate.
|
|
84
|
-
*
|
|
85
|
-
* - `budget` — the token ceiling the degraded prompt must fit under.
|
|
86
|
-
* - `pin` — a caller pin predicate; a message matching it is never evicted or truncated.
|
|
87
|
-
* The substrate stays tier-ignorant (355 pins its tiers explicitly).
|
|
88
|
-
* - `estimate` — the estimator the damage loop re-runs after each eviction. Optional so
|
|
89
|
-
* `degrade` stays a standalone-testable pure function; the Plan-03 factory passes its own.
|
|
90
|
-
*/
|
|
91
61
|
interface DegradeOptions {
|
|
92
62
|
budget: number;
|
|
93
63
|
pin?: (message: ModelMessage, index: number) => boolean;
|
|
94
64
|
estimate?: (messages: ModelMessage[]) => number;
|
|
95
65
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Discriminated degrade result (D-09). `ok:true` carries the fitted messages; `ok:false`
|
|
98
|
-
* is the structured cannot-fit outcome returned when system + final + pinned content alone
|
|
99
|
-
* exceeds the budget — degrade never throws and never violates a pin, returning the
|
|
100
|
-
* best-effort hygiene-reduced messages instead.
|
|
101
|
-
*/
|
|
102
66
|
type DegradeOutcome = {
|
|
103
67
|
ok: true;
|
|
104
68
|
messages: ModelMessage[];
|
|
@@ -107,10 +71,6 @@ type DegradeOutcome = {
|
|
|
107
71
|
reason: 'pinned-content-exceeds-budget';
|
|
108
72
|
messages: ModelMessage[];
|
|
109
73
|
};
|
|
110
|
-
/**
|
|
111
|
-
* The instance shape returned by the Plan-03 factory and consumed through the runner's
|
|
112
|
-
* provider-neutral port (D-05). Prompt tokens only; the substrate is policy-free.
|
|
113
|
-
*/
|
|
114
74
|
interface TokenAccounting {
|
|
115
75
|
estimate(messages: ModelMessage[]): number;
|
|
116
76
|
recordUsage(usage: LanguageModelUsage, messages: ModelMessage[]): void;
|
|
@@ -120,13 +80,6 @@ interface TokenAccounting {
|
|
|
120
80
|
};
|
|
121
81
|
degrade(messages: ModelMessage[], options: DegradeOptions): DegradeOutcome;
|
|
122
82
|
}
|
|
123
|
-
/**
|
|
124
|
-
* Factory construction options (Plan 03).
|
|
125
|
-
*
|
|
126
|
-
* - `getCapabilities` — the D-04 lazy ceilings thunk (composes v46 `resolveCapabilities`),
|
|
127
|
-
* read on every estimate/degrade so a mid-run overflow-learned window shrink applies next turn.
|
|
128
|
-
* - `perImageTokens` — the D-12 injectable flat per-image constant (test/chat-layer tuning).
|
|
129
|
-
*/
|
|
130
83
|
interface TokenAccountingOptions {
|
|
131
84
|
getCapabilities: () => ModelCapabilities;
|
|
132
85
|
perImageTokens?: number;
|
|
@@ -261,7 +214,6 @@ interface VisionGate {
|
|
|
261
214
|
captureMode: 'full' | 'textOnly';
|
|
262
215
|
promptNote: string;
|
|
263
216
|
}
|
|
264
|
-
/** 439 D-19: the configured `vision` when set, otherwise what the capability table says. */
|
|
265
217
|
declare function visionFromConfig(configured: boolean | undefined, capabilities: {
|
|
266
218
|
vision: boolean;
|
|
267
219
|
}): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -51,54 +51,18 @@ type LogEntry = {
|
|
|
51
51
|
level?: string;
|
|
52
52
|
message: string;
|
|
53
53
|
};
|
|
54
|
-
/**
|
|
55
|
-
* Compact a log-shaped burst into a deterministic, bounded string (D-13/D-15).
|
|
56
|
-
* Groups typed `{source, level, message}` entries by `source::level::normalized`,
|
|
57
|
-
* counts each class, and renders it with the first ≤5 raw samples seen (monotonic:
|
|
58
|
-
* once a class has 5 samples, growing the burst never changes which 5 are shown;
|
|
59
|
-
* the onset occurrence is always retained). Classes render in sorted-key order.
|
|
60
|
-
*/
|
|
61
54
|
declare function compactLogs(entries: LogEntry[]): string;
|
|
62
|
-
/**
|
|
63
|
-
* Bound a single structured value for prompt inclusion (D-14). Safe-stringifies the
|
|
64
|
-
* value verbatim (variable tokens preserved — the planner may need them exactly) and,
|
|
65
|
-
* only if it exceeds `BLOB_CEILING`, slices and appends the visible truncation marker.
|
|
66
|
-
* `undefined` in ⇒ `undefined` out. Never throws on cyclic input (V5).
|
|
67
|
-
*/
|
|
68
55
|
declare function guardBlob(value: unknown): string | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* The composed pre-prompt guard for one tool-output value (CTXB-06): a burst of
|
|
71
|
-
* log-shaped entries (console `{level, text}` / network `{url, method, status}` /
|
|
72
|
-
* generic `{source?, level?, message}`) routes through {@link compactLogs};
|
|
73
|
-
* anything else through {@link guardBlob}. Compacted output is still bounded by
|
|
74
|
-
* the blob ceiling so a burst of all-distinct classes cannot flood the prompt.
|
|
75
|
-
*/
|
|
76
56
|
declare function guardToolOutput(value: unknown): string | undefined;
|
|
77
57
|
|
|
78
58
|
declare function parseRealWindow(error: unknown): number | undefined;
|
|
79
59
|
declare function isContextOverflow(error: unknown): boolean;
|
|
80
60
|
|
|
81
|
-
/**
|
|
82
|
-
* Caller-supplied degrade controls (D-07/D-09). Policy-free: no default/safety margin is
|
|
83
|
-
* baked here — Phase 355 supplies the concrete budget and pin predicate.
|
|
84
|
-
*
|
|
85
|
-
* - `budget` — the token ceiling the degraded prompt must fit under.
|
|
86
|
-
* - `pin` — a caller pin predicate; a message matching it is never evicted or truncated.
|
|
87
|
-
* The substrate stays tier-ignorant (355 pins its tiers explicitly).
|
|
88
|
-
* - `estimate` — the estimator the damage loop re-runs after each eviction. Optional so
|
|
89
|
-
* `degrade` stays a standalone-testable pure function; the Plan-03 factory passes its own.
|
|
90
|
-
*/
|
|
91
61
|
interface DegradeOptions {
|
|
92
62
|
budget: number;
|
|
93
63
|
pin?: (message: ModelMessage, index: number) => boolean;
|
|
94
64
|
estimate?: (messages: ModelMessage[]) => number;
|
|
95
65
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Discriminated degrade result (D-09). `ok:true` carries the fitted messages; `ok:false`
|
|
98
|
-
* is the structured cannot-fit outcome returned when system + final + pinned content alone
|
|
99
|
-
* exceeds the budget — degrade never throws and never violates a pin, returning the
|
|
100
|
-
* best-effort hygiene-reduced messages instead.
|
|
101
|
-
*/
|
|
102
66
|
type DegradeOutcome = {
|
|
103
67
|
ok: true;
|
|
104
68
|
messages: ModelMessage[];
|
|
@@ -107,10 +71,6 @@ type DegradeOutcome = {
|
|
|
107
71
|
reason: 'pinned-content-exceeds-budget';
|
|
108
72
|
messages: ModelMessage[];
|
|
109
73
|
};
|
|
110
|
-
/**
|
|
111
|
-
* The instance shape returned by the Plan-03 factory and consumed through the runner's
|
|
112
|
-
* provider-neutral port (D-05). Prompt tokens only; the substrate is policy-free.
|
|
113
|
-
*/
|
|
114
74
|
interface TokenAccounting {
|
|
115
75
|
estimate(messages: ModelMessage[]): number;
|
|
116
76
|
recordUsage(usage: LanguageModelUsage, messages: ModelMessage[]): void;
|
|
@@ -120,13 +80,6 @@ interface TokenAccounting {
|
|
|
120
80
|
};
|
|
121
81
|
degrade(messages: ModelMessage[], options: DegradeOptions): DegradeOutcome;
|
|
122
82
|
}
|
|
123
|
-
/**
|
|
124
|
-
* Factory construction options (Plan 03).
|
|
125
|
-
*
|
|
126
|
-
* - `getCapabilities` — the D-04 lazy ceilings thunk (composes v46 `resolveCapabilities`),
|
|
127
|
-
* read on every estimate/degrade so a mid-run overflow-learned window shrink applies next turn.
|
|
128
|
-
* - `perImageTokens` — the D-12 injectable flat per-image constant (test/chat-layer tuning).
|
|
129
|
-
*/
|
|
130
83
|
interface TokenAccountingOptions {
|
|
131
84
|
getCapabilities: () => ModelCapabilities;
|
|
132
85
|
perImageTokens?: number;
|
|
@@ -261,7 +214,6 @@ interface VisionGate {
|
|
|
261
214
|
captureMode: 'full' | 'textOnly';
|
|
262
215
|
promptNote: string;
|
|
263
216
|
}
|
|
264
|
-
/** 439 D-19: the configured `vision` when set, otherwise what the capability table says. */
|
|
265
217
|
declare function visionFromConfig(configured: boolean | undefined, capabilities: {
|
|
266
218
|
vision: boolean;
|
|
267
219
|
}): boolean;
|
package/dist/index.js
CHANGED
|
@@ -720,7 +720,7 @@ var LOCAL_OPENAI_WIRE = [
|
|
|
720
720
|
{
|
|
721
721
|
id: "deepseek-chat",
|
|
722
722
|
label: "DeepSeek Chat",
|
|
723
|
-
notes: "
|
|
723
|
+
notes: "Text-only model; use the accessibility tree."
|
|
724
724
|
},
|
|
725
725
|
{ id: "deepseek-r1", label: "DeepSeek R1", notes: "Text-only reasoning model." },
|
|
726
726
|
{ id: "qwen2.5-vl", label: "Qwen2.5 VL" },
|
|
@@ -1256,10 +1256,7 @@ function seedBuiltins() {
|
|
|
1256
1256
|
subscription: true,
|
|
1257
1257
|
modelAdapter: "openai-responses",
|
|
1258
1258
|
defaultModel: "gpt-6.1-sol",
|
|
1259
|
-
//
|
|
1260
|
-
// (`max_output_tokens`) with HTTP 400. Strip it at egress for this provider ONLY —
|
|
1261
|
-
// standard OpenAI-compatible `.chat()` endpoints and Anthropic support the cap.
|
|
1262
|
-
// 2026-10-20 (446-11, D-18): it also answers 400 "Unsupported parameter: temperature".
|
|
1259
|
+
// The subscription backend rejects `max_output_tokens` and `temperature` with HTTP 400.
|
|
1263
1260
|
unsupportedParams: ["maxOutputTokens", "temperature"]
|
|
1264
1261
|
});
|
|
1265
1262
|
registerProvider({
|
|
@@ -1415,9 +1412,9 @@ var MIDDLEWARE = [
|
|
|
1415
1412
|
toolSchemaMiddleware,
|
|
1416
1413
|
deriveExamplesMiddleware(),
|
|
1417
1414
|
addToolInputExamplesMiddleware(),
|
|
1418
|
-
//
|
|
1415
|
+
// Flag-gated by `AGENT_QA_DEBUG_LLM`; first, so it catches the raw `APICallError`.
|
|
1419
1416
|
debugLoggingMiddleware(),
|
|
1420
|
-
//
|
|
1417
|
+
// Strips empty-content messages just before the wire.
|
|
1421
1418
|
dropEmptyMessagesMiddleware()
|
|
1422
1419
|
];
|
|
1423
1420
|
function createModel(profile, auth, mask, overrides = {}, observation = {}) {
|
|
@@ -1566,7 +1563,7 @@ function resolveVisionConfig(servicesVision) {
|
|
|
1566
1563
|
// src/vision/resolve-gate.ts
|
|
1567
1564
|
var TEXT_ONLY_PROMPT_NOTE = [
|
|
1568
1565
|
"Visual screenshot is unavailable for this step.",
|
|
1569
|
-
"Rely on the accessibility tree
|
|
1566
|
+
"Rely on the accessibility tree for element identification, including roles, names, values, refs, and URLs.",
|
|
1570
1567
|
"Verify functional state from the available structured context rather than purely visual appearance."
|
|
1571
1568
|
].join(" ");
|
|
1572
1569
|
function visionFromConfig(configured, capabilities) {
|