modelrig 0.11.1 → 0.12.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/CHANGELOG.md +34 -0
- package/dist/adapters/anthropic.d.ts +4 -4
- package/dist/adapters/anthropic.d.ts.map +1 -1
- package/dist/adapters/anthropic.js +8 -1
- package/dist/adapters/deepseek.d.ts +2 -4
- package/dist/adapters/deepseek.d.ts.map +1 -1
- package/dist/adapters/deepseek.js +9 -5
- package/dist/adapters/gemini.d.ts +4 -1
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +16 -1
- package/dist/adapters/grok.d.ts +2 -4
- package/dist/adapters/grok.d.ts.map +1 -1
- package/dist/adapters/grok.js +8 -4
- package/dist/adapters/history-mapping.d.ts +126 -0
- package/dist/adapters/history-mapping.d.ts.map +1 -0
- package/dist/adapters/history-mapping.js +230 -0
- package/dist/adapters/openai-compat.d.ts +2 -4
- package/dist/adapters/openai-compat.d.ts.map +1 -1
- package/dist/adapters/openai-compat.js +9 -5
- package/dist/adapters/openai.d.ts +2 -4
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +8 -4
- package/dist/adapters/responses-api.d.ts.map +1 -1
- package/dist/adapters/responses-api.js +9 -4
- package/dist/artifacts/artifact.d.ts.map +1 -1
- package/dist/artifacts/artifact.js +79 -0
- package/dist/artifacts/conversation.d.ts +128 -0
- package/dist/artifacts/conversation.d.ts.map +1 -0
- package/dist/artifacts/conversation.js +172 -0
- package/dist/artifacts/index.d.ts +1 -1
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/media.d.ts +46 -0
- package/dist/artifacts/media.d.ts.map +1 -0
- package/dist/artifacts/media.js +88 -0
- package/dist/artifacts/run-context.d.ts +61 -2
- package/dist/artifacts/run-context.d.ts.map +1 -1
- package/dist/artifacts/run-context.js +183 -12
- package/dist/artifacts/scrub.d.ts +3 -0
- package/dist/artifacts/scrub.d.ts.map +1 -1
- package/dist/bakeoff/engine.d.ts.map +1 -1
- package/dist/bakeoff/engine.js +34 -7
- package/dist/bakeoff/eval-cases.d.ts +5 -0
- package/dist/bakeoff/eval-cases.d.ts.map +1 -1
- package/dist/bakeoff/eval-cases.js +10 -1
- package/dist/bakeoff/replay.d.ts +15 -0
- package/dist/bakeoff/replay.d.ts.map +1 -1
- package/dist/bakeoff/replay.js +19 -1
- package/dist/bakeoff/report.d.ts.map +1 -1
- package/dist/bakeoff/report.js +9 -2
- package/dist/bakeoff/turn-replay.d.ts +93 -0
- package/dist/bakeoff/turn-replay.d.ts.map +1 -0
- package/dist/bakeoff/turn-replay.js +150 -0
- package/dist/bakeoff/types.d.ts +12 -0
- package/dist/bakeoff/types.d.ts.map +1 -1
- package/dist/feedback/grade.d.ts +7 -2
- package/dist/feedback/grade.d.ts.map +1 -1
- package/dist/feedback/grade.js +14 -0
- package/dist/feedback/outcome.d.ts +103 -0
- package/dist/feedback/outcome.d.ts.map +1 -0
- package/dist/feedback/outcome.js +175 -0
- package/dist/gateway/history-bridge.d.ts +32 -0
- package/dist/gateway/history-bridge.d.ts.map +1 -0
- package/dist/gateway/history-bridge.js +64 -0
- package/dist/gateway/serve-client.d.ts.map +1 -1
- package/dist/gateway/serve-client.js +6 -0
- package/dist/index.d.ts +44 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +106 -6
- package/dist/init/observe.d.ts.map +1 -1
- package/dist/init/observe.js +3 -3
- package/dist/registry/build.d.ts +4 -0
- package/dist/registry/build.d.ts.map +1 -1
- package/dist/registry/generation-models.d.ts +68 -0
- package/dist/registry/generation-models.d.ts.map +1 -0
- package/dist/registry/generation-models.js +168 -0
- package/dist/registry/model-kind.d.ts +34 -0
- package/dist/registry/model-kind.d.ts.map +1 -0
- package/dist/registry/model-kind.js +40 -0
- package/dist/registry/pricing-shape.d.ts +29 -1
- package/dist/registry/pricing-shape.d.ts.map +1 -1
- package/dist/registry/pricing-shape.js +9 -0
- package/dist/registry/pricing.d.ts +26 -0
- package/dist/registry/pricing.d.ts.map +1 -1
- package/dist/registry/pricing.js +29 -0
- package/dist/registry/rows.d.ts.map +1 -1
- package/dist/registry/rows.js +3 -1
- package/dist/registry/unit-pricing.d.ts +32 -0
- package/dist/registry/unit-pricing.d.ts.map +1 -0
- package/dist/registry/unit-pricing.js +62 -0
- package/dist/routes/input-loader.d.ts +38 -0
- package/dist/routes/input-loader.d.ts.map +1 -0
- package/dist/routes/input-loader.js +80 -0
- package/dist/routes/loader.d.ts.map +1 -1
- package/dist/routes/loader.js +3 -0
- package/dist/routes/resolved-bundle.d.ts +2 -0
- package/dist/routes/resolved-bundle.d.ts.map +1 -1
- package/dist/routes/resolved-bundle.js +3 -0
- package/dist/run/cost.d.ts +28 -0
- package/dist/run/cost.d.ts.map +1 -1
- package/dist/run/cost.js +74 -0
- package/dist/run/dispatch.d.ts +4 -1
- package/dist/run/dispatch.d.ts.map +1 -1
- package/dist/run/dispatch.js +3 -0
- package/dist/run/limits.d.ts +88 -0
- package/dist/run/limits.d.ts.map +1 -0
- package/dist/run/limits.js +155 -0
- package/dist/run/messages.d.ts +199 -0
- package/dist/run/messages.d.ts.map +1 -0
- package/dist/run/messages.js +430 -0
- package/dist/run/raw-finalize.d.ts +5 -2
- package/dist/run/raw-finalize.d.ts.map +1 -1
- package/dist/run/raw-finalize.js +8 -5
- package/dist/run/raw-request.d.ts.map +1 -1
- package/dist/run/raw-request.js +2 -1
- package/dist/run/raw.d.ts +10 -4
- package/dist/run/raw.d.ts.map +1 -1
- package/dist/run/raw.js +11 -3
- package/dist/run/record-attempt.d.ts.map +1 -1
- package/dist/run/record-attempt.js +16 -6
- package/dist/run/record-call.d.ts +13 -2
- package/dist/run/record-call.d.ts.map +1 -1
- package/dist/run/record-call.js +50 -7
- package/dist/run/run.d.ts.map +1 -1
- package/dist/run/run.js +12 -8
- package/dist/telemetry/attempt-meta.d.ts +49 -1
- package/dist/telemetry/attempt-meta.d.ts.map +1 -1
- package/dist/telemetry/attempt-meta.js +45 -1
- package/dist/telemetry/exporter.d.ts.map +1 -1
- package/dist/telemetry/exporter.js +2 -1
- package/dist/telemetry/grade-mappers.d.ts +1 -1
- package/dist/telemetry/grade-mappers.d.ts.map +1 -1
- package/dist/telemetry/grade-mappers.js +7 -1
- package/dist/telemetry/grade-task.d.ts +49 -0
- package/dist/telemetry/grade-task.d.ts.map +1 -0
- package/dist/telemetry/grade-task.js +85 -0
- package/dist/telemetry/grades-sql.d.ts +16 -1
- package/dist/telemetry/grades-sql.d.ts.map +1 -1
- package/dist/telemetry/grades-sql.js +64 -4
- package/dist/telemetry/ingest-protocol.d.ts +24 -1
- package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
- package/dist/telemetry/ingest-protocol.js +72 -43
- package/dist/telemetry/otel-content.d.ts +31 -0
- package/dist/telemetry/otel-content.d.ts.map +1 -0
- package/dist/telemetry/otel-content.js +106 -0
- package/dist/telemetry/otel-hierarchy.d.ts +57 -0
- package/dist/telemetry/otel-hierarchy.d.ts.map +1 -0
- package/dist/telemetry/otel-hierarchy.js +155 -0
- package/dist/telemetry/otel-normalize.d.ts +15 -1
- package/dist/telemetry/otel-normalize.d.ts.map +1 -1
- package/dist/telemetry/otel-normalize.js +24 -39
- package/dist/telemetry/sinks.d.ts +4 -1
- package/dist/telemetry/sinks.d.ts.map +1 -1
- package/dist/telemetry/sinks.js +53 -34
- package/dist/telemetry/store-migrations.d.ts.map +1 -1
- package/dist/telemetry/store-migrations.js +8 -0
- package/dist/telemetry/store.d.ts +9 -0
- package/dist/telemetry/store.d.ts.map +1 -1
- package/dist/telemetry/store.js +10 -0
- package/dist/telemetry/uniform-rows.d.ts +43 -0
- package/dist/telemetry/uniform-rows.d.ts.map +1 -0
- package/dist/telemetry/uniform-rows.js +139 -0
- package/dist/types/failures-teaching.d.ts.map +1 -1
- package/dist/types/failures-teaching.js +11 -0
- package/dist/types/failures.d.ts +1 -1
- package/dist/types/failures.d.ts.map +1 -1
- package/dist/types/failures.js +2 -0
- package/dist/types/provider.d.ts +12 -0
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/route.d.ts +13 -0
- package/dist/types/route.d.ts.map +1 -1
- package/dist/types/telemetry.d.ts +14 -1
- package/dist/types/telemetry.d.ts.map +1 -1
- package/docs/agent-skill/SKILL.md +16 -3
- package/docs/how-it-fits.md +3 -3
- package/docs/instrumentation.md +15 -6
- package/docs/llms.txt +55 -7
- package/docs/mcp-oracle.md +15 -4
- package/docs/quickstart.md +6 -5
- package/package.json +4 -2
- package/registry/registry.json +456 -0
- package/templates/creative-approval.json +81 -0
- package/templates/support-conversation.json +82 -0
package/dist/run/dispatch.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Tool *execution* is never ours (spec §4.4); these helpers normalize the
|
|
9
9
|
* protocol and surface it — nothing here runs a tool.
|
|
10
10
|
*/
|
|
11
|
-
import type { AdapterRequest, AdapterResult, CandidateRef, ProviderAdapter, ServiceTier, ToolDefinition } from "../types/provider";
|
|
11
|
+
import type { AdapterRequest, AdapterResult, CandidateRef, ProviderAdapter, ServiceTier, ToolCall, ToolDefinition } from "../types/provider";
|
|
12
12
|
import type { RigFailure } from "../types/failures";
|
|
13
13
|
import type { OutputKind, RouteBundle, RunMeta, RunOptions, RunResult, RunTags } from "../types/route";
|
|
14
14
|
import type { TelemetryRung, TelemetryStore } from "../types/telemetry";
|
|
@@ -53,6 +53,9 @@ export interface AttemptTelemetry {
|
|
|
53
53
|
* `summarizeAttemptMeta` with this row's provider/model/usage. Absent ⇒ the
|
|
54
54
|
* recorder builds a minimal envelope from usage + cost alone (never null-only). */
|
|
55
55
|
readonly metaInputs?: AttemptMetaSource;
|
|
56
|
+
/** ARC-5: the tool calls the model requested on this attempt (tool-call path
|
|
57
|
+
* only) — hashed by the run-limit repeat detector, never stored. */
|
|
58
|
+
readonly toolCalls?: readonly ToolCall[];
|
|
56
59
|
/** SDK-owned extra telemetry tags merged onto the row (Q1 quality gate stamps
|
|
57
60
|
* `quality` / `quality_score` here). Never carries `rung` — the recorder
|
|
58
61
|
* stamps that last so a caller cannot override it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/run/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,EACf,WAAW,EACX,cAAc,EACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACvG,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAKnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAsD,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAExG,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG3E;oEACoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC;wEACoE;IACpE,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,C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CAAC;CACxC;AASD;;;;;;;;;GASG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,eAAe,GAAG,SAAS,EACpC,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,eAAe,CAAC,CAwF1B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,EAAE;QAAE,EAAE,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC;kDAC8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,QAAQ,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IACxC;gFAC4E;IAC5E,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAC/C;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAmD/F"}
|
package/dist/run/dispatch.js
CHANGED
|
@@ -151,6 +151,8 @@ function buildAdapterRequest(parts) {
|
|
|
151
151
|
...(route.policy.sampling !== undefined ? { sampling: route.policy.sampling } : {}),
|
|
152
152
|
...(opts.tools !== undefined ? { tools: opts.tools } : {}),
|
|
153
153
|
...(opts.toolChoice !== undefined ? { toolChoice: opts.toolChoice } : {}),
|
|
154
|
+
// ARC-β messages lane: the (run-validated) history; absent ⇒ no key ⇒ byte-identical.
|
|
155
|
+
...(opts.messages !== undefined ? { history: opts.messages } : {}),
|
|
154
156
|
};
|
|
155
157
|
}
|
|
156
158
|
/** Build the repair-attempt AdapterRequest (no tools — repair re-asks for the
|
|
@@ -348,6 +350,7 @@ function emitToolCallResult(record, parts) {
|
|
|
348
350
|
// dispatch or a serve (its cost still counts).
|
|
349
351
|
rung: "tool_call",
|
|
350
352
|
...(parts.metaInputs !== undefined ? { metaInputs: parts.metaInputs } : {}),
|
|
353
|
+
...(result.toolCalls !== undefined ? { toolCalls: result.toolCalls } : {}), // ARC-5 repeat-tool detector
|
|
351
354
|
});
|
|
352
355
|
return {
|
|
353
356
|
output: null,
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ARC-5 — run limits: an inline loop and budget guard, per run, in-process.
|
|
3
|
+
*
|
|
4
|
+
* run.start({ pipeline, limits: { maxUsd, maxCalls, maxWallMs, maxRepeatToolCall } })
|
|
5
|
+
* rig.conversation(id, { agent, limits })
|
|
6
|
+
*
|
|
7
|
+
* Every call inside an ambient run passes through the SDK, so the SDK can refuse
|
|
8
|
+
* the NEXT dispatch once a limit is reached — something an observability tool
|
|
9
|
+
* structurally cannot. On breach the dispatch throws a typed
|
|
10
|
+
* {@link RunLimitExceeded} (`failureClass: "limit_exceeded"`, terminal), the
|
|
11
|
+
* run's `RunMeta.failure_reason` becomes `limit:<which>`, and the run ends
|
|
12
|
+
* `failed`. A run that stopped at a limit keeps refusing on that async path.
|
|
13
|
+
*
|
|
14
|
+
* `recordCall` cannot prevent a call it did not dispatch: it ACCUMULATES (cost,
|
|
15
|
+
* call count) and the next `run`/`runRaw` throws. Distinct from envelopes (org /
|
|
16
|
+
* route money budgets, server-side, monthly): limits are per run and immediate.
|
|
17
|
+
*
|
|
18
|
+
* `maxRepeatToolCall: n` trips when the SAME tool name + argument hash is
|
|
19
|
+
* requested n times IN A ROW (a stuck agent loop). Only a SHA-256 of the
|
|
20
|
+
* canonical JSON arguments is kept — never the argument content.
|
|
21
|
+
*
|
|
22
|
+
* Everything here is PURE (state in, state out); run-context.ts holds the state.
|
|
23
|
+
*/
|
|
24
|
+
import { RigFailureError } from "../types/failures";
|
|
25
|
+
import type { LimitFailureReason } from "../telemetry/attempt-meta";
|
|
26
|
+
export interface RunLimits {
|
|
27
|
+
/** Stop once the run's accumulated cost reaches this many USD. */
|
|
28
|
+
readonly maxUsd?: number;
|
|
29
|
+
/** Stop once this many calls have been made in the run. */
|
|
30
|
+
readonly maxCalls?: number;
|
|
31
|
+
/** Stop once this many milliseconds have passed since the run started. */
|
|
32
|
+
readonly maxWallMs?: number;
|
|
33
|
+
/** Stop once the same tool + arguments has been requested this many times in a row. */
|
|
34
|
+
readonly maxRepeatToolCall?: number;
|
|
35
|
+
}
|
|
36
|
+
export type LimitName = "max_usd" | "max_calls" | "max_wall_ms" | "max_repeat_tool_call";
|
|
37
|
+
export interface LimitBreach {
|
|
38
|
+
readonly which: LimitName;
|
|
39
|
+
readonly limit: number;
|
|
40
|
+
readonly observed: number;
|
|
41
|
+
}
|
|
42
|
+
/** The accumulated run state the check reads. Hashes only for tool calls. */
|
|
43
|
+
export interface RunLimitState {
|
|
44
|
+
readonly costUsd: number;
|
|
45
|
+
readonly calls: number;
|
|
46
|
+
readonly startedAtMs: number;
|
|
47
|
+
/** `<tool name>:<sha256 of canonical args>` of the last requested tool call. */
|
|
48
|
+
readonly lastToolSig: string | null;
|
|
49
|
+
/** How many times in a row `lastToolSig` was requested. */
|
|
50
|
+
readonly repeatCount: number;
|
|
51
|
+
}
|
|
52
|
+
/** One recorded call as the accumulator sees it. `toolCalls` undefined ⇒ the
|
|
53
|
+
* lane cannot say (a recorded call) — the repeat streak is left untouched; an
|
|
54
|
+
* empty array ⇒ a reply with no tool call, which breaks the streak. */
|
|
55
|
+
export interface LimitCallObservation {
|
|
56
|
+
readonly costUsd?: number | null;
|
|
57
|
+
/** True for a pre-dispatch refusal (no provider call happened) — not counted. */
|
|
58
|
+
readonly notDispatched?: boolean;
|
|
59
|
+
readonly toolCalls?: readonly {
|
|
60
|
+
readonly name: string;
|
|
61
|
+
readonly arguments: string;
|
|
62
|
+
}[];
|
|
63
|
+
}
|
|
64
|
+
export declare function initialLimitState(startedAtMs: number): RunLimitState;
|
|
65
|
+
/** `<name>:<sha256(canonical JSON args)>` — the ONLY form a tool call is kept in. */
|
|
66
|
+
export declare function toolCallSignature(name: string, argsJson: string): string;
|
|
67
|
+
/** Fold one recorded call into the state (pure). */
|
|
68
|
+
export declare function accumulate(state: RunLimitState, call: LimitCallObservation): RunLimitState;
|
|
69
|
+
/** PURE pre-dispatch check: the first limit already reached, or null. Order:
|
|
70
|
+
* money, calls, wall clock, repeat loop. */
|
|
71
|
+
export declare function checkRunLimits(state: RunLimitState, limits: RunLimits, nowMs: number): LimitBreach | null;
|
|
72
|
+
/** `limit:<which>` — the RunMeta.failure_reason a breach writes. */
|
|
73
|
+
export declare function limitFailureReason(which: LimitName): LimitFailureReason;
|
|
74
|
+
/** Validate caller limits (a caller bug throws with the fix). Returns null for
|
|
75
|
+
* an empty / absent object — no limits, no state, byte-identical runs. */
|
|
76
|
+
export declare function validateRunLimits(limits: RunLimits | undefined): RunLimits | null;
|
|
77
|
+
/** The snake_case copy recorded on `RunMeta.limits` (metadata-safe numbers). */
|
|
78
|
+
export declare function limitsForMeta(limits: RunLimits): Readonly<Record<string, number>>;
|
|
79
|
+
/** The typed error a refused dispatch throws. A `RigFailureError` (class
|
|
80
|
+
* `limit_exceeded`, terminal) carrying which limit, its value and the observed one. */
|
|
81
|
+
export declare class RunLimitExceeded extends RigFailureError {
|
|
82
|
+
readonly which: LimitName;
|
|
83
|
+
readonly limit: number;
|
|
84
|
+
readonly observed: number;
|
|
85
|
+
readonly runId: string;
|
|
86
|
+
constructor(breach: LimitBreach, runId: string);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=limits.d.ts.map
|
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"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ARC-5 — run limits: an inline loop and budget guard, per run, in-process.
|
|
4
|
+
*
|
|
5
|
+
* run.start({ pipeline, limits: { maxUsd, maxCalls, maxWallMs, maxRepeatToolCall } })
|
|
6
|
+
* rig.conversation(id, { agent, limits })
|
|
7
|
+
*
|
|
8
|
+
* Every call inside an ambient run passes through the SDK, so the SDK can refuse
|
|
9
|
+
* the NEXT dispatch once a limit is reached — something an observability tool
|
|
10
|
+
* structurally cannot. On breach the dispatch throws a typed
|
|
11
|
+
* {@link RunLimitExceeded} (`failureClass: "limit_exceeded"`, terminal), the
|
|
12
|
+
* run's `RunMeta.failure_reason` becomes `limit:<which>`, and the run ends
|
|
13
|
+
* `failed`. A run that stopped at a limit keeps refusing on that async path.
|
|
14
|
+
*
|
|
15
|
+
* `recordCall` cannot prevent a call it did not dispatch: it ACCUMULATES (cost,
|
|
16
|
+
* call count) and the next `run`/`runRaw` throws. Distinct from envelopes (org /
|
|
17
|
+
* route money budgets, server-side, monthly): limits are per run and immediate.
|
|
18
|
+
*
|
|
19
|
+
* `maxRepeatToolCall: n` trips when the SAME tool name + argument hash is
|
|
20
|
+
* requested n times IN A ROW (a stuck agent loop). Only a SHA-256 of the
|
|
21
|
+
* canonical JSON arguments is kept — never the argument content.
|
|
22
|
+
*
|
|
23
|
+
* Everything here is PURE (state in, state out); run-context.ts holds the state.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.RunLimitExceeded = void 0;
|
|
27
|
+
exports.initialLimitState = initialLimitState;
|
|
28
|
+
exports.toolCallSignature = toolCallSignature;
|
|
29
|
+
exports.accumulate = accumulate;
|
|
30
|
+
exports.checkRunLimits = checkRunLimits;
|
|
31
|
+
exports.limitFailureReason = limitFailureReason;
|
|
32
|
+
exports.validateRunLimits = validateRunLimits;
|
|
33
|
+
exports.limitsForMeta = limitsForMeta;
|
|
34
|
+
const node_crypto_1 = require("node:crypto");
|
|
35
|
+
const failures_1 = require("../types/failures");
|
|
36
|
+
const failures_teaching_1 = require("../types/failures-teaching");
|
|
37
|
+
function initialLimitState(startedAtMs) {
|
|
38
|
+
return { costUsd: 0, calls: 0, startedAtMs, lastToolSig: null, repeatCount: 0 };
|
|
39
|
+
}
|
|
40
|
+
/** Canonical JSON (sorted keys) so `{a:1,b:2}` and `{b:2,a:1}` hash alike. A
|
|
41
|
+
* non-JSON argument string hashes as the raw string. */
|
|
42
|
+
function canonical(value) {
|
|
43
|
+
if (Array.isArray(value))
|
|
44
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
45
|
+
if (value !== null && typeof value === "object") {
|
|
46
|
+
const obj = value;
|
|
47
|
+
return `{${Object.keys(obj).sort().map((k) => `${JSON.stringify(k)}:${canonical(obj[k])}`).join(",")}}`;
|
|
48
|
+
}
|
|
49
|
+
return JSON.stringify(value) ?? "null";
|
|
50
|
+
}
|
|
51
|
+
/** `<name>:<sha256(canonical JSON args)>` — the ONLY form a tool call is kept in. */
|
|
52
|
+
function toolCallSignature(name, argsJson) {
|
|
53
|
+
let body;
|
|
54
|
+
try {
|
|
55
|
+
body = canonical(JSON.parse(argsJson));
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
body = argsJson;
|
|
59
|
+
}
|
|
60
|
+
return `${name}:${(0, node_crypto_1.createHash)("sha256").update(body, "utf8").digest("hex")}`;
|
|
61
|
+
}
|
|
62
|
+
/** Fold one recorded call into the state (pure). */
|
|
63
|
+
function accumulate(state, call) {
|
|
64
|
+
if (call.notDispatched === true)
|
|
65
|
+
return state;
|
|
66
|
+
let { lastToolSig, repeatCount } = state;
|
|
67
|
+
if (call.toolCalls !== undefined) {
|
|
68
|
+
if (call.toolCalls.length === 0) {
|
|
69
|
+
lastToolSig = null;
|
|
70
|
+
repeatCount = 0;
|
|
71
|
+
}
|
|
72
|
+
for (const tc of call.toolCalls) {
|
|
73
|
+
const sig = toolCallSignature(tc.name, tc.arguments);
|
|
74
|
+
if (sig === lastToolSig)
|
|
75
|
+
repeatCount += 1;
|
|
76
|
+
else {
|
|
77
|
+
lastToolSig = sig;
|
|
78
|
+
repeatCount = 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const cost = typeof call.costUsd === "number" && Number.isFinite(call.costUsd) && call.costUsd > 0 ? call.costUsd : 0;
|
|
83
|
+
return { ...state, costUsd: state.costUsd + cost, calls: state.calls + 1, lastToolSig, repeatCount };
|
|
84
|
+
}
|
|
85
|
+
/** PURE pre-dispatch check: the first limit already reached, or null. Order:
|
|
86
|
+
* money, calls, wall clock, repeat loop. */
|
|
87
|
+
function checkRunLimits(state, limits, nowMs) {
|
|
88
|
+
if (limits.maxUsd !== undefined && state.costUsd >= limits.maxUsd) {
|
|
89
|
+
return { which: "max_usd", limit: limits.maxUsd, observed: state.costUsd };
|
|
90
|
+
}
|
|
91
|
+
if (limits.maxCalls !== undefined && state.calls >= limits.maxCalls) {
|
|
92
|
+
return { which: "max_calls", limit: limits.maxCalls, observed: state.calls };
|
|
93
|
+
}
|
|
94
|
+
const elapsed = nowMs - state.startedAtMs;
|
|
95
|
+
if (limits.maxWallMs !== undefined && elapsed >= limits.maxWallMs) {
|
|
96
|
+
return { which: "max_wall_ms", limit: limits.maxWallMs, observed: elapsed };
|
|
97
|
+
}
|
|
98
|
+
if (limits.maxRepeatToolCall !== undefined && state.repeatCount >= limits.maxRepeatToolCall) {
|
|
99
|
+
return { which: "max_repeat_tool_call", limit: limits.maxRepeatToolCall, observed: state.repeatCount };
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
/** `limit:<which>` — the RunMeta.failure_reason a breach writes. */
|
|
104
|
+
function limitFailureReason(which) {
|
|
105
|
+
return `limit:${which}`;
|
|
106
|
+
}
|
|
107
|
+
/** Validate caller limits (a caller bug throws with the fix). Returns null for
|
|
108
|
+
* an empty / absent object — no limits, no state, byte-identical runs. */
|
|
109
|
+
function validateRunLimits(limits) {
|
|
110
|
+
if (limits === undefined)
|
|
111
|
+
return null;
|
|
112
|
+
const out = {};
|
|
113
|
+
const check = (key, integer) => {
|
|
114
|
+
const v = limits[key];
|
|
115
|
+
if (v === undefined)
|
|
116
|
+
return;
|
|
117
|
+
if (typeof v !== "number" || !Number.isFinite(v) || v <= 0 || (integer && !Number.isInteger(v))) {
|
|
118
|
+
throw new Error(`run limits: ${key} must be a positive ${integer ? "integer" : "number"}, got ${String(v)} — ` +
|
|
119
|
+
"omit the field to leave that limit off");
|
|
120
|
+
}
|
|
121
|
+
out[key] = v;
|
|
122
|
+
};
|
|
123
|
+
check("maxUsd", false);
|
|
124
|
+
check("maxCalls", true);
|
|
125
|
+
check("maxWallMs", false);
|
|
126
|
+
check("maxRepeatToolCall", true);
|
|
127
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
128
|
+
}
|
|
129
|
+
/** The snake_case copy recorded on `RunMeta.limits` (metadata-safe numbers). */
|
|
130
|
+
function limitsForMeta(limits) {
|
|
131
|
+
return {
|
|
132
|
+
...(limits.maxUsd !== undefined ? { max_usd: limits.maxUsd } : {}),
|
|
133
|
+
...(limits.maxCalls !== undefined ? { max_calls: limits.maxCalls } : {}),
|
|
134
|
+
...(limits.maxWallMs !== undefined ? { max_wall_ms: limits.maxWallMs } : {}),
|
|
135
|
+
...(limits.maxRepeatToolCall !== undefined ? { max_repeat_tool_call: limits.maxRepeatToolCall } : {}),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** The typed error a refused dispatch throws. A `RigFailureError` (class
|
|
139
|
+
* `limit_exceeded`, terminal) carrying which limit, its value and the observed one. */
|
|
140
|
+
class RunLimitExceeded extends failures_1.RigFailureError {
|
|
141
|
+
constructor(breach, runId) {
|
|
142
|
+
super({
|
|
143
|
+
class: "limit_exceeded",
|
|
144
|
+
message: `run ${runId} stopped at its ${breach.which} limit (limit ${breach.limit}, observed ` +
|
|
145
|
+
`${Number.isInteger(breach.observed) ? breach.observed : breach.observed.toFixed(6)}) — the next call was not dispatched`,
|
|
146
|
+
fixHint: failures_teaching_1.FAILURE_TEACHING.limit_exceeded.fixHint,
|
|
147
|
+
});
|
|
148
|
+
this.name = "RunLimitExceeded";
|
|
149
|
+
this.which = breach.which;
|
|
150
|
+
this.limit = breach.limit;
|
|
151
|
+
this.observed = breach.observed;
|
|
152
|
+
this.runId = runId;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.RunLimitExceeded = RunLimitExceeded;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The messages-native lane — ARC-β (agent-archetypes spec §4, builder-prompt-02
|
|
3
|
+
* §1.1). A provider-neutral conversation HISTORY that every adapter maps to its
|
|
4
|
+
* native shape (adapters/history-mapping.ts), so a chat turn or a tool loop can
|
|
5
|
+
* be routed, captured and replayed on a cheaper model.
|
|
6
|
+
*
|
|
7
|
+
* Design rules (binding):
|
|
8
|
+
* - NO `system` role in history. The system prompt stays
|
|
9
|
+
* `AdapterRequest.systemPrompt`, rendered by the route template exactly as
|
|
10
|
+
* today. A `system` message in caller input is rejected with a teaching error.
|
|
11
|
+
* - Tool calls reuse the existing normalized {@link ToolCall} (OpenAI
|
|
12
|
+
* `tool_calls` shape) — there is no second tool-call vocabulary.
|
|
13
|
+
* - `history` absent ⇒ every adapter takes today's code path, byte-identical
|
|
14
|
+
* (pinned by adapters/one-turn-parity.test.ts).
|
|
15
|
+
*
|
|
16
|
+
* NAMING NOTE: the spec calls the type `ChatMessage`, but `ChatMessage` is
|
|
17
|
+
* already a public export (the gateway's OpenAI wire message,
|
|
18
|
+
* gateway/http-protocol.ts). To keep that export stable the lane's type is
|
|
19
|
+
* exported as {@link HistoryMessage} (it is what `AdapterRequest.history` holds).
|
|
20
|
+
*
|
|
21
|
+
* Pure module: types, validation, canonicalization and the capture codec. No I/O.
|
|
22
|
+
*/
|
|
23
|
+
import type { ToolCall, ToolChoice, ToolDefinition } from "../types/provider";
|
|
24
|
+
import type { RouteBundle, RunOptions } from "../types/route";
|
|
25
|
+
import type { CapabilityFlag } from "../types/provider";
|
|
26
|
+
import { RouteConfigError } from "../routes/loader";
|
|
27
|
+
/** A text part of a message's content. */
|
|
28
|
+
export interface HistoryTextPart {
|
|
29
|
+
readonly type: "text";
|
|
30
|
+
readonly text: string;
|
|
31
|
+
}
|
|
32
|
+
/** A content part. TEXT ONLY in ARC-β — image parts are UC-3 M1's job and join
|
|
33
|
+
* this union there (EXTENSION POINT: add `| HistoryImagePart` and teach each
|
|
34
|
+
* mapper in adapters/history-mapping.ts; validation below rejects any other
|
|
35
|
+
* `type` with a teaching problem until then). */
|
|
36
|
+
export type HistoryPart = HistoryTextPart;
|
|
37
|
+
export type HistoryContent = string | readonly HistoryPart[];
|
|
38
|
+
export interface HistoryUserMessage {
|
|
39
|
+
readonly role: "user";
|
|
40
|
+
readonly content: HistoryContent;
|
|
41
|
+
}
|
|
42
|
+
export interface HistoryAssistantMessage {
|
|
43
|
+
readonly role: "assistant";
|
|
44
|
+
readonly content: HistoryContent;
|
|
45
|
+
/** The tool calls this assistant turn emitted (exactly what `meta.toolCalls`
|
|
46
|
+
* returned on that turn). Only assistant messages carry them. */
|
|
47
|
+
readonly toolCalls?: readonly ToolCall[];
|
|
48
|
+
}
|
|
49
|
+
export interface HistoryToolMessage {
|
|
50
|
+
readonly role: "tool";
|
|
51
|
+
/** The `ToolCall.id` this message answers — must match a PRIOR assistant
|
|
52
|
+
* message's tool call. */
|
|
53
|
+
readonly toolCallId: string;
|
|
54
|
+
readonly content: string;
|
|
55
|
+
}
|
|
56
|
+
/** One turn of a conversation (spec's `ChatMessage`; see the naming note). */
|
|
57
|
+
export type HistoryMessage = HistoryUserMessage | HistoryAssistantMessage | HistoryToolMessage;
|
|
58
|
+
/** Where every messages-lane teaching message points. */
|
|
59
|
+
export declare const MESSAGES_DOCS_ANCHOR = "messages-lane.md";
|
|
60
|
+
/** A caller-contract breach in a `messages` input. Subclasses RouteConfigError
|
|
61
|
+
* so every surface that already maps config errors (the gateway's 422, the CLI)
|
|
62
|
+
* treats it the same way: thrown pre-dispatch, nothing billed, no telemetry. */
|
|
63
|
+
export declare class MessagesInputError extends RouteConfigError {
|
|
64
|
+
constructor(problems: readonly string[]);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validate a caller-supplied history. Returns the list of teaching problems
|
|
68
|
+
* (empty ⇒ valid). Rules: a non-empty array; roles user | assistant | tool only
|
|
69
|
+
* (a `system` message is rejected, pointing at the route template /
|
|
70
|
+
* `systemPrompt`); `toolCalls` only on assistant messages; every tool message
|
|
71
|
+
* answers a PRIOR assistant tool call by id; the last message is `user` or
|
|
72
|
+
* `tool` (the model answers it).
|
|
73
|
+
*/
|
|
74
|
+
export declare function historyProblems(messages: unknown): string[];
|
|
75
|
+
/** Throw a {@link MessagesInputError} when `messages` is not a valid history;
|
|
76
|
+
* otherwise return it typed. */
|
|
77
|
+
export declare function assertValidHistory(messages: unknown): readonly HistoryMessage[];
|
|
78
|
+
/** The text of a content value (parts concatenated in order, no separator —
|
|
79
|
+
* the same joining OpenAI applies to multi-part text content). */
|
|
80
|
+
export declare function contentText(content: HistoryContent): string;
|
|
81
|
+
/** Total characters across every message's text and tool-call arguments — the
|
|
82
|
+
* history's contribution to the envelope's pre-dispatch input estimate. */
|
|
83
|
+
export declare function historyChars(history: readonly HistoryMessage[] | undefined): number;
|
|
84
|
+
/**
|
|
85
|
+
* Canonical text of a history, for hashing and cache-prefix reasoning: one
|
|
86
|
+
* sorted-key JSON line per message. PREFIX-STABLE by construction —
|
|
87
|
+
* `canonicalize(h.slice(0, n))` is a string prefix of `canonicalize(h)` — so a
|
|
88
|
+
* conversation that grows by appending turns keeps every earlier turn's bytes
|
|
89
|
+
* (the property provider prefix caches key on).
|
|
90
|
+
*/
|
|
91
|
+
export declare function canonicalize(history: readonly HistoryMessage[]): string;
|
|
92
|
+
/** The marker that tells a capture row's `variablesJson` holds a messages call. */
|
|
93
|
+
export declare const MESSAGES_CAPTURE_KIND = "modelrig.messages";
|
|
94
|
+
export interface MessagesCapture {
|
|
95
|
+
readonly kind: typeof MESSAGES_CAPTURE_KIND;
|
|
96
|
+
readonly v: 1;
|
|
97
|
+
/** The route's template variables (`RunOptions.input`). */
|
|
98
|
+
readonly variables: Record<string, unknown>;
|
|
99
|
+
/** The history the model answered — up to and including the turn's final
|
|
100
|
+
* user/tool message. The captured output is the reference assistant reply. */
|
|
101
|
+
readonly history: readonly HistoryMessage[];
|
|
102
|
+
/** The tool definitions the live call declared (R2-1) — present ONLY when it
|
|
103
|
+
* declared them, so a capture without tools is byte-identical to before. */
|
|
104
|
+
readonly tools?: readonly ToolDefinition[];
|
|
105
|
+
readonly toolChoice?: ToolChoice;
|
|
106
|
+
}
|
|
107
|
+
/** The live call's tool surface, recorded on the capture so turn replay answers
|
|
108
|
+
* the final turn with the SAME tool definitions. */
|
|
109
|
+
export interface CapturedTools {
|
|
110
|
+
readonly tools?: readonly ToolDefinition[];
|
|
111
|
+
readonly toolChoice?: ToolChoice;
|
|
112
|
+
}
|
|
113
|
+
/** Render a messages call's replay input for the capture row (JSON). */
|
|
114
|
+
export declare function renderForCapture(history: readonly HistoryMessage[], variables?: Record<string, unknown>, tools?: CapturedTools): string;
|
|
115
|
+
/** The replay input a capture row encodes: the route variables, plus the
|
|
116
|
+
* history when the row came from a messages call. A legacy (variables-only)
|
|
117
|
+
* row parses exactly as before. */
|
|
118
|
+
export interface CaptureReplayInput {
|
|
119
|
+
readonly input: Record<string, unknown>;
|
|
120
|
+
readonly messages?: readonly HistoryMessage[];
|
|
121
|
+
/** The live call's tools (R2-1), when it declared any — replayed verbatim. */
|
|
122
|
+
readonly tools?: readonly ToolDefinition[];
|
|
123
|
+
readonly toolChoice?: ToolChoice;
|
|
124
|
+
}
|
|
125
|
+
export declare function parseCaptureInput(variablesJson: string): CaptureReplayInput;
|
|
126
|
+
/** The capture-row input for a run: the variables alone (legacy, byte-identical)
|
|
127
|
+
* or the messages envelope. Returned as a value for `JSON.stringify` by the
|
|
128
|
+
* capture writer. */
|
|
129
|
+
export declare function captureInputFor(input: Record<string, unknown>, messages: readonly HistoryMessage[] | undefined, tools?: CapturedTools): unknown;
|
|
130
|
+
/**
|
|
131
|
+
* The routed lane's history for one run (rig.run / runStream / runBundle), or
|
|
132
|
+
* `undefined` for a variables route — BYTE-IDENTICAL then. Throws pre-dispatch
|
|
133
|
+
* (nothing billed, no telemetry — a config error, like every RouteConfigError):
|
|
134
|
+
* `messages` on a route that does not declare `input: messages`; a messages
|
|
135
|
+
* route called without `messages`; a messages route that also declares
|
|
136
|
+
* mask/screen (mirror bundles skip the loader, so the pairing is re-checked);
|
|
137
|
+
* an invalid history.
|
|
138
|
+
*/
|
|
139
|
+
export interface RoutedHistory<R> {
|
|
140
|
+
readonly history: readonly HistoryMessage[] | undefined;
|
|
141
|
+
/** The route the ladder runs on: the SAME object unless candidates were
|
|
142
|
+
* skipped for this history (ruling R2-2). */
|
|
143
|
+
readonly route: R;
|
|
144
|
+
/** Telemetry tag for the skipped candidates (`provider/model=code,…`), or {}. */
|
|
145
|
+
readonly skipTag: Record<string, string>;
|
|
146
|
+
}
|
|
147
|
+
export declare function routedHistory<R extends Pick<RouteBundle, "route" | "inputKind" | "mask" | "screen" | "repair" | "variants" | "candidates">>(route: R, opts: Pick<RunOptions, "messages" | "tools">): RoutedHistory<R>;
|
|
148
|
+
/** The `history_skipped` tag key (the precedent is `zdr_enforced`). */
|
|
149
|
+
export declare const HISTORY_SKIPPED_TAG = "history_skipped";
|
|
150
|
+
/** Merge the skip tag onto the run's tags; the SAME object when there is none. */
|
|
151
|
+
export declare function withSkipTag<T extends RunOptions["tags"]>(tags: T, skipTag: Record<string, string>): T;
|
|
152
|
+
/** A messages route's final user instruction: its rendered `prompt.user` when
|
|
153
|
+
* declared, else nothing (the history's last turn IS the prompt — the fixed
|
|
154
|
+
* single-turn trigger is never appended to a conversation). */
|
|
155
|
+
export declare function messagesUserTurn(route: Pick<RouteBundle, "userTemplate">, ctx: {
|
|
156
|
+
readonly variables: Record<string, unknown>;
|
|
157
|
+
readonly capabilities: ReadonlySet<CapabilityFlag>;
|
|
158
|
+
readonly variableTrust?: Readonly<Record<string, "untrusted">>;
|
|
159
|
+
}): string;
|
|
160
|
+
/** Prefix of every "this provider cannot take this history natively" refusal —
|
|
161
|
+
* the stable marker turn replay keys on to mark a case INCOMPARABLE for a
|
|
162
|
+
* candidate (bakeoff/turn-replay.ts) rather than score it as a failure. */
|
|
163
|
+
export declare const HISTORY_INCOMPATIBLE_PREFIX = "history not accepted natively";
|
|
164
|
+
/**
|
|
165
|
+
* Why `provider/model` cannot be sent this history natively, or null. Fail-closed
|
|
166
|
+
* PRE-DISPATCH (no provider call) on two documented provider rules:
|
|
167
|
+
* - Anthropic rejects `tool_use` / `tool_result` blocks unless the request
|
|
168
|
+
* declares `tools`;
|
|
169
|
+
* - Gemini 3 models require thought signatures on earlier `functionCall` parts,
|
|
170
|
+
* which ModelRig neither captures nor invents (no placeholder signatures).
|
|
171
|
+
* Every other provider/model proceeds.
|
|
172
|
+
*/
|
|
173
|
+
export declare function historyIncompatibility(provider: string, model: string, history: readonly HistoryMessage[] | undefined, declaredTools: readonly unknown[] | undefined): string | null;
|
|
174
|
+
/** Short reason code (telemetry tag value) + the teaching message. */
|
|
175
|
+
export interface HistoryIncompatibility {
|
|
176
|
+
readonly code: "tools_required" | "thought_signatures";
|
|
177
|
+
readonly message: string;
|
|
178
|
+
}
|
|
179
|
+
/** R2-4: `models/gemini-3…` and case variants normalize to `gemini-3…`. An
|
|
180
|
+
* unregistered alias (e.g. `gemini-pro-latest`) does not match and falls
|
|
181
|
+
* through to the provider's own 400 — documented, never guessed. */
|
|
182
|
+
export declare function isGemini3Model(model: string): boolean;
|
|
183
|
+
export declare function historyIncompatibilityCode(provider: string, model: string, history: readonly HistoryMessage[] | undefined, declaredTools: readonly unknown[] | undefined): HistoryIncompatibility | null;
|
|
184
|
+
/** The raw lane's history (runRaw / runRawStream), or `undefined` for the
|
|
185
|
+
* single-turn call. `userPrompt` is optional only when `messages` is given;
|
|
186
|
+
* neither is a teaching error. A history the target provider cannot take
|
|
187
|
+
* natively is refused here, pre-dispatch (no provider call, no telemetry row). */
|
|
188
|
+
export declare function rawHistory(input: {
|
|
189
|
+
readonly provider: string;
|
|
190
|
+
readonly model: string;
|
|
191
|
+
readonly userPrompt?: string;
|
|
192
|
+
readonly messages?: unknown;
|
|
193
|
+
readonly tools?: readonly unknown[];
|
|
194
|
+
}): readonly HistoryMessage[] | undefined;
|
|
195
|
+
/** The user side of the rendered request for the attempt envelope's
|
|
196
|
+
* input_hash / size (WI-1): the canonical history followed by the final user
|
|
197
|
+
* instruction; exactly `userPrompt` when there is no history (byte-identical). */
|
|
198
|
+
export declare function userSideForHash(userPrompt: string, history: readonly HistoryMessage[] | undefined): string;
|
|
199
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/run/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAKpD,0CAA0C;AAC1C,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;iDAGiD;AACjD,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC;AAE1C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,WAAW,EAAE,CAAC;AAE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