@indexnetwork/protocol 0.31.0-rc.119.1 → 0.32.0-rc.120.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.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/opportunity/question.generator.d.ts +14 -0
- package/dist/opportunity/question.generator.d.ts.map +1 -0
- package/dist/opportunity/question.generator.js +113 -0
- package/dist/opportunity/question.generator.js.map +1 -0
- package/dist/opportunity/question.prompt.d.ts +84 -0
- package/dist/opportunity/question.prompt.d.ts.map +1 -0
- package/dist/opportunity/question.prompt.js +170 -0
- package/dist/opportunity/question.prompt.js.map +1 -0
- package/dist/shared/agent/model.config.d.ts +5 -0
- package/dist/shared/agent/model.config.d.ts.map +1 -1
- package/dist/shared/agent/model.config.js +1 -0
- package/dist/shared/agent/model.config.js.map +1 -1
- package/dist/shared/schemas/question.schema.d.ts +182 -0
- package/dist/shared/schemas/question.schema.d.ts.map +1 -0
- package/dist/shared/schemas/question.schema.js +41 -0
- package/dist/shared/schemas/question.schema.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type { AgentDispatcher, AgentDispatchResult, NegotiationTurnPayload } fro
|
|
|
23
23
|
export type { AgentRecord, AgentTransportRecord, AgentPermissionRecord, AgentWithRelations, CreateAgentInput, CreateTransportInput, GrantPermissionInput, AgentDatabase, } from './shared/interfaces/agent.interface.js';
|
|
24
24
|
export { SYSTEM_AGENT_IDS } from './shared/interfaces/agent.interface.js';
|
|
25
25
|
export { ChatContextDigestSchema, type ChatContextDigest, } from "./shared/schemas/chat-context.schema.js";
|
|
26
|
+
export { QuestionOptionSchema, QuestionSchema, QuestionStrategySchema, QuestionWithStrategySchema, QuestionGeneratorResponseSchema, type Question, type QuestionOption, type QuestionStrategy, type QuestionWithStrategy, type QuestionGeneratorResponse, type QuestionGenerationResult, } from "./shared/schemas/question.schema.js";
|
|
26
27
|
export { ChatGraphFactory } from "./chat/chat.graph.js";
|
|
27
28
|
export { HomeGraphFactory } from "./opportunity/feed/feed.graph.js";
|
|
28
29
|
export { HydeGraphFactory } from "./shared/hyde/hyde.graph.js";
|
|
@@ -53,6 +54,8 @@ export { OpportunityEvaluator } from "./opportunity/opportunity.evaluator.js";
|
|
|
53
54
|
export type { EvaluatorInput, OpportunityEvaluatorOptionsConstructor, } from "./opportunity/opportunity.evaluator.js";
|
|
54
55
|
export { OpportunityPresenter, gatherPresenterContext } from "./opportunity/opportunity.presenter.js";
|
|
55
56
|
export type { PresenterDatabase } from "./opportunity/opportunity.presenter.js";
|
|
57
|
+
export { QuestionGenerator } from "./opportunity/question.generator.js";
|
|
58
|
+
export type { DiscoveryQuestionInput, DiscoveryNegotiation, DiscoveryOutcome, DiscoveryTurn, DiscoverySummary, DiscoverySourceProfile, NegotiationRole, } from "./opportunity/question.prompt.js";
|
|
56
59
|
export { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition, FEED_SOFT_TARGETS, } from "./opportunity/opportunity.utils.js";
|
|
57
60
|
export { getPrimaryActionLabel } from "./opportunity/opportunity.labels.js";
|
|
58
61
|
export { computeFeedHealth } from "./opportunity/feed/feed.health.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACjF,YAAY,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACjF,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,UAAU,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C5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,YAAY,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAChG,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,sCAAsC,CAAC;AAI9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAI5E,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,YAAY,EACV,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,oBAAoB,GACrB,MAAM,oCAAoC,CAAC;AAI5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { ChatContextAccessError, resolveChatContext } from "./shared/agent/tool.
|
|
|
5
5
|
export { SYSTEM_AGENT_IDS } from './shared/interfaces/agent.interface.js';
|
|
6
6
|
// ─── Shared schemas ───────────────────────────────────────────────────────────
|
|
7
7
|
export { ChatContextDigestSchema, } from "./shared/schemas/chat-context.schema.js";
|
|
8
|
+
export { QuestionOptionSchema, QuestionSchema, QuestionStrategySchema, QuestionWithStrategySchema, QuestionGeneratorResponseSchema, } from "./shared/schemas/question.schema.js";
|
|
8
9
|
// ─── Graph factories ──────────────────────────────────────────────────────────
|
|
9
10
|
export { ChatGraphFactory } from "./chat/chat.graph.js";
|
|
10
11
|
export { HomeGraphFactory } from "./opportunity/feed/feed.graph.js";
|
|
@@ -29,6 +30,7 @@ export { NegotiationInsightsGenerator } from "./negotiation/insight.generator.js
|
|
|
29
30
|
export { IndexNegotiator } from "./negotiation/negotiation.agent.js";
|
|
30
31
|
export { OpportunityEvaluator } from "./opportunity/opportunity.evaluator.js";
|
|
31
32
|
export { OpportunityPresenter, gatherPresenterContext } from "./opportunity/opportunity.presenter.js";
|
|
33
|
+
export { QuestionGenerator } from "./opportunity/question.generator.js";
|
|
32
34
|
// ─── Support utilities ────────────────────────────────────────────────────────
|
|
33
35
|
export { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition, FEED_SOFT_TARGETS, } from "./opportunity/opportunity.utils.js";
|
|
34
36
|
export { getPrimaryActionLabel } from "./opportunity/opportunity.labels.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAYjF,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AA8B5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,iFAAiF;AAEjF,OAAO,EACL,uBAAuB,GAExB,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAYjF,OAAO,EAAE,sBAAsB,EAAE,k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AAsB,EAAE,MAAM,qBAAqB,CAAC;AAa9E,iFAAiF;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type QuestionGenerationResult } from "../shared/schemas/question.schema.js";
|
|
2
|
+
import { type DiscoveryQuestionInput } from "./question.prompt.js";
|
|
3
|
+
export declare class QuestionGenerator {
|
|
4
|
+
private model;
|
|
5
|
+
constructor();
|
|
6
|
+
/**
|
|
7
|
+
* Generate up to 3 decision questions from the given discovery turn.
|
|
8
|
+
* @returns A result with parallel questions[] and strategies[] arrays,
|
|
9
|
+
* or null when the LLM fails, the output is malformed, or the
|
|
10
|
+
* guardrails leave zero questions standing.
|
|
11
|
+
*/
|
|
12
|
+
generate(input: DiscoveryQuestionInput): Promise<QuestionGenerationResult | null>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=question.generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.generator.d.ts","sourceRoot":"","sources":["../../src/opportunity/question.generator.ts"],"names":[],"mappings":"AAgBA,OAAO,EAGL,KAAK,wBAAwB,EAG9B,MAAM,sCAAsC,CAAC;AAI9C,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAO9B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAAiD;;IAS9D;;;;;OAKG;IAEG,QAAQ,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC;CA8BxF"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { HumanMessage, SystemMessage } from "@langchain/core/messages";
|
|
11
|
+
import { QuestionGeneratorResponseSchema, } from "../shared/schemas/question.schema.js";
|
|
12
|
+
import { createModel } from "../shared/agent/model.config.js";
|
|
13
|
+
import { protocolLogger } from "../shared/observability/protocol.logger.js";
|
|
14
|
+
import { Timed } from "../shared/observability/performance.js";
|
|
15
|
+
import { SYSTEM_PROMPT, buildQuestionPrompt, } from "./question.prompt.js";
|
|
16
|
+
const logger = protocolLogger("QuestionGenerator");
|
|
17
|
+
/** Maximum same-strategy questions allowed in a single emission. */
|
|
18
|
+
const MAX_SAME_STRATEGY = 2;
|
|
19
|
+
export class QuestionGenerator {
|
|
20
|
+
constructor() {
|
|
21
|
+
const llm = createModel("discoveryQuestionGenerator");
|
|
22
|
+
this.model = llm.withStructuredOutput(QuestionGeneratorResponseSchema, {
|
|
23
|
+
name: "clarifying_questions",
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Generate up to 3 decision questions from the given discovery turn.
|
|
28
|
+
* @returns A result with parallel questions[] and strategies[] arrays,
|
|
29
|
+
* or null when the LLM fails, the output is malformed, or the
|
|
30
|
+
* guardrails leave zero questions standing.
|
|
31
|
+
*/
|
|
32
|
+
async generate(input) {
|
|
33
|
+
const user = buildQuestionPrompt(input);
|
|
34
|
+
let raw;
|
|
35
|
+
try {
|
|
36
|
+
raw = await this.model.invoke([
|
|
37
|
+
new SystemMessage(SYSTEM_PROMPT),
|
|
38
|
+
new HumanMessage(user),
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
logger.warn("QuestionGenerator LLM call failed", {
|
|
43
|
+
error: err instanceof Error ? err.message : String(err),
|
|
44
|
+
});
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const parsed = QuestionGeneratorResponseSchema.safeParse(raw);
|
|
48
|
+
if (!parsed.success) {
|
|
49
|
+
logger.warn("QuestionGenerator parse failed", { error: parsed.error.message });
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const filtered = applyGuardrails(parsed.data.questions);
|
|
53
|
+
if (filtered.length === 0)
|
|
54
|
+
return null;
|
|
55
|
+
return {
|
|
56
|
+
questions: filtered.map(stripStrategy),
|
|
57
|
+
strategies: filtered.map((q) => q.strategy),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
__decorate([
|
|
62
|
+
Timed(),
|
|
63
|
+
__metadata("design:type", Function),
|
|
64
|
+
__metadata("design:paramtypes", [Object]),
|
|
65
|
+
__metadata("design:returntype", Promise)
|
|
66
|
+
], QuestionGenerator.prototype, "generate", null);
|
|
67
|
+
/**
|
|
68
|
+
* Guardrail pipeline. Order matters:
|
|
69
|
+
* 1. Dedup by title (keep first occurrence). Title uniqueness is a hard UX
|
|
70
|
+
* requirement for the renderer — two questions cannot share a chip label.
|
|
71
|
+
* 2. Strategy diversity: cap same-strategy entries at MAX_SAME_STRATEGY,
|
|
72
|
+
* dropping overflow unconditionally (does NOT depend on whether a
|
|
73
|
+
* distinct-strategy alternative exists in the batch). The cap exists to
|
|
74
|
+
* enforce the "never 3 of the same kind" guidance from the spec.
|
|
75
|
+
*/
|
|
76
|
+
function applyGuardrails(questions) {
|
|
77
|
+
const dedupedByTitle = dedupByTitle(questions);
|
|
78
|
+
return enforceStrategyDiversity(dedupedByTitle);
|
|
79
|
+
}
|
|
80
|
+
function dedupByTitle(questions) {
|
|
81
|
+
const seen = new Set();
|
|
82
|
+
const out = [];
|
|
83
|
+
for (const q of questions) {
|
|
84
|
+
if (seen.has(q.title))
|
|
85
|
+
continue;
|
|
86
|
+
seen.add(q.title);
|
|
87
|
+
out.push(q);
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Enforce the "never 3 same-strategy" rule. Walks the array in order; once a
|
|
93
|
+
* given strategy has appeared MAX_SAME_STRATEGY times, subsequent entries with
|
|
94
|
+
* the same strategy are dropped. Distinct-strategy entries are always kept
|
|
95
|
+
* (subject to the schema's overall 3-question cap, which has already applied).
|
|
96
|
+
*/
|
|
97
|
+
function enforceStrategyDiversity(questions) {
|
|
98
|
+
const counts = new Map();
|
|
99
|
+
const out = [];
|
|
100
|
+
for (const q of questions) {
|
|
101
|
+
const n = counts.get(q.strategy) ?? 0;
|
|
102
|
+
if (n >= MAX_SAME_STRATEGY)
|
|
103
|
+
continue;
|
|
104
|
+
counts.set(q.strategy, n + 1);
|
|
105
|
+
out.push(q);
|
|
106
|
+
}
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
function stripStrategy(q) {
|
|
110
|
+
const { strategy: _strategy, ...publicShape } = q;
|
|
111
|
+
return publicShape;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=question.generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.generator.js","sourceRoot":"","sources":["../../src/opportunity/question.generator.ts"],"names":[],"mappings":";;;;;;;;;AAcA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EACL,+BAA+B,GAKhC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAA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iB;YAAE,SAAS;QACrC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,aAAa,CAAC,CAAuB;IAC5C,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,GAAG,CAAC,CAAC;IAClD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt module for the decision-question generator: the system prompt
|
|
3
|
+
* constant, the `DiscoveryQuestionInput` contract, and a pure string-building
|
|
4
|
+
* `buildQuestionPrompt` that assembles the user message.
|
|
5
|
+
*
|
|
6
|
+
* Pure: no I/O, no LLM call. The generator class (`question.generator.ts`)
|
|
7
|
+
* orchestrates this module + an LLM client.
|
|
8
|
+
*/
|
|
9
|
+
import type { ChatContextDigest } from "../shared/schemas/chat-context.schema.js";
|
|
10
|
+
/** Roles used in the existing negotiation framework. */
|
|
11
|
+
export type NegotiationRole = "agent" | "patient" | "peer";
|
|
12
|
+
/** One turn within a negotiation. */
|
|
13
|
+
export interface DiscoveryTurn {
|
|
14
|
+
action: "propose" | "accept" | "reject" | "counter" | "question";
|
|
15
|
+
reasoning: string;
|
|
16
|
+
suggestedRoles: {
|
|
17
|
+
ownUser: NegotiationRole;
|
|
18
|
+
otherUser: NegotiationRole;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** Outcome of a negotiation. */
|
|
22
|
+
export interface DiscoveryOutcome {
|
|
23
|
+
hasOpportunity: boolean;
|
|
24
|
+
reasoning: string;
|
|
25
|
+
agreedRoles?: Array<{
|
|
26
|
+
userId: string;
|
|
27
|
+
role: NegotiationRole;
|
|
28
|
+
}>;
|
|
29
|
+
/** Why the negotiation stopped, when not by an explicit accept/reject. */
|
|
30
|
+
reason?: "turn_cap" | "timeout";
|
|
31
|
+
}
|
|
32
|
+
/** One negotiation that ran during this discovery turn. */
|
|
33
|
+
export interface DiscoveryNegotiation {
|
|
34
|
+
/** Opaque counterparty identifier; NEVER surfaced to the user (kept out of the prompt). */
|
|
35
|
+
counterpartyId: string;
|
|
36
|
+
/** Abstract profile slice for the LLM (e.g. "AI infra founder, Berlin"). */
|
|
37
|
+
counterpartyHint: string;
|
|
38
|
+
/** The network/community prompt this negotiation ran under. */
|
|
39
|
+
indexContext: string;
|
|
40
|
+
/** Last 6 turns are retained; earlier ones are dropped. */
|
|
41
|
+
turns: DiscoveryTurn[];
|
|
42
|
+
outcome: DiscoveryOutcome;
|
|
43
|
+
/**
|
|
44
|
+
* Optional pre-negotiation evaluator score (0..1). When more than
|
|
45
|
+
* `MAX_NEGOTIATIONS` candidates exist, this is used as a tie-breaker after
|
|
46
|
+
* `turns.length` to decide which to keep.
|
|
47
|
+
*/
|
|
48
|
+
seedAssessmentScore?: number;
|
|
49
|
+
}
|
|
50
|
+
/** Aggregate counters across all negotiations in this discovery turn. */
|
|
51
|
+
export interface DiscoverySummary {
|
|
52
|
+
totalCandidates: number;
|
|
53
|
+
opportunitiesFound: number;
|
|
54
|
+
noOpportunityCount: number;
|
|
55
|
+
/** Subset of `noOpportunityCount` where the negotiation hit a turn-cap or timeout. */
|
|
56
|
+
timeoutCount: number;
|
|
57
|
+
/** Map of role → count across all outcomes' `agreedRoles`. */
|
|
58
|
+
roleDistribution: Partial<Record<NegotiationRole, number>>;
|
|
59
|
+
}
|
|
60
|
+
/** The seeker's profile slice the generator sees. All fields optional. */
|
|
61
|
+
export interface DiscoverySourceProfile {
|
|
62
|
+
name?: string;
|
|
63
|
+
bio?: string;
|
|
64
|
+
location?: string;
|
|
65
|
+
skills?: string[];
|
|
66
|
+
interests?: string[];
|
|
67
|
+
}
|
|
68
|
+
/** Full input to the question generator. */
|
|
69
|
+
export interface DiscoveryQuestionInput {
|
|
70
|
+
/** The seeker's original natural-language query / signal that triggered discovery. */
|
|
71
|
+
query: string;
|
|
72
|
+
sourceProfile: DiscoverySourceProfile;
|
|
73
|
+
/** Negotiations from THIS discovery turn (capped/sorted by the builder). */
|
|
74
|
+
negotiations: DiscoveryNegotiation[];
|
|
75
|
+
summary: DiscoverySummary;
|
|
76
|
+
/** Distilled chat-session digest, when a session is in scope. */
|
|
77
|
+
chatContext?: ChatContextDigest;
|
|
78
|
+
/** ISO timestamp used as the "now" anchor in the prompt. */
|
|
79
|
+
now: string;
|
|
80
|
+
}
|
|
81
|
+
export declare const SYSTEM_PROMPT = "You sit between a human and a discovery protocol that just ran negotiations on their behalf. Your job: surface the minimum set of structured decision questions the human must answer to make the next discovery turn sharper, or improve their outlook on the intent.\n\nYou may pick from five strategies. Choose contextually; mix when multiple questions genuinely complement.\n- refine_intent: ask the user to sharpen or pivot their original signal.\n- surface_missing_detail: ask for one concrete missing input (stage, location, timing, scope, \u2026).\n- open_adjacent_thread: offer a pivot suggested by recurring counterparty signals.\n- reflective_summary: mirror what the negotiations revealed and ask the user to decide.\n- surface_emergent_knowledge: cite a fact you learned from negotiations and ask the user to decide in light of it.\n\nAsk a question only when ALL of these hold:\n1. The agent cannot resolve the decision autonomously from the evidence shown.\n2. The answer would materially change which candidates surface next.\n3. The same fact is NOT already in chatContext.statedFacts, NOT already asked in chatContext.openQuestions, and NOT already shared in chatContext.surfacedFindings.\n\nCardinality. Default one question. Add a second only when a DIFFERENT strategy genuinely complements the first (e.g. one surface_emergent_knowledge + one refine_intent). Add a third only when there are \u22653 substantive candidates and three distinct strategies each unblock a real decision. Two questions of the same strategy are acceptable only if their decision domains differ (different titles). Avoid stacking three pulls (info-from-user); balance with pushes (info-to-user via reflective_summary / surface_emergent_knowledge).\n\nOrdering. Questions whose answer unblocks the most failed negotiations come first; then highest-impact; then ambiguity-clarifying. Negotiations whose outcome.reason is \"turn_cap\" or \"timeout\" signal under-specification \u2014 prioritize.\n\nOption construction. Each option must represent a meaningfully different outcome. Suffix the safest path with \" (Recommended)\" and list it first. The description states the CONSEQUENCE of choosing the option, not its definition. 2\u20134 options. Never add an \"Other\" option \u2014 clients provide a free-text fallback automatically. For surface_emergent_knowledge questions, anchor the prompt in the concrete cited fact (\"Multiple candidates flagged that\u2026\") and let the options represent decisions in light of that fact, not different versions of the fact.\n\nTitle rules. \u226412 chars. Noun of the decision domain. Discovery examples: \"Stage\", \"Timing\", \"Role\", \"Location\", \"Stack\", \"Budget\", \"Scope\", \"Format\".\n\nAnti-patterns \u2014 never do these.\n- Don't ask procedural confirmations (\"Should I look again?\").\n- Don't ask about hypothetical edge cases that didn't occur.\n- Don't ask about specific candidate identities; treat counterpartyHint as the only allowed reference.\n- Don't repeat anything in chatContext.openQuestions.\n- Don't re-surface anything in chatContext.surfacedFindings.\n- Don't ask for facts in chatContext.statedFacts.\n\nOutput. Return at most 3 entries in the \"questions\" array. Each entry must include a \"strategy\" field (one of the five values). If nothing is worth asking, return \"questions\": [].";
|
|
82
|
+
/** Pure builder: assembles the user message string from a structured input. */
|
|
83
|
+
export declare function buildQuestionPrompt(input: DiscoveryQuestionInput): string;
|
|
84
|
+
//# sourceMappingURL=question.prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.prompt.d.ts","sourceRoot":"","sources":["../../src/opportunity/question.prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAElF,wDAAwD;AACxD,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE3D,qCAAqC;AACrC,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE;QAAE,OAAO,EAAE,eAAe,CAAC;QAAC,SAAS,EAAE,eAAe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AAE,MAAM,CAAC;IACd,aAAa,EAAE,sBAAsB,CAAC;IACtC,4EAA4E;IAC5E,YAAY,EAAE,oBAAoB,EAAE,CAAC;IACrC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,iEAAiE;IACjE,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;CACb;AAWD,eAAO,MAAM,aAAa,kyGA8B0J,CAAC;AAErL,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAmCzE"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/** Upper bound on negotiations included in the prompt; ~10 KB total prompt budget. */
|
|
2
|
+
const MAX_NEGOTIATIONS = 8;
|
|
3
|
+
/** Upper bound on turns included per negotiation (last N retained). */
|
|
4
|
+
const MAX_TURNS_PER_NEGOTIATION = 6;
|
|
5
|
+
/** Per-turn reasoning truncation. */
|
|
6
|
+
const MAX_TURN_REASONING_CHARS = 200;
|
|
7
|
+
/** Outcome reasoning truncation. */
|
|
8
|
+
const MAX_OUTCOME_REASONING_CHARS = 300;
|
|
9
|
+
export const SYSTEM_PROMPT = `You sit between a human and a discovery protocol that just ran negotiations on their behalf. Your job: surface the minimum set of structured decision questions the human must answer to make the next discovery turn sharper, or improve their outlook on the intent.
|
|
10
|
+
|
|
11
|
+
You may pick from five strategies. Choose contextually; mix when multiple questions genuinely complement.
|
|
12
|
+
- refine_intent: ask the user to sharpen or pivot their original signal.
|
|
13
|
+
- surface_missing_detail: ask for one concrete missing input (stage, location, timing, scope, …).
|
|
14
|
+
- open_adjacent_thread: offer a pivot suggested by recurring counterparty signals.
|
|
15
|
+
- reflective_summary: mirror what the negotiations revealed and ask the user to decide.
|
|
16
|
+
- surface_emergent_knowledge: cite a fact you learned from negotiations and ask the user to decide in light of it.
|
|
17
|
+
|
|
18
|
+
Ask a question only when ALL of these hold:
|
|
19
|
+
1. The agent cannot resolve the decision autonomously from the evidence shown.
|
|
20
|
+
2. The answer would materially change which candidates surface next.
|
|
21
|
+
3. The same fact is NOT already in chatContext.statedFacts, NOT already asked in chatContext.openQuestions, and NOT already shared in chatContext.surfacedFindings.
|
|
22
|
+
|
|
23
|
+
Cardinality. Default one question. Add a second only when a DIFFERENT strategy genuinely complements the first (e.g. one surface_emergent_knowledge + one refine_intent). Add a third only when there are ≥3 substantive candidates and three distinct strategies each unblock a real decision. Two questions of the same strategy are acceptable only if their decision domains differ (different titles). Avoid stacking three pulls (info-from-user); balance with pushes (info-to-user via reflective_summary / surface_emergent_knowledge).
|
|
24
|
+
|
|
25
|
+
Ordering. Questions whose answer unblocks the most failed negotiations come first; then highest-impact; then ambiguity-clarifying. Negotiations whose outcome.reason is "turn_cap" or "timeout" signal under-specification — prioritize.
|
|
26
|
+
|
|
27
|
+
Option construction. Each option must represent a meaningfully different outcome. Suffix the safest path with " (Recommended)" and list it first. The description states the CONSEQUENCE of choosing the option, not its definition. 2–4 options. Never add an "Other" option — clients provide a free-text fallback automatically. For surface_emergent_knowledge questions, anchor the prompt in the concrete cited fact ("Multiple candidates flagged that…") and let the options represent decisions in light of that fact, not different versions of the fact.
|
|
28
|
+
|
|
29
|
+
Title rules. ≤12 chars. Noun of the decision domain. Discovery examples: "Stage", "Timing", "Role", "Location", "Stack", "Budget", "Scope", "Format".
|
|
30
|
+
|
|
31
|
+
Anti-patterns — never do these.
|
|
32
|
+
- Don't ask procedural confirmations ("Should I look again?").
|
|
33
|
+
- Don't ask about hypothetical edge cases that didn't occur.
|
|
34
|
+
- Don't ask about specific candidate identities; treat counterpartyHint as the only allowed reference.
|
|
35
|
+
- Don't repeat anything in chatContext.openQuestions.
|
|
36
|
+
- Don't re-surface anything in chatContext.surfacedFindings.
|
|
37
|
+
- Don't ask for facts in chatContext.statedFacts.
|
|
38
|
+
|
|
39
|
+
Output. Return at most 3 entries in the "questions" array. Each entry must include a "strategy" field (one of the five values). If nothing is worth asking, return "questions": [].`;
|
|
40
|
+
/** Pure builder: assembles the user message string from a structured input. */
|
|
41
|
+
export function buildQuestionPrompt(input) {
|
|
42
|
+
const profileSummary = renderProfile(input.sourceProfile);
|
|
43
|
+
const negotiationBlocks = renderNegotiations(input.negotiations);
|
|
44
|
+
const chatContextBlock = input.chatContext
|
|
45
|
+
? renderDigest(input.chatContext)
|
|
46
|
+
: "(no chat context available)";
|
|
47
|
+
const roleDistribution = renderRoleDistribution(input.summary.roleDistribution);
|
|
48
|
+
return [
|
|
49
|
+
"## Seeker's query",
|
|
50
|
+
input.query,
|
|
51
|
+
"",
|
|
52
|
+
"## Seeker profile",
|
|
53
|
+
profileSummary,
|
|
54
|
+
"",
|
|
55
|
+
"## This discovery turn",
|
|
56
|
+
`- ${input.summary.totalCandidates} candidates evaluated`,
|
|
57
|
+
`- ${input.summary.opportunitiesFound} opportunities found`,
|
|
58
|
+
`- ${input.summary.noOpportunityCount} ended without opportunity (${input.summary.timeoutCount} hit turn-cap/timeout)`,
|
|
59
|
+
`- Role distribution across outcomes: ${roleDistribution}`,
|
|
60
|
+
"",
|
|
61
|
+
"## Negotiation evidence",
|
|
62
|
+
negotiationBlocks,
|
|
63
|
+
"",
|
|
64
|
+
"## What the user has already said in this session",
|
|
65
|
+
chatContextBlock,
|
|
66
|
+
"",
|
|
67
|
+
"## Now",
|
|
68
|
+
input.now,
|
|
69
|
+
"",
|
|
70
|
+
"## Your task",
|
|
71
|
+
"Identify the minimum set of decision questions the seeker must answer to make",
|
|
72
|
+
"the next discovery turn sharper. Apply every rule from your system prompt",
|
|
73
|
+
"before outputting. Return an empty `questions` array if nothing is worth asking.",
|
|
74
|
+
].join("\n");
|
|
75
|
+
}
|
|
76
|
+
function renderProfile(p) {
|
|
77
|
+
const lines = [];
|
|
78
|
+
if (p.name)
|
|
79
|
+
lines.push(`Name: ${p.name}`);
|
|
80
|
+
if (p.bio)
|
|
81
|
+
lines.push(`Bio: ${p.bio}`);
|
|
82
|
+
if (p.location)
|
|
83
|
+
lines.push(`Location: ${p.location}`);
|
|
84
|
+
if (p.skills && p.skills.length > 0)
|
|
85
|
+
lines.push(`Skills: ${p.skills.join(", ")}`);
|
|
86
|
+
if (p.interests && p.interests.length > 0)
|
|
87
|
+
lines.push(`Interests: ${p.interests.join(", ")}`);
|
|
88
|
+
return lines.length > 0 ? lines.join("\n") : "(no profile data)";
|
|
89
|
+
}
|
|
90
|
+
function renderRoleDistribution(dist) {
|
|
91
|
+
const entries = Object.entries(dist)
|
|
92
|
+
.filter(([, n]) => n > 0);
|
|
93
|
+
if (entries.length === 0)
|
|
94
|
+
return "(none)";
|
|
95
|
+
return entries.map(([role, n]) => `${role}=${n}`).join(", ");
|
|
96
|
+
}
|
|
97
|
+
function renderDigest(d) {
|
|
98
|
+
const lines = [];
|
|
99
|
+
if (d.statedFacts.length > 0) {
|
|
100
|
+
lines.push("Stated facts:");
|
|
101
|
+
for (const f of d.statedFacts)
|
|
102
|
+
lines.push(` - ${f}`);
|
|
103
|
+
}
|
|
104
|
+
if (d.openQuestions.length > 0) {
|
|
105
|
+
lines.push("Open questions (assistant already asked):");
|
|
106
|
+
for (const q of d.openQuestions)
|
|
107
|
+
lines.push(` - ${q}`);
|
|
108
|
+
}
|
|
109
|
+
if (d.rejectionReasons.length > 0) {
|
|
110
|
+
lines.push("User pushback / rejections:");
|
|
111
|
+
for (const r of d.rejectionReasons)
|
|
112
|
+
lines.push(` - ${r}`);
|
|
113
|
+
}
|
|
114
|
+
if (d.surfacedFindings.length > 0) {
|
|
115
|
+
lines.push("Findings already surfaced to user:");
|
|
116
|
+
for (const f of d.surfacedFindings)
|
|
117
|
+
lines.push(` - ${f}`);
|
|
118
|
+
}
|
|
119
|
+
return lines.length > 0 ? lines.join("\n") : "(digest is empty)";
|
|
120
|
+
}
|
|
121
|
+
function renderNegotiations(negotiations) {
|
|
122
|
+
if (negotiations.length === 0)
|
|
123
|
+
return "(no negotiations)";
|
|
124
|
+
const selected = selectNegotiations(negotiations).map(renderNegotiation);
|
|
125
|
+
return selected.join("\n\n");
|
|
126
|
+
}
|
|
127
|
+
/** Sort + cap selection: top MAX_NEGOTIATIONS by [turns.length desc, seedAssessmentScore desc]. */
|
|
128
|
+
function selectNegotiations(negotiations) {
|
|
129
|
+
if (negotiations.length <= MAX_NEGOTIATIONS)
|
|
130
|
+
return negotiations;
|
|
131
|
+
return [...negotiations]
|
|
132
|
+
.sort((a, b) => {
|
|
133
|
+
if (b.turns.length !== a.turns.length)
|
|
134
|
+
return b.turns.length - a.turns.length;
|
|
135
|
+
const scoreDiff = (b.seedAssessmentScore ?? 0) - (a.seedAssessmentScore ?? 0);
|
|
136
|
+
if (scoreDiff !== 0)
|
|
137
|
+
return scoreDiff;
|
|
138
|
+
// Stable final tiebreaker so the prompt is input-order-independent. The
|
|
139
|
+
// counterparty id is opaque and never rendered; we use it only to break ties.
|
|
140
|
+
return a.counterpartyId.localeCompare(b.counterpartyId);
|
|
141
|
+
})
|
|
142
|
+
.slice(0, MAX_NEGOTIATIONS);
|
|
143
|
+
}
|
|
144
|
+
function renderNegotiation(n) {
|
|
145
|
+
const lastTurns = n.turns.slice(-MAX_TURNS_PER_NEGOTIATION);
|
|
146
|
+
const turnsRendered = lastTurns
|
|
147
|
+
.map((t) => ` [${t.action}] (${t.suggestedRoles.ownUser}↔${t.suggestedRoles.otherUser}) ${truncate(t.reasoning, MAX_TURN_REASONING_CHARS)}`)
|
|
148
|
+
.join("\n");
|
|
149
|
+
const outcomeRole = n.outcome.hasOpportunity ? "opportunity" : "no-opportunity";
|
|
150
|
+
const reasonSuffix = n.outcome.reason ? ` (${n.outcome.reason})` : "";
|
|
151
|
+
return [
|
|
152
|
+
`- Counterparty: ${n.counterpartyHint}`,
|
|
153
|
+
` Index: ${n.indexContext}`,
|
|
154
|
+
` Turns (last ${lastTurns.length} of ${n.turns.length}):`,
|
|
155
|
+
turnsRendered,
|
|
156
|
+
` Outcome: ${outcomeRole}${reasonSuffix} — ${truncate(n.outcome.reasoning, MAX_OUTCOME_REASONING_CHARS)}`,
|
|
157
|
+
].join("\n");
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Truncate a string to `max` UTF-16 code units. Operates on `length`, not on
|
|
161
|
+
* Unicode code points — a slice at an odd boundary in non-BMP text could split
|
|
162
|
+
* a surrogate pair. Acceptable for v1: the inputs (negotiation reasoning, outcome
|
|
163
|
+
* reasoning) are bounded prose that rarely contains emoji or astral-plane chars.
|
|
164
|
+
* If that changes, switch to `Array.from(s).slice(0, max).join("")` for code-point
|
|
165
|
+
* truncation at the cost of one extra allocation.
|
|
166
|
+
*/
|
|
167
|
+
function truncate(s, max) {
|
|
168
|
+
return s.length > max ? s.slice(0, max) : s;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=question.prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.prompt.js","sourceRoot":"","sources":["../../src/opportunity/question.prompt.ts"],"names":[],"mappings":"AAkFA,sFAAsF;AACtF,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,uEAAuE;AACvE,MAAM,yBAAyB,GAAG,CAAC,CAAC;AACpC,qCAAqC;AACrC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,oCAAoC;AACpC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAExC,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oLA8BuJ,CAAC;AAErL,+EAA+E;AAC/E,MAAM,UAAU,mBAAmB,CAAC,KAA6B;IAC/D,MAAM,cAAc,GAAG,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC1D,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACjE,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW;QACxC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC;QACjC,CAAC,CAAC,6BAA6B,CAAC;IAClC,MAAM,gBAA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C,CAAC,KAAK,CAAC,MAAM,IAAI;QAC1D,aAAa;QACb,cAAc,WAAW,GAAG,YAAY,MAAM,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,2BAA2B,CAAC,EAAE;KAC3G,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,QAAQ,CAAC,CAAS,EAAE,GAAW;IACtC,OAAO,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -92,6 +92,11 @@ declare function getModelConfig(config?: ModelConfig): {
|
|
|
92
92
|
readonly temperature: 0.2;
|
|
93
93
|
readonly maxTokens: 512;
|
|
94
94
|
};
|
|
95
|
+
readonly discoveryQuestionGenerator: {
|
|
96
|
+
readonly model: "google/gemini-2.5-flash";
|
|
97
|
+
readonly temperature: 0.5;
|
|
98
|
+
readonly maxTokens: 1024;
|
|
99
|
+
};
|
|
95
100
|
readonly inviteGenerator: {
|
|
96
101
|
readonly model: "google/gemini-2.5-flash";
|
|
97
102
|
readonly temperature: 0.3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.config.d.ts","sourceRoot":"","sources":["../../../src/shared/agent/model.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,iDAAiD;AACjD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;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AAE,WAAW,GAAG,IAAI,CAE3D;AAED,iBAAS,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BA0BkD,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;;;;EAK9I;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,UAAU,CAAC,OAAO,cAAc,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAEzG;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,UAAU,CAAC,OAAO,cAAc,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,CAiB5G"}
|
|
@@ -31,6 +31,7 @@ function getModelConfig(config) {
|
|
|
31
31
|
chatTitleGenerator: { model: "google/gemini-2.5-flash", temperature: 0.3, maxTokens: 32 },
|
|
32
32
|
negotiationInsights: { model: "google/gemini-2.5-flash", temperature: 0.4, maxTokens: 512 },
|
|
33
33
|
chatContextSummarizer: { model: "google/gemini-2.5-flash", temperature: 0.2, maxTokens: 512 },
|
|
34
|
+
discoveryQuestionGenerator: { model: "google/gemini-2.5-flash", temperature: 0.5, maxTokens: 1024 },
|
|
34
35
|
inviteGenerator: { model: "google/gemini-2.5-flash", temperature: 0.3, maxTokens: 512 },
|
|
35
36
|
chat: {
|
|
36
37
|
model: merged.chatModel ?? process.env.CHAT_MODEL ?? "google/gemini-3-pro-preview",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.config.js","sourceRoot":"","sources":["../../../src/shared/agent/model.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AA0B/C,sFAAsF;AACtF,IAAI,aAAa,GAAgB,EAAE,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,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AAG,aAAa,EAAE,GAAG,MAAM,EAAE,CAAC;IAC5D,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAC/D,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,eAAe,KAAK,+HAA+H,CAAC,CAAC;IACvK,CAAC;IACD,MAAM,GAAG,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,KAAK,CAAkB,CAAC;IAC3D,OAAO,IAAI,UAAU,CAAC;QACpB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,aAAa,EAAE;YACb,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,8BAA8B;YAC5F,MAAM;SACP;QACD,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,GAAG,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC;KACpE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Question — public structured shape consumed by frontend renderers and MCP
|
|
3
|
+
* elicitation dispatch. Mirrors the brainstorming AskUserQuestion skill so a
|
|
4
|
+
* Question can be rendered identically across surfaces.
|
|
5
|
+
*
|
|
6
|
+
* `QuestionWithStrategy` extends the public shape with an internal `strategy`
|
|
7
|
+
* tag used by the generator's guardrails (dedup/diversity) and recorded in
|
|
8
|
+
* `debugMeta`. The tag is stripped before the public payload leaves the
|
|
9
|
+
* generator — users never see it.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
export declare const QuestionOptionSchema: z.ZodObject<{
|
|
13
|
+
/** Display text. Suffix " (Recommended)" on the safest path; list it first. */
|
|
14
|
+
label: z.ZodString;
|
|
15
|
+
/** Explains the consequence of choosing this option, not just its definition. */
|
|
16
|
+
description: z.ZodString;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
description: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}, {
|
|
21
|
+
description: string;
|
|
22
|
+
label: string;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const QuestionSchema: z.ZodObject<{
|
|
25
|
+
/** ≤12 chars. Noun of the decision domain — e.g. "Stage", "Timing", "Role". */
|
|
26
|
+
title: z.ZodString;
|
|
27
|
+
/** ≤2 sentences, ≤400 chars. Ends in a question mark. */
|
|
28
|
+
prompt: z.ZodString;
|
|
29
|
+
/** 2–4 options. No explicit "Other" — clients provide that automatically. */
|
|
30
|
+
options: z.ZodArray<z.ZodObject<{
|
|
31
|
+
/** Display text. Suffix " (Recommended)" on the safest path; list it first. */
|
|
32
|
+
label: z.ZodString;
|
|
33
|
+
/** Explains the consequence of choosing this option, not just its definition. */
|
|
34
|
+
description: z.ZodString;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
description: string;
|
|
37
|
+
label: string;
|
|
38
|
+
}, {
|
|
39
|
+
description: string;
|
|
40
|
+
label: string;
|
|
41
|
+
}>, "many">;
|
|
42
|
+
/** True when options are not mutually exclusive (priorities, bundles). */
|
|
43
|
+
multiSelect: z.ZodBoolean;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
prompt: string;
|
|
46
|
+
options: {
|
|
47
|
+
description: string;
|
|
48
|
+
label: string;
|
|
49
|
+
}[];
|
|
50
|
+
title: string;
|
|
51
|
+
multiSelect: boolean;
|
|
52
|
+
}, {
|
|
53
|
+
prompt: string;
|
|
54
|
+
options: {
|
|
55
|
+
description: string;
|
|
56
|
+
label: string;
|
|
57
|
+
}[];
|
|
58
|
+
title: string;
|
|
59
|
+
multiSelect: boolean;
|
|
60
|
+
}>;
|
|
61
|
+
export declare const QuestionStrategySchema: z.ZodEnum<["refine_intent", "surface_missing_detail", "open_adjacent_thread", "reflective_summary", "surface_emergent_knowledge"]>;
|
|
62
|
+
export declare const QuestionWithStrategySchema: z.ZodObject<{
|
|
63
|
+
/** ≤12 chars. Noun of the decision domain — e.g. "Stage", "Timing", "Role". */
|
|
64
|
+
title: z.ZodString;
|
|
65
|
+
/** ≤2 sentences, ≤400 chars. Ends in a question mark. */
|
|
66
|
+
prompt: z.ZodString;
|
|
67
|
+
/** 2–4 options. No explicit "Other" — clients provide that automatically. */
|
|
68
|
+
options: z.ZodArray<z.ZodObject<{
|
|
69
|
+
/** Display text. Suffix " (Recommended)" on the safest path; list it first. */
|
|
70
|
+
label: z.ZodString;
|
|
71
|
+
/** Explains the consequence of choosing this option, not just its definition. */
|
|
72
|
+
description: z.ZodString;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
description: string;
|
|
75
|
+
label: string;
|
|
76
|
+
}, {
|
|
77
|
+
description: string;
|
|
78
|
+
label: string;
|
|
79
|
+
}>, "many">;
|
|
80
|
+
/** True when options are not mutually exclusive (priorities, bundles). */
|
|
81
|
+
multiSelect: z.ZodBoolean;
|
|
82
|
+
} & {
|
|
83
|
+
strategy: z.ZodEnum<["refine_intent", "surface_missing_detail", "open_adjacent_thread", "reflective_summary", "surface_emergent_knowledge"]>;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
prompt: string;
|
|
86
|
+
options: {
|
|
87
|
+
description: string;
|
|
88
|
+
label: string;
|
|
89
|
+
}[];
|
|
90
|
+
title: string;
|
|
91
|
+
multiSelect: boolean;
|
|
92
|
+
strategy: "refine_intent" | "surface_missing_detail" | "open_adjacent_thread" | "reflective_summary" | "surface_emergent_knowledge";
|
|
93
|
+
}, {
|
|
94
|
+
prompt: string;
|
|
95
|
+
options: {
|
|
96
|
+
description: string;
|
|
97
|
+
label: string;
|
|
98
|
+
}[];
|
|
99
|
+
title: string;
|
|
100
|
+
multiSelect: boolean;
|
|
101
|
+
strategy: "refine_intent" | "surface_missing_detail" | "open_adjacent_thread" | "reflective_summary" | "surface_emergent_knowledge";
|
|
102
|
+
}>;
|
|
103
|
+
export declare const QuestionGeneratorResponseSchema: z.ZodObject<{
|
|
104
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
105
|
+
/** ≤12 chars. Noun of the decision domain — e.g. "Stage", "Timing", "Role". */
|
|
106
|
+
title: z.ZodString;
|
|
107
|
+
/** ≤2 sentences, ≤400 chars. Ends in a question mark. */
|
|
108
|
+
prompt: z.ZodString;
|
|
109
|
+
/** 2–4 options. No explicit "Other" — clients provide that automatically. */
|
|
110
|
+
options: z.ZodArray<z.ZodObject<{
|
|
111
|
+
/** Display text. Suffix " (Recommended)" on the safest path; list it first. */
|
|
112
|
+
label: z.ZodString;
|
|
113
|
+
/** Explains the consequence of choosing this option, not just its definition. */
|
|
114
|
+
description: z.ZodString;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
description: string;
|
|
117
|
+
label: string;
|
|
118
|
+
}, {
|
|
119
|
+
description: string;
|
|
120
|
+
label: string;
|
|
121
|
+
}>, "many">;
|
|
122
|
+
/** True when options are not mutually exclusive (priorities, bundles). */
|
|
123
|
+
multiSelect: z.ZodBoolean;
|
|
124
|
+
} & {
|
|
125
|
+
strategy: z.ZodEnum<["refine_intent", "surface_missing_detail", "open_adjacent_thread", "reflective_summary", "surface_emergent_knowledge"]>;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
prompt: string;
|
|
128
|
+
options: {
|
|
129
|
+
description: string;
|
|
130
|
+
label: string;
|
|
131
|
+
}[];
|
|
132
|
+
title: string;
|
|
133
|
+
multiSelect: boolean;
|
|
134
|
+
strategy: "refine_intent" | "surface_missing_detail" | "open_adjacent_thread" | "reflective_summary" | "surface_emergent_knowledge";
|
|
135
|
+
}, {
|
|
136
|
+
prompt: string;
|
|
137
|
+
options: {
|
|
138
|
+
description: string;
|
|
139
|
+
label: string;
|
|
140
|
+
}[];
|
|
141
|
+
title: string;
|
|
142
|
+
multiSelect: boolean;
|
|
143
|
+
strategy: "refine_intent" | "surface_missing_detail" | "open_adjacent_thread" | "reflective_summary" | "surface_emergent_knowledge";
|
|
144
|
+
}>, "many">;
|
|
145
|
+
}, "strip", z.ZodTypeAny, {
|
|
146
|
+
questions: {
|
|
147
|
+
prompt: string;
|
|
148
|
+
options: {
|
|
149
|
+
description: string;
|
|
150
|
+
label: string;
|
|
151
|
+
}[];
|
|
152
|
+
title: string;
|
|
153
|
+
multiSelect: boolean;
|
|
154
|
+
strategy: "refine_intent" | "surface_missing_detail" | "open_adjacent_thread" | "reflective_summary" | "surface_emergent_knowledge";
|
|
155
|
+
}[];
|
|
156
|
+
}, {
|
|
157
|
+
questions: {
|
|
158
|
+
prompt: string;
|
|
159
|
+
options: {
|
|
160
|
+
description: string;
|
|
161
|
+
label: string;
|
|
162
|
+
}[];
|
|
163
|
+
title: string;
|
|
164
|
+
multiSelect: boolean;
|
|
165
|
+
strategy: "refine_intent" | "surface_missing_detail" | "open_adjacent_thread" | "reflective_summary" | "surface_emergent_knowledge";
|
|
166
|
+
}[];
|
|
167
|
+
}>;
|
|
168
|
+
export type QuestionOption = z.infer<typeof QuestionOptionSchema>;
|
|
169
|
+
export type Question = z.infer<typeof QuestionSchema>;
|
|
170
|
+
export type QuestionStrategy = z.infer<typeof QuestionStrategySchema>;
|
|
171
|
+
export type QuestionWithStrategy = z.infer<typeof QuestionWithStrategySchema>;
|
|
172
|
+
export type QuestionGeneratorResponse = z.infer<typeof QuestionGeneratorResponseSchema>;
|
|
173
|
+
/**
|
|
174
|
+
* Internal generator output: public questions plus a parallel strategies
|
|
175
|
+
* array for debug-only consumption. The generator emits this; callers
|
|
176
|
+
* forward `questions` to renderers and `strategies` to `debugMeta` only.
|
|
177
|
+
*/
|
|
178
|
+
export interface QuestionGenerationResult {
|
|
179
|
+
questions: Question[];
|
|
180
|
+
strategies: QuestionStrategy[];
|
|
181
|
+
}
|
|
182
|
+
//# sourceM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,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Question — public structured shape consumed by frontend renderers and MCP
|
|
3
|
+
* elicitation dispatch. Mirrors the brainstorming AskUserQuestion skill so a
|
|
4
|
+
* Question can be rendered identically across surfaces.
|
|
5
|
+
*
|
|
6
|
+
* `QuestionWithStrategy` extends the public shape with an internal `strategy`
|
|
7
|
+
* tag used by the generator's guardrails (dedup/diversity) and recorded in
|
|
8
|
+
* `debugMeta`. The tag is stripped before the public payload leaves the
|
|
9
|
+
* generator — users never see it.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
export const QuestionOptionSchema = z.object({
|
|
13
|
+
/** Display text. Suffix " (Recommended)" on the safest path; list it first. */
|
|
14
|
+
label: z.string().min(1).max(120),
|
|
15
|
+
/** Explains the consequence of choosing this option, not just its definition. */
|
|
16
|
+
description: z.string().min(1).max(280),
|
|
17
|
+
});
|
|
18
|
+
export const QuestionSchema = z.object({
|
|
19
|
+
/** ≤12 chars. Noun of the decision domain — e.g. "Stage", "Timing", "Role". */
|
|
20
|
+
title: z.string().min(1).max(12),
|
|
21
|
+
/** ≤2 sentences, ≤400 chars. Ends in a question mark. */
|
|
22
|
+
prompt: z.string().min(1).max(400),
|
|
23
|
+
/** 2–4 options. No explicit "Other" — clients provide that automatically. */
|
|
24
|
+
options: z.array(QuestionOptionSchema).min(2).max(4),
|
|
25
|
+
/** True when options are not mutually exclusive (priorities, bundles). */
|
|
26
|
+
multiSelect: z.boolean(),
|
|
27
|
+
});
|
|
28
|
+
export const QuestionStrategySchema = z.enum([
|
|
29
|
+
"refine_intent",
|
|
30
|
+
"surface_missing_detail",
|
|
31
|
+
"open_adjacent_thread",
|
|
32
|
+
"reflective_summary",
|
|
33
|
+
"surface_emergent_knowledge",
|
|
34
|
+
]);
|
|
35
|
+
export const QuestionWithStrategySchema = QuestionSchema.extend({
|
|
36
|
+
strategy: QuestionStrategySchema,
|
|
37
|
+
});
|
|
38
|
+
export const QuestionGeneratorResponseSchema = z.object({
|
|
39
|
+
questions: z.array(QuestionWithStrategySchema).max(3),
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=question.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.schema.js","sourceRoot":"","sources":["../../../src/shared/schemas/question.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,+EAA+E;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACjC,iFAAiF;IACjF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,+EAA+E;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IAChC,yDAAyD;IACzD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAClC,6EAA6E;IAC7E,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACpD,0EAA0E;IA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