@indexnetwork/protocol 14.0.0-rc.468.1 → 14.1.0-rc.469.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/CHANGELOG.md CHANGED
@@ -20,6 +20,20 @@ went 6.7.1 → 8.0.2 with no 7.x in between because the whole 7.x line shipped a
20
20
  prereleases between the two promotions. To track every change, read `rc`; to
21
21
  pin a supported release, use `latest`.
22
22
 
23
+ ## 14.1.0 - 2026-08-16
24
+
25
+ ### Added
26
+
27
+ - `intentQuestionDailyCap()` env accessor plus the `INTENT_QUESTION_DAILY_CAP_DEFAULT`
28
+ (2) and `INTENT_QUESTION_DAILY_WINDOW_HOURS` (24) constants, exported from the
29
+ questions capability. These express a per-intent budget for background
30
+ refinement questions over a rolling 24 hours, spanning the recovery and
31
+ pool-discovery families combined.
32
+
33
+ Zero is a meaningful setting — it disables background refinement without
34
+ touching `QUESTIONER_ENABLED` — so the accessor deliberately does not reuse
35
+ `positiveIntEnv`. Configured by `QUESTIONER_INTENT_DAILY_CAP`.
36
+
23
37
  ## 13.2.1 - 2026-08-16
24
38
 
25
39
  No public API change: all 441 exported symbols are byte-identical to 13.2.0, and
@@ -4,5 +4,5 @@
4
4
  * IND-547: updated to re-export from questions/public/index.js.
5
5
  * Legacy consumers importing from this path continue to work unchanged.
6
6
  */
7
- export { QuestionerAgent, isValidQuestionerInputContract, isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, createQuestionerTools, createAskUserQuestionTools, NegotiationQuestionCandidateSchema, NegotiationQuestionProvenanceSchema, } from "../questions/public/index.js";
7
+ export { QuestionerAgent, isValidQuestionerInputContract, isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, intentQuestionDailyCap, INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS, createQuestionerTools, createAskUserQuestionTools, NegotiationQuestionCandidateSchema, NegotiationQuestionProvenanceSchema, } from "../questions/public/index.js";
8
8
  export type { QuestionerInput, RecoveryQuestionerInput, UptakeQuestionerInput, PostStallQuestionerInput, InflightQuestionerInput, QuestionerEnqueuePayload, QuestionerEnqueueFn, PoolDiscoveryContext, QuestionerToolDeps, AskUserQuestionToolDeps, ChatQuestionsHost, NegotiationQuestionCandidate, NegotiationQuestionProvenance, NegotiationQuestionPurpose, PersistableQuestion, PersistedQuestion, Question, QuestionFilters, QuestionGenerationResult, QuestionPoolDiscriminator, QuestionPoolPush, QuestionPoolPushRequestReason, QuestionPoolPushRequestStatus, QuestionPoolSnapshot, QuestionPurpose, QuestionRecoverySnapshot, QuestionStrategy, QuestionVoidedReason, QuestionerDatabase, UnderspecificationType, } from "../questions/public/index.js";
@@ -4,4 +4,4 @@
4
4
  * IND-547: updated to re-export from questions/public/index.js.
5
5
  * Legacy consumers importing from this path continue to work unchanged.
6
6
  */
7
- export { QuestionerAgent, isValidQuestionerInputContract, isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, createQuestionerTools, createAskUserQuestionTools, NegotiationQuestionCandidateSchema, NegotiationQuestionProvenanceSchema, } from "../questions/public/index.js";
7
+ export { QuestionerAgent, isValidQuestionerInputContract, isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, intentQuestionDailyCap, INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS, createQuestionerTools, createAskUserQuestionTools, NegotiationQuestionCandidateSchema, NegotiationQuestionProvenanceSchema, } from "../questions/public/index.js";
package/dist/index.d.ts CHANGED
@@ -82,7 +82,7 @@ export type { NegotiatorMemoryEntry } from "./capabilities/negotiation.facade.js
82
82
  export { QuestionerAgent } from "./capabilities/questions.facade.js";
83
83
  export { isValidQuestionerInputContract } from "./capabilities/questions.facade.js";
84
84
  export type { QuestionerInput, RecoveryQuestionerInput, UptakeQuestionerInput, PostStallQuestionerInput, InflightQuestionerInput, QuestionerEnqueuePayload, QuestionerEnqueueFn, PoolDiscoveryContext } from "./capabilities/questions.facade.js";
85
- export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold } from "./capabilities/questions.facade.js";
85
+ export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, intentQuestionDailyCap, INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS } from "./capabilities/questions.facade.js";
86
86
  export { PoolDiscriminatorMiner } from "./capabilities/opportunities.facade.js";
87
87
  export { PoolDiscriminatorAssigner } from "./capabilities/opportunities.facade.js";
88
88
  export type { PoolDiscriminatorAssignmentInput, PoolDiscriminatorAssignedAxis } from "./capabilities/opportunities.facade.js";
package/dist/index.js CHANGED
@@ -67,7 +67,7 @@ export { NegotiationScreener } from "./capabilities/negotiation.facade.js";
67
67
  export { NegotiationReflector } from "./capabilities/negotiation.facade.js";
