@indexnetwork/protocol 66.0.0-rc.648.1 → 66.0.0-rc.650.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/internal/intents/intent.preparer.d.ts +1 -0
- package/dist/internal/intents/intent.preparer.js +9 -18
- package/dist/internal/shared/agent/model.config.d.ts +2 -2
- package/dist/internal/shared/agent/model.config.js +2 -2
- package/dist/internal/shared/agent/model.resolver.d.ts +2 -2
- package/dist/internal/shared/agent/model.resolver.js +2 -2
- package/package.json +1 -1
|
@@ -49,4 +49,5 @@ export declare class IntentPreparer {
|
|
|
49
49
|
* @throws When rewriting, verification, or recovery generation fails; callers must retain the input for retry.
|
|
50
50
|
*/
|
|
51
51
|
invoke(input: PrepareInput, profileContext?: string): Promise<PrepareResult>;
|
|
52
|
+
private recoveryForm;
|
|
52
53
|
}
|
|
@@ -58,30 +58,21 @@ export class IntentPreparer {
|
|
|
58
58
|
]);
|
|
59
59
|
payload = payloadSchema.parse(result).payload;
|
|
60
60
|
}
|
|
61
|
+
// The form starts with verification: it only needs the draft, so a failed draft doesn't wait for it twice.
|
|
62
|
+
const recovery = this.recoveryForm(payload, answers);
|
|
63
|
+
recovery.catch(() => { }); // Unused when the draft is ready, or when verification throws first.
|
|
61
64
|
const verdict = await this.verifier.invoke(payload, profileContext);
|
|
62
65
|
const failure = admissionFailure(payload, verdict);
|
|
63
66
|
if (!failure)
|
|
64
67
|
return { status: "ready", payload, metadata: semanticMetadata(verdict) };
|
|
68
|
+
return { status: "needs_revision", payload, feedback: failure.message, recovery: await recovery };
|
|
69
|
+
}
|
|
70
|
+
async recoveryForm(payload, answers) {
|
|
65
71
|
const model = createStructuredModel("intentClarifier", recoverySchema, { name: "intent_recovery" });
|
|
66
72
|
const result = await invokeWithAbortSignal(model, [
|
|
67
|
-
new SystemMessage("Build one recovery form that helps the person concretize their intent. Return 2-6 fields. Each field needs a draft-specific label, a kind (single, multi, or text), and for single/multi 2-5 concrete options anchored to the draft. Text fields need a placeholder. Never re-ask what the draft or answers already settle. Options must be matchable and specific. Do not expose scores, classifications, JSON, or internal vocabulary."),
|
|
68
|
-
new HumanMessage(JSON.stringify({
|
|
69
|
-
payload,
|
|
70
|
-
answers,
|
|
71
|
-
feedback: failure.message,
|
|
72
|
-
category: failure.category,
|
|
73
|
-
classification: verdict.classification,
|
|
74
|
-
clarity: verdict.felicity_scores.clarity,
|
|
75
|
-
entropy: verdict.semantic_entropy,
|
|
76
|
-
referentialBreadth: verdict.referential_breadth,
|
|
77
|
-
missingConstraints: verdict.missing_selectional_constraints,
|
|
78
|
-
})),
|
|
73
|
+
new SystemMessage("Build one recovery form that helps the person concretize their intent. Assume the draft is too broad to match anyone yet: ask for whatever is missing among role, outcome, location, timeframe, domain, and concrete need. Return 2-6 fields. Each field needs a draft-specific label, a kind (single, multi, or text), and for single/multi 2-5 concrete options anchored to the draft. Text fields need a placeholder. Never re-ask what the draft or answers already settle. Options must be matchable and specific. Do not expose scores, classifications, JSON, or internal vocabulary."),
|
|
74
|
+
new HumanMessage(JSON.stringify({ payload, answers })),
|
|
79
75
|
]);
|
|
80
|
-
return
|
|
81
|
-
status: "needs_revision",
|
|
82
|
-
payload,
|
|
83
|
-
feedback: failure.message,
|
|
84
|
-
recovery: parseRecoveryFields(recoverySchema.parse(result)),
|
|
85
|
-
};
|
|
76
|
+
return parseRecoveryFields(recoverySchema.parse(result));
|
|
86
77
|
}
|
|
87
78
|
}
|
|
@@ -37,10 +37,10 @@ declare function getBaseModelConfig(config?: ModelConfig): { [Agent in "intentIn
|
|
|
37
37
|
readonly model: "google/gemini-3.7-flash";
|
|
38
38
|
};
|
|
39
39
|
readonly intentVerifier: {
|
|
40
|
-
readonly model: "google/gemini-
|
|
40
|
+
readonly model: "google/gemini-2.5-flash";
|
|
41
41
|
};
|
|
42
42
|
readonly intentClarifier: {
|
|
43
|
-
readonly model: "google/gemini-
|
|
43
|
+
readonly model: "google/gemini-2.5-flash";
|
|
44
44
|
};
|
|
45
45
|
readonly profileGenerator: {
|
|
46
46
|
readonly model: "google/gemini-3.7-flash";
|
|
@@ -5,8 +5,8 @@ const GEMINI_3_7_FLASH_MODEL = "google/gemini-3.7-flash";
|
|
|
5
5
|
function getBaseModelConfig(config) {
|
|
6
6
|
const settings = {
|
|
7
7
|
intentInferrer: { model: "google/gemini-3.7-flash" },
|
|
8
|
-
intentVerifier: { model: "google/gemini-
|
|
9
|
-
intentClarifier: { model: "google/gemini-
|
|
8
|
+
intentVerifier: { model: "google/gemini-2.5-flash" },
|
|
9
|
+
intentClarifier: { model: "google/gemini-2.5-flash" },
|
|
10
10
|
profileGenerator: { model: "google/gemini-3.7-flash" },
|
|
11
11
|
opportunityPresenter: { model: "google/gemini-3.7-flash" },
|
|
12
12
|
negotiator: { model: "google/gemini-3.7-flash" },
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const CANONICAL_AGENT_MODEL_DEFAULTS: Readonly<{
|
|
9
9
|
readonly intentInferrer: "google/gemini-3.7-flash";
|
|
10
|
-
readonly intentVerifier: "google/gemini-
|
|
11
|
-
readonly intentClarifier: "google/gemini-
|
|
10
|
+
readonly intentVerifier: "google/gemini-2.5-flash";
|
|
11
|
+
readonly intentClarifier: "google/gemini-2.5-flash";
|
|
12
12
|
readonly profileGenerator: "google/gemini-3.7-flash";
|
|
13
13
|
readonly opportunityPresenter: "google/gemini-3.7-flash";
|
|
14
14
|
readonly negotiator: "google/gemini-3.7-flash";
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export const CANONICAL_AGENT_MODEL_DEFAULTS = Object.freeze({
|
|
9
9
|
intentInferrer: "google/gemini-3.7-flash",
|
|
10
|
-
intentVerifier: "google/gemini-
|
|
11
|
-
intentClarifier: "google/gemini-
|
|
10
|
+
intentVerifier: "google/gemini-2.5-flash",
|
|
11
|
+
intentClarifier: "google/gemini-2.5-flash",
|
|
12
12
|
profileGenerator: "google/gemini-3.7-flash",
|
|
13
13
|
opportunityPresenter: "google/gemini-3.7-flash",
|
|
14
14
|
negotiator: "google/gemini-3.7-flash",
|