@parcha/agentrun-kernel 0.1.0-beta.50 → 0.1.0-beta.52

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.
@@ -41,3 +41,7 @@ export declare const freeCeilingMessage: (summary: string | null | undefined) =>
41
41
  * that is no such number is refused, loudly: a limit read as none would let a free run loop for ever. */
42
42
  export declare const FREE_MODEL_REQUESTS_ENV = "AGENTRUN_FREE_MODEL_REQUESTS";
43
43
  export declare function freeModelRequestsOf(env: Record<string, string | undefined>): number;
44
+ /** A run's limit on its requests on free models: the server's (freeModelRequestsOf), or the agent's own when it is lower
45
+ * (definition.max_requests, its revision's `maxRequests`, a whole number above 0). The server's always holds: an agent's
46
+ * higher one gets the server's. */
47
+ export declare function freeRequestLimitOf(env: Record<string, string | undefined>, maxRequests?: unknown): number;
@@ -69,3 +69,10 @@ export function freeModelRequestsOf(env) {
69
69
  throw new Error(`${FREE_MODEL_REQUESTS_ENV} is a whole number of requests above 0, not ${given}`);
70
70
  return value;
71
71
  }
72
+ /** A run's limit on its requests on free models: the server's (freeModelRequestsOf), or the agent's own when it is lower
73
+ * (definition.max_requests, its revision's `maxRequests`, a whole number above 0). The server's always holds: an agent's
74
+ * higher one gets the server's. */
75
+ export function freeRequestLimitOf(env, maxRequests) {
76
+ const server = freeModelRequestsOf(env);
77
+ return typeof maxRequests === "number" && Number.isSafeInteger(maxRequests) && maxRequests >= 1 ? Math.min(maxRequests, server) : server;
78
+ }
@@ -4,7 +4,7 @@ export { beforeRequestOf, capRequestOf, type BeforeRequestOptions, type PricedRe
4
4
  export { DECISION_SESSION, overCapOf, paidCalls, runCap, TOOL_SESSION, type RunCap, type RunCapOptions, type RunDecisions, type RunTools } from "./run-cap.js";
5
5
  export { ANSWER_TOKENS_LEAST, CAP_TOLERANCE, FIT_TOLERANCE, STOP_ALLOWANCE_TOKENS, THINKING_BUDGET_LEAST, inputBound, mostOutput, pricingOf, ratesFor, requestPrice, type Pricing } from "./price.js";
6
6
  export { aloneRefusal, CAP_REFUSAL_CODE, SPEND_CAP_REACHED, SUGGESTED_RAISE_FACTOR, centsMoney, leastMoney, money, OVER_CAP_END, overCapEnd, overCapMessage, overCapWords, paidRefusal, raiseFigure, raiseTo, spentMoney, suggestedRaise } from "./words.js";
7
- export { FREE_MODEL_REQUESTS, FREE_MODEL_REQUESTS_ENV, FREE_WRAP_UP_MARGIN, freeCeilingEnd, freeCeilingMessage, freeModel, freeModelRequestsOf, freeRequest, freeRequestsIn, freeWrapUpDue, freeWrapUpWords, planCapModel, ROUTERS } from "./free.js";
7
+ export { FREE_MODEL_REQUESTS, FREE_MODEL_REQUESTS_ENV, FREE_WRAP_UP_MARGIN, freeCeilingEnd, freeCeilingMessage, freeModel, freeModelRequestsOf, freeRequest, freeRequestLimitOf, freeRequestsIn, freeWrapUpDue, freeWrapUpWords, planCapModel, ROUTERS } from "./free.js";
8
8
  export { checkRaise, followUpOf, parkOf, takeRaises, type BudgetPending, type Park, type RaiseCheck, type RaiseState } from "./park.js";
9
9
  export { SERVER_NOTE_LABEL, WRAP_UP_FACTOR, WRAP_UP_LEAST_FACTOR, WRAP_UP_STEP0_ANSWER_TOKENS, typicalCost, wrapUpDue, wrapUpWords } from "./wrap-up.js";
10
10
  export { CapStop, createStepWaits, type StepWaits } from "./steps.js";
@@ -6,7 +6,7 @@ export { beforeRequestOf, capRequestOf } from "./port.js";
6
6
  export { DECISION_SESSION, overCapOf, paidCalls, runCap, TOOL_SESSION } from "./run-cap.js";
7
7
  export { ANSWER_TOKENS_LEAST, CAP_TOLERANCE, FIT_TOLERANCE, STOP_ALLOWANCE_TOKENS, THINKING_BUDGET_LEAST, inputBound, mostOutput, pricingOf, ratesFor, requestPrice } from "./price.js";
8
8
  export { aloneRefusal, CAP_REFUSAL_CODE, SPEND_CAP_REACHED, SUGGESTED_RAISE_FACTOR, centsMoney, leastMoney, money, OVER_CAP_END, overCapEnd, overCapMessage, overCapWords, paidRefusal, raiseFigure, raiseTo, spentMoney, suggestedRaise } from "./words.js";
9
- export { FREE_MODEL_REQUESTS, FREE_MODEL_REQUESTS_ENV, FREE_WRAP_UP_MARGIN, freeCeilingEnd, freeCeilingMessage, freeModel, freeModelRequestsOf, freeRequest, freeRequestsIn, freeWrapUpDue, freeWrapUpWords, planCapModel, ROUTERS } from "./free.js";
9
+ export { FREE_MODEL_REQUESTS, FREE_MODEL_REQUESTS_ENV, FREE_WRAP_UP_MARGIN, freeCeilingEnd, freeCeilingMessage, freeModel, freeModelRequestsOf, freeRequest, freeRequestLimitOf, freeRequestsIn, freeWrapUpDue, freeWrapUpWords, planCapModel, ROUTERS } from "./free.js";
10
10
  export { checkRaise, followUpOf, parkOf, takeRaises } from "./park.js";
11
11
  export { SERVER_NOTE_LABEL, WRAP_UP_FACTOR, WRAP_UP_LEAST_FACTOR, WRAP_UP_STEP0_ANSWER_TOKENS, typicalCost, wrapUpDue, wrapUpWords } from "./wrap-up.js";
12
12
  export { CapStop, createStepWaits } from "./steps.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcha/agentrun-kernel",
3
- "version": "0.1.0-beta.50",
3
+ "version": "0.1.0-beta.52",
4
4
  "description": "Agent harnesses other than Pi, starting with Codex, behind one seam: a DSL node's runNode and an AgentRun run on a harness adapter, durable in AgentRun's own store.",
5
5
  "keywords": [
6
6
  "agentrun",
@@ -62,7 +62,7 @@
62
62
  "test": "node --test --test-concurrency=8 'test/*.test.mjs'"
63
63
  },
64
64
  "dependencies": {
65
- "@parcha/agentrun-dsl": "0.1.0-beta.50",
65
+ "@parcha/agentrun-dsl": "0.1.0-beta.52",
66
66
  "ajv": "8.18.0",
67
67
  "typebox": "1.3.27"
68
68
  },