@clearideas/agent-runtime-contracts 0.3.0 → 0.4.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/README.md +3 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,6 +5,9 @@ manifests. `metadata` stores inert application data. Namespaced `extensions`
|
|
|
5
5
|
configure behavior implemented by an application adapter. Unknown manifest
|
|
6
6
|
fields fail validation.
|
|
7
7
|
|
|
8
|
+
Agent run manifests may declare `budget.maxTotalTokens`. Checkpoints persist
|
|
9
|
+
the effective limit and cumulative consumed model tokens across attempts.
|
|
10
|
+
|
|
8
11
|
Variable keys are top-level names. Dot notation reads nested properties from
|
|
9
12
|
object values. Paths cannot contain empty, `__proto__`, `prototype`, or
|
|
10
13
|
`constructor` segments.
|
package/dist/index.d.ts
CHANGED
|
@@ -257,7 +257,17 @@ export interface AgentRunManifest {
|
|
|
257
257
|
runId?: string;
|
|
258
258
|
variables?: AgentVariableOverride[];
|
|
259
259
|
execution?: AgentRunExecution;
|
|
260
|
+
budget?: AgentRunBudget;
|
|
260
261
|
}
|
|
262
|
+
export interface AgentRunBudget {
|
|
263
|
+
/** Cumulative reported model tokens allowed across all run attempts. */
|
|
264
|
+
maxTotalTokens: number;
|
|
265
|
+
}
|
|
266
|
+
export interface RunBudgetState extends AgentRunBudget {
|
|
267
|
+
consumedTokens: number;
|
|
268
|
+
}
|
|
269
|
+
export declare const agentRunBudgetSchema: z.ZodType<AgentRunBudget>;
|
|
270
|
+
export declare const runBudgetStateSchema: z.ZodType<RunBudgetState>;
|
|
261
271
|
export declare const AGENT_RUN_EXECUTION_MODES: readonly ["sequential", "parallel"];
|
|
262
272
|
export type AgentRunExecutionMode = (typeof AGENT_RUN_EXECUTION_MODES)[number];
|
|
263
273
|
export interface AgentRunExecution {
|
|
@@ -304,6 +314,8 @@ export interface RunCheckpoint {
|
|
|
304
314
|
activeStepArtifacts?: ArtifactRef[];
|
|
305
315
|
/** Executor-owned, JSON-safe continuation data for an active nested step. */
|
|
306
316
|
continuation?: JsonObject;
|
|
317
|
+
/** Cumulative model-token usage and the effective limit for this run. */
|
|
318
|
+
budget?: RunBudgetState;
|
|
307
319
|
createdAt: string;
|
|
308
320
|
metadata?: JsonObject;
|
|
309
321
|
}
|
|
@@ -1026,6 +1038,7 @@ export declare const runCheckpointSchema: z.ZodObject<{
|
|
|
1026
1038
|
metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
|
|
1027
1039
|
}, z.core.$strict>>>;
|
|
1028
1040
|
continuation: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
|
|
1041
|
+
budget: z.ZodOptional<z.ZodType<RunBudgetState, unknown, z.core.$ZodTypeInternals<RunBudgetState, unknown>>>;
|
|
1029
1042
|
createdAt: z.ZodISODateTime;
|
|
1030
1043
|
metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
|
|
1031
1044
|
}, z.core.$strict>;
|
package/dist/index.js
CHANGED
|
@@ -415,6 +415,13 @@ export const agentManifestSchema = z
|
|
|
415
415
|
variableKeys.add(normalizedKey);
|
|
416
416
|
});
|
|
417
417
|
});
|
|
418
|
+
export const agentRunBudgetSchema = z.strictObject({
|
|
419
|
+
maxTotalTokens: z.number().int().positive().safe(),
|
|
420
|
+
});
|
|
421
|
+
export const runBudgetStateSchema = z.strictObject({
|
|
422
|
+
maxTotalTokens: z.number().int().positive().safe(),
|
|
423
|
+
consumedTokens: z.number().int().nonnegative().safe(),
|
|
424
|
+
});
|
|
418
425
|
export const AGENT_RUN_EXECUTION_MODES = ["sequential", "parallel"];
|
|
419
426
|
export const agentRunExecutionSchema = z.strictObject({
|
|
420
427
|
mode: z.enum(AGENT_RUN_EXECUTION_MODES),
|
|
@@ -428,6 +435,7 @@ export const agentRunManifestSchema = z.strictObject({
|
|
|
428
435
|
runId: z.string().trim().min(1).optional(),
|
|
429
436
|
variables: agentVariableOverridesSchema.optional(),
|
|
430
437
|
execution: agentRunExecutionSchema.optional(),
|
|
438
|
+
budget: agentRunBudgetSchema.optional(),
|
|
431
439
|
});
|
|
432
440
|
export const artifactRefSchema = z.strictObject({
|
|
433
441
|
id: z.string().min(1),
|
|
@@ -574,6 +582,7 @@ export const runCheckpointSchema = z.strictObject({
|
|
|
574
582
|
activeStepTranscript: z.array(transcriptItemSchema).optional(),
|
|
575
583
|
activeStepArtifacts: z.array(artifactRefSchema).optional(),
|
|
576
584
|
continuation: jsonObjectSchema.optional(),
|
|
585
|
+
budget: runBudgetStateSchema.optional(),
|
|
577
586
|
createdAt: z.iso.datetime({ offset: true }),
|
|
578
587
|
metadata: jsonObjectSchema.optional(),
|
|
579
588
|
});
|
package/package.json
CHANGED