68
68
  export { QuestionerAgent } from "./capabilities/questions.facade.js";
69
69
  export { isValidQuestionerInputContract } from "./capabilities/questions.facade.js";
70
- export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold } from "./capabilities/questions.facade.js";
70
+ export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, intentQuestionDailyCap, INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS } from "./capabilities/questions.facade.js";
71
71
  export { PoolDiscriminatorMiner } from "./capabilities/opportunities.facade.js";
72
72
  export { PoolDiscriminatorAssigner } from "./capabilities/opportunities.facade.js";
73
73
  export { runPoolDiscriminatorShadow } from "./capabilities/opportunities.facade.js";
@@ -32,7 +32,7 @@ export { isValidQuestionerInputContract, } from "./question.input.js";
32
32
  export type { QuestionerInput, QuestionerContext, QuestionerEnqueuePayload, QuestionerEnqueueFn, IntentContext, RecoveryIntentContext, NegotiationContext, PostStallNegotiationContext, UptakeNegotiationContext, NegotiationInflightContext, ChatContext, PoolDiscoveryContext, PostStallQuestionerInput, InflightQuestionerInput, UptakeQuestionerInput, RecoveryQuestionerInput, } from "./question.input.js";
33
33
  export { QuestionerAgent } from "./question.agent.js";
34
34
  export type { QuestionerAgentConfig } from "./question.agent.js";
35
- export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, chatQuestionWaitTimeoutMs, CHAT_QUESTION_WAIT_TIMEOUT_MS_DEFAULT, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, } from "./question.env.js";
35
+ export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, chatQuestionWaitTimeoutMs, intentQuestionDailyCap, CHAT_QUESTION_WAIT_TIMEOUT_MS_DEFAULT, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS, } from "./question.env.js";
36
36
  export { getPreset } from "./question.presets.js";
37
37
  export type { QuestionerPreset } from "./question.presets.js";
38
38
  export { createQuestionerTools } from "./question.tools.js";
@@ -33,7 +33,7 @@ export { isValidQuestionerInputContract, } from "./question.input.js";
33
33
  // ── Agent ─────────────────────────────────────────────────────────────────────
34
34
  export { QuestionerAgent } from "./question.agent.js";
35
35
  // ── Env ───────────────────────────────────────────────────────────────────────
36
- export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, chatQuestionWaitTimeoutMs, CHAT_QUESTION_WAIT_TIMEOUT_MS_DEFAULT, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, } from "./question.env.js";
36
+ export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, chatQuestionWaitTimeoutMs, intentQuestionDailyCap, CHAT_QUESTION_WAIT_TIMEOUT_MS_DEFAULT, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS, } from "./question.env.js";
37
37
  // ── Presets ───────────────────────────────────────────────────────────────────
38
38
  export { getPreset } from "./question.presets.js";
39
39
  // ── Foreground adapter tools ──────────────────────────────────────────────────
@@ -11,6 +11,9 @@
11
11
  * authority threshold (0-100, default 70).
12
12
  * QUESTIONER_CHAT_WAIT_TIMEOUT_MS how long the blocking ask_user_question chat
13
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).
14
17
  *
15
18
  * All reads go through this module — do not read these variables via
16
19
  * `process.env` elsewhere. Values are read on every call (no caching) so tests
@@ -21,6 +24,25 @@
21
24
  */
22
25
  export declare const CHAT_QUESTION_WAIT_TIMEOUT_MS_DEFAULT = 240000;
23
26
  export declare const UPTAKE_AUTHORITY_THRESHOLD_DEFAULT = 70;
27
+ /**
28
+ * Refinement questions a single intent may generate per rolling window.
29
+ *
30
+ * Recovery and pool mining both re-arm when the intent text changes, and
31
+ * answering a refinement question is itself what changes it — so each answer
32
+ * buys another question and the loop ends only when the user stops replying.
33
+ * Measured on a dev account: 27 questions against three intents in 9.5 hours,
34
+ * one discriminator asked three times, while the best-scoring match had already
35
+ * been found after the first question.
36
+ */
37
+ export declare const INTENT_QUESTION_DAILY_CAP_DEFAULT = 2;
38
+ /**
39
+ * Width of the budget window, in hours.
40
+ *
41
+ * Rolling rather than per-UTC-day deliberately: the observed bursts straddled
42
+ * midnight UTC (20:22-21:18, then 05:48-05:55), and a calendar-day budget would
43
+ * have granted the second burst a full fresh allowance.
44
+ */
45
+ export declare const INTENT_QUESTION_DAILY_WINDOW_HOURS = 24;
24
46
  /** Master switch: is any background question generation enabled? */
25
47
  export declare function isQuestionerEnabled(): boolean;
26
48
  /** Advisory uptake interlock. Flag-off by default and subordinate to the master switch. */
@@ -29,3 +51,10 @@ export declare function isUptakeGuardEnabled(): boolean;
29
51
  export declare function uptakeAuthorityThreshold(): number;
30
52
  /** Wait budget for the blocking ask_user_question chat tool. */
