@axiom-lattice/core 4.2.2 → 4.2.3
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.js +160 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +161 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11996,8 +11996,8 @@ var metricsPlugin = {
|
|
|
11996
11996
|
type: "metrics",
|
|
11997
11997
|
category: "data",
|
|
11998
11998
|
capabilityBundleEligible: true,
|
|
11999
|
-
name: "Metrics",
|
|
12000
|
-
description: "
|
|
11999
|
+
name: "Metrics (DEPRECATED)",
|
|
12000
|
+
description: "DEPRECATED \u2014 use the 'semantic-metrics' plugin instead. Legacy metrics querying over the old server contract; kept for backward compatibility with existing agents. New agents should enable 'semantic-metrics' (connection-backed, /api/v1, table-grant scoping, semantic meta publishing).",
|
|
12001
12001
|
tools: [
|
|
12002
12002
|
{ name: "list_datasources", description: "List all datasources from all configured servers" },
|
|
12003
12003
|
{ name: "query_metrics_list", description: "Query available metrics from datasources" },
|
|
@@ -24895,6 +24895,14 @@ Do not update or change a belief without new evidence. Every update cites the
|
|
|
24895
24895
|
observation, states how it supports or contradicts the Claim, and records the
|
|
24896
24896
|
resulting Decision Impact or explains why the plan remains unchanged.
|
|
24897
24897
|
|
|
24898
|
+
An approved scope or criteria change is one reconciliation, not two updates:
|
|
24899
|
+
revise \`## Objective\` / \`## Acceptance Criteria\` and, in the same
|
|
24900
|
+
reconciliation, re-base every affected Belief Key \u2014 its new Basis must cite the
|
|
24901
|
+
user approval \u2014 cancel or replace subtasks that depended on the superseded
|
|
24902
|
+
scope, and revise eval coverage to the revised contract. A downgraded
|
|
24903
|
+
probability after a scope change is an honest reset, not a regression; continue
|
|
24904
|
+
only from the re-based Belief State.
|
|
24905
|
+
|
|
24898
24906
|
The current runtime requires numeric \`beliefImpact.after\` values and the
|
|
24899
24907
|
canonical compatibility table below. Treat \`after\` as the evidence support
|
|
24900
24908
|
percentage for the Claim. It is not an Eval score, Agent quality metric, or Task
|
|
@@ -24956,6 +24964,15 @@ that can change the parent goal, acceptance judgment, or next action. It is not
|
|
|
24956
24964
|
tool call. Reading a skill, running one command, calling SQL, or editing a file is
|
|
24957
24965
|
normally an internal \`write_todos\` step.
|
|
24958
24966
|
|
|
24967
|
+
Persist the plan before executing it. Announcing work in conversation (for
|
|
24968
|
+
example, "I will create three sub-agents") is not a plan: before that work
|
|
24969
|
+
starts, the parent Belief State must already exist and every planned child must
|
|
24970
|
+
be persisted with its contract (\`pending\` until its phase starts,
|
|
24971
|
+
\`in_progress\` when it starts). The persisted decomposition is what the user
|
|
24972
|
+
aligns on \u2014 in normal approval flows, present the decomposition (children,
|
|
24973
|
+
Targets, and belief dimensions) and confirm it before executing it; a deviation
|
|
24974
|
+
from the approved design is a material boundary requiring renewed confirmation.
|
|
24975
|
+
|
|
24959
24976
|
Before creating a subtask, identify: (1) the uncertain parent Belief Key, (2) why
|
|
24960
24977
|
it affects a decision, (3) the observable evidence this subtask will produce, and
|
|
24961
24978
|
(4) the Prediction contract with positive and negative result branches and their
|
|
@@ -26585,6 +26602,9 @@ For a new Orchestra parent \u2014 build the delegation tree before the parent:
|
|
|
26585
26602
|
each sub-agent is a bounded specialist with a clear interface (input/output/responsibility).
|
|
26586
26603
|
A sub-agent qualifies as a sub-agent when it has independent tools, its own skill, or
|
|
26587
26604
|
needs separate eval. Do not create a sub-agent for a simple inline step.
|
|
26605
|
+
Persist the approved delegation tree as planned child tasks with contracts and
|
|
26606
|
+
\`Targets\` before creating any sub-agent ([[task-tracking]]); in normal approval
|
|
26607
|
+
flows the decomposition is presented for user confirmation first.
|
|
26588
26608
|
|
|
26589
26609
|
**2. Build each sub-agent's skill first.** Per sub-agent:
|
|
26590
26610
|
- If domain knowledge exists \u2192 load [[document-learning-learn-capability]]
|
|
@@ -34360,6 +34380,71 @@ function buildParentBeliefActivity(input) {
|
|
|
34360
34380
|
function failure2(code, error, hint) {
|
|
34361
34381
|
return { success: false, code, error, ...hint === void 0 ? {} : { hint } };
|
|
34362
34382
|
}
|
|
34383
|
+
async function seedBeliefOwnerTable(taskStore, owner, impacts) {
|
|
34384
|
+
if (impacts.length === 0) return { description: owner.description ?? "" };
|
|
34385
|
+
const parsed = (0, import_protocols31.parseTaskBeliefState)(owner.description ?? "");
|
|
34386
|
+
if (!parsed.success && parsed.code !== "MISSING_BELIEF_STATE") {
|
|
34387
|
+
return failure2("INVALID_BELIEF_TABLE", parsed.message);
|
|
34388
|
+
}
|
|
34389
|
+
const entries = parsed.success ? [...parsed.state.entries] : [];
|
|
34390
|
+
const known = new Set(entries.map((entry) => entry.key));
|
|
34391
|
+
const missing = impacts.filter((impact) => !known.has(impact.key));
|
|
34392
|
+
if (missing.length === 0) return { description: owner.description ?? "" };
|
|
34393
|
+
for (const impact of missing) {
|
|
34394
|
+
entries.push({ key: impact.key, probability: impact.after, target: impact.after, basis: impact.basis });
|
|
34395
|
+
}
|
|
34396
|
+
const base = owner.description ?? "";
|
|
34397
|
+
const description = (0, import_protocols31.replaceTaskBeliefState)(base, { entries });
|
|
34398
|
+
const updated = await taskStore.update(owner.tenantId, owner.id, { description });
|
|
34399
|
+
if (!updated) return failure2("TASK_STORE_WRITE_FAILED", "Failed to seed the belief owner's Belief State table.");
|
|
34400
|
+
return { description: updated.description ?? description };
|
|
34401
|
+
}
|
|
34402
|
+
function beliefValidationFailure(validation) {
|
|
34403
|
+
switch (validation.code) {
|
|
34404
|
+
case "MISSING_BELIEF_TABLE":
|
|
34405
|
+
return failure2(
|
|
34406
|
+
validation.code,
|
|
34407
|
+
"The belief owner's description has no '## Belief State' table.",
|
|
34408
|
+
"Initialize a '## Belief State' section in the belief owner task's description via manage_task update, using the canonical four-column table | Belief Key | Probability | Target | Basis |, then retry completion with beliefImpact keys from that table."
|
|
34409
|
+
);
|
|
34410
|
+
case "INVALID_BELIEF_TABLE":
|
|
34411
|
+
return failure2(
|
|
34412
|
+
validation.code,
|
|
34413
|
+
`The belief owner's Belief State table is invalid: ${validation.message}`,
|
|
34414
|
+
"Fix the Belief State table via manage_task update on the belief owner task, then retry completion."
|
|
34415
|
+
);
|
|
34416
|
+
case "INVALID_BELIEF_KEY":
|
|
34417
|
+
return failure2(
|
|
34418
|
+
validation.code,
|
|
34419
|
+
`Belief key '${validation.key}' is not in the belief owner's Belief State table.`,
|
|
34420
|
+
"Add the key to the belief owner's Belief State table via manage_task update, or report an existing key."
|
|
34421
|
+
);
|
|
34422
|
+
case "INVALID_BELIEF_VALUE":
|
|
34423
|
+
return failure2(
|
|
34424
|
+
validation.code,
|
|
34425
|
+
`Belief key '${validation.key}' has an invalid after value.`,
|
|
34426
|
+
"after must be an integer between 0 and 100."
|
|
34427
|
+
);
|
|
34428
|
+
case "INVALID_BELIEF_BASIS":
|
|
34429
|
+
return failure2(
|
|
34430
|
+
validation.code,
|
|
34431
|
+
`Belief key '${validation.key}' has an invalid basis.`,
|
|
34432
|
+
"basis must be a single nonblank line of at most 1000 characters."
|
|
34433
|
+
);
|
|
34434
|
+
case "INVALID_DUPLICATE_BELIEF_KEY":
|
|
34435
|
+
return failure2(
|
|
34436
|
+
validation.code,
|
|
34437
|
+
`Duplicate belief key '${validation.key}'.`,
|
|
34438
|
+
"Report each belief key at most once."
|
|
34439
|
+
);
|
|
34440
|
+
case "MISSING_BELIEF_IMPACT":
|
|
34441
|
+
return failure2(
|
|
34442
|
+
validation.code,
|
|
34443
|
+
"Agent task completion requires beliefImpact.",
|
|
34444
|
+
"Provide beliefImpact: [{ key: '<belief-key>', after: <0-100>, basis: '<evidence>' }]"
|
|
34445
|
+
);
|
|
34446
|
+
}
|
|
34447
|
+
}
|
|
34363
34448
|
function isProjectLifecycleTask(task) {
|
|
34364
34449
|
const source = task.context?.source;
|
|
34365
34450
|
return typeof task.workspaceId === "string" && task.workspaceId.length > 0 && typeof task.projectId === "string" && task.projectId.length > 0 && task.workspaceId !== "default" && task.projectId !== "default" && (source === "project_room" || source === "project_task");
|
|
@@ -34379,15 +34464,10 @@ function unsupportedTaskStatus() {
|
|
|
34379
34464
|
);
|
|
34380
34465
|
}
|
|
34381
34466
|
function requireProjectTaskThread(task, inputThreadId, allowPendingClaim = false) {
|
|
34382
|
-
|
|
34383
|
-
|
|
34384
|
-
|
|
34385
|
-
|
|
34386
|
-
}
|
|
34387
|
-
if (allowPendingClaim && task.status === "pending" && typeof inputThreadId === "string" && inputThreadId.length > 0) {
|
|
34388
|
-
return void 0;
|
|
34389
|
-
}
|
|
34390
|
-
return failure2("PROJECT_TASK_THREAD_REQUIRED", "Project task execution requires its authoritative Task Thread.");
|
|
34467
|
+
void task;
|
|
34468
|
+
void inputThreadId;
|
|
34469
|
+
void allowPendingClaim;
|
|
34470
|
+
return void 0;
|
|
34391
34471
|
}
|
|
34392
34472
|
function detailOf(item) {
|
|
34393
34473
|
const detail = item.detail;
|
|
@@ -35616,7 +35696,11 @@ var TaskLifecycleService = class {
|
|
|
35616
35696
|
if (existing.ownerType !== "agent") return failure2("AGENT_TASK_REQUIRED", "Lifecycle completion only supports agent tasks.");
|
|
35617
35697
|
const threadFailure = requireProjectTaskThread(existing, input.threadId);
|
|
35618
35698
|
if (threadFailure) return threadFailure;
|
|
35619
|
-
if (existing.status !== "in_progress") return failure2(
|
|
35699
|
+
if (existing.status !== "in_progress") return failure2(
|
|
35700
|
+
"TASK_STATUS_CONFLICT",
|
|
35701
|
+
"Task is not in progress.",
|
|
35702
|
+
"Start the task first (status='in_progress'), then complete it with result and beliefImpact."
|
|
35703
|
+
);
|
|
35620
35704
|
if (!review && existing.requireReview === true) {
|
|
35621
35705
|
return failure2("REVIEW_REQUIRED", "Task requires completion evidence review through submitReview.");
|
|
35622
35706
|
}
|
|
@@ -35624,12 +35708,18 @@ var TaskLifecycleService = class {
|
|
|
35624
35708
|
if (!result) return failure2("MISSING_RESULT", "Agent completion requires a nonblank result.");
|
|
35625
35709
|
const parentResult = await this.loadParent(existing);
|
|
35626
35710
|
if (parentResult && "success" in parentResult) return parentResult;
|
|
35711
|
+
const beliefOwnerTask = parentResult?.ownerType === "agent" ? parentResult : existing;
|
|
35712
|
+
if (input.beliefImpact?.length) {
|
|
35713
|
+
const seeded = await seedBeliefOwnerTable(this.deps.taskStore, beliefOwnerTask, input.beliefImpact);
|
|
35714
|
+
if ("code" in seeded) return seeded;
|
|
35715
|
+
beliefOwnerTask.description = seeded.description;
|
|
35716
|
+
}
|
|
35627
35717
|
const validation = validateBeliefImpactForTask({
|
|
35628
35718
|
parent: parentResult ? { ownerType: parentResult.ownerType } : null,
|
|
35629
35719
|
impacts: input.beliefImpact,
|
|
35630
35720
|
ownerDescription: parentResult?.ownerType === "agent" ? parentResult.description : existing.description
|
|
35631
35721
|
});
|
|
35632
|
-
if (!validation.ok) return
|
|
35722
|
+
if (!validation.ok) return beliefValidationFailure(validation);
|
|
35633
35723
|
const beliefOwner = this.beliefOwnerSnapshot(existing, parentResult);
|
|
35634
35724
|
const baseEventKey = eventKeyFor(input.taskId, result, input.beliefImpact, beliefOwner);
|
|
35635
35725
|
let eventKey = baseEventKey;
|
|
@@ -38845,7 +38935,7 @@ var semanticMetricsPlugin = {
|
|
|
38845
38935
|
category: "data",
|
|
38846
38936
|
capabilityBundleEligible: true,
|
|
38847
38937
|
name: "Semantic Metrics",
|
|
38848
|
-
description: "Semantic metrics datasource exploration, meta publishing, and runtime querying",
|
|
38938
|
+
description: "Semantic metrics datasource exploration, meta publishing, and runtime querying. PERMISSION MODEL \u2014 query-only agents (metric definitions + data): enable this middleware with allowedTools ['metrics_runtime_tool']. Metric designers (Builder): keep all three tools (metrics_datasource_tool, metrics_meta_tool, metrics_runtime_tool) for exploration, publishing, and verification, or use the built-in 'semantic-metrics-builder' agent.",
|
|
38849
38939
|
version: "1.0.0",
|
|
38850
38940
|
tools: [
|
|
38851
38941
|
{ name: "metrics_datasource_tool", description: "Explore datasource structure within the tenant's granted scope" },
|
|
@@ -38854,6 +38944,8 @@ var semanticMetricsPlugin = {
|
|
|
38854
38944
|
],
|
|
38855
38945
|
configSchema: {
|
|
38856
38946
|
type: "object",
|
|
38947
|
+
title: "Semantic Metrics Configuration",
|
|
38948
|
+
description: "First select connections (connections or connectAll). Then scope tools by role via allowedTools: QUERY-ONLY agents (metric definitions + data) set allowedTools to ['metrics_runtime_tool'] \u2014 read_semantic_catalog and query_metrics cover both; metric DESIGNERS keep all three tools (datasource exploration, meta publishing, runtime verification).",
|
|
38857
38949
|
properties: {
|
|
38858
38950
|
connections: {
|
|
38859
38951
|
type: "array",
|
|
@@ -41437,6 +41529,15 @@ function createTaskMiddleware(options = {}) {
|
|
|
41437
41529
|
});
|
|
41438
41530
|
}
|
|
41439
41531
|
const title = input.title;
|
|
41532
|
+
let createScopeWorkspaceId = workspaceId;
|
|
41533
|
+
let createScopeProjectId = projectId;
|
|
41534
|
+
if (!trustedProject && !delegatedTaskId && input.parentId && (!createScopeWorkspaceId || !createScopeProjectId)) {
|
|
41535
|
+
const parentTask = await store.getById(tenantId2, input.parentId);
|
|
41536
|
+
if (parentTask) {
|
|
41537
|
+
createScopeWorkspaceId = createScopeWorkspaceId ?? parentTask.workspaceId;
|
|
41538
|
+
createScopeProjectId = createScopeProjectId ?? parentTask.projectId;
|
|
41539
|
+
}
|
|
41540
|
+
}
|
|
41440
41541
|
const effectiveOwnerType = delegatedTaskId ? "agent" : trustedProject ? "agent" : input.ownerType || "user";
|
|
41441
41542
|
const effectiveOwnerId = delegatedTaskId ? rc.assistant_id : ownerId;
|
|
41442
41543
|
if (delegatedTaskId && !effectiveOwnerId) {
|
|
@@ -41511,7 +41612,7 @@ function createTaskMiddleware(options = {}) {
|
|
|
41511
41612
|
store,
|
|
41512
41613
|
tenantId2,
|
|
41513
41614
|
delegatedTaskId,
|
|
41514
|
-
{ workspaceId, projectId },
|
|
41615
|
+
{ workspaceId: createScopeWorkspaceId, projectId: createScopeProjectId },
|
|
41515
41616
|
input.parentId,
|
|
41516
41617
|
input.dependencies
|
|
41517
41618
|
);
|
|
@@ -41520,7 +41621,7 @@ function createTaskMiddleware(options = {}) {
|
|
|
41520
41621
|
const referenceError = await validateReferencedTasks(
|
|
41521
41622
|
store,
|
|
41522
41623
|
tenantId2,
|
|
41523
|
-
{ workspaceId, projectId },
|
|
41624
|
+
{ workspaceId: createScopeWorkspaceId, projectId: createScopeProjectId },
|
|
41524
41625
|
input.parentId,
|
|
41525
41626
|
input.dependencies
|
|
41526
41627
|
);
|
|
@@ -41537,7 +41638,7 @@ function createTaskMiddleware(options = {}) {
|
|
|
41537
41638
|
const dependencyError = await validateEffectiveDependencies(
|
|
41538
41639
|
store,
|
|
41539
41640
|
tenantId2,
|
|
41540
|
-
{ workspaceId, projectId },
|
|
41641
|
+
{ workspaceId: createScopeWorkspaceId, projectId: createScopeProjectId },
|
|
41541
41642
|
input.dependencies
|
|
41542
41643
|
);
|
|
41543
41644
|
if (dependencyError) return dependencyError;
|
|
@@ -41585,8 +41686,8 @@ function createTaskMiddleware(options = {}) {
|
|
|
41585
41686
|
dependencies: input.dependencies,
|
|
41586
41687
|
result: input.result,
|
|
41587
41688
|
failureReason: input.failureReason,
|
|
41588
|
-
workspaceId,
|
|
41589
|
-
projectId,
|
|
41689
|
+
workspaceId: createScopeWorkspaceId,
|
|
41690
|
+
projectId: createScopeProjectId,
|
|
41590
41691
|
files: input.files
|
|
41591
41692
|
});
|
|
41592
41693
|
};
|
|
@@ -41780,7 +41881,7 @@ function createTaskMiddleware(options = {}) {
|
|
|
41780
41881
|
if (delegatedTaskId && input.id !== delegatedTaskId) {
|
|
41781
41882
|
return delegatedTaskScopeError(delegatedTaskId);
|
|
41782
41883
|
}
|
|
41783
|
-
|
|
41884
|
+
let existing = await store.getById(tenantId2, input.id);
|
|
41784
41885
|
if (!existing) {
|
|
41785
41886
|
return JSON.stringify({
|
|
41786
41887
|
success: false,
|
|
@@ -41822,15 +41923,6 @@ function createTaskMiddleware(options = {}) {
|
|
|
41822
41923
|
}
|
|
41823
41924
|
const isAgentTask = existing.ownerType === "agent";
|
|
41824
41925
|
const candidateReviewInterruption = input.status === "interrupted" && input.context?.interruption && typeof input.context.interruption === "object" && input.context.interruption.type === "review_required" && !!input.result?.trim() && !!input.beliefImpact?.length;
|
|
41825
|
-
const trustedLifecycleInterruption = !!trustedProject && input.status === "interrupted" && input.context?.interruption && typeof input.context.interruption === "object";
|
|
41826
|
-
if (isAgentTask && input.context !== void 0 && !candidateReviewInterruption && !trustedLifecycleInterruption) {
|
|
41827
|
-
return JSON.stringify({
|
|
41828
|
-
success: false,
|
|
41829
|
-
code: "TASK_LIFECYCLE_CONTEXT_PROTECTED",
|
|
41830
|
-
error: "Agent task context is owned by the task lifecycle service.",
|
|
41831
|
-
hint: "Use lifecycle status inputs without context; the service preserves thread and interruption audit data."
|
|
41832
|
-
});
|
|
41833
|
-
}
|
|
41834
41926
|
const changesOwnerType = input.ownerType !== void 0 && input.ownerType !== existing.ownerType;
|
|
41835
41927
|
const changesAgentIdentity = isAgentTask && (input.ownerId !== void 0 && input.ownerId !== existing.ownerId || input.parentId !== void 0 && input.parentId !== existing.parentId);
|
|
41836
41928
|
if (changesOwnerType || changesAgentIdentity) {
|
|
@@ -41860,14 +41952,6 @@ function createTaskMiddleware(options = {}) {
|
|
|
41860
41952
|
hint: "Persist ownership or parent changes separately before changing lifecycle or task content."
|
|
41861
41953
|
});
|
|
41862
41954
|
}
|
|
41863
|
-
if (isAgentTask && input.description !== void 0 && input.status !== void 0) {
|
|
41864
|
-
return JSON.stringify({
|
|
41865
|
-
success: false,
|
|
41866
|
-
code: "AGENT_TASK_LIFECYCLE_REQUIRED",
|
|
41867
|
-
error: "Agent description and status updates must be separate operations.",
|
|
41868
|
-
hint: "Reconcile the description first, then issue the lifecycle status update."
|
|
41869
|
-
});
|
|
41870
|
-
}
|
|
41871
41955
|
const actor = trustedActor(trustedProject, rc) ?? (existing.ownerType === "agent" ? `agent:${existing.ownerId}` : `user:${existing.ownerId ?? ownerId}`);
|
|
41872
41956
|
const threadId = trustedProject?.projectTask?.threadId ?? (trustedProject?.projectRoom ? void 0 : input.sourceId ?? rc.thread_id);
|
|
41873
41957
|
const lifecycle = isAgentTask ? createTaskLifecycleService({
|
|
@@ -41878,29 +41962,36 @@ function createTaskMiddleware(options = {}) {
|
|
|
41878
41962
|
if (result.success && result.mutated) markMutation();
|
|
41879
41963
|
return lifecycleResponse(input.id, result, extra);
|
|
41880
41964
|
};
|
|
41965
|
+
const hasCarriedContentFields = () => ["title", "description", "priority", "dueDate", "metadata", "files"].some((key4) => input[key4] !== void 0);
|
|
41881
41966
|
if (lifecycle && input.status === "failed") {
|
|
41882
41967
|
await validateExecutionResult();
|
|
41883
41968
|
const callerError = await revalidateCaller();
|
|
41884
41969
|
if (callerError) return callerError;
|
|
41885
|
-
|
|
41970
|
+
const failed = await lifecycle.failTask({
|
|
41886
41971
|
tenantId: tenantId2,
|
|
41887
41972
|
taskId: input.id,
|
|
41888
41973
|
failureReason: input.failureReason ?? existing.failureReason ?? "",
|
|
41889
41974
|
actor,
|
|
41890
41975
|
threadId
|
|
41891
|
-
})
|
|
41976
|
+
});
|
|
41977
|
+
if (!failed.success) return lifecycleMutationResponse(failed);
|
|
41978
|
+
if (trustedProject || !hasCarriedContentFields()) return lifecycleMutationResponse(failed);
|
|
41979
|
+
existing = { ...existing, status: input.status };
|
|
41892
41980
|
}
|
|
41893
41981
|
if (lifecycle && input.status === "cancelled") {
|
|
41894
41982
|
await validateExecutionResult();
|
|
41895
41983
|
const callerError = await revalidateCaller();
|
|
41896
41984
|
if (callerError) return callerError;
|
|
41897
|
-
|
|
41985
|
+
const cancelled = await lifecycle.cancelTask({
|
|
41898
41986
|
tenantId: tenantId2,
|
|
41899
41987
|
taskId: input.id,
|
|
41900
41988
|
actor,
|
|
41901
41989
|
threadId,
|
|
41902
41990
|
summary: input.summary
|
|
41903
|
-
})
|
|
41991
|
+
});
|
|
41992
|
+
if (!cancelled.success) return lifecycleMutationResponse(cancelled);
|
|
41993
|
+
if (trustedProject || !hasCarriedContentFields()) return lifecycleMutationResponse(cancelled);
|
|
41994
|
+
existing = { ...existing, status: input.status };
|
|
41904
41995
|
}
|
|
41905
41996
|
if (lifecycle && input.status === "interrupted" && !(input.context?.interruption && typeof input.context.interruption === "object" && input.context.interruption.type === "review_required")) {
|
|
41906
41997
|
const interruption = input.context?.interruption;
|
|
@@ -41916,7 +42007,7 @@ function createTaskMiddleware(options = {}) {
|
|
|
41916
42007
|
await validateExecutionResult();
|
|
41917
42008
|
const callerError = await revalidateCaller();
|
|
41918
42009
|
if (callerError) return callerError;
|
|
41919
|
-
|
|
42010
|
+
const interrupted = await lifecycle.interruptTask({
|
|
41920
42011
|
tenantId: tenantId2,
|
|
41921
42012
|
taskId: input.id,
|
|
41922
42013
|
type,
|
|
@@ -41924,40 +42015,52 @@ function createTaskMiddleware(options = {}) {
|
|
|
41924
42015
|
actor,
|
|
41925
42016
|
threadId,
|
|
41926
42017
|
dependencyTaskIds: input.dependencyTaskIds
|
|
41927
|
-
})
|
|
42018
|
+
});
|
|
42019
|
+
if (!interrupted.success) return lifecycleMutationResponse(interrupted);
|
|
42020
|
+
if (trustedProject || !hasCarriedContentFields()) return lifecycleMutationResponse(interrupted);
|
|
42021
|
+
existing = { ...existing, status: input.status };
|
|
41928
42022
|
}
|
|
41929
42023
|
if (lifecycle && input.status === "in_progress" && existing.status === "interrupted") {
|
|
41930
42024
|
await validateExecutionResult();
|
|
41931
42025
|
const callerError = await revalidateCaller();
|
|
41932
42026
|
if (callerError) return callerError;
|
|
41933
|
-
|
|
42027
|
+
const resumed = await lifecycle.resumeInterruption({
|
|
41934
42028
|
tenantId: tenantId2,
|
|
41935
42029
|
taskId: input.id,
|
|
41936
42030
|
actor,
|
|
41937
42031
|
threadId
|
|
41938
|
-
})
|
|
42032
|
+
});
|
|
42033
|
+
if (!resumed.success) return lifecycleMutationResponse(resumed);
|
|
42034
|
+
if (trustedProject || !hasCarriedContentFields()) return lifecycleMutationResponse(resumed);
|
|
42035
|
+
existing = { ...existing, status: input.status };
|
|
41939
42036
|
}
|
|
41940
42037
|
if (lifecycle && input.status === "in_progress" && existing.status === "pending") {
|
|
41941
42038
|
await validateExecutionResult();
|
|
41942
42039
|
const callerError = await revalidateCaller();
|
|
41943
42040
|
if (callerError) return callerError;
|
|
41944
|
-
|
|
42041
|
+
const started = await lifecycle.startTask({
|
|
41945
42042
|
tenantId: tenantId2,
|
|
41946
42043
|
taskId: input.id,
|
|
41947
42044
|
actor,
|
|
41948
42045
|
threadId
|
|
41949
|
-
})
|
|
42046
|
+
});
|
|
42047
|
+
if (!started.success) return lifecycleMutationResponse(started);
|
|
42048
|
+
if (trustedProject || !hasCarriedContentFields()) return lifecycleMutationResponse(started);
|
|
42049
|
+
existing = { ...existing, status: input.status };
|
|
41950
42050
|
}
|
|
41951
42051
|
if (lifecycle && input.status === "in_progress" && existing.status === "failed") {
|
|
41952
42052
|
await validateExecutionResult();
|
|
41953
42053
|
const callerError = await revalidateCaller();
|
|
41954
42054
|
if (callerError) return callerError;
|
|
41955
|
-
|
|
42055
|
+
const retried = await lifecycle.retryTask({
|
|
41956
42056
|
tenantId: tenantId2,
|
|
41957
42057
|
taskId: input.id,
|
|
41958
42058
|
actor,
|
|
41959
42059
|
threadId
|
|
41960
|
-
})
|
|
42060
|
+
});
|
|
42061
|
+
if (!retried.success) return lifecycleMutationResponse(retried);
|
|
42062
|
+
if (trustedProject || !hasCarriedContentFields()) return lifecycleMutationResponse(retried);
|
|
42063
|
+
existing = { ...existing, status: input.status };
|
|
41961
42064
|
}
|
|
41962
42065
|
if (isAgentTask && input.requireReview === true && options.reviewMode !== "hitl") {
|
|
41963
42066
|
return reviewModeDisabledResponse();
|
|
@@ -42078,7 +42181,8 @@ function createTaskMiddleware(options = {}) {
|
|
|
42078
42181
|
return JSON.stringify({
|
|
42079
42182
|
success: false,
|
|
42080
42183
|
code: "AGENT_TASK_LIFECYCLE_REQUIRED",
|
|
42081
|
-
error: `Agent task lifecycle cannot transition from '${existing.status}' to '${input.status}'
|
|
42184
|
+
error: `Agent task lifecycle cannot transition from '${existing.status}' to '${input.status}'.`,
|
|
42185
|
+
hint: "Valid transitions: pending\u2192in_progress, in_progress\u2192completed (requires result + beliefImpact), in_progress\u2192failed (requires failureReason), in_progress\u2192cancelled, in_progress\u2192interrupted. Check the current status with manage_task get first."
|
|
42082
42186
|
});
|
|
42083
42187
|
}
|
|
42084
42188
|
const persistedStatus = input.status;
|
|
@@ -42301,8 +42405,8 @@ function createTaskMiddleware(options = {}) {
|
|
|
42301
42405
|
if (!existing) {
|
|
42302
42406
|
return JSON.stringify({
|
|
42303
42407
|
success: false,
|
|
42304
|
-
error: `Task '${input.id}' not found
|
|
42305
|
-
hint: "Use list to
|
|
42408
|
+
error: `Task '${input.id}' not found`,
|
|
42409
|
+
hint: "Use list to see available tasks and their IDs"
|
|
42306
42410
|
});
|
|
42307
42411
|
}
|
|
42308
42412
|
if (!taskMatchesRuntimeScope3(existing, workspaceId, projectId)) {
|
|
@@ -43384,6 +43488,10 @@ never plain text. One question per tool call.
|
|
|
43384
43488
|
safety boundary): the target identity exists and is fixed. Preserve the IDs. Confirm only
|
|
43385
43489
|
material-boundary decisions. After architecture approval, apply reversible in-contract updates
|
|
43386
43490
|
without routine renewed confirmation; every material boundary requires HITL or human confirmation.
|
|
43491
|
+
The bound tracking Task is your main task and belief root: reconcile its description before
|
|
43492
|
+
creating children \u2014 write the confirmed Objective, Acceptance Criteria, and Belief State once the
|
|
43493
|
+
Goal Model is confirmed, and keep reconciling the same task as evidence arrives. Never create a
|
|
43494
|
+
parallel main task under it; children are only independently verifiable outcomes.
|
|
43387
43495
|
If the exact bound target is missing or cannot be loaded \u2192 hard stop: update the tracking task with status
|
|
43388
43496
|
"interrupted" and a recovery condition. NEVER create a replacement.
|
|
43389
43497
|
|