@indexnetwork/protocol 66.0.0-rc.661.1 → 66.0.0-rc.665.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
@@ -10,11 +10,13 @@
10
10
 
11
11
  ### Added
12
12
 
13
+ - `OpportunityCard` gains `updatedAt`, when the opportunity last changed. It is stamped live on every read, so a cached card never carries a stale time.
13
14
  - `decideNegotiationResume(state, userId)` lets a seat take the first turn of a new round on a negotiation paused with nobody to move, refusing with `not_paused` while a seat has the turn; `Negotiations.resume` applies it. Nothing resumes on its own: a seat resumes when its owner's new context bears on the pair.
14
15
  - `currentRound(turns)` returns the turns of the round in progress, and `observeNegotiation` returns `remainingTurns` for it.
15
16
  - `OpportunityCard` gains `priorOpportunity` (an earlier accepted opportunity, or a pending one the viewer already said yes to) and `peerChat` (the viewer's existing direct chat with the counterpart), two separate facts. The card presenter gets the prior opportunity and no longer words a known contact as new. Types `PriorOpportunity` and `PeerChat` are exported.
16
17
  - `OpportunityCardsDatabase` and `OpportunityControllerDatabase` require `findPriorOpportunities(viewerId, peerIds, excludeOpportunityIds?)` and `findPeerChats(viewerId, peerIds)`, both batched and read-only.
17
18
  - `OpportunityDetection.source` gains `'introducer'`, stamped on opportunities a third party opens.
19
+ - `OpportunityActor.via`: a participant reached through the member who introduced them, with no network. `OpportunityActor.networkId` is now optional; an actor carries one of the two. This is how an introduction reaches someone outside Index: one hop through a person, never through a network.
18
20
  - Protocol agent requests to OpenRouter carry `HTTP-Referer` and `X-Title` headers, so their spend is attributed apart from the hosted agent's, and a `trace` and `metadata` (`service: "protocol"`, `operation`) named by the agent key (for example `intentInferrer` or `chat`).
19
21
 
20
22
  ### Fixed
@@ -10,6 +10,8 @@ import { OpportunityPresenter } from './opportunity.presentation.js';
10
10
  export interface OpportunityCard {
11
11
  opportunityId: string;
12
12
  createdAt?: string;
13
+ /** When the opportunity last changed: arrived, committed, accepted, or closed. Stamped live on every read. */
14
+ updatedAt?: string;
13
15
  /** Lifecycle status of the underlying opportunity at render time. */
14
16
  status?: OpportunityStatus;
15
17
  userId: string;
@@ -95,7 +95,7 @@ export async function presentOpportunityCard(deps, opportunity, viewerId, option
95
95
  try {
96
96
  const hit = await deps.cache.get(cacheKey);
97
97
  if (hit && (hit.presentedPrior ?? null) === priorKey(peerContext.priorOpportunity)) {
98
- return stampPeerContext(stampViewerCommitted({ ...hit, status: opportunity.status }, viewerCommitted), peerContext);
98
+ return stampPeerContext(stampViewerCommitted({ ...hit, status: opportunity.status, updatedAt: opportunity.updatedAt.toISOString() }, viewerCommitted), peerContext);
99
99
  }
100
100
  }
101
101
  catch (error) {
@@ -113,6 +113,7 @@ export async function presentOpportunityCard(deps, opportunity, viewerId, option
113
113
  const identity = {
114
114
  opportunityId: opportunity.id,
115
115
  createdAt: opportunity.createdAt.toISOString(),
116
+ updatedAt: opportunity.updatedAt.toISOString(),
116
117
  status: opportunity.status,
117
118
  userId: counterpart.userId,
118
119
  name,
@@ -86,8 +86,17 @@ export interface OpportunityDetection {
86
86
  enrichedFrom?: string[];
87
87
  }
88
88
  /** A participant (user + network) involved in an opportunity. */
89
+ /**
90
+ * One participant on an opportunity and what anchors them to it. Discovery
91
+ * anchors every participant on a network they share. An introduction to
92
+ * someone outside every network anchors that person `via` the member who
93
+ * introduced them instead: reach through a person, one hop, never a network.
94
+ */
89
95
  export interface OpportunityActor {
90
- networkId: Id<'networks'>;
96
+ /** The network this participant was matched in. Absent when anchored `via` an introducer. */
97
+ networkId?: Id<'networks'>;
98
+ /** The introducer this participant is reached through, when no network anchors them. */
99
+ via?: Id<'users'>;
91
100
  userId: Id<'users'>;
92
101
  intent?: Id<'intents'>;
93
102
  role: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "66.0.0-rc.661.1",
3
+ "version": "66.0.0-rc.665.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",