@indexnetwork/protocol 66.0.0-rc.645.1 → 66.0.0-rc.648.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/README.md +27 -34
- package/dist/index.d.ts +1 -1
- package/dist/internal/intents/intent.suggester.d.ts +10 -2
- package/dist/internal/intents/intent.suggester.js +34 -7
- package/dist/internal/opportunities/opportunity.presentation.js +3 -2
- package/dist/protocol/protocol.prompt.d.ts +1 -1
- package/dist/protocol/protocol.prompt.js +6 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,8 +31,8 @@ flowchart LR
|
|
|
31
31
|
|
|
32
32
|
Scope --> CandidateGeneration[Candidate generation]
|
|
33
33
|
CandidateGeneration --> Evaluation[Evaluation]
|
|
34
|
-
Evaluation -->|plausible but uncertain| Opportunity[
|
|
35
|
-
Evaluation -->|clear fit| Opportunity[
|
|
34
|
+
Evaluation -->|plausible but uncertain| Opportunity[Negotiating opportunity]
|
|
35
|
+
Evaluation -->|clear fit| Opportunity[Pending opportunity]
|
|
36
36
|
Opportunity -->|needs agent clarification| Negotiation[Bounded negotiation]
|
|
37
37
|
Negotiation -->|fit established| Opportunity
|
|
38
38
|
Negotiation -->|human judgment required| Questions[Structured questions]
|
|
@@ -238,11 +238,11 @@ Opportunity states are participant-facing as follows:
|
|
|
238
238
|
|
|
239
239
|
| State | Participant-facing term | Meaning |
|
|
240
240
|
|---|---|---|
|
|
241
|
-
| **
|
|
242
|
-
| **
|
|
243
|
-
| **
|
|
244
|
-
| **
|
|
245
|
-
| **
|
|
241
|
+
| **negotiating** | Agents talking | The agents are negotiating whether the fit holds. |
|
|
242
|
+
| **pending** | Waiting on you | The agents agreed and the participants decide. A participant who already accepted sees Chat open: the first accept opens the conversation, and the status stays pending until every participant has accepted. |
|
|
243
|
+
| **accepted** | Connected | Every participant accepted. |
|
|
244
|
+
| **rejected** | Passed | An agent declined or a participant rejected the opportunity. |
|
|
245
|
+
| **expired** | Expired | An intent was archived. |
|
|
246
246
|
|
|
247
247
|
A conforming agent MUST NOT present a received opportunity as **Connected** without explicit approval from the receiving participant. The reference implementation enforces actor authorization and valid source statuses for acceptance, while current-approval capture is handled by the agent or user-interface flow invoking the transition.
|
|
248
248
|
|
|
@@ -250,33 +250,26 @@ A conforming agent MUST NOT present a received opportunity as **Connected** with
|
|
|
250
250
|
|
|
251
251
|
```mermaid
|
|
252
252
|
stateDiagram-v2
|
|
253
|
-
[*] -->
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
Only visible under role and scope rules.
|
|
253
|
+
[*] --> negotiating: agent opens it
|
|
254
|
+
negotiating --> pending: agents agree
|
|
255
|
+
negotiating --> rejected: agent declines
|
|
256
|
+
negotiating --> expired: intent archived
|
|
257
|
+
|
|
258
|
+
pending --> accepted: every participant accepts
|
|
259
|
+
pending --> rejected: participant rejects
|
|
260
|
+
pending --> expired: intent archived
|
|
261
|
+
|
|
262
|
+
accepted --> [*]
|
|
263
|
+
rejected --> [*]
|
|
264
|
+
expired --> [*]
|
|
265
|
+
|
|
266
|
+
note right of pending
|
|
267
|
+
Waiting on the participants.
|
|
268
|
+
The first accept opens the chat.
|
|
270
269
|
end note
|
|
271
270
|
|
|
272
|
-
note right of
|
|
273
|
-
|
|
274
|
-
Acceptance requires participant approval.
|
|
275
|
-
end note
|
|
276
|
-
|
|
277
|
-
note right of Connected
|
|
278
|
-
Relationship boundary crossed.
|
|
279
|
-
Conversation or introduction may proceed.
|
|
271
|
+
note right of accepted
|
|
272
|
+
Every participant accepted.
|
|
280
273
|
end note
|
|
281
274
|
```
|
|
282
275
|
|
|
@@ -300,11 +293,11 @@ sequenceDiagram
|
|
|
300
293
|
PR->>PR: Generate candidates inside scope
|
|
301
294
|
PR->>PR: Evaluate role fit and constraints
|
|
302
295
|
alt Fit is clear
|
|
303
|
-
PR-->>A:
|
|
296
|
+
PR-->>A: Pending opportunity with explanation
|
|
304
297
|
else Fit is uncertain
|
|
305
298
|
PR->>N: Start bounded negotiation
|
|
306
299
|
N-->>PR: Propose, counter, accept, reject, or question
|
|
307
|
-
PR-->>A:
|
|
300
|
+
PR-->>A: Pending opportunity or structured question
|
|
308
301
|
end
|
|
309
302
|
A->>P: Explain strongest reason and ask for approval
|
|
310
303
|
P-->>A: Approve, decline, or refine intent
|
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export type { NetworksDeps } from "./capabilities/networks.js";
|
|
|
33
33
|
export { Intents } from "./capabilities/intents.js";
|
|
34
34
|
export type { PrepareAnswer, PrepareInput, PrepareResult, RecoveryField, RecoveryFieldKind, RecoveryFieldOption, IntentsDeps, IntentSemanticMetadata, PreparedIntent, } from "./capabilities/intents.js";
|
|
35
35
|
export { IntentSuggester } from "./internal/intents/intent.suggester.js";
|
|
36
|
-
export type { IntentSuggestion, IntentSuggestionInput } from "./internal/intents/intent.suggester.js";
|
|
36
|
+
export type { IntentSuggestion, IntentSuggestionInput, IntentSuggestions } from "./internal/intents/intent.suggester.js";
|
|
37
37
|
export { normalizeTelegramHandle } from './internal/shared/utils/telegram-handle.js';
|
|
38
38
|
/**
|
|
39
39
|
* opportunity — the capability's sole cross-capability surface.
|
|
@@ -2,12 +2,15 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const IntentSuggestionOutputSchema: z.ZodObject<{
|
|
3
3
|
lookingFor: z.ZodArray<z.ZodString, "many">;
|
|
4
4
|
offering: z.ZodString;
|
|
5
|
+
examples: z.ZodArray<z.ZodString, "many">;
|
|
5
6
|
}, "strip", z.ZodTypeAny, {
|
|
6
7
|
lookingFor: string[];
|
|
7
8
|
offering: string;
|
|
9
|
+
examples: string[];
|
|
8
10
|
}, {
|
|
9
11
|
lookingFor: string[];
|
|
10
12
|
offering: string;
|
|
13
|
+
examples: string[];
|
|
11
14
|
}>;
|
|
12
15
|
export interface IntentSuggestionInput {
|
|
13
16
|
name: string | null;
|
|
@@ -21,6 +24,11 @@ export interface IntentSuggestion {
|
|
|
21
24
|
kind: "looking_for" | "offering";
|
|
22
25
|
text: string;
|
|
23
26
|
}
|
|
27
|
+
/** The picks, plus the example starters rewritten for this person. */
|
|
28
|
+
export interface IntentSuggestions {
|
|
29
|
+
suggestions: IntentSuggestion[];
|
|
30
|
+
examples: string[];
|
|
31
|
+
}
|
|
24
32
|
/**
|
|
25
33
|
* Suggests a new member's first intents from their profile: two they might be
|
|
26
34
|
* looking for and one they could offer. Follows the shared agent pattern:
|
|
@@ -31,7 +39,7 @@ export declare class IntentSuggester {
|
|
|
31
39
|
constructor();
|
|
32
40
|
/**
|
|
33
41
|
* @param input - The person's profile and their active intents.
|
|
34
|
-
* @returns Two "looking_for" suggestions then one "offering",
|
|
42
|
+
* @returns Two "looking_for" suggestions then one "offering", with the rewritten examples; null when the call fails.
|
|
35
43
|
*/
|
|
36
|
-
invoke(input: IntentSuggestionInput): Promise<
|
|
44
|
+
invoke(input: IntentSuggestionInput): Promise<IntentSuggestions | null>;
|
|
37
45
|
}
|
|
@@ -22,6 +22,9 @@ export const IntentSuggestionOutputSchema = z.object({
|
|
|
22
22
|
.array(SuggestionText)
|
|
23
23
|
.describe("Exactly two things they might want: someone to learn from, hire, fund, build with, or meet."),
|
|
24
24
|
offering: SuggestionText.describe("One thing they could offer others: their skills, capital, time, or help."),
|
|
25
|
+
examples: z
|
|
26
|
+
.array(z.string().describe("One line, at most 110 characters, lowercase, no trailing period."))
|
|
27
|
+
.describe("Five to seven of the example starters, rewritten for this person in the same casual shape."),
|
|
25
28
|
});
|
|
26
29
|
// ─── Logger ───────────────────────────────────────────────────────────────────
|
|
27
30
|
const logger = log.lib.from("IntentSuggester");
|
|
@@ -39,11 +42,32 @@ RULES:
|
|
|
39
42
|
- Write each in their voice, first person implied, like they would type it:
|
|
40
43
|
"looking for a technical cofounder who has shipped ml in production",
|
|
41
44
|
"happy to give early founders feedback on their go-to-market".
|
|
42
|
-
- Ground every suggestion in the profile: their
|
|
43
|
-
|
|
45
|
+
- Ground every suggestion in the profile: their role and field. What we found may be old, so
|
|
46
|
+
stay at that level: never name a company, product, fund, school, or city, and leave out
|
|
47
|
+
details that go stale (stage, round, team size, dates). Do not invent facts.
|
|
44
48
|
- One line each, at most 90 characters, lowercase, no trailing period, no emoji, no em dashes.
|
|
45
49
|
- Skip anything that repeats one of their existing intents.
|
|
46
50
|
- If the profile says little, still give three plausible, specific starting points.
|
|
51
|
+
|
|
52
|
+
EXAMPLES:
|
|
53
|
+
Also rewrite these generic starters for this person, keeping their short, casual
|
|
54
|
+
"situation, want ..." shape:
|
|
55
|
+
- traveling soon, want to meet cool people in ai
|
|
56
|
+
- building something, want honest feedback on it
|
|
57
|
+
- just launched, want cool people to try it
|
|
58
|
+
- new in town, want to find my people
|
|
59
|
+
- raising soon, want to meet investors who get it
|
|
60
|
+
- hiring soon, want to meet great people early
|
|
61
|
+
- have an idea, want someone to build it with
|
|
62
|
+
Give each a light touch so it feels like theirs: swap the generic part for their broad field or
|
|
63
|
+
role, nothing more. A founder in agent infrastructure might get "traveling soon, want to meet people
|
|
64
|
+
building or investing in agents". Same limits as above: no company, product, fund, school, or city
|
|
65
|
+
names, and nothing that would go stale. Keep them short and loose; one field word is usually enough.
|
|
66
|
+
Swap any that do not fit their role for one that does: an investor does not raise, so "raising soon"
|
|
67
|
+
becomes something like "deploying capital, want to meet founders in <their broad focus>"; someone who
|
|
68
|
+
is not building does not launch. Drop any you cannot make fit, but always keep the traveling one.
|
|
69
|
+
Return five to seven, each at most 90 characters, lowercase, no trailing period, no emoji, no em
|
|
70
|
+
dashes, and none that repeat the three suggestions above.
|
|
47
71
|
`;
|
|
48
72
|
// ─── Agent class ──────────────────────────────────────────────────────────────
|
|
49
73
|
/**
|
|
@@ -59,7 +83,7 @@ export class IntentSuggester {
|
|
|
59
83
|
}
|
|
60
84
|
/**
|
|
61
85
|
* @param input - The person's profile and their active intents.
|
|
62
|
-
* @returns Two "looking_for" suggestions then one "offering",
|
|
86
|
+
* @returns Two "looking_for" suggestions then one "offering", with the rewritten examples; null when the call fails.
|
|
63
87
|
*/
|
|
64
88
|
async invoke(input) {
|
|
65
89
|
const clean = (text, max) => (text ?? "").replace(/\s+/g, " ").trim().slice(0, max);
|
|
@@ -81,10 +105,13 @@ export class IntentSuggester {
|
|
|
81
105
|
const offering = tidy(parsed.data.offering);
|
|
82
106
|
if (lookingFor.length < 2 || !offering)
|
|
83
107
|
return null;
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
108
|
+
return {
|
|
109
|
+
suggestions: [
|
|
110
|
+
...lookingFor.map((text) => ({ kind: "looking_for", text })),
|
|
111
|
+
{ kind: "offering", text: offering },
|
|
112
|
+
],
|
|
113
|
+
examples: parsed.data.examples.map(tidy).filter((text) => text && text.length <= 140).slice(0, 7),
|
|
114
|
+
};
|
|
88
115
|
}
|
|
89
116
|
catch (error) {
|
|
90
117
|
logger.error("Error during execution", { error });
|
|
@@ -145,8 +145,9 @@ Rules:
|
|
|
145
145
|
**Negotiation-grounded explanations (ONLY when NEGOTIATION CONTEXT is provided):**
|
|
146
146
|
When NEGOTIATION CONTEXT is provided, this opportunity passed through an agent-to-agent negotiation. Use the transcript to ground your explanation in the concrete reasoning the agents exchanged.
|
|
147
147
|
- Personalize the summary with *why* the negotiation produced this match — reference the roles the agents agreed on, the specific concerns raised, and how they were resolved.
|
|
148
|
-
- For status "
|
|
149
|
-
- For status "
|
|
148
|
+
- For status "pending": the agents agreed and the viewer decides; the card should confidently explain *why* they agreed.
|
|
149
|
+
- For status "accepted": both people said yes; the card should explain *why* the agents agreed.
|
|
150
|
+
- For status "rejected": say who ended it. If the negotiation says one agent declined, the agents did; otherwise a person passed. The card should explain the reason briefly so the user understands — not dwell on it.
|
|
150
151
|
- Do NOT invent turn content. Only reference what is in the NEGOTIATION CONTEXT block.
|
|
151
152
|
|
|
152
153
|
`;
|
|
@@ -5,7 +5,7 @@ export declare const NEGOTIATION_GUIDANCE = "You participate in the Index protoc
|
|
|
5
5
|
export declare const CANONICAL_GUIDANCE_TOPICS: readonly ["identity-context", "intents", "communities-networks", "opportunities", "negotiations", "workflows"];
|
|
6
6
|
export type CanonicalGuidanceTopic = (typeof CANONICAL_GUIDANCE_TOPICS)[number];
|
|
7
7
|
/** Summary served when GET /api/docs has no topic. */
|
|
8
|
-
export declare const CANONICAL_GUIDANCE_SUMMARY = "# Index Network Protocol\n\nIndex Network is a private, intent-driven discovery protocol. Users express intents, agents find matches within shared networks, and decisions proceed through clear gates.\n\n## Core Concepts\n\n**Identity & Context** \u2014 Account and presentation metadata plus scoped runtime state (networks, intents, stage).\n\n**Intents** \u2014 What users seek (intents, opportunities). Drive semantic matching.\n\n**Communities & Networks** \u2014 Private groups where members share intents and discover connections via shared membership.\n\n**Opportunities** \u2014 Discovered matches between users. Matches
|
|
8
|
+
export declare const CANONICAL_GUIDANCE_SUMMARY = "# Index Network Protocol\n\nIndex Network is a private, intent-driven discovery protocol. Users express intents, agents find matches within shared networks, and decisions proceed through clear gates.\n\n## Core Concepts\n\n**Identity & Context** \u2014 Account and presentation metadata plus scoped runtime state (networks, intents, stage).\n\n**Intents** \u2014 What users seek (intents, opportunities). Drive semantic matching.\n\n**Communities & Networks** \u2014 Private groups where members share intents and discover connections via shared membership.\n\n**Opportunities** \u2014 Discovered matches between users. Matches start negotiating; agreement advances to pending owner review, then accepted/rejected/expired.\n\n**Negotiations** \u2014 Agents coordinate, users approve. **A2A acceptance is not owner approval.** These are separate gates.\n\n**Workflows** \u2014 H2A (users express intents \u2192 agents discover) and A2A (agents coordinate) over the REST API. External agents use the Index CLI; the personal-agent runtime stays on the server. Human conversations are available through the conversation routes and commands.\n\n## Command interface\n\nUse the Index CLI with an explicit API origin: index --api-url <origin> ... --json.\nAuthenticate with browser login or one environment credential: INDEX_SESSION_TOKEN (Bearer) or INDEX_API_KEY (x-api-key). Keys do not bypass owner-session requirements.\nEvery capability is a named resource: /api/intents, /api/networks, /api/opportunities, /api/negotiations, /api/conversations, /api/scrape, /api/docs. The user's event stream is GET /api/events.\nUse the workflows topic for the resource routes and their CLI commands.\n\n## Canonical Topics\n\nRefer to these for detailed entity facts and lifecycle:\n\n- **identity-context** \u2014 Presentation identity, context scoping, matching inputs\n- **intents** \u2014 Intent inference, classification\n- **communities-networks** \u2014 Membership and explicit intent sharing\n- **opportunities** \u2014 Discovery, roles, reasoning\n- **negotiations** \u2014 Owner approval vs A2A, acceptance gates\n- **workflows** \u2014 H2A and A2A request sequences";
|
|
9
9
|
/**
|
|
10
10
|
* Detailed canonical topic content for GET /api/docs.
|
|
11
11
|
* Indexed by topic name; each contains current entity, capability, and lifecycle facts.
|
|
@@ -30,7 +30,7 @@ Index Network is a private, intent-driven discovery protocol. Users express inte
|
|
|
30
30
|
|
|
31
31
|
**Communities & Networks** — Private groups where members share intents and discover connections via shared membership.
|
|
32
32
|
|
|
33
|
-
**Opportunities** — Discovered matches between users. Matches
|
|
33
|
+
**Opportunities** — Discovered matches between users. Matches start negotiating; agreement advances to pending owner review, then accepted/rejected/expired.
|
|
34
34
|
|
|
35
35
|
**Negotiations** — Agents coordinate, users approve. **A2A acceptance is not owner approval.** These are separate gates.
|
|
36
36
|
|
|
@@ -131,16 +131,15 @@ Discovery is networked — it only finds matches within shared networks. This pr
|
|
|
131
131
|
**Opportunity** is a discovered connection between two or more users based on complementary intents and shared network membership. Each opportunity has:
|
|
132
132
|
- Parties (the people being connected)
|
|
133
133
|
- Roles (party)
|
|
134
|
-
- Status (
|
|
134
|
+
- Status (negotiating → pending owner review → accepted/rejected/expired)
|
|
135
135
|
- Match reasoning (why they're a good fit)
|
|
136
136
|
- Confidence score (0-1 from evaluation)
|
|
137
137
|
|
|
138
138
|
### Opportunity Lifecycle
|
|
139
|
-
1. **
|
|
140
|
-
2. **
|
|
141
|
-
3. **
|
|
142
|
-
4. **
|
|
143
|
-
5. **Rejected** or **Expired**: The opportunity no longer advances automatically.
|
|
139
|
+
1. **Negotiating**: Agents exchange structured turns under the negotiation rules.
|
|
140
|
+
2. **Pending**: Agent agreement recommends a connection for separate owner review. An owner's accept opens their chat right away; the status stays pending until every participant has accepted.
|
|
141
|
+
3. **Accepted**: Every participant has accepted.
|
|
142
|
+
4. **Rejected** or **Expired**: The opportunity no longer advances automatically. Expired means an intent was archived.
|
|
144
143
|
|
|
145
144
|
### Background Matching
|
|
146
145
|
Approved intents are evaluated in the background. GET /api/opportunities only reviews persisted opportunities; it does not start matching.
|