31
53
  export declare function chatQuestionWaitTimeoutMs(): number;
54
+ /**
55
+ * Per-intent refinement budget over {@link INTENT_QUESTION_DAILY_WINDOW_HOURS}.
56
+ *
57
+ * Zero is a meaningful setting — it disables background refinement entirely
58
+ * without touching the master switch — so this does not reuse `positiveIntEnv`.
59
+ */
60
+ export declare function intentQuestionDailyCap(): number;
@@ -11,6 +11,9 @@
11
11
  * authority threshold (0-100, default 70).
12
12
  * QUESTIONER_CHAT_WAIT_TIMEOUT_MS how long the blocking ask_user_question chat
13
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).
14
17
  *
15
18
  * All reads go through this module — do not read these variables via
16
19
  * `process.env` elsewhere. Values are read on every call (no caching) so tests
@@ -21,6 +24,25 @@
21
24
  */
22
25
  export const CHAT_QUESTION_WAIT_TIMEOUT_MS_DEFAULT = 240000;
23
26
  export const UPTAKE_AUTHORITY_THRESHOLD_DEFAULT = 70;
27
+ /**
28
+ * Refinement questions a single intent may generate per rolling window.
29
+ *
30
+ * Recovery and pool mining both re-arm when the intent text changes, and
31
+ * answering a refinement question is itself what changes it — so each answer
32
+ * buys another question and the loop ends only when the user stops replying.
33
+ * Measured on a dev account: 27 questions against three intents in 9.5 hours,
34
+ * one discriminator asked three times, while the best-scoring match had already
35
+ * been found after the first question.
36
+ */
37
+ export const INTENT_QUESTION_DAILY_CAP_DEFAULT = 2;
38
+ /**
39
+ * Width of the budget window, in hours.
40
+ *
41
+ * Rolling rather than per-UTC-day deliberately: the observed bursts straddled
42
+ * midnight UTC (20:22-21:18, then 05:48-05:55), and a calendar-day budget would
43
+ * have granted the second burst a full fresh allowance.
44
+ */
45
+ export const INTENT_QUESTION_DAILY_WINDOW_HOURS = 24;
24
46
  /**
25
47
  * Parse a positive integer env var, clamped to the safe-integer range so a
26
48
  * malformed env value cannot crash `AbortSignal.timeout` (which throws on
@@ -57,3 +79,17 @@ export function uptakeAuthorityThreshold() {
57
79
  export function chatQuestionWaitTimeoutMs() {
58
80
  return positiveIntEnv("QUESTIONER_CHAT_WAIT_TIMEOUT_MS", CHAT_QUESTION_WAIT_TIMEOUT_MS_DEFAULT);
59
81
  }
82
+ /**
83
+ * Per-intent refinement budget over {@link INTENT_QUESTION_DAILY_WINDOW_HOURS}.
84
+ *
85
+ * Zero is a meaningful setting — it disables background refinement entirely
86
+ * without touching the master switch — so this does not reuse `positiveIntEnv`.
87
+ */
88
+ export function intentQuestionDailyCap() {
89
+ const raw = process.env.QUESTIONER_INTENT_DAILY_CAP;
90
+ if (!raw?.trim())
91
+ return INTENT_QUESTION_DAILY_CAP_DEFAULT;
92
+ if (!/^\d+$/.test(raw.trim()))
93
+ return INTENT_QUESTION_DAILY_CAP_DEFAULT;
94
+ return Number.parseInt(raw, 10);
95
+ }
@@ -40,7 +40,7 @@
40
40
  export * from "../domain/index.js";
41
41
  export { QuestionerAgent } from "../application/index.js";
42
42
  export type { QuestionerAgentConfig } from "../application/index.js";
43
- export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, } from "../application/index.js";
43
+ export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, intentQuestionDailyCap, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS, } from "../application/index.js";
44
44
  export { isValidQuestionerInputContract, } from "../application/index.js";
45
45
  export type { QuestionerInput, QuestionerEnqueuePayload, QuestionerEnqueueFn, PoolDiscoveryContext, RecoveryQuestionerInput, UptakeQuestionerInput, PostStallQuestionerInput, InflightQuestionerInput, } from "../application/index.js";
46
46
  export { createQuestionerTools, createAskUserQuestionTools } from "../application/index.js";
@@ -42,7 +42,7 @@ export * from "../domain/index.js";
42
42
  // ── Application: agent ────────────────────────────────────────────────────────
43
43
  export { QuestionerAgent } from "../application/index.js";
44
44
  // ── Application: env accessors ────────────────────────────────────────────────
45
- export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, } from "../application/index.js";
45
+ export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, intentQuestionDailyCap, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, INTENT_QUESTION_DAILY_CAP_DEFAULT, INTENT_QUESTION_DAILY_WINDOW_HOURS, } from "../application/index.js";
46
46
  // ── Application: input types and validation ───────────────────────────────────
47
47
  export { isValidQuestionerInputContract, } from "../application/index.js";
48
48
  // ── Application: foreground adapter tools ─────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "14.0.0-rc.468.1",
3
+ "version": "14.1.0-rc.469.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",