@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.mjs CHANGED
@@ -11551,8 +11551,8 @@ function readLoopBreakerConfig(env = process.env) {
11551
11551
  return Math.floor(parsed);
11552
11552
  };
11553
11553
  return {
11554
- repeatWarn: parse(env.AGENT_REPEATED_TOOL_CALL_WARN, 3),
11555
- repeatStop: parse(env.AGENT_REPEATED_TOOL_CALL_STOP, 5),
11554
+ repeatWarn: parse(env.AGENT_REPEATED_TOOL_CALL_WARN, 20),
11555
+ repeatStop: parse(env.AGENT_REPEATED_TOOL_CALL_STOP, 25),
11556
11556
  runLimit: parse(env.AGENT_TOOL_CALL_RUN_LIMIT, 300),
11557
11557
  skillRunLimit: parse(env.AGENT_SKILL_CALL_RUN_LIMIT, 8)
11558
11558
  };
@@ -11575,9 +11575,9 @@ var BREAKER_STATE_SCHEMA = z41.object({
11575
11575
  repeatedToolCallMemberSignatures: z41.array(z41.string()).default([])
11576
11576
  });
11577
11577
  function createRepeatedToolCallBreakerMiddleware(options = {}) {
11578
- const rawWarn = options.warnThreshold ?? 3;
11578
+ const rawWarn = options.warnThreshold ?? 20;
11579
11579
  const warnThreshold = rawWarn > 0 ? Math.max(2, rawWarn) : 0;
11580
- const stopThreshold = Math.max(1, options.stopThreshold ?? 5);
11580
+ const stopThreshold = Math.max(1, options.stopThreshold ?? 25);
11581
11581
  return createMiddleware10({
11582
11582
  name: "RepeatedToolCallBreaker",
11583
11583
  stateSchema: BREAKER_STATE_SCHEMA,
@@ -42077,7 +42077,7 @@ var manageTaskSchema = z70.object({
42077
42077
  parentId: z70.string().optional().describe("Parent task ID for grouping subtasks"),
42078
42078
  sourceId: z70.string().optional().describe("Source session/thread ID"),
42079
42079
  context: z70.record(z70.unknown()).optional().describe("Additional context data"),
42080
- ownerType: z70.enum(["user", "agent"]).optional().describe("Owner type. Defaults to 'user' if omitted"),
42080
+ ownerType: z70.enum(["user", "agent"]).optional().describe("Owner type. Defaults to the runtime actor: agent runtime (no user identity) -> 'agent', user runtime -> 'user'."),
42081
42081
  ownerId: z70.string().optional().describe("Owner ID. Auto-filled from current user/agent if omitted"),
42082
42082
  requireReview: z70.boolean().optional().describe("If true, agent completion pauses as interrupted(review_required) for HITL approval"),
42083
42083
  dependencies: z70.array(z70.string()).optional().describe("List of task IDs that must be completed before this task can start"),
@@ -42264,7 +42264,9 @@ function createTaskMiddleware(options = {}) {
42264
42264
  return projectPolicyError(error);
42265
42265
  }
42266
42266
  }
42267
- const ownerId = input.ownerId || trustedScope?.assistantId || (input.ownerType === "agent" ? rc.assistant_id : null) || rc.user_id;
42267
+ const runtimeOwnerType = rc.user_id ? "user" : rc.assistant_id ? "agent" : "user";
42268
+ const requestedOwnerType = input.ownerType ?? runtimeOwnerType;
42269
+ const ownerId = input.ownerId || trustedScope?.assistantId || (requestedOwnerType === "agent" ? rc.assistant_id : null) || rc.user_id;
42268
42270
  const store = getTaskStore();
42269
42271
  const deleteOneTask = async (id) => {
42270
42272
  if (delegatedTaskId && id !== delegatedTaskId) {
@@ -42333,7 +42335,7 @@ function createTaskMiddleware(options = {}) {
42333
42335
  createScopeProjectId = createScopeProjectId ?? parentTask.projectId;
42334
42336
  }
42335
42337
  }
42336
- const effectiveOwnerType = delegatedTaskId ? "agent" : trustedProject ? "agent" : input.ownerType || "user";
42338
+ const effectiveOwnerType = delegatedTaskId ? "agent" : trustedProject ? "agent" : requestedOwnerType;
42337
42339
  const effectiveOwnerId = delegatedTaskId ? rc.assistant_id : ownerId;
42338
42340
  if (delegatedTaskId && !effectiveOwnerId) {
42339
42341
  return delegatedTaskScopeError(delegatedTaskId);
@@ -42359,6 +42361,14 @@ function createTaskMiddleware(options = {}) {
42359
42361
  }
42360
42362
  }
42361
42363
  }
42364
+ if (!delegatedTaskId && (typeof effectiveOwnerId !== "string" || effectiveOwnerId.length === 0)) {
42365
+ return JSON.stringify({
42366
+ success: false,
42367
+ code: "TASK_OWNER_REQUIRED",
42368
+ error: "Cannot resolve task owner: no user or agent identity in this run.",
42369
+ hint: 'Provide an explicit ownerId, or retry with ownerType:"agent" if this run has an agent identity.'
42370
+ });
42371
+ }
42362
42372
  if (effectiveOwnerType === "agent" && (input.result !== void 0 || input.failureReason !== void 0)) {
42363
42373
  return JSON.stringify({
42364
42374
  success: false,
@@ -43413,13 +43423,22 @@ function createTaskMiddleware(options = {}) {
43413
43423
  try {
43414
43424
  response = await handleManageTaskAction(input, config, validateExecutionResult, markMutation);
43415
43425
  } catch (error) {
43416
- if (!(error instanceof ExecutionResultNotPendingError)) throw error;
43426
+ if (error instanceof GraphInterrupt3) throw error;
43427
+ if (error instanceof ExecutionResultNotPendingError) {
43428
+ return JSON.stringify({
43429
+ success: false,
43430
+ code: "EXECUTION_RESULT_NOT_PENDING",
43431
+ taskId: error.taskId,
43432
+ executionResultId: error.executionResultId,
43433
+ error: error.message
43434
+ });
43435
+ }
43436
+ if (input.executionResultId) throw error;
43417
43437
  return JSON.stringify({
43418
43438
  success: false,
43419
- code: "EXECUTION_RESULT_NOT_PENDING",
43420
- taskId: error.taskId,
43421
- executionResultId: error.executionResultId,
43422
- error: error.message
43439
+ code: "TASK_ACTION_FAILED",
43440
+ error: error instanceof Error ? error.message : String(error),
43441
+ hint: "The action did not complete. Fix the input or retry; do not repeat the identical call."
43423
43442
  });
43424
43443
  }
43425
43444
  return reconcileExplicitExecutionResult(
@@ -43585,8 +43604,8 @@ changes only when acceptance criteria are truly met.
43585
43604
  ${TASK_CONVERGENCE_GUIDANCE}
43586
43605
 
43587
43606
  ### Ownership defaults
43588
- - No params: ownerType defaults to "user" with current user's ID
43589
- - ownerType="agent": auto-fills ownerId from current agent (subtask for yourself)
43607
+ - No params: ownerType defaults to the runtime actor (user runtime -> current user's ID; agent runtime -> current agent's ID)
43608
+ - ownerType="agent": auto-fills ownerId from the current agent (subtask for yourself)
43590
43609
  - Explicit ownerId: assign to a specific agent or user`;
43591
43610
  const boundTaskId = request.state?.taskId;
43592
43611
  const binding = typeof boundTaskId === "string" && boundTaskId ? renderTaskBinding(boundTaskId) : "";
@@ -43605,7 +43624,7 @@ ${TASK_CONVERGENCE_GUIDANCE}
43605
43624
  description: `Manage persistent tasks and their activity timelines for user and agent tasks.
43606
43625
 
43607
43626
  ## Owner defaults
43608
- - No ownerType/ownerId: auto-assigned to current user
43627
+ - No ownerType/ownerId: auto-assigned to the runtime actor (user runtime -> current user; agent runtime -> current agent)
43609
43628
  - ownerType="agent" without ownerId: auto-assigned to current agent
43610
43629
  - Explicit ownerId: assign to a specific agent (cross-agent delegation)
43611
43630