@indexnetwork/protocol 21.1.0-rc.493.1 → 22.0.0-rc.495.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/chat/chat-streaming.types.d.ts +2 -23
  3. package/dist/chat/chat-streaming.types.js +0 -3
  4. package/dist/chat/chat.agent.d.ts +0 -5
  5. package/dist/chat/chat.streamer.js +3 -6
  6. package/dist/chat/negotiator.persona.d.ts +1 -1
  7. package/dist/chat/negotiator.persona.js +0 -7
  8. package/dist/chat/negotiator.prompt.js +10 -12
  9. package/dist/chat/onboarding.persona.d.ts +1 -1
  10. package/dist/chat/onboarding.persona.js +0 -1
  11. package/dist/chat/onboarding.prompt.js +2 -2
  12. package/dist/chat/signal.persona.d.ts +1 -1
  13. package/dist/chat/signal.persona.js +1 -2
  14. package/dist/chat/signal.prompt.d.ts +6 -5
  15. package/dist/chat/signal.prompt.js +17 -37
  16. package/dist/index.d.ts +3 -7
  17. package/dist/index.js +2 -4
  18. package/dist/intents/graph/intent.graph.d.ts +1 -2
  19. package/dist/intents/graph/intent.graph.execute.js +0 -15
  20. package/dist/intents/graph/intent.graph.js +1 -2
  21. package/dist/intents/graph/intent.graph.shared.d.ts +0 -2
  22. package/dist/intents/intent.module.d.ts +0 -3
  23. package/dist/intents/intent.module.js +2 -2
  24. package/dist/mcp/mcp.authorization-policy.d.ts +2 -2
  25. package/dist/mcp/mcp.authorization-policy.js +0 -24
  26. package/dist/negotiations/negotiation.agent.js +10 -1
  27. package/dist/negotiations/negotiation.graph.turn.d.ts +2 -0
  28. package/dist/negotiations/negotiation.graph.turn.js +9 -0
  29. package/dist/negotiations/negotiation.module.d.ts +1 -1
  30. package/dist/negotiations/negotiation.module.js +1 -1
  31. package/dist/negotiations/negotiation.question-safety.d.ts +0 -1
  32. package/dist/negotiations/negotiation.question-safety.js +0 -1
  33. package/dist/negotiations/negotiation.tools.js +83 -31
  34. package/dist/opportunities/opportunity.graph.d.ts +1 -1
  35. package/dist/opportunities/opportunity.tools.cards.d.ts +0 -13
  36. package/dist/opportunities/opportunity.tools.cards.js +0 -22
  37. package/dist/opportunities/opportunity.tools.js +4 -65
  38. package/dist/opportunities/opportunity.tools.port.d.ts +1 -1
  39. package/dist/questions/question.env.d.ts +5 -35
  40. package/dist/questions/question.env.js +5 -70
  41. package/dist/questions/question.input.d.ts +36 -145
  42. package/dist/questions/question.input.js +1 -56
  43. package/dist/questions/question.module.d.ts +10 -22
  44. package/dist/questions/question.module.js +9 -19
  45. package/dist/shared/agent/activity-projection.d.ts +2 -2
  46. package/dist/shared/agent/tool.factory.js +3 -15
  47. package/dist/shared/agent/tool.helpers.d.ts +0 -73
  48. package/dist/shared/agent/tool.registry.js +0 -2
  49. package/dist/shared/agent/tool.runtime.d.ts +1 -1
  50. package/dist/shared/agent/tool.runtime.js +3 -14
  51. package/dist/shared/observability/request-context.d.ts +0 -5
  52. package/package.json +1 -1
  53. package/dist/opportunities/opportunity.pending-questions.d.ts +0 -33
  54. package/dist/opportunities/opportunity.pending-questions.js +0 -42
  55. package/dist/questions/question.agent.d.ts +0 -28
  56. package/dist/questions/question.agent.js +0 -136
  57. package/dist/questions/question.ask.tool.d.ts +0 -12
  58. package/dist/questions/question.ask.tool.js +0 -297
  59. package/dist/questions/question.persistence.port.d.ts +0 -84
  60. package/dist/questions/question.persistence.port.js +0 -1
  61. package/dist/questions/question.presets.d.ts +0 -21
  62. package/dist/questions/question.presets.js +0 -388
  63. package/dist/questions/question.tools.d.ts +0 -15
  64. package/dist/questions/question.tools.js +0 -216
  65. package/dist/questions/question.tools.port.d.ts +0 -12
  66. package/dist/questions/question.tools.port.js +0 -1
  67. package/dist/shared/schemas/pending-question.schema.d.ts +0 -28
  68. package/dist/shared/schemas/pending-question.schema.js +0 -1
