@rulvar/core 1.191.0 → 1.192.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/index.d.ts +28 -0
- package/dist/index.js +22 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2381,6 +2381,14 @@ type AgentEvents = {
|
|
|
2381
2381
|
label?: string;
|
|
2382
2382
|
error: WireError;
|
|
2383
2383
|
willRetry: boolean;
|
|
2384
|
+
} | {
|
|
2385
|
+
type: "quota:denied";
|
|
2386
|
+
agentType: string;
|
|
2387
|
+
label?: string; /** The denied model ref. */
|
|
2388
|
+
model?: string; /** The limiter's reason ('tokensPerMinute 1800000 exhausted'). */
|
|
2389
|
+
reason?: string;
|
|
2390
|
+
retryAfterMs?: number;
|
|
2391
|
+
willRetry: true;
|
|
2384
2392
|
} | {
|
|
2385
2393
|
type: "agent:schema-retry";
|
|
2386
2394
|
agentType: string;
|
|
@@ -5192,6 +5200,12 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
|
|
|
5192
5200
|
adapter: ProviderAdapter;
|
|
5193
5201
|
resolved: ResolvedInvocation;
|
|
5194
5202
|
/**
|
|
5203
|
+
* The versioned compat flag (RV1810): emit the legacy `agent:error`
|
|
5204
|
+
* twin beside `quota:denied` for recoverable pre-wire quota waits.
|
|
5205
|
+
* Default off: the wait speaks its own type only.
|
|
5206
|
+
*/
|
|
5207
|
+
quotaDeniedAgentError?: boolean;
|
|
5208
|
+
/**
|
|
5195
5209
|
* Transport failover chain for the loop phase (M4-T04):
|
|
5196
5210
|
* resolved fallback targets tried in order on
|
|
5197
5211
|
* transport or rate-limit failures after retries exhaust. Failover is
|
|
@@ -7070,6 +7084,16 @@ interface CreateEngineOptions {
|
|
|
7070
7084
|
modelKnowledge?: ModelKnowledgeStore;
|
|
7071
7085
|
};
|
|
7072
7086
|
defaults?: EngineDefaults;
|
|
7087
|
+
/**
|
|
7088
|
+
* Telemetry compat posture (RV1810). `quotaDeniedAgentError: true`
|
|
7089
|
+
* restores the legacy `agent:error` twin beside the primary
|
|
7090
|
+
* `quota:denied` event for recoverable pre-wire quota waits, for
|
|
7091
|
+
* consumers still keyed to the old type. Default off: healthy
|
|
7092
|
+
* throttling speaks its own type and never reads as failure.
|
|
7093
|
+
*/
|
|
7094
|
+
telemetry?: {
|
|
7095
|
+
quotaDeniedAgentError?: boolean;
|
|
7096
|
+
};
|
|
7073
7097
|
budgetDefaults?: BudgetDefaults;
|
|
7074
7098
|
concurrency?: {
|
|
7075
7099
|
perRun?: number; /** Per-adapter-id caps; unlimited unless configured (Appendix A; M4-T07). */
|
|
@@ -10515,6 +10539,10 @@ interface RunInternals {
|
|
|
10515
10539
|
gates?: Record<string, MechanicalGateProfile>; /** Engine-wide admission countTokens policy (RV1804); default 'allow'. */
|
|
10516
10540
|
countTokens?: "allow" | "deny";
|
|
10517
10541
|
};
|
|
10542
|
+
/** Telemetry compat posture (RV1810). */
|
|
10543
|
+
telemetry?: {
|
|
10544
|
+
/** Emit the legacy agent:error twin beside quota:denied. */quotaDeniedAgentError?: boolean;
|
|
10545
|
+
};
|
|
10518
10546
|
/** Engine-scoped per-provider keyed limiter (M4-T07). */
|
|
10519
10547
|
providerLimiter?: KeyedLimiter;
|
|
10520
10548
|
/**
|
package/dist/index.js
CHANGED
|
@@ -12407,7 +12407,25 @@ async function runAgent(options) {
|
|
|
12407
12407
|
const retryAfter = (outcome.wireError?.data)?.retryAfterMs;
|
|
12408
12408
|
if (outcome.wireError !== void 0) {
|
|
12409
12409
|
if (outcome.quotaDenied !== true) transportRetries += 1;
|
|
12410
|
-
|
|
12410
|
+
if (outcome.quotaDenied === true) {
|
|
12411
|
+
const denialData = outcome.wireError.data;
|
|
12412
|
+
events?.emit({
|
|
12413
|
+
type: "quota:denied",
|
|
12414
|
+
agentType,
|
|
12415
|
+
label: options.label,
|
|
12416
|
+
model: target.resolved.ref,
|
|
12417
|
+
...typeof denialData?.reason === "string" ? { reason: denialData.reason } : {},
|
|
12418
|
+
...typeof denialData?.retryAfterMs === "number" ? { retryAfterMs: denialData.retryAfterMs } : {},
|
|
12419
|
+
willRetry: true
|
|
12420
|
+
});
|
|
12421
|
+
if (options.quotaDeniedAgentError === true) events?.emit({
|
|
12422
|
+
type: "agent:error",
|
|
12423
|
+
agentType,
|
|
12424
|
+
label: options.label,
|
|
12425
|
+
error: outcome.wireError,
|
|
12426
|
+
willRetry: true
|
|
12427
|
+
});
|
|
12428
|
+
} else events?.emit({
|
|
12411
12429
|
type: "agent:error",
|
|
12412
12430
|
agentType,
|
|
12413
12431
|
label: options.label,
|
|
@@ -17579,6 +17597,7 @@ function createCtx(internals, rootWorkflow) {
|
|
|
17579
17597
|
resolved: loopResolved,
|
|
17580
17598
|
limits,
|
|
17581
17599
|
events: agentSink,
|
|
17600
|
+
...internals.telemetry?.quotaDeniedAgentError === true ? { quotaDeniedAgentError: true } : {},
|
|
17582
17601
|
transcript: {
|
|
17583
17602
|
mintRef: internals.mintTranscriptRef,
|
|
17584
17603
|
put: (ref, blob) => internals.transcripts.put(ref, blob, internals.lease)
|
|
@@ -25184,6 +25203,7 @@ function createEngine(options) {
|
|
|
25184
25203
|
if (profile.countTokens !== void 0 && !["allow", "deny"].includes(profile.countTokens)) throw new ConfigError(`createEngine defaults.profiles['${name}'].countTokens must be 'allow' or 'deny'`);
|
|
25185
25204
|
}
|
|
25186
25205
|
if (options.defaults?.countTokens !== void 0 && !["allow", "deny"].includes(options.defaults.countTokens)) throw new ConfigError("createEngine defaults.countTokens must be 'allow' or 'deny'");
|
|
25206
|
+
if (options.telemetry?.quotaDeniedAgentError !== void 0 && typeof options.telemetry.quotaDeniedAgentError !== "boolean") throw new ConfigError("createEngine telemetry.quotaDeniedAgentError must be a boolean");
|
|
25187
25207
|
validateDeterminismConfig(options.determinism);
|
|
25188
25208
|
validateEngineQuotaConfig(options.quota);
|
|
25189
25209
|
if (options.security?.argsHashSalt !== void 0 && (typeof options.security.argsHashSalt !== "string" || options.security.argsHashSalt === "")) throw new ConfigError("createEngine security.argsHashSalt must be a nonempty string when given");
|
|
@@ -25360,6 +25380,7 @@ function createEngine(options) {
|
|
|
25360
25380
|
...defaults.gates === void 0 ? {} : { gates: defaults.gates },
|
|
25361
25381
|
...defaults.countTokens === void 0 ? {} : { countTokens: defaults.countTokens }
|
|
25362
25382
|
},
|
|
25383
|
+
...options.telemetry === void 0 ? {} : { telemetry: options.telemetry },
|
|
25363
25384
|
errorPolicy: wf.errorPolicy,
|
|
25364
25385
|
dropped: [],
|
|
25365
25386
|
cost: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.192.0",
|
|
4
4
|
"description": "Rulvar core: L0 contracts, journal kernel, ctx primitives, agent runtime, model router, tool system, dynamic orchestrator, InMemory and JSONL stores, event stream.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|