@autonoma-ai/planner 0.1.8 → 0.1.9
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 +14 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3585,7 +3585,7 @@ function buildClassifierPrompt(args) {
|
|
|
3585
3585
|
const statusLine = args.httpStatus != null ? `HTTP status: ${args.httpStatus}. (A 5xx usually means the handler threw; a 4xx is more often a rejected payload, but use the error text \u2014 status alone is not decisive.)` : `No HTTP status (the request threw before a response \u2014 often a network/server-process problem, lean implementation or unclear).`;
|
|
3586
3586
|
return `${PRIMER}
|
|
3587
3587
|
|
|
3588
|
-
- RECIPE DATA is wrong \u2014 the JSON the tool sent doesn't fit the developer's (correct) schema. Examples of the *kind* of problem (not an exhaustive list):
|
|
3588
|
+
- RECIPE DATA is wrong \u2014 the JSON the tool sent doesn't fit the developer's (correct) schema. Examples of the *kind* of problem (not an exhaustive list): the request body references an alias (_ref) that no record in THIS SAME request declares with an _alias, a field holds a value the backend rejects, a required field is missing or an unknown field was sent, or a value has the wrong type. These are fixable by regenerating the data \u2014 the developer's code is fine. NOTE: an error like "references unknown alias(es): X" is recipe-side whenever X is not declared by an _alias in the test data shown below \u2014 the SDK resolves _refs WITHIN the request body, so it does not matter whether X appears in the "valid targets" list (that list is historical context about other entities' own runs, NOT the contents of this request).
|
|
3589
3589
|
- IMPLEMENTATION is wrong \u2014 the developer's own handler/factory code is broken. Examples of the *kind* of problem: the factory for this entity is not registered, the handler references a column or table that does not exist (even though the recipe never mentioned it), the insert/delete logic has a bug, or the server threw an unhandled exception. No change to the test data can fix this; the developer must edit code.
|
|
3590
3590
|
|
|
3591
3591
|
## How to decide
|
|
@@ -3595,7 +3595,7 @@ Ask: "Would sending DIFFERENT, corrected test data \u2014 still matching the int
|
|
|
3595
3595
|
- If the data shown below looks valid and the error points at the server's own logic, a missing factory, or a column/table the recipe never referenced \u2192 **implementation**.
|
|
3596
3596
|
- If you genuinely cannot tell from the evidence \u2192 **unclear**. Prefer "unclear" over a confident guess; a wrong confident answer is worse than admitting uncertainty.
|
|
3597
3597
|
|
|
3598
|
-
Cross-check the error against the actual data below before deciding \u2014
|
|
3598
|
+
Cross-check the error against the actual data sent below before deciding. For an "unknown alias" error, look at whether a record in the test data declares that alias with an _alias \u2014 NOT at the valid-targets list. If the alias the error names is missing from (or spelled differently in) the data we sent, it is recipe-side, even when that alias appears in the valid-targets list.
|
|
3599
3599
|
|
|
3600
3600
|
## Evidence
|
|
3601
3601
|
|
|
@@ -3906,8 +3906,7 @@ function seedFeedbackFromError(errorContext, reason) {
|
|
|
3906
3906
|
async function promptOnFailure(entityName, errorBody, ctx, phase, httpStatus) {
|
|
3907
3907
|
notify("Autonoma", `${entityName} \u2014 failed, action needed`);
|
|
3908
3908
|
const errorContext = formatErrorContext(errorBody);
|
|
3909
|
-
const
|
|
3910
|
-
const { side, reason } = await classifyFailure(ctx.model, {
|
|
3909
|
+
const { reason } = await classifyFailure(ctx.model, {
|
|
3911
3910
|
entityName,
|
|
3912
3911
|
phase,
|
|
3913
3912
|
httpStatus,
|
|
@@ -3916,31 +3915,25 @@ async function promptOnFailure(entityName, errorBody, ctx, phase, httpStatus) {
|
|
|
3916
3915
|
validRefAliases: ctx.validRefAliases,
|
|
3917
3916
|
entityAudit: ctx.entityAudit
|
|
3918
3917
|
});
|
|
3919
|
-
if (
|
|
3918
|
+
if (ctx.budget.attempts < MAX_AUTOFIX_ATTEMPTS) {
|
|
3920
3919
|
ctx.budget.attempts++;
|
|
3920
|
+
p5.log.info(`Triage: ${reason}`);
|
|
3921
3921
|
p5.log.info(
|
|
3922
|
-
`
|
|
3922
|
+
`Handing the failure to the agent to fix from the error (attempt ${ctx.budget.attempts}/${MAX_AUTOFIX_ATTEMPTS})...`
|
|
3923
3923
|
);
|
|
3924
3924
|
return seedFeedbackFromError(errorContext, reason);
|
|
3925
3925
|
}
|
|
3926
|
-
|
|
3927
|
-
if (side === "implementation") {
|
|
3928
|
-
p5.log.warn(`This looks like a handler/code issue, not the test data: ${reason}`);
|
|
3929
|
-
} else if (side === "recipe" && !budgetLeft) {
|
|
3930
|
-
p5.log.warn(`Autofix ran ${MAX_AUTOFIX_ATTEMPTS}\xD7 without resolving it \u2014 over to you. Latest read: ${reason}`);
|
|
3931
|
-
}
|
|
3926
|
+
p5.log.warn(`The agent tried ${MAX_AUTOFIX_ATTEMPTS}\xD7 without resolving it. Latest triage: ${reason}`);
|
|
3932
3927
|
const action = await p5.select({
|
|
3933
3928
|
message: "What would you like to do?",
|
|
3934
3929
|
options: [
|
|
3935
3930
|
{ value: "retry", label: "Yes, retry \u2014 I fixed my handler code", hint: "Send the same request again" },
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
] : [],
|
|
3943
|
-
{ value: "feedback", label: "Yes, fix the recipe data \u2014 I'll explain what's wrong", hint: "The request data is wrong and I'll describe the change" },
|
|
3931
|
+
{
|
|
3932
|
+
value: "autofix",
|
|
3933
|
+
label: "Let the agent try again from the error",
|
|
3934
|
+
hint: "Hand the raw error back to the agent, no typing"
|
|
3935
|
+
},
|
|
3936
|
+
{ value: "feedback", label: "Let me explain what's wrong", hint: "Describe the change and the agent will apply it" },
|
|
3944
3937
|
{ value: "skip", label: "No, skip this entity", hint: "Move on to the next entity" }
|
|
3945
3938
|
]
|
|
3946
3939
|
});
|
|
@@ -3949,7 +3942,7 @@ async function promptOnFailure(entityName, errorBody, ctx, phase, httpStatus) {
|
|
|
3949
3942
|
if (action === "retry") return "retry";
|
|
3950
3943
|
if (action === "autofix") {
|
|
3951
3944
|
ctx.budget.attempts++;
|
|
3952
|
-
return seedFeedbackFromError(errorContext);
|
|
3945
|
+
return seedFeedbackFromError(errorContext, reason);
|
|
3953
3946
|
}
|
|
3954
3947
|
const fb = await p5.text({
|
|
3955
3948
|
message: "What's wrong with the recipe data?",
|