@@ -1,26 +1,11 @@
1
1
  /**
2
- * questions/question.env — centralized question-generation env accessors.
2
+ * questions/question.env — leftover question env constants.
3
3
  *
4
- * Naming scheme (one prefix, hierarchical):
5
- *
6
- * QUESTIONER_ENABLED master switch — QuestionerQueue worker +
7
- * enqueue closures at every composition site.
8
- * QUESTIONER_UPTAKE_ENABLED per-surface switch — advisory pre-accept uptake
9
- * interlock. Requires the master switch.
10
- * QUESTIONER_UPTAKE_AUTHORITY_THRESHOLD
11
- * authority threshold (0-100, default 70).
12
- * QUESTIONER_CHAT_WAIT_TIMEOUT_MS how long the blocking ask_user_question chat
13
- * tool waits for an inline answer (default 4 min).
14
- * QUESTIONER_INTENT_DAILY_CAP refinement questions one intent may generate
15
- * per rolling 24h, recovery + pool combined
16
- * (default 2; 0 disables refinement).
17
- *
18
- * All reads go through this module — do not read these variables via
19
- * `process.env` elsewhere. Values are read on every call (no caching) so tests
20
- * and long-lived processes observe changes.
4
+ * The QUESTIONER_* runtime flags are retired with the card generators
5
+ * (conversational-questions plan); park-path routing is always on. What
6
+ * remains are the historical budget constants still referenced by the
7
+ * questions-table adapter until its surface drops.
21
8
  */
22
- export const CHAT_QUESTION_WAIT_TIMEOUT_MS_DEFAULT = 240000;
23
- export const UPTAKE_AUTHORITY_THRESHOLD_DEFAULT = 70;
24
9
  /**
25
10
  * Refinement questions a single intent may generate per rolling window.
26
11
  *
@@ -40,53 +25,3 @@ export const INTENT_QUESTION_DAILY_CAP_DEFAULT = 2;
40
25
  * have granted the second burst a full fresh allowance.
41
26
  */
42
27
  export const INTENT_QUESTION_DAILY_WINDOW_HOURS = 24;
43
- /**
44
- * Parse a positive integer env var, clamped to the safe-integer range so a
45
- * malformed env value cannot crash `AbortSignal.timeout` (which throws on
46
- * values outside `[0, MAX_SAFE_INTEGER]`).
47
- */
48
- function positiveIntEnv(name, fallback) {
49
- const raw = process.env[name];
50
- if (!raw)
51
- return fallback;
52
- const parsed = Number.parseInt(raw, 10);
53
- if (!Number.isFinite(parsed) || parsed <= 0 || parsed > Number.MAX_SAFE_INTEGER)
54
- return fallback;
55
- return parsed;
56
- }
57
- /** Master switch: is any background question generation enabled? */
58
- export function isQuestionerEnabled() {
59
- return process.env.QUESTIONER_ENABLED === "true";
60
- }
61
- /** Advisory uptake interlock. Flag-off by default and subordinate to the master switch. */
62
- export function isUptakeGuardEnabled() {
63
- return isQuestionerEnabled() && process.env.QUESTIONER_UPTAKE_ENABLED === "true";
64
- }
65
- /** Authority threshold below which hosts may generate uptake questions. */
66
- export function uptakeAuthorityThreshold() {
67
- const raw = process.env.QUESTIONER_UPTAKE_AUTHORITY_THRESHOLD;
68
- if (!raw?.trim())
69
- return UPTAKE_AUTHORITY_THRESHOLD_DEFAULT;
70
- if (!/^-?\d+$/.test(raw.trim()))
71
- return UPTAKE_AUTHORITY_THRESHOLD_DEFAULT;
72
- const parsed = Number.parseInt(raw, 10);
73
- return Math.min(100, Math.max(0, parsed));
74
- }
75
- /** Wait budget for the blocking ask_user_question chat tool. */
76
- export function chatQuestionWaitTimeoutMs() {
77
- return positiveIntEnv("QUESTIONER_CHAT_WAIT_TIMEOUT_MS", CHAT_QUESTION_WAIT_TIMEOUT_MS_DEFAULT);
78
- }
79
- /**
80
- * Per-intent refinement budget over {@link INTENT_QUESTION_DAILY_WINDOW_HOURS}.
81
- *
82
- * Zero is a meaningful setting — it disables background refinement entirely
83
- * without touching the master switch — so this does not reuse `positiveIntEnv`.
84
- */
85
- export function intentQuestionDailyCap() {
86
- const raw = process.env.QUESTIONER_INTENT_DAILY_CAP;
87
- if (!raw?.trim())
88
- return INTENT_QUESTION_DAILY_CAP_DEFAULT;
89
- if (!/^\d+$/.test(raw.trim()))
90
- return INTENT_QUESTION_DAILY_CAP_DEFAULT;
91
- return Number.parseInt(raw, 10);
92
- }
@@ -1,37 +1,20 @@
1
1
  /**
2
- * questions/question.input — QuestionerAgent input envelope.
2
+ * questions/question.input — park-path question payloads.
3
3
  *
4
- * Defines per-mode context types (IntentContext, NegotiationContext, …),
5
- * the discriminated QuestionerInput union, and the runtime validation guard
6
- * `isValidQuestionerInputContract`.
7
- *
8
- * Lives in the application layer (not domain) because `isValidQuestionerInputContract`
9
- * consumes the negotiation question-safety port
10
- * (`capabilities/negotiation.questions.facade`) to enforce privacy invariants
11
- * on counterparty hints and indexContext labels.
12
- *
13
- * Foreground and ambient adapter entry points inject a `QuestionerEnqueueFn`
14
- * (defined here as a port alias) to schedule async generation without
15
- * importing the queue implementation.
4
+ * The QuestionerAgent and its per-mode generation envelope are retired
5
+ * (conversational-questions plan, "Retirements"). What survives is the
6
+ * payload the negotiation graph hands the composition root when a
7
+ * negotiation parks needing its client's input: the two park families
8
+ * (`negotiation_inflight`/`inflight_consultation` mid-flight consults and
9
+ * `negotiation`/`stalled_followup` post-stall parks). The composition root
10
+ * routes them to the question-message regeneration queue keyed on the parked
11
+ * side's `(recipientUserId, recipientIntentId)`; the parked negotiation is
12
+ * the durable record and the DM message is its rendering.
16
13
  */
