@indexnetwork/protocol 22.0.0-rc.496.1 → 22.0.0-rc.497.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.
@@ -195,6 +195,12 @@ export class IndexNegotiator {
195
195
  // via the domain contract, exactly like `configuredScreenMode()`. Under the
196
196
  // `advocate` default every stance fragment below is the legacy string, so
197
197
  // the rendered prompt is byte-identical to the pre-IND-611 build.
198
+ //
199
+ // `stanceActionRules` also takes the resolved `seat`: the responder
200
+ // verification rules are a duty of the seat that did NOT open, so they
201
+ // render only there. The resolved seat, not `input.seat`, so the v1
202
+ // `isDiscoverer` fallback decides it there too — under v1 the discoverer
203
+ // is likewise the side that opens.
198
204
  const stance = configuredNegotiatorStance();
199
205
  const schema = turnSchemaFor(version, seat, isFinalTurn, {
200
206
  system: SystemNegotiationTurnSchema,
@@ -206,7 +212,7 @@ export class IndexNegotiator {
206
212
  const networkContext = input.indexContext.prompt || "General discovery";
207
213
  const actionRules = (version === "v2"
208
214
  ? (seat === "initiator" ? V2_INITIATOR_RULES : V2_COUNTERPARTY_RULES)
209
- : V1_ACTION_RULES) + stanceActionRules(stance)
215
+ : V1_ACTION_RULES) + stanceActionRules(stance, seat)
210
216
  + (canAskUser
211
217
  ? ASK_USER_RULE
212
218
  + (preContactConsult ? PRE_CONTACT_ASK_USER_RULE + stancePreContactConsultRule(stance) : "")
@@ -9,11 +9,11 @@
9
9
  *
10
10
  * `NEGOTIATOR_STANCE` makes that stance configurable instead of hard-coded:
11
11
  *
12
- * | stance | framing | value bar | query rule | consult propensity | deadlock |
13
- * |-------------|--------------------------------------|------------------|-------------------------|-------------------------|-----------|
14
- * | `advocate` | argue the case (today) | none | mandate (today) | none (today) | bargain |
15
- * | `evaluator` | assess first, advocate if it survives | opportunity-cost | necessary-not-sufficient| prefer over assumption | bargain |
16
- * | `skeptic` | + "most matches are not worth making" | opportunity-cost | necessary-not-sufficient| + unverified = don't proceed | stalemate |
12
+ * | stance | framing | value bar | query rule | consult propensity | responder check | deadlock |
13
+ * |-------------|--------------------------------------|------------------|-------------------------|-------------------------|--------------------------|-----------|
14
+ * | `advocate` | argue the case (today) | none | mandate (today) | none (today) | none (today) | bargain |
15
+ * | `evaluator` | assess first, advocate if it survives | opportunity-cost | necessary-not-sufficient| prefer over assumption | verify the opening | bargain |
16
+ * | `skeptic` | + "most matches are not worth making" | opportunity-cost | necessary-not-sufficient| + unverified = don't proceed | + probe before accepting | stalemate |
17
17
  *
18
18
  * Design constraints (hard):
19
19
  * - **`advocate` is byte-identical.** Every fragment below is additive and
@@ -35,7 +35,16 @@
35
35
  * Fragments deliberately never contain the literal `ask_user` or a quoted
36
36
  * `"withdraw"`: they render into every seat and protocol version, and the seat
37
37
  * specs pin that those tokens appear only where the seat legally holds them.
38
+ *
39
+ * One family of fragments is the exception to that seat-blindness by
40
+ * construction rather than by accident: the responder verification rules
41
+ * (`stanceVerifiesResponderFit`) address a duty only the RESPONDING seat has —
42
+ * reading someone else's opening — so `stanceActionRules` takes the seat and
43
+ * renders them only there. They still name no action and no mechanism, so the
44
+ * seat's own rules and the graph's grants stay the sole authority on what this
45
+ * turn may actually do.
38
46
  */
47
+ import type { NegotiationSeat } from "../shared/schemas/negotiation-state.schema.js";
39
48
  export declare const NEGOTIATOR_STANCES: readonly ["advocate", "evaluator", "skeptic"];
40
49
  export type NegotiatorStance = (typeof NEGOTIATOR_STANCES)[number];
41
50
  export declare const DEFAULT_NEGOTIATOR_STANCE: NegotiatorStance;
@@ -55,6 +64,11 @@ export declare function stanceAppliesValueBar(stance: NegotiatorStance): boolean
55
64
  * continuing to evaluate rather than as a mandate to connect.
56
65
  */
57
66
  export declare function stanceQueryMatchIsNecessaryNotSufficient(stance: NegotiatorStance): boolean;
67
+ /**
68
+ * Whether this stance asks the RESPONDING seat to verify the opening's account
69
+ * of the fit before accepting it, rather than reading that account as evidence.
70
+ */
71
+ export declare function stanceVerifiesResponderFit(stance: NegotiatorStance): boolean;
58
72
  /** Whether a detected deadlock resolves by stalemate rather than bargaining. */
59
73
  export declare function stanceResolvesDeadlockByStalemate(stance: NegotiatorStance): boolean;
60
74
  /**
@@ -68,8 +82,13 @@ export declare function stanceJobFraming(stance: NegotiatorStance): string;
68
82
  /**
69
83
  * Extra action-rule lines contributed by the stance, appended after the seat's
70
84
  * own rules. Empty under `advocate` → byte-identical.
85
+ *
86
+ * `seat` scopes the responder verification rules to the seat that did NOT
87
+ * open. Everything else here is seat-blind: the value bar and the consult
88
+ * propensity are duties of both seats, and the seat parameter must not become
89
+ * a reason to fork them.
71
90
  */
72
- export declare function stanceActionRules(stance: NegotiatorStance): string;
91
+ export declare function stanceActionRules(stance: NegotiatorStance, seat: NegotiationSeat): string;
73
92
  /**
74
93
  * Stance contribution to the pre-contact consultation rule. Empty under
75
94
  * `advocate` and `evaluator` — the base seat-level rule already states when
@@ -9,11 +9,11 @@
9
9
  *
10
10
  * `NEGOTIATOR_STANCE` makes that stance configurable instead of hard-coded:
11
11
  *
12
- * | stance | framing | value bar | query rule | consult propensity | deadlock |
13
- * |-------------|--------------------------------------|------------------|-------------------------|-------------------------|-----------|
14
- * | `advocate` | argue the case (today) | none | mandate (today) | none (today) | bargain |
15
- * | `evaluator` | assess first, advocate if it survives | opportunity-cost | necessary-not-sufficient| prefer over assumption | bargain |
16
- * | `skeptic` | + "most matches are not worth making" | opportunity-cost | necessary-not-sufficient| + unverified = don't proceed | stalemate |
12
+ * | stance | framing | value bar | query rule | consult propensity | responder check | deadlock |
13
+ * |-------------|--------------------------------------|------------------|-------------------------|-------------------------|--------------------------|-----------|
14
+ * | `advocate` | argue the case (today) | none | mandate (today) | none (today) | none (today) | bargain |
15
+ * | `evaluator` | assess first, advocate if it survives | opportunity-cost | necessary-not-sufficient| prefer over assumption | verify the opening | bargain |
16
+ * | `skeptic` | + "most matches are not worth making" | opportunity-cost | necessary-not-sufficient| + unverified = don't proceed | + probe before accepting | stalemate |
17
17
  *
18
18
  * Design constraints (hard):
19
19
  * - **`advocate` is byte-identical.** Every fragment below is additive and
@@ -35,6 +35,14 @@
35
35
  * Fragments deliberately never contain the literal `ask_user` or a quoted
36
36
  * `"withdraw"`: they render into every seat and protocol version, and the seat
37
37
  * specs pin that those tokens appear only where the seat legally holds them.
38
+ *
39
+ * One family of fragments is the exception to that seat-blindness by
40
+ * construction rather than by accident: the responder verification rules
41
+ * (`stanceVerifiesResponderFit`) address a duty only the RESPONDING seat has —
42
+ * reading someone else's opening — so `stanceActionRules` takes the seat and
43
+ * renders them only there. They still name no action and no mechanism, so the
44
+ * seat's own rules and the graph's grants stay the sole authority on what this
45
+ * turn may actually do.
38
46
  */
39
47
  export const NEGOTIATOR_STANCES = ["advocate", "evaluator", "skeptic"];
40
48
  export const DEFAULT_NEGOTIATOR_STANCE = "advocate";
@@ -63,6 +71,13 @@ export function stanceAppliesValueBar(stance) {
63
71
  export function stanceQueryMatchIsNecessaryNotSufficient(stance) {
64
72
  return stance !== "advocate";
65
73
  }
74
+ /**
75
+ * Whether this stance asks the RESPONDING seat to verify the opening's account
76
+ * of the fit before accepting it, rather than reading that account as evidence.
77
+ */
78
+ export function stanceVerifiesResponderFit(stance) {
79
+ return stance !== "advocate";
80
+ }
66
81
  /** Whether a detected deadlock resolves by stalemate rather than bargaining. */
67
82
  export function stanceResolvesDeadlockByStalemate(stance) {
68
83
  return stance === "skeptic";
@@ -141,17 +156,66 @@ const CONSULT_PROPENSITY_RULE = `
141
156
  * reason not to proceed, and consulting the client is how it gets verified.
142
157
  */
143
158
  const SKEPTIC_CONSULT_SHARPENING = ` For you this is a gate, not a preference: an UNVERIFIED assumption that the two sides' intents actually align is a reason NOT to proceed, and consulting {userName} is how that assumption gets verified.`;
159
+ /**
160
+ * Responder verification — assessing stances, RESPONDING seat only.
161
+ *
162
+ * Two structural gaps this closes, both visible in the failure it was written
163
+ * for: a first-contact outreach accepted in one exchange, on reasoning that
164
+ * restated the opening's own fit claim back as the reason for accepting.
165
+ *
166
+ * 1. The opening enters the prompt as if it were evidence. It is not: it is
167
+ * advocacy authored by the counterparty's agent, and its most load-bearing
168
+ * move is characterizing what THIS client wants. Nothing else in the prompt
169
+ * tells the responding seat to treat that characterization as a claim.
170
+ * 2. `VALUE_BAR_RULE` has no bite in this seat. "Most matches are not worth
171
+ * making" reads as being about MAKING matches, and a responder frames its
172
+ * decision as "would my client be open to connecting?" — nearly costless,
173
+ * nearly certain to be yes. So the same opportunity-cost currency is
174
+ * restated in the terms this seat actually spends it: accepting puts a
175
+ * connection in front of the client for approval.
176
+ *
177
+ * Conditional by construction: the steer applies where the fit case RESTS on
178
+ * the initiator's interpretation. A match the client's own criteria and the
179
+ * counterparty's own evidence support independently may still be accepted on
180
+ * first contact — which is why no "always"/"never accept" wording appears here
181
+ * and a spec pins its absence.
182
+ *
183
+ * Names no action and no mechanism, like every other fragment in this module:
184
+ * "one more exchange" and "consulting {userName}" describe the move, and the
185
+ * seat's own rules decide which token carries it (and whether the grant for it
186
+ * is even live this turn).
187
+ */
188
+ const RESPONDER_VERIFICATION_RULE = `
189
+ - THE OPENING IS ADVOCACY, NOT EVIDENCE: what reached {userName} was written by the other side's agent to make this match sound worth taking, and its account of the fit — what {userName} is looking for, why the two sides line up — is that agent's CLAIM about {userName}, not a fact you have checked. Test it against {userName}'s OWN intent and against what the counterparty's own profile and intents actually show. Restating the opening's fit claim back as your reason is agreement, not verification.
190
+ - WHAT ACCEPTING SPENDS: accepting is not the free or agreeable option — it puts a connection in front of {userName} for approval and spends the same finite attention the bar above governs. "Would {userName} be open to connecting?" is a bar almost anything clears, and it is not the bar. An accept on the first exchange has to be grounded in what {userName} themselves stated they were looking for, met by evidence about the counterparty that stands up without the opening's reading of it. Where the case for fit still rests on how the other agent characterized {userName}'s needs, the cheap move is one more exchange — put the specific gap to them, or counter with what would have to be true — and where the doubt is about {userName}'s own criteria rather than the counterparty's evidence, consulting {userName} settles it instead.`;
191
+ /**
192
+ * `skeptic` sharpening of the responder rule, appended to the same bullet (the
193
+ * same additive pattern as `SKEPTIC_CONSULT_SHARPENING`): under the
194
+ * not-worth-making prior, closing on the opening alone is the exception rather
195
+ * than the default. The escape hatch is restated explicitly here because this
196
+ * is where the pressure is highest and an over-read would turn a lean into a
197
+ * ban on first-contact accepts.
198
+ */
199
+ const SKEPTIC_RESPONDER_SHARPENING = ` For you an accept on the first exchange is the exception, not the default: where the fit case still rests on the opening's own characterization, probe once before accepting — one exchange costs the counterparty nothing and {userName} very little, while an accept you cannot ground spends their attention on a match no one has checked. Where {userName}'s stated criteria and the counterparty's own evidence carry the fit without that characterization, accepting straight away is still the right call.`;
144
200
  /**
145
201
  * Extra action-rule lines contributed by the stance, appended after the seat's
146
202
  * own rules. Empty under `advocate` → byte-identical.
203
+ *
204
+ * `seat` scopes the responder verification rules to the seat that did NOT
205
+ * open. Everything else here is seat-blind: the value bar and the consult
206
+ * propensity are duties of both seats, and the seat parameter must not become
207
+ * a reason to fork them.
147
208
  */
148
- export function stanceActionRules(stance) {
209
+ export function stanceActionRules(stance, seat) {
149
210
  if (!stanceAppliesValueBar(stance))
150
211
  return "";
151
212
  const consultRule = stance === "skeptic"
152
213
  ? CONSULT_PROPENSITY_RULE + SKEPTIC_CONSULT_SHARPENING
153
214
  : CONSULT_PROPENSITY_RULE;
154
- return VALUE_BAR_RULE + consultRule;
215
+ const responderRule = seat === "counterparty" && stanceVerifiesResponderFit(stance)
216
+ ? RESPONDER_VERIFICATION_RULE + (stance === "skeptic" ? SKEPTIC_RESPONDER_SHARPENING : "")
217
+ : "";
218
+ return VALUE_BAR_RULE + consultRule + responderRule;
155
219
  }
156
220
  /**
157
221
  * `skeptic` sharpening of the pre-contact consultation rule (the turn-0 third
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "22.0.0-rc.496.1",
3
+ "version": "22.0.0-rc.497.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",