@axiom-lattice/core 6.1.0 → 6.1.1
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.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +34 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -11678,7 +11678,7 @@ declare function createUnknownToolHandlerMiddleware(config?: UnknownToolHandlerC
|
|
|
11678
11678
|
*
|
|
11679
11679
|
* @example
|
|
11680
11680
|
* ```ts
|
|
11681
|
-
* middlewares.push(createRepeatedToolCallBreakerMiddleware({ warnThreshold:
|
|
11681
|
+
* middlewares.push(createRepeatedToolCallBreakerMiddleware({ warnThreshold: 20, stopThreshold: 25 }));
|
|
11682
11682
|
* ```
|
|
11683
11683
|
*
|
|
11684
11684
|
* @remarks
|
|
@@ -11710,14 +11710,14 @@ declare function readLoopBreakerConfig(env?: NodeJS.ProcessEnv): LoopBreakerConf
|
|
|
11710
11710
|
/** Construction options for {@link createRepeatedToolCallBreakerMiddleware}. */
|
|
11711
11711
|
interface RepeatedToolCallBreakerOptions {
|
|
11712
11712
|
/**
|
|
11713
|
-
* Call count at which the repeated call is blocked with a reminder (default
|
|
11713
|
+
* Call count at which the repeated call is blocked with a reminder (default 20).
|
|
11714
11714
|
* A positive value is floored to `2` so the first call of every signature always
|
|
11715
11715
|
* executes (`warnThreshold: 1` cannot brick all tool use). A value `<= 0` disables
|
|
11716
11716
|
* the blocking tier while counting and the stop throw stay active.
|
|
11717
11717
|
*/
|
|
11718
11718
|
warnThreshold?: number;
|
|
11719
11719
|
/**
|
|
11720
|
-
* Call count at which a `RepeatedToolCallError` is thrown (default
|
|
11720
|
+
* Call count at which a `RepeatedToolCallError` is thrown (default 25).
|
|
11721
11721
|
* Construction coerces this to at least 1; a value `<= 0` disables the whole guard at install time.
|
|
11722
11722
|
*/
|
|
11723
11723
|
stopThreshold?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -11678,7 +11678,7 @@ declare function createUnknownToolHandlerMiddleware(config?: UnknownToolHandlerC
|
|
|
11678
11678
|
*
|
|
11679
11679
|
* @example
|
|
11680
11680
|
* ```ts
|
|
11681
|
-
* middlewares.push(createRepeatedToolCallBreakerMiddleware({ warnThreshold:
|
|
11681
|
+
* middlewares.push(createRepeatedToolCallBreakerMiddleware({ warnThreshold: 20, stopThreshold: 25 }));
|
|
11682
11682
|
* ```
|
|
11683
11683
|
*
|
|
11684
11684
|
* @remarks
|
|
@@ -11710,14 +11710,14 @@ declare function readLoopBreakerConfig(env?: NodeJS.ProcessEnv): LoopBreakerConf
|
|
|
11710
11710
|
/** Construction options for {@link createRepeatedToolCallBreakerMiddleware}. */
|
|
11711
11711
|
interface RepeatedToolCallBreakerOptions {
|
|
11712
11712
|
/**
|
|
11713
|
-
* Call count at which the repeated call is blocked with a reminder (default
|
|
11713
|
+
* Call count at which the repeated call is blocked with a reminder (default 20).
|
|
11714
11714
|
* A positive value is floored to `2` so the first call of every signature always
|
|
11715
11715
|
* executes (`warnThreshold: 1` cannot brick all tool use). A value `<= 0` disables
|
|
11716
11716
|
* the blocking tier while counting and the stop throw stay active.
|
|
11717
11717
|
*/
|
|
11718
11718
|
warnThreshold?: number;
|
|
11719
11719
|
/**
|
|
11720
|
-
* Call count at which a `RepeatedToolCallError` is thrown (default
|
|
11720
|
+
* Call count at which a `RepeatedToolCallError` is thrown (default 25).
|
|
11721
11721
|
* Construction coerces this to at least 1; a value `<= 0` disables the whole guard at install time.
|
|
11722
11722
|
*/
|
|
11723
11723
|
stopThreshold?: number;
|
package/dist/index.js
CHANGED
|
@@ -13524,8 +13524,8 @@ function readLoopBreakerConfig(env = process.env) {
|
|
|
13524
13524
|
return Math.floor(parsed);
|
|
13525
13525
|
};
|
|
13526
13526
|
return {
|
|
13527
|
-
repeatWarn: parse(env.AGENT_REPEATED_TOOL_CALL_WARN,
|
|
13528
|
-
repeatStop: parse(env.AGENT_REPEATED_TOOL_CALL_STOP,
|
|
13527
|
+
repeatWarn: parse(env.AGENT_REPEATED_TOOL_CALL_WARN, 20),
|
|
13528
|
+
repeatStop: parse(env.AGENT_REPEATED_TOOL_CALL_STOP, 25),
|
|
13529
13529
|
runLimit: parse(env.AGENT_TOOL_CALL_RUN_LIMIT, 300),
|
|
13530
13530
|
skillRunLimit: parse(env.AGENT_SKILL_CALL_RUN_LIMIT, 8)
|
|
13531
13531
|
};
|
|
@@ -13548,9 +13548,9 @@ var BREAKER_STATE_SCHEMA = import_zod43.z.object({
|
|
|
13548
13548
|
repeatedToolCallMemberSignatures: import_zod43.z.array(import_zod43.z.string()).default([])
|
|
13549
13549
|
});
|
|
13550
13550
|
function createRepeatedToolCallBreakerMiddleware(options = {}) {
|
|
13551
|
-
const rawWarn = options.warnThreshold ??
|
|
13551
|
+
const rawWarn = options.warnThreshold ?? 20;
|
|
13552
13552
|
const warnThreshold = rawWarn > 0 ? Math.max(2, rawWarn) : 0;
|
|
13553
|
-
const stopThreshold = Math.max(1, options.stopThreshold ??
|
|
13553
|
+
const stopThreshold = Math.max(1, options.stopThreshold ?? 25);
|
|
13554
13554
|
return (0, import_langchain46.createMiddleware)({
|
|
13555
13555
|
name: "RepeatedToolCallBreaker",
|
|
13556
13556
|
stateSchema: BREAKER_STATE_SCHEMA,
|
|
@@ -44038,7 +44038,7 @@ var manageTaskSchema = import_zod68.z.object({
|
|
|
44038
44038
|
parentId: import_zod68.z.string().optional().describe("Parent task ID for grouping subtasks"),
|
|
44039
44039
|
sourceId: import_zod68.z.string().optional().describe("Source session/thread ID"),
|
|
44040
44040
|
context: import_zod68.z.record(import_zod68.z.unknown()).optional().describe("Additional context data"),
|
|
44041
|
-
ownerType: import_zod68.z.enum(["user", "agent"]).optional().describe("Owner type. Defaults to
|
|
44041
|
+
ownerType: import_zod68.z.enum(["user", "agent"]).optional().describe("Owner type. Defaults to the runtime actor: agent runtime (no user identity) -> 'agent', user runtime -> 'user'."),
|
|
44042
44042
|
ownerId: import_zod68.z.string().optional().describe("Owner ID. Auto-filled from current user/agent if omitted"),
|
|
44043
44043
|
requireReview: import_zod68.z.boolean().optional().describe("If true, agent completion pauses as interrupted(review_required) for HITL approval"),
|
|
44044
44044
|
dependencies: import_zod68.z.array(import_zod68.z.string()).optional().describe("List of task IDs that must be completed before this task can start"),
|
|
@@ -44225,7 +44225,9 @@ function createTaskMiddleware(options = {}) {
|
|
|
44225
44225
|
return projectPolicyError(error);
|
|
44226
44226
|
}
|
|
44227
44227
|
}
|
|
44228
|
-
const
|
|
44228
|
+
const runtimeOwnerType = rc.user_id ? "user" : rc.assistant_id ? "agent" : "user";
|
|
44229
|
+
const requestedOwnerType = input.ownerType ?? runtimeOwnerType;
|
|
44230
|
+
const ownerId = input.ownerId || trustedScope?.assistantId || (requestedOwnerType === "agent" ? rc.assistant_id : null) || rc.user_id;
|
|
44229
44231
|
const store = getTaskStore();
|
|
44230
44232
|
const deleteOneTask = async (id) => {
|
|
44231
44233
|
if (delegatedTaskId && id !== delegatedTaskId) {
|
|
@@ -44294,7 +44296,7 @@ function createTaskMiddleware(options = {}) {
|
|
|
44294
44296
|
createScopeProjectId = createScopeProjectId ?? parentTask.projectId;
|
|
44295
44297
|
}
|
|
44296
44298
|
}
|
|
44297
|
-
const effectiveOwnerType = delegatedTaskId ? "agent" : trustedProject ? "agent" :
|
|
44299
|
+
const effectiveOwnerType = delegatedTaskId ? "agent" : trustedProject ? "agent" : requestedOwnerType;
|
|
44298
44300
|
const effectiveOwnerId = delegatedTaskId ? rc.assistant_id : ownerId;
|
|
44299
44301
|
if (delegatedTaskId && !effectiveOwnerId) {
|
|
44300
44302
|
return delegatedTaskScopeError(delegatedTaskId);
|
|
@@ -44320,6 +44322,14 @@ function createTaskMiddleware(options = {}) {
|
|
|
44320
44322
|
}
|
|
44321
44323
|
}
|
|
44322
44324
|
}
|
|
44325
|
+
if (!delegatedTaskId && (typeof effectiveOwnerId !== "string" || effectiveOwnerId.length === 0)) {
|
|
44326
|
+
return JSON.stringify({
|
|
44327
|
+
success: false,
|
|
44328
|
+
code: "TASK_OWNER_REQUIRED",
|
|
44329
|
+
error: "Cannot resolve task owner: no user or agent identity in this run.",
|
|
44330
|
+
hint: 'Provide an explicit ownerId, or retry with ownerType:"agent" if this run has an agent identity.'
|
|
44331
|
+
});
|
|
44332
|
+
}
|
|
44323
44333
|
if (effectiveOwnerType === "agent" && (input.result !== void 0 || input.failureReason !== void 0)) {
|
|
44324
44334
|
return JSON.stringify({
|
|
44325
44335
|
success: false,
|
|
@@ -45374,13 +45384,22 @@ function createTaskMiddleware(options = {}) {
|
|
|
45374
45384
|
try {
|
|
45375
45385
|
response = await handleManageTaskAction(input, config, validateExecutionResult, markMutation);
|
|
45376
45386
|
} catch (error) {
|
|
45377
|
-
if (
|
|
45387
|
+
if (error instanceof import_langgraph16.GraphInterrupt) throw error;
|
|
45388
|
+
if (error instanceof ExecutionResultNotPendingError) {
|
|
45389
|
+
return JSON.stringify({
|
|
45390
|
+
success: false,
|
|
45391
|
+
code: "EXECUTION_RESULT_NOT_PENDING",
|
|
45392
|
+
taskId: error.taskId,
|
|
45393
|
+
executionResultId: error.executionResultId,
|
|
45394
|
+
error: error.message
|
|
45395
|
+
});
|
|
45396
|
+
}
|
|
45397
|
+
if (input.executionResultId) throw error;
|
|
45378
45398
|
return JSON.stringify({
|
|
45379
45399
|
success: false,
|
|
45380
|
-
code: "
|
|
45381
|
-
|
|
45382
|
-
|
|
45383
|
-
error: error.message
|
|
45400
|
+
code: "TASK_ACTION_FAILED",
|
|
45401
|
+
error: error instanceof Error ? error.message : String(error),
|
|
45402
|
+
hint: "The action did not complete. Fix the input or retry; do not repeat the identical call."
|
|
45384
45403
|
});
|
|
45385
45404
|
}
|
|
45386
45405
|
return reconcileExplicitExecutionResult(
|
|
@@ -45546,8 +45565,8 @@ changes only when acceptance criteria are truly met.
|
|
|
45546
45565
|
${TASK_CONVERGENCE_GUIDANCE}
|
|
45547
45566
|
|
|
45548
45567
|
### Ownership defaults
|
|
45549
|
-
- No params: ownerType defaults to
|
|
45550
|
-
- ownerType="agent": auto-fills ownerId from current agent (subtask for yourself)
|
|
45568
|
+
- No params: ownerType defaults to the runtime actor (user runtime -> current user's ID; agent runtime -> current agent's ID)
|
|
45569
|
+
- ownerType="agent": auto-fills ownerId from the current agent (subtask for yourself)
|
|
45551
45570
|
- Explicit ownerId: assign to a specific agent or user`;
|
|
45552
45571
|
const boundTaskId = request.state?.taskId;
|
|
45553
45572
|
const binding = typeof boundTaskId === "string" && boundTaskId ? renderTaskBinding(boundTaskId) : "";
|
|
@@ -45566,7 +45585,7 @@ ${TASK_CONVERGENCE_GUIDANCE}
|
|
|
45566
45585
|
description: `Manage persistent tasks and their activity timelines for user and agent tasks.
|
|
45567
45586
|
|
|
45568
45587
|
## Owner defaults
|
|
45569
|
-
- No ownerType/ownerId: auto-assigned to current user
|
|
45588
|
+
- No ownerType/ownerId: auto-assigned to the runtime actor (user runtime -> current user; agent runtime -> current agent)
|
|
45570
45589
|
- ownerType="agent" without ownerId: auto-assigned to current agent
|
|
45571
45590
|
- Explicit ownerId: assign to a specific agent (cross-agent delegation)
|
|
45572
45591
|
|