17
14
  import type { ToolScopeType } from "../shared/agent/tool.scope.js";
18
- import type { NegotiationQuestionCandidate, QuestionMode, QuestionPoolDiscriminator } from "./question.schema.js";
15
+ import type { NegotiationQuestionCandidate } from "./question.schema.js";
19
16
  import type { NegotiationConsultationReason } from "../negotiations/negotiation.module.js";
20
- /** Intent context — data needed to generate questions about an intent. */
21
- export interface IntentContext {
22
- intentId: string;
23
- payload: string;
24
- summary?: string;
25
- /** The user's global user_context paragraph (profile-replacing identity text). */
26
- userContext?: string;
27
- }
28
- /** Recovery-only intent context after a successful discovery completion. */
29
- export interface RecoveryIntentContext extends IntentContext {
30
- purpose: "recovery";
31
- /** Privacy-safe aggregate signal; raw negotiation evidence is never provided. */
32
- rejectedNegotiationCount?: number;
33
- }
34
- /** Shared context fields for negotiation-mode questions. */
17
+ /** Shared context fields for negotiation park payloads. */
35
18
  interface NegotiationContextBase {
36
19
  negotiationId: string;
37
20
  /** Privacy-reviewed generic description; never raw counterparty identity/profile. */
@@ -48,20 +31,10 @@ export interface PostStallNegotiationContext extends NegotiationContextBase {
48
31
  /** The recipient's own exact opportunity-bound signal, never evaluator reasoning. */
49
32
  recipientIntent: string;
50
33
  }
51
- /** Pre-accept uptake context targeting a counterparty's preparatory conditions. */
52
- export interface UptakeNegotiationContext extends NegotiationContextBase {
53
- purpose: "uptake";
54
- /** Plain-language activity or commitment whose feasibility needs clarification. */
55
- proposedActivity: string;
56
- }
57
- /** Negotiation context discriminated by internal question purpose. */
58
- export type NegotiationContext = PostStallNegotiationContext | UptakeNegotiationContext;
59
34
  /**
60
35
  * Negotiation-inflight context — a negotiator mid-negotiation wants to ask its
61
- * OWN client a question before continuing (the `ask_user` action, P3.2). The
62
- * negotiator supplies only a closed category; the QuestionerAgent receives
63
- * server-owned fixed copy and never agent-authored instruction text.
64
- * Distinct from {@link NegotiationContext}, which covers post-stall questions.
36
+ * OWN client a question before continuing (the `ask_user` action, P3.2).
37
+ * The negotiator supplies only a closed category.
65
38
  */
66
39
  export interface NegotiationInflightContext {
67
40
  negotiationId: string;
@@ -69,108 +42,47 @@ export interface NegotiationInflightContext {
69
42
  counterpartyHint: string;
70
43
  /** Community / index context the negotiation runs in. */
71
44
  indexContext: string;
72
- /** Closed server-owned category selecting fixed Questioner copy. */
45
+ /** Closed server-owned category selecting the consultation reason. */
73
46
  consultationPolicyReason: NegotiationConsultationReason;
74
47
  /** The user's global user_context paragraph (profile-replacing identity text). */
75
48
  userContext?: string;
76
49
  }
77
50
  /**
78
- * Chat context — data for orchestrator-initiated mid-conversation questions
79
- * (the `ask_user_question` tool). The orchestrator states what it needs to
80
- * learn; the QuestionerAgent turns that into polished structured questions,
81
- * grounded in the recent conversation and the user's identity context.
82
- */
83
- export interface ChatContext {
84
- /** What the orchestrator needs to learn and why (authored by the chat model). */
85
- purpose: string;
86
- /** Draft questions proposed by the orchestrator. The agent refines these. */
87
- draftQuestions?: Array<{
88
- prompt: string;
89
- options?: string[];
90
- multiSelect?: boolean;
91
- }>;
92
- /** Recent conversation excerpt for grounding (most recent messages last). */
93
- conversationExcerpt?: string;
94
- /** The user's global user_context paragraph (profile-replacing identity text). */
95
- userContext?: string;
96
- }
97
- /**
98
- * Pool-discovery context — mined discriminators from a discovery-run pool
99
- * (IND-418). No generator LLM runs for this mode: the QuestionerQueue
100
- * synthesizes the question deterministically from the top discriminator and
101
- * stashes the rest as interview-mode alternates.
102
- */
103
- export interface PoolDiscoveryContext {
104
- intentId: string;
105
- /** Truncated intent payload (+ summary) display snippet. */
106
- intentText: string;
107
- /** Stable hash of the full normalized payload + summary used for freshness. */
108
- intentFingerprint?: string;
109
- poolSize: number;
110
- /** Exact bounded candidate opportunity IDs supplied to synthesis. */
111
- opportunityIds: string[];
112
- /** Discovery run that produced the pool. */
113
- runId?: string;
114
- /** Eligible discriminators, VoI-descending (asked + chain alternates). */
115
- discriminators: QuestionPoolDiscriminator[];
116
- /** ISO-8601 timestamp of the mining pass. */
117
- minedAt: string;
118
- }
119
- /** Discriminated union: mode selects the context shape. */
120
- export type QuestionerContext = IntentContext | RecoveryIntentContext | NegotiationContext | NegotiationInflightContext | ChatContext | PoolDiscoveryContext;
121
- /**
122
- * Payload shape accepted by the questionerEnqueue callback. Covers all
123
- * question modes — the composition root bridges this to the concrete
124
- * QuestionerQueue.
51
+ * Payload shape accepted by the questionerEnqueue callback: exactly the two
52
+ * park families. The composition root bridges this to the question-message
53
+ * regeneration queue.
125
54
  */
126
55
  export type QuestionerEnqueuePayload = QuestionerInput;
127
56
  /**
128
- * Callback signature for async question generation enqueue.
57
+ * Callback signature for the park-path enqueue.
129
58
  *
130
- * Ambient adapter port: recovery, pool, uptake, inflight, and push generation
131
- * each inject this callback from the composition root; they never import the
132
- * queue implementation directly.
59
+ * Ambient adapter port: the negotiation graph and the external-consultation
60
+ * pause path inject this callback from the composition root; they never
61
+ * import the queue implementation directly.
133
62
  */
134
63
  export type QuestionerEnqueueFn = (input: QuestionerEnqueuePayload) => Promise<void>;
135
- /** Top-level input envelope for QuestionerAgent.invoke(). */
64
+ /** Shared envelope fields for both park families. */
136
65
  interface QuestionerInputBase {
137
- /** Selects the preset (system prompt + builder). */
138
- mode: QuestionMode;
139
- /** User the questions are generated for. */
66
+ /** User whose input is required (the parked side). */
140
67
  userId: string;
141
- /** Entity type that triggered this (e.g. "opportunity", "intent", "profile"). */
68
+ /** Entity type that triggered this (always "opportunity" for park payloads). */
142
69
  sourceType: string;
143
70
  /** ID of the triggering entity. */
144
71
  sourceId: string;
145
- /** Scoped question context. Network scopes persist as QuestionActor.networkId. */
72
+ /** Scoped context carried through from the triggering surface. */
146
73
  scopeType?: ToolScopeType;
147
- /** Scoped question id. When scopeType is `network`, this is the actor networkId. */
74
+ /** Scoped id. When scopeType is `network`, this is the network id. */
148
75
  scopeId?: string;
149
- /**
150
- * Intent that triggered the run that generated these questions. Persisted as
151
- * `detection.triggeredBy` so intent-scoped surfaces (e.g. the intent page)
152
- * can find them. Independent of `scopeType`/`scopeId`, which may carry a
153
- * network scope at the same time.
154
- */
76
+ /** Intent that triggered the run, when the producer knows it. */
155
77
  triggeredByIntentId?: string;
156
- /** Conversation ID — set when the question originates from a chat session. Persisted on the question row for frontend filtering. */
157
- conversationId?: string;
158
- /** Assistant message ID — set when we know which message triggered the question. Stored in detection.messageId for inline anchoring. */
159
- messageId?: string;
160
78
  /**
161
- * Candidate exact binding for negotiation-family jobs. The API/DB must
162
- * authoritatively re-resolve it before generation and again before insert.
79
+ * Candidate exact binding. `recipientUserId`/`recipientIntentId` name the
80
+ * parked side — the user whose input is required and the signal whose DM
81
+ * carries the question-message.
163
82
  */
164
- negotiation?: NegotiationQuestionCandidate;
165
- }
166
- /** Non-negotiation modes cannot smuggle negotiation purpose/provenance. */
167
- interface StandardQuestionerInput extends QuestionerInputBase {
168
- mode: Exclude<QuestionMode, "negotiation" | "negotiation_inflight">;
169
- purpose?: never;
170
- negotiation?: never;
171
- context: Exclude<QuestionerContext, NegotiationContext | NegotiationInflightContext | RecoveryIntentContext>;
83
+ negotiation: NegotiationQuestionCandidate;
172
84
  }
173
- /** Ordinary post-stall generation is task-backed and uses only the ordinary preset. */
85
+ /** Post-stall park payload, task-backed. */
174
86
  export interface PostStallQuestionerInput extends QuestionerInputBase {
175
87
  mode: "negotiation";
176
88
  purpose: "stalled_followup";
@@ -180,7 +92,7 @@ export interface PostStallQuestionerInput extends QuestionerInputBase {
180
92
  };
181
93
  context: PostStallNegotiationContext;
182
94
  }
183
- /** Mid-negotiation consultation is task-backed and uses only structured ask_user fields. */
95
+ /** Mid-negotiation consultation park payload, task-backed. */
184
96
  export interface InflightQuestionerInput extends QuestionerInputBase {
185
97
  mode: "negotiation_inflight";
186
98
  purpose: "inflight_consultation";
@@ -190,27 +102,6 @@ export interface InflightQuestionerInput extends QuestionerInputBase {
190
102
  };
191
103
  context: NegotiationInflightContext;
192
104
  }
193
- /** Negotiation-mode uptake generation input. */
194
- export interface UptakeQuestionerInput extends QuestionerInputBase {
195
- mode: "negotiation";
196
- purpose: "uptake";
197
- negotiation: NegotiationQuestionCandidate & {
198
- purpose: "uptake";
199
- taskId?: undefined;
200
- };
201
- context: UptakeNegotiationContext;
202
- }
203
- /** Intent-mode post-discovery recovery generation input. */
204
- export interface RecoveryQuestionerInput extends QuestionerInputBase {
205
- mode: "intent";
206
- purpose: "recovery";
207
- sourceType: "intent";
208
- triggeredByIntentId: string;
209
- negotiation?: never;
210
- context: RecoveryIntentContext;
211
- }
212
- /** Top-level input discriminated by both mode and internal purpose. */
213
- export type QuestionerInput = StandardQuestionerInput | PostStallQuestionerInput | InflightQuestionerInput | UptakeQuestionerInput | RecoveryQuestionerInput;
214
- /** Runtime mirror of the mode/purpose/context discriminant used at queue boundaries. */
215
- export declare function isValidQuestionerInputContract(input: QuestionerInput): boolean;
105
+ /** Park-path payload union, discriminated by mode + internal purpose. */
106
+ export type QuestionerInput = PostStallQuestionerInput | InflightQuestionerInput;
216
107
  export {};
@@ -1,56 +1 @@
1
- import { NEGOTIATION_QUESTION_GENERIC_COUNTERPARTY, NEGOTIATION_QUESTION_GENERIC_NETWORK, NEGOTIATION_QUESTION_GENERIC_UPTAKE_ACTIVITY } from "../negotiations/negotiation.module.js";
2
- /** Runtime mirror of the mode/purpose/context discriminant used at queue boundaries. */
3
- export function isValidQuestionerInputContract(input) {
4
- if (input.purpose === 'recovery') {
5
- const context = input.context;
6
- return input.mode === 'intent'
7
- && input.sourceType === 'intent'
8
- && input.triggeredByIntentId === input.sourceId
9
- && input.negotiation === undefined
10
- && context.purpose === 'recovery'
11
- && context.intentId === input.sourceId;
12
- }
13
- if (input.mode !== 'negotiation' && input.mode !== 'negotiation_inflight') {
14
- return input.purpose === undefined && input.negotiation === undefined;
15
- }
16
- if (input.sourceType !== 'opportunity'
17
- || !input.negotiation
18
- || input.negotiation.opportunityId !== input.sourceId
19
- || input.negotiation.recipientUserId !== input.userId
20
- || input.negotiation.purpose !== input.purpose)
21
- return false;
22
- const context = input.context;
23
- if (context.counterpartyHint !== NEGOTIATION_QUESTION_GENERIC_COUNTERPARTY
24
- || context.indexContext !== NEGOTIATION_QUESTION_GENERIC_NETWORK)
25
- return false;
26
- if (input.mode === 'negotiation_inflight') {
27
- return input.purpose === 'inflight_consultation'
28
- && typeof input.negotiation.taskId === 'string'
29
- && input.negotiation.taskId.length > 0
30
- && context.negotiationId === input.negotiation.taskId
31
- && (context.consultationPolicyReason === 'unresolved_owner_constraint'
32
- || context.consultationPolicyReason === 'consequential_disclosure_permission'
33
- || context.consultationPolicyReason === 'repeated_non_convergence'
34
- || context.consultationPolicyReason === 'insufficient_commitment_authority');
35
- }
36
- if (input.purpose === 'uptake') {
37
- return input.negotiation.taskId === undefined
38
- && typeof input.negotiation.counterpartyUserId === 'string'
39
- && input.negotiation.counterpartyUserId.length > 0
40
- && typeof input.negotiation.counterpartyIntentId === 'string'
41
- && input.negotiation.counterpartyIntentId.length > 0
42
- && typeof input.negotiation.counterpartyFelicityAuthority === 'number'
43
- && Number.isFinite(input.negotiation.counterpartyFelicityAuthority)
44
- && context.negotiationId === input.sourceId
45
- && context.purpose === 'uptake'
46
- && context.proposedActivity === NEGOTIATION_QUESTION_GENERIC_UPTAKE_ACTIVITY;
47
- }
48
- return input.purpose === 'stalled_followup'
49
- && typeof input.negotiation.taskId === 'string'
50
- && input.negotiation.taskId.length > 0
51
- && context.negotiationId === input.negotiation.taskId
52
- && context.purpose === undefined
53
- && (context.outcomeReason === 'turn_cap' || context.outcomeReason === 'timeout' || context.outcomeReason === 'stalled')
54
- && typeof context.recipientIntent === 'string'
55
- && context.recipientIntent.trim().length > 0;
56
- }
1
+ export {};
@@ -8,21 +8,15 @@
8
8
  * - **question.schema** — Zod schemas and derived types for the whole question
9
9
  * vocabulary: the public Question shape, generator envelopes, and the
10
10
  * detection/provenance/pool/recovery persistence sub-schemas.
11
- * - **question.input** — per-mode context types, the discriminated
12
- * QuestionerInput union, and `isValidQuestionerInputContract`, the runtime
13
- * mirror of that discriminant enforced at queue boundaries.
14
- * - **question.agent** — QuestionerAgent: stateless, mode-driven generation.
15
- * - **question.presets** — system prompts and user-message builders per mode.
16
- * - **question.env** — the QUESTIONER_* env accessors. All reads go through it.
17
- * - **question.tools** / **question.ask.tool** — foreground adapters: the
18
- * authenticated MCP read/answer tools, and the blocking chat
19
- * `ask_user_question` tool.
20
- * - **question.persistence.port** / **question.tools.port** — the injected
21
- * host contracts (question CRUD, chat host bridge, tool host capabilities).
11
+ * - **question.input** — the park-path payload types
12
+ * ({@link QuestionerEnqueueFn} and the two park families).
13
+ * - **question.env** — leftover question env constants.
14
+ * - **question.tools** — foreground adapters: the authenticated MCP
15
+ * read/answer tools.
22
16
  *
23
- * Ambient generation (recovery, pool, uptake, inflight, push) is scheduled via
24
- * the backend QuestionerQueue, which consumes the {@link QuestionerEnqueueFn}
25
- * injected from the composition root.
17
+ * The QuestionerAgent, its presets, and the per-mode generation envelope are
18
+ * retired (conversational-questions plan): a park payload now routes to the
19
+ * question-message regeneration queue in the backend composition root.
26
20
  *
27
21
  * ## Boundary
28
22
  *
@@ -30,13 +24,7 @@
30
24
  * barrel — never from runtime/, host implementations, or other capability
31
25
  * internals.
32
26
  */
33
- export { QuestionerAgent } from "./question.agent.js";
34
- export { createAskUserQuestionTools } from "./question.ask.tool.js";
35
- export { createQuestionerTools } from "./question.tools.js";
36
- export { INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS, intentQuestionDailyCap, isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, } from "./question.env.js";
37
- export { isValidQuestionerInputContract } from "./question.input.js";
38
- export type { InflightQuestionerInput, PoolDiscoveryContext, PostStallQuestionerInput, QuestionerEnqueueFn, QuestionerEnqueuePayload, QuestionerInput, RecoveryQuestionerInput, UptakeQuestionerInput, } from "./question.input.js";
39
- export type { ChatQuestionsHost, PersistableQuestion, PersistedQuestion, QuestionerDatabase, QuestionFilters, } from "./question.persistence.port.js";
40
- export type { AskUserQuestionToolDeps, QuestionerToolDeps } from "./question.tools.port.js";
27
+ export { INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS, } from "./question.env.js";
28
+ export type { InflightQuestionerInput, PostStallQuestionerInput, QuestionerEnqueueFn, QuestionerEnqueuePayload, QuestionerInput, } from "./question.input.js";
41
29
  export { NegotiationQuestionCandidateSchema, NegotiationQuestionProvenanceSchema, UnderspecificationTypeSchema, } from "./question.schema.js";
42
30
  export type { NegotiationQuestionCandidate, NegotiationQuestionProvenance, NegotiationQuestionPurpose, Question, QuestionGenerationResult, QuestionOption, QuestionPoolDiscriminator, QuestionPoolPush, QuestionPoolPushRequestReason, QuestionPoolPushRequestStatus, QuestionPoolSnapshot, QuestionPurpose, QuestionRecoverySnapshot, QuestionStrategy, QuestionVoidedReason, UnderspecificationType, } from "./question.schema.js";
@@ -8,21 +8,15 @@
8
8
  * - **question.schema** — Zod schemas and derived types for the whole question
9
9
  * vocabulary: the public Question shape, generator envelopes, and the
10
10
  * detection/provenance/pool/recovery persistence sub-schemas.
11
- * - **question.input** — per-mode context types, the discriminated
12
- * QuestionerInput union, and `isValidQuestionerInputContract`, the runtime
13
- * mirror of that discriminant enforced at queue boundaries.
14
- * - **question.agent** — QuestionerAgent: stateless, mode-driven generation.
15
- * - **question.presets** — system prompts and user-message builders per mode.
16
- * - **question.env** — the QUESTIONER_* env accessors. All reads go through it.
17
- * - **question.tools** / **question.ask.tool** — foreground adapters: the
18
- * authenticated MCP read/answer tools, and the blocking chat
19
- * `ask_user_question` tool.
20
- * - **question.persistence.port** / **question.tools.port** — the injected
21
- * host contracts (question CRUD, chat host bridge, tool host capabilities).
11
+ * - **question.input** — the park-path payload types
12
+ * ({@link QuestionerEnqueueFn} and the two park families).
13
+ * - **question.env** — leftover question env constants.
14
+ * - **question.tools** — foreground adapters: the authenticated MCP
15
+ * read/answer tools.
22
16
  *
23
- * Ambient generation (recovery, pool, uptake, inflight, push) is scheduled via
24
- * the backend QuestionerQueue, which consumes the {@link QuestionerEnqueueFn}
25
- * injected from the composition root.
17
+ * The QuestionerAgent, its presets, and the per-mode generation envelope are
18
+ * retired (conversational-questions plan): a park payload now routes to the
19
+ * question-message regeneration queue in the backend composition root.
26
20
  *
27
21
  * ## Boundary
28
22
  *
@@ -30,9 +24,5 @@
30
24
  * barrel — never from runtime/, host implementations, or other capability
31
25
  * internals.
32
26
  */
33
- export { QuestionerAgent } from "./question.agent.js";
34
- export { createAskUserQuestionTools } from "./question.ask.tool.js";
35
- export { createQuestionerTools } from "./question.tools.js";
36
- export { INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS, intentQuestionDailyCap, isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, } from "./question.env.js";
37
- export { isValidQuestionerInputContract } from "./question.input.js";
27
+ export { INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS, } from "./question.env.js";
38
28
  export { NegotiationQuestionCandidateSchema, NegotiationQuestionProvenanceSchema, UnderspecificationTypeSchema, } from "./question.schema.js";
@@ -87,12 +87,12 @@ export declare const McpActivityCallerSchema: z.ZodObject<{
87
87
  networkScopeId: z.ZodNullable<z.ZodString>;
88
88
  }, "strict", z.ZodTypeAny, {
89
89
  kind: "agent" | "human";
90
- permissions: string[];
91
90
  networkScopeId: string | null;
91
+ permissions: string[];
92
92
  }, {
93
93
  kind: "agent" | "human";
94
- permissions: string[];
95
94
  networkScopeId: string | null;
95
+ permissions: string[];
96
96
  }>;
97
97
  export type McpActivityCaller = z.infer<typeof McpActivityCallerSchema>;
98
98
  /**
@@ -22,7 +22,6 @@ import { createContactTools } from "../../contacts/contact.module.js";
22
22
  import { createAgentTools } from "../../agents/agent.tools.js";
23
23
  import { createNegotiationTools } from "../../negotiations/negotiation.module.js";
24
24
  import { createPremiseTools } from "../../premises/premise.tools.js";
25
- import { createQuestionerTools, createAskUserQuestionTools } from "../../questions/question.module.js";
26
25
  import { bindOwnerApprovalProvenance } from "../../opportunities/opportunity.owner-provenance.js";
27
26
  const logger = protocolLogger("ChatTools");
28
27
  // ═══════════════════════════════════════════════════════════════════════════════
@@ -102,21 +101,21 @@ export async function createChatTools(deps, preResolvedContext) {
102
101
  }, { name: opts.name, description: opts.description, schema: opts.querySchema });
103
102
  }
104
103
  // ─── Compile subgraphs ─────────────────────────────────────────────────────
105
- // Wrap questionerEnqueue to include scoped/session context when available.
104
+ // Wrap questionerEnqueue to include scoped context when available. (The
105
+ // chat-session conversationId defaulting went with the retired chat-mode
106
+ // generator; park payloads carry their own recipient routing.)
106
107
  const sessionAwareEnqueue = deps.questionerEnqueue
107
108
  ? (input) => deps.questionerEnqueue({
108
109
  ...input,
109
110
  ...(resolvedContext.scopeType && resolvedContext.scopeId && !input.scopeId
110
111
  ? { scopeType: resolvedContext.scopeType, scopeId: resolvedContext.scopeId }
111
112
  : {}),
112
- ...(resolvedContext.sessionId && !input.conversationId ? { conversationId: resolvedContext.sessionId } : {}),
113
113
  })
114
114
  : undefined;
115
115
  const intents = new Intents({
116
116
  database,
117
117
  embedder,
118
118
  queue: deps.intentQueue,
119
- questionerEnqueue: sessionAwareEnqueue,
120
119
  });
121
120
  const intentGraph = intents.createGraph();
122
121
  const premiseGraph = new PremiseGraphFactory(database, embedder).createGraph();
@@ -170,10 +169,7 @@ export async function createChatTools(deps, preResolvedContext) {
170
169
  apiBaseUrl: deps.apiBaseUrl,
171
170
  ...(deps.chatSummary && { chatSummary: deps.chatSummary }),
172
171
  ...(sessionAwareEnqueue && { questionerEnqueue: sessionAwareEnqueue }),
173
- ...(deps.findPendingQuestions && { findPendingQuestions: deps.findPendingQuestions }),
174
- ...(deps.answerPendingQuestion && { answerPendingQuestion: deps.answerPendingQuestion }),
175
172
  ...(deps.negotiationSummary && { negotiationSummary: deps.negotiationSummary }),
176
- ...(deps.chatQuestions && { chatQuestions: deps.chatQuestions }),
177
173
  ...(deps.chatSession && { chatSession: deps.chatSession }),
178
174
  ...(deps.getUserContextText && { getUserContextText: deps.getUserContextText }),
179
175
  ...(deps.intentProposalStore && { intentProposalStore: deps.intentProposalStore }),
@@ -205,12 +201,6 @@ export async function createChatTools(deps, preResolvedContext) {
205
201
  ? createNegotiationTools(defineTool, toolDeps)
206
202
  : [];
207
203
  const premiseTools = createPremiseTools(defineTool, toolDeps);
208
- const questionerTools = createQuestionerTools(defineTool, toolDeps);
209
- // Blocking mid-conversation questions — chat-only (never in the MCP registry),
210
- // and only when the host provides the ChatQuestionsHost bridge.
211
- const askUserQuestionTools = deps.chatQuestions
212
- ? createAskUserQuestionTools(defineTool, toolDeps)
213
- : [];
214
204
  // confirm_opportunity_delivery is an OpenClaw-delivery ledger write and must not be
215
205
  // callable from regular chat sessions.
216
206
  const chatOpportunityToolExclusions = new Set([
@@ -227,7 +217,5 @@ export async function createChatTools(deps, preResolvedContext) {
227
217
  ...agentTools,
228
218
  ...negotiationTools,
229
219
  ...premiseTools,
230
- ...questionerTools,
231
- ...askUserQuestionTools,
232
220
  ];
233
221
  }