@indexnetwork/protocol 4.5.0-rc.328.1 → 4.5.0-rc.329.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.
@@ -9,13 +9,23 @@ export declare const NEGOTIATOR_PERSONA_ID = "negotiator";
9
9
  /**
10
10
  * Client-scoped tool allowlist for the negotiator persona.
11
11
  *
12
- * Deliberately excludes every network-facing capability: no discovery
13
- * (`discover_opportunities`), no network/membership management, no profile or
14
- * intent writes, no contact import. This agent works for one client; as the
15
- * orchestrator sunsets, network-facing capabilities migrate here deliberately
16
- * (out of scope for P4.1).
12
+ * P4.5 (IND-413) expanded this from the read-mostly P4.1 set: with direct
13
+ * opportunity discovery retiring alongside the orchestrator, discovery is
14
+ * purely signal-based so the negotiator (the surviving personal-agent chat
15
+ * surface) manages the client's signals, profile knowledge, memberships, and
16
+ * contacts.
17
+ *
18
+ * Still deliberately excluded:
19
+ * - discovery runs (`discover_opportunities`, `get/cancel_discovery_run`) —
20
+ * retired capability; matching happens in the background from signals,
21
+ * - whole-network administration (`create/update/delete_network`) — a
22
+ * human/UI act for now (joins/leaves are allowed),
23
+ * - onboarding plumbing (`complete_onboarding`,
24
+ * `record_onboarding_privacy_consent`),
25
+ * - agent management (`register/update/delete_agent`, permission grants),
26
+ * - `confirm_opportunity_delivery` (OpenClaw ledger write, never chat).
17
27
  */
18
- export declare const NEGOTIATOR_TOOL_NAMES: readonly ["list_negotiations", "get_negotiation", "respond_to_negotiation", "list_opportunities", "read_intents", "read_premises"];
28
+ export declare const NEGOTIATOR_TOOL_NAMES: readonly ["list_negotiations", "get_negotiation", "respond_to_negotiation", "list_opportunities", "update_opportunity", "read_intents", "create_intent", "update_intent", "delete_intent", "search_intents", "read_intent_indexes", "create_intent_index", "delete_intent_index", "read_user_contexts", "create_user_context", "update_user_context", "confirm_user_context", "preview_user_context", "read_premises", "create_premise", "update_premise", "retract_premise", "read_networks", "read_network_memberships", "create_network_membership", "delete_network_membership", "list_contacts", "search_contacts", "add_contact", "remove_contact", "import_contacts", "import_gmail_contacts", "scrape_url"];
19
29
  /**
20
30
  * Filters a full chat-tool registry down to the negotiator allowlist.
21
31
  * Exported separately so the scoping rule is unit-testable without
@@ -38,10 +48,17 @@ export declare function createNegotiatorTools(deps: ToolContext, preResolvedCont
38
48
  * Creates a negotiator `ChatPersonaConfig` bound to the client's personal
39
49
  * negotiator agent row identity.
40
50
  *
41
- * Loop behaviors are all OFF: no create-intent callback and no
42
- * hallucinated-block auto-invoke/strip — the negotiator's toolset cannot
43
- * legitimately produce opportunity/intent-proposal blocks, and it must never
44
- * inherit the orchestrator's discovery auto-invocation.
51
+ * Loop behaviors (P4.5):
52
+ * - `hallucinationRecovery: true` with `create_intent` in the toolset the
53
+ * model can legitimately produce ```intent_proposal blocks, so unbacked
54
+ * blocks must be detected/auto-invoked/stripped. The auto-invoke path is
55
+ * confirm-safe: `create_intent` returns a proposal card that persists
56
+ * nothing until the client approves it in the UI. A hallucinated
57
+ * ```opportunity block maps to `discover_opportunities`, which is absent
58
+ * from this toolset — the loop falls back to a correction message and the
59
+ * final-response strip still removes the unbacked block.
60
+ * - `createIntentCallback: false` — discovery-coupled (fires only off
61
+ * `discover_opportunities` results); retired along with direct discovery.
45
62
  *
46
63
  * @param opts - Identity from the user's `type='personal'` agent row
47
64
  */
@@ -1 +1 @@
1
- {"version":3,"file":"negotiator.persona.d.ts","sourceRoot":"/","sources":["chat/negotiator.persona.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC9H,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAgC,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAYpG;;;GAGG;AACH,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD;;;;;;;;GAQG;AACH,eAAO,MAAM,q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 export const NEGOTIATOR_PERSONA_ID = "negotiator";
17
17
  /**
18
18
  * Client-scoped tool allowlist for the negotiator persona.
19
19
  *
20
- * Deliberately excludes every network-facing capability: no discovery
21
- * (`discover_opportunities`), no network/membership management, no profile or
22
- * intent writes, no contact import. This agent works for one client; as the
23
- * orchestrator sunsets, network-facing capabilities migrate here deliberately
24
- * (out of scope for P4.1).
20
+ * P4.5 (IND-413) expanded this from the read-mostly P4.1 set: with direct
21
+ * opportunity discovery retiring alongside the orchestrator, discovery is
22
+ * purely signal-based so the negotiator (the surviving personal-agent chat
23
+ * surface) manages the client's signals, profile knowledge, memberships, and
24
+ * contacts.
25
+ *
26
+ * Still deliberately excluded:
27
+ * - discovery runs (`discover_opportunities`, `get/cancel_discovery_run`) —
28
+ * retired capability; matching happens in the background from signals,
29
+ * - whole-network administration (`create/update/delete_network`) — a
30
+ * human/UI act for now (joins/leaves are allowed),
31
+ * - onboarding plumbing (`complete_onboarding`,
32
+ * `record_onboarding_privacy_consent`),
33
+ * - agent management (`register/update/delete_agent`, permission grants),
34
+ * - `confirm_opportunity_delivery` (OpenClaw ledger write, never chat).
25
35
  */
26
36
  export const NEGOTIATOR_TOOL_NAMES = [
37
+ // Negotiation record — the advocate core (P4.1)
27
38
  "list_negotiations",
28
39
  "get_negotiation",
29
40
  "respond_to_negotiation",
30
41
  "list_opportunities",
42
+ "update_opportunity",
43
+ // Signals — the input surface of signal-based discovery (P4.5)
31
44
  "read_intents",
45
+ "create_intent",
46
+ "update_intent",
47
+ "delete_intent",
48
+ "search_intents",
49
+ "read_intent_indexes",
50
+ "create_intent_index",
51
+ "delete_intent_index",
52
+ // Profile knowledge (P4.5)
53
+ "read_user_contexts",
54
+ "create_user_context",
55
+ "update_user_context",
56
+ "confirm_user_context",
57
+ "preview_user_context",
58
+ // Premises (P4.5; read was already in P4.1)
32
59
  "read_premises",
60
+ "create_premise",
61
+ "update_premise",
62
+ "retract_premise",
63
+ // Networks — joins/leaves only, no network administration (P4.5)
64
+ "read_networks",
65
+ "read_network_memberships",
66
+ "create_network_membership",
67
+ "delete_network_membership",
68
+ // Contacts — dormant while CONTACTS_ENABLED=false (P4.5)
69
+ "list_contacts",
70
+ "search_contacts",
71
+ "add_contact",
72
+ "remove_contact",
73
+ "import_contacts",
74
+ "import_gmail_contacts",
75
+ // Utility — create_intent's own contract instructs scraping pasted URLs
76
+ // before synthesizing a signal description (P4.5)
77
+ "scrape_url",
33
78
  ];
34
79
  const NEGOTIATOR_TOOL_ALLOWLIST = new Set(NEGOTIATOR_TOOL_NAMES);
35
80
  /**
@@ -57,10 +102,17 @@ export async function createNegotiatorTools(deps, preResolvedContext) {
57
102
  * Creates a negotiator `ChatPersonaConfig` bound to the client's personal
58
103
  * negotiator agent row identity.
59
104
  *
60
- * Loop behaviors are all OFF: no create-intent callback and no
61
- * hallucinated-block auto-invoke/strip — the negotiator's toolset cannot
62
- * legitimately produce opportunity/intent-proposal blocks, and it must never
63
- * inherit the orchestrator's discovery auto-invocation.
105
+ * Loop behaviors (P4.5):
106
+ * - `hallucinationRecovery: true` with `create_intent` in the toolset the
107
+ * model can legitimately produce ```intent_proposal blocks, so unbacked
108
+ * blocks must be detected/auto-invoked/stripped. The auto-invoke path is
109
+ * confirm-safe: `create_intent` returns a proposal card that persists
110
+ * nothing until the client approves it in the UI. A hallucinated
111
+ * ```opportunity block maps to `discover_opportunities`, which is absent
112
+ * from this toolset — the loop falls back to a correction message and the
113
+ * final-response strip still removes the unbacked block.
114
+ * - `createIntentCallback: false` — discovery-coupled (fires only off
115
+ * `discover_opportunities` results); retired along with direct discovery.
64
116
  *
65
117
  * @param opts - Identity from the user's `type='personal'` agent row
66
118
  */
@@ -71,7 +123,7 @@ export function createNegotiatorPersona(opts) {
71
123
  createTools: (deps, preResolvedContext) => createNegotiatorTools(deps, preResolvedContext),
72
124
  loopBehaviors: {
73
125
  createIntentCallback: false,
74
- hallucinationRecovery: false,
126
+ hallucinationRecovery: true,
75
127
  },
76
128
  };
77
129
  }
@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QACtF,WAAW,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,kBAAkB,CAAC;QAC1F,aAAa,EAAE;YACb,oBAAoB,EAAE,KAAK;YAC3B,qBAAqB,EAAE,KAAK;SAC7B;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { createChatTools, type ChatTools, type ToolContext, type ResolvedToolContext } from \"../shared/agent/tool.factory.js\";\nimport type { ChatPersonaConfig } from \"./chat.persona.js\";\nimport { buildNegotiatorSystemContent, type NegotiatorPromptOptions } from \"./negotiator.prompt.js\";\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// NEGOTIATOR PERSONA (P4.1)\n// ═══════════════════════════════════════════════════════════════════════════════\n//\n// A pure persona addition on the P4.0 persona-neutral chat runtime: advocate\n// prompt, client-scoped toolset, and all orchestrator loop behaviors OFF.\n// Unlike the orchestrator (a static singleton), the negotiator persona is\n// created per session because its identity comes from the user's\n// `type='personal'` agent row (name/description).\n\n/**\n * Persona id for the user's personal negotiator. Matches the\n * `conversations.persona` column value for negotiator DM sessions.\n */\nexport const NEGOTIATOR_PERSONA_ID = \"negotiator\";\n\n/**\n * Client-scoped tool allowlist for the negotiator persona.\n *\n * Deliberately excludes every network-facing capability: no discovery\n * (`discover_opportunities`), no network/membership management, no profile or\n * intent writes, no contact import. This agent works for one client; as the\n * orchestrator sunsets, network-facing capabilities migrate here deliberately\n * (out of scope for P4.1).\n */\nexport const NEGOTIATOR_TOOL_NAMES = [\n \"list_negotiations\",\n \"get_negotiation\",\n \"respond_to_negotiation\",\n \"list_opportunities\",\n \"read_intents\",\n \"read_premises\",\n] as const;\n\nconst NEGOTIATOR_TOOL_ALLOWLIST: ReadonlySet<string> = new Set(NEGOTIATOR_TOOL_NAMES);\n\n/**\n * Filters a full chat-tool registry down to the negotiator allowlist.\n * Exported separately so the scoping rule is unit-testable without\n * constructing the full tool factory dependency graph.\n */\nexport function filterNegotiatorTools<T extends { name: string }>(tools: T[]): T[] {\n return tools.filter((t) => NEGOTIATOR_TOOL_ALLOWLIST.has(t.name));\n}\n\n/**\n * Creates the negotiator persona's client-scoped toolset.\n *\n * Reuses the standard chat tool factory (so context resolution, scope\n * derivation, logging, and error handling stay identical) and filters the\n * registry to the allowlist. The negotiation tools are already context-bound\n * to `context.userId`, so every tool in this set can only read or act on the\n * calling client's own data.\n */\nexport async function createNegotiatorTools(\n deps: ToolContext,\n preResolvedContext?: ResolvedToolContext,\n): Promise<ChatTools> {\n const tools = await createChatTools(deps, preResolvedContext);\n return filterNegotiatorTools(tools);\n}\n\n/**\n * Creates a negotiator `ChatPersonaConfig` bound to the client's personal\n * negotiator agent row identity.\n *\n * Loop behaviors are all OFF: no create-intent callback and no\n * hallucinated-block auto-invoke/strip the negotiator's toolset cannot\n * legitimately produce opportunity/intent-proposal blocks, and it must never\n * inherit the orchestrator's discovery auto-invocation.\n *\n * @param opts - Identity from the user's `type='personal'` agent row\n */\nexport function createNegotiatorPersona(opts: NegotiatorPromptOptions): ChatPersonaConfig {\n return {\n id: NEGOTIATOR_PERSONA_ID,\n buildSystemContent: (ctx, iterCtx) => buildNegotiatorSystemContent(ctx, opts, iterCtx),\n createTools: (deps, preResolvedContext) => createNegotiatorTools(deps, preResolvedContext),\n loopBehaviors: {\n createIntentCallback: false,\n hallucinationRecovery: false,\n },\n };\n}\n"]}
1
+ {"version":3,"file":"negotiator.persona.js","sourceRoot":"/","sources":["chat/negotiator.persona.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA8D,MAAM,iCAAiC,CAAC;AAE9H,OAAO,EAAE,4BAA4B,EAAgC,MAAM,wBAAwB,CAAC;AAEpG,kFAAkF;AAClF,4BAA4B;AAC5B,kFAAkF;AAClF,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,0EAA0E;AAC1E,iEAAiE;AACjE,kDAAkD;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAEl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B;QACzB,kBAAkB,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,4BAA4B,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC;QACtF,WAAW,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,kBAAkB,CAAC;QAC1F,aAAa,EAAE;YACb,oBAAoB,EAAE,KAAK;YAC3B,qBAAqB,EAAE,IAAI;SAC5B;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { createChatTools, type ChatTools, type ToolContext, type ResolvedToolContext } from \"../shared/agent/tool.factory.js\";\nimport type { ChatPersonaConfig } from \"./chat.persona.js\";\nimport { buildNegotiatorSystemContent, type NegotiatorPromptOptions } from \"./negotiator.prompt.js\";\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// NEGOTIATOR PERSONA (P4.1)\n// ═══════════════════════════════════════════════════════════════════════════════\n//\n// A pure persona addition on the P4.0 persona-neutral chat runtime: advocate\n// prompt, client-scoped toolset, and all orchestrator loop behaviors OFF.\n// Unlike the orchestrator (a static singleton), the negotiator persona is\n// created per session because its identity comes from the user's\n// `type='personal'` agent row (name/description).\n\n/**\n * Persona id for the user's personal negotiator. Matches the\n * `conversations.persona` column value for negotiator DM sessions.\n */\nexport const NEGOTIATOR_PERSONA_ID = \"negotiator\";\n\n/**\n * Client-scoped tool allowlist for the negotiator persona.\n *\n * P4.5 (IND-413) expanded this from the read-mostly P4.1 set: with direct\n * opportunity discovery retiring alongside the orchestrator, discovery is\n * purely signal-based — so the negotiator (the surviving personal-agent chat\n * surface) manages the client's signals, profile knowledge, memberships, and\n * contacts.\n *\n * Still deliberately excluded:\n * - discovery runs (`discover_opportunities`, `get/cancel_discovery_run`) —\n * retired capability; matching happens in the background from signals,\n * - whole-network administration (`create/update/delete_network`) — a\n * human/UI act for now (joins/leaves are allowed),\n * - onboarding plumbing (`complete_onboarding`,\n * `record_onboarding_privacy_consent`),\n * - agent management (`register/update/delete_agent`, permission grants),\n * - `confirm_opportunity_delivery` (OpenClaw ledger write, never chat).\n */\nexport const NEGOTIATOR_TOOL_NAMES = [\n // Negotiation record — the advocate core (P4.1)\n \"list_negotiations\",\n \"get_negotiation\",\n \"respond_to_negotiation\",\n \"list_opportunities\",\n \"update_opportunity\",\n // Signals — the input surface of signal-based discovery (P4.5)\n \"read_intents\",\n \"create_intent\",\n \"update_intent\",\n \"delete_intent\",\n \"search_intents\",\n \"read_intent_indexes\",\n \"create_intent_index\",\n \"delete_intent_index\",\n // Profile knowledge (P4.5)\n \"read_user_contexts\",\n \"create_user_context\",\n \"update_user_context\",\n \"confirm_user_context\",\n \"preview_user_context\",\n // Premises (P4.5; read was already in P4.1)\n \"read_premises\",\n \"create_premise\",\n \"update_premise\",\n \"retract_premise\",\n // Networks — joins/leaves only, no network administration (P4.5)\n \"read_networks\",\n \"read_network_memberships\",\n \"create_network_membership\",\n \"delete_network_membership\",\n // Contacts — dormant while CONTACTS_ENABLED=false (P4.5)\n \"list_contacts\",\n \"search_contacts\",\n \"add_contact\",\n \"remove_contact\",\n \"import_contacts\",\n \"import_gmail_contacts\",\n // Utility — create_intent's own contract instructs scraping pasted URLs\n // before synthesizing a signal description (P4.5)\n \"scrape_url\",\n] as const;\n\nconst NEGOTIATOR_TOOL_ALLOWLIST: ReadonlySet<string> = new Set(NEGOTIATOR_TOOL_NAMES);\n\n/**\n * Filters a full chat-tool registry down to the negotiator allowlist.\n * Exported separately so the scoping rule is unit-testable without\n * constructing the full tool factory dependency graph.\n */\nexport function filterNegotiatorTools<T extends { name: string }>(tools: T[]): T[] {\n return tools.filter((t) => NEGOTIATOR_TOOL_ALLOWLIST.has(t.name));\n}\n\n/**\n * Creates the negotiator persona's client-scoped toolset.\n *\n * Reuses the standard chat tool factory (so context resolution, scope\n * derivation, logging, and error handling stay identical) and filters the\n * registry to the allowlist. The negotiation tools are already context-bound\n * to `context.userId`, so every tool in this set can only read or act on the\n * calling client's own data.\n */\nexport async function createNegotiatorTools(\n deps: ToolContext,\n preResolvedContext?: ResolvedToolContext,\n): Promise<ChatTools> {\n const tools = await createChatTools(deps, preResolvedContext);\n return filterNegotiatorTools(tools);\n}\n\n/**\n * Creates a negotiator `ChatPersonaConfig` bound to the client's personal\n * negotiator agent row identity.\n *\n * Loop behaviors (P4.5):\n * - `hallucinationRecovery: true` with `create_intent` in the toolset the\n * model can legitimately produce ```intent_proposal blocks, so unbacked\n * blocks must be detected/auto-invoked/stripped. The auto-invoke path is\n * confirm-safe: `create_intent` returns a proposal card that persists\n * nothing until the client approves it in the UI. A hallucinated\n * ```opportunity block maps to `discover_opportunities`, which is absent\n * from this toolset — the loop falls back to a correction message and the\n * final-response strip still removes the unbacked block.\n * - `createIntentCallback: false` — discovery-coupled (fires only off\n * `discover_opportunities` results); retired along with direct discovery.\n *\n * @param opts - Identity from the user's `type='personal'` agent row\n */\nexport function createNegotiatorPersona(opts: NegotiatorPromptOptions): ChatPersonaConfig {\n return {\n id: NEGOTIATOR_PERSONA_ID,\n buildSystemContent: (ctx, iterCtx) => buildNegotiatorSystemContent(ctx, opts, iterCtx),\n createTools: (deps, preResolvedContext) => createNegotiatorTools(deps, preResolvedContext),\n loopBehaviors: {\n createIntentCallback: false,\n hallucinationRecovery: true,\n },\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"negotiator.prompt.d.ts","sourceRoot":"/","sources":["chat/negotiator.prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAajE,+EAA+E;AAC/E,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,uBAAuB,EAC7B,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,MAAM,CAyDR"}
1
+ {"version":3,"file":"negotiator.prompt.d.ts","sourceRoot":"/","sources":["chat/negotiator.prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAkBjE,+EAA+E;AAC/E,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,uBAAuB,EAC7B,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,MAAM,CAwER"}
@@ -26,13 +26,16 @@ You work for exactly one client: ${ctx.userName}. You represent them in negotiat
26
26
  ## What you do in this chat
27
27
  - **Report on negotiations**: when the client asks what is happening, look up their negotiations and summarize status, counterparties, and where things stand.
28
28
  - **Explain decisions**: when the client asks why something was pursued, declined, or stalled ("why did you pass on X?"), find the relevant negotiation and answer from the actual record — the messages, outcomes, and reasoning stored there. Never reconstruct a rationale from memory.
29
- - **Review opportunities**: show the client the opportunities currently waiting on them and what accepting or passing would mean.
30
- - **Stay grounded in their signals**: their active intents and premises define what you negotiate for. Read them before making claims about what the client is looking for.
31
- - **Act on instruction**: respond to a negotiation (accept, decline, or reply) only when the client explicitly tells you to in this conversation. Never take a negotiation action the client did not just ask for.
29
+ - **Review and act on opportunities**: show the client the opportunities currently waiting on them and what accepting or passing would mean; accept or pass on one only when they explicitly say so.
30
+ - **Manage their signals**: their active intents (signals) define what you negotiate for and matching is driven entirely by them. When the client tells you what they are looking for, draft a clear, specific signal and create it; refine or retire signals when they ask. If a signal request is vague, read their profile and existing signals first, then propose a sharper wording before creating it. If they paste a link describing what they want, read it first and synthesize the signal from its content.
31
+ - **Keep their knowledge current**: when the client shares a new fact about themselves ("I moved to Berlin", "I stopped consulting"), update their profile context or premises so future negotiations reflect reality. Read before you write update the existing entry instead of duplicating it.
32
+ - **Handle memberships**: list the communities they belong to and join or leave communities when they ask.
33
+ - **Manage their contacts**: look up, add, remove, or import contacts when they ask (when contact features are enabled).
34
+ - **Act on instruction**: every write — a negotiation response, an opportunity decision, a signal, a profile or premise change, a membership change, a contact change — happens only when the client explicitly asks for it in this conversation. Never write anything the client did not just ask for.
32
35
 
33
36
  ## What you cannot do here
34
- - **No network-wide discovery.** You cannot look for new people, run matching, or create new connections from this chat. New matches are discovered by the system in the background and appear on the client's home page.
35
- - **No profile, community, or membership management.** If the client asks for those, tell them plainly that it is outside your remit as their negotiator and they can do it from the main chat or the app.
37
+ - **No direct discovery.** You cannot run matching or search for people yourself. Matching happens automatically in the background from the client's signals shaping the signals is how you steer it. New matches appear on the client's home page and in this chat as opportunities.
38
+ - **No community administration.** You can join or leave communities for the client, but you cannot create, rename, or delete communities point them to the app for that.
36
39
  - You cannot push updates after this conversation ends. You only report when asked.
37
40
 
38
41
  ## Session
@@ -56,14 +59,26 @@ ${profileContext}
56
59
  | **get_negotiation** | negotiationId | Full negotiation record: messages, outcome, reasoning |
57
60
  | **respond_to_negotiation** | negotiationId, ... | Act on a negotiation — ONLY on explicit client instruction |
58
61
  | **list_opportunities** | — | List the client's actionable opportunities |
59
- | **read_intents** | | The client's active signals (what they're looking for) |
60
- | **read_premises** | — | The client's premises (facts they've established) |
62
+ | **update_opportunity** | opportunityId, status | Accept/pass an opportunity ONLY on explicit client instruction |
63
+ | **read_intents** / **search_intents** | — / query | The client's active signals (what they're looking for) |
64
+ | **create_intent** | description, networkId? | Draft a new signal — returns a proposal card the client approves in the UI |
65
+ | **update_intent** / **delete_intent** | intentId, ... | Refine or retire a signal on instruction |
66
+ | **read_intent_indexes** / **create_intent_index** / **delete_intent_index** | intentId, networkId | Where a signal is placed across communities |
67
+ | **read_user_contexts** / **create_user_context** / **update_user_context** | ... | The client's profile knowledge — read before writing |
68
+ | **preview_user_context** / **confirm_user_context** | ... | Preview/confirm profile updates from sources |
69
+ | **read_premises** / **create_premise** / **update_premise** / **retract_premise** | ... | The client's premises (facts they've established) |
70
+ | **read_networks** / **read_network_memberships** | — | The client's communities and memberships |
71
+ | **create_network_membership** / **delete_network_membership** | networkId | Join/leave a community on instruction |
72
+ | **list_contacts** / **search_contacts** / **add_contact** / **remove_contact** | ... | The client's contacts |
73
+ | **import_contacts** / **import_gmail_contacts** | ... | Bulk contact import on instruction |
74
+ | **scrape_url** | url, objective | Read a link the client pasted (e.g. before drafting a signal from it) |
61
75
 
62
76
  ## Grounding rules
63
77
  - **Never fabricate.** Every claim about a negotiation, opportunity, signal, or premise must come from a tool result in this conversation. If you have not looked it up this turn, look it up before answering. Only the client's identity and profile above are preloaded.
64
78
  - **Check tool results before confirming.** Never claim an action succeeded without a successful tool result for it.
65
79
  - **Be honest about your own actions.** If the record shows you made a judgment call the client disagrees with, explain the reasoning from the record — do not get defensive, and do not invent justifications the record does not support.
66
- - **Never expose IDs, UUIDs, tool names, or raw JSON** to the client. Translate everything into natural language; refer to people and opportunities by name.
80
+ - **Pass proposal cards through verbatim.** When a tool result contains a fenced code block meant for the app (e.g. \`\`\`intent_proposal from create_intent), include that block verbatim in your reply — the app renders it as an interactive card the client approves or skips. Never write such a block yourself without a backing tool result.
81
+ - **Never expose IDs, UUIDs, tool names, or raw JSON** to the client. Translate everything into natural language; refer to people and opportunities by name. (Fenced proposal blocks from tool results are the one exception — they are rendered as cards, not shown as JSON.)
67
82
  - **Respond in the language of the client's latest message.**
68
83
  - **Voice**: first person, loyal but candid, calm and concise. No hype, no networking clichés, no exaggeration. You are their agent, not a salesperson.
69
84
  - When calling tools, first write a short natural sentence plus a \`>\` blockquote describing what you are checking (e.g. "> Checking the record with Alice"), then leave an empty line after the blockquote.`;
@@ -1 +1 @@
1
- {"version":3,"file":"negotiator.prompt.js","sourceRoot":"/","sources":["chat/negotiator.prompt.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,4BAA4B,CAC1C,GAAwB,EACxB,IAA6B,EAC7B,QAA2B;IAE3B,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtD,MAAM,cAAc,GAAG,GAAG,CAAC,WAAW;QACpC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,CAAC,CAAC,MAAM,CAAC;IACX,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,IAAI,EAAE;QACnD,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI;QACvC,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,WAAW,IAAI,CAAC,SAAS,+CAA+C,GAAG,CAAC,QAAQ;EAC3F,eAAe;mCACkB,GAAG,CAAC,QAAQ;;;;;;;;;;;;;;;YAenC,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,SAAS,UAAU,GAAG,CAAC,MAAM;;;;EAI5D,WAAW;;;;;EAKX,cAAc;;;;;;;;;;;;;;;;;;;;;8MAqB8L,CAAC;AAC/M,CAAC","sourcesContent":["import type { ResolvedToolContext } from \"../shared/agent/tool.factory.js\";\nimport type { IterationContext } from \"./chat.prompt.modules.js\";\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// NEGOTIATOR PERSONA SYSTEM PROMPT (P4.1)\n// ═══════════════════════════════════════════════════════════════════════════════\n//\n// The direct chat line between a user and their personal negotiator agent\n// (the `type='personal'` agent row). Unlike the orchestrator prompt, this\n// persona works for exactly one client: it reports on the client's\n// negotiations and opportunities, explains decisions from the negotiation\n// record, and acts only on explicit client instruction. It has no\n// network-wide discovery capabilities.\n\n/** Identity options resolved from the user's personal negotiator agent row. */\nexport interface NegotiatorPromptOptions {\n /** The negotiator agent's display name (e.g. \"Ada's Negotiator\"). */\n agentName: string;\n /** The negotiator agent's description, when set on the agent row. */\n agentDescription?: string;\n}\n\n/**\n * Builds the system prompt for the negotiator chat persona.\n *\n * Grounded in the client's preloaded user/profile context; everything else\n * (negotiations, opportunities, signals, premises) must be fetched through\n * the client-scoped toolset each turn.\n *\n * @param ctx - Resolved tool context for the current session\n * @param opts - Identity from the client's personal negotiator agent row\n * @param _iterCtx - Iteration context (unused — the negotiator prompt has no\n * dynamic modules; the nudge is injected by the agent loop)\n * @returns The complete system prompt string\n */\nexport function buildNegotiatorSystemContent(\n ctx: ResolvedToolContext,\n opts: NegotiatorPromptOptions,\n _iterCtx?: IterationContext,\n): string {\n const userContext = JSON.stringify(ctx.user, null, 2);\n const profileContext = ctx.userProfile\n ? JSON.stringify(ctx.userProfile, null, 2)\n : \"null\";\n const descriptionLine = opts.agentDescription?.trim()\n ? `\\n${opts.agentDescription.trim()}\\n`\n : \"\";\n\n return `You are ${opts.agentName}, the personal negotiator agent working for ${ctx.userName}.\n${descriptionLine}\nYou work for exactly one client: ${ctx.userName}. You represent them in negotiations with other members' agents across the network, and this chat is your direct line to them. Your job here is to keep your client informed about what you have been doing on their behalf, explain your reasoning honestly, and act only on their explicit instructions.\n\n## What you do in this chat\n- **Report on negotiations**: when the client asks what is happening, look up their negotiations and summarize status, counterparties, and where things stand.\n- **Explain decisions**: when the client asks why something was pursued, declined, or stalled (\"why did you pass on X?\"), find the relevant negotiation and answer from the actual record — the messages, outcomes, and reasoning stored there. Never reconstruct a rationale from memory.\n- **Review opportunities**: show the client the opportunities currently waiting on them and what accepting or passing would mean.\n- **Stay grounded in their signals**: their active intents and premises define what you negotiate for. Read them before making claims about what the client is looking for.\n- **Act on instruction**: respond to a negotiation (accept, decline, or reply) only when the client explicitly tells you to in this conversation. Never take a negotiation action the client did not just ask for.\n\n## What you cannot do here\n- **No network-wide discovery.** You cannot look for new people, run matching, or create new connections from this chat. New matches are discovered by the system in the background and appear on the client's home page.\n- **No profile, community, or membership management.** If the client asks for those, tell them plainly that it is outside your remit as their negotiator and they can do it from the main chat or the app.\n- You cannot push updates after this conversation ends. You only report when asked.\n\n## Session\n- Client: ${ctx.userName} (${ctx.userEmail}), id: ${ctx.userId}\n\n### Client (preloaded context)\n\\`\\`\\`json\n${userContext}\n\\`\\`\\`\n\n### Client Context (preloaded context)\n\\`\\`\\`json\n${profileContext}\n\\`\\`\\`\n\n## Tools Reference\n\n| Tool | Params | What it does |\n|------|--------|-------------|\n| **list_negotiations** | status?, limit? | List the client's negotiations |\n| **get_negotiation** | negotiationId | Full negotiation record: messages, outcome, reasoning |\n| **respond_to_negotiation** | negotiationId, ... | Act on a negotiation — ONLY on explicit client instruction |\n| **list_opportunities** | — | List the client's actionable opportunities |\n| **read_intents** | — | The client's active signals (what they're looking for) |\n| **read_premises** | — | The client's premises (facts they've established) |\n\n## Grounding rules\n- **Never fabricate.** Every claim about a negotiation, opportunity, signal, or premise must come from a tool result in this conversation. If you have not looked it up this turn, look it up before answering. Only the client's identity and profile above are preloaded.\n- **Check tool results before confirming.** Never claim an action succeeded without a successful tool result for it.\n- **Be honest about your own actions.** If the record shows you made a judgment call the client disagrees with, explain the reasoning from the record — do not get defensive, and do not invent justifications the record does not support.\n- **Never expose IDs, UUIDs, tool names, or raw JSON** to the client. Translate everything into natural language; refer to people and opportunities by name.\n- **Respond in the language of the client's latest message.**\n- **Voice**: first person, loyal but candid, calm and concise. No hype, no networking clichés, no exaggeration. You are their agent, not a salesperson.\n- When calling tools, first write a short natural sentence plus a \\`>\\` blockquote describing what you are checking (e.g. \"> Checking the record with Alice\"), then leave an empty line after the blockquote.`;\n}\n"]}
1
+ {"version":3,"file":"negotiator.prompt.js","sourceRoot":"/","sources":["chat/negotiator.prompt.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,4BAA4B,CAC1C,GAAwB,EACxB,IAA6B,EAC7B,QAA2B;IAE3B,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtD,MAAM,cAAc,GAAG,GAAG,CAAC,WAAW;QACpC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,CAAC,CAAC,MAAM,CAAC;IACX,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,IAAI,EAAE;QACnD,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI;QACvC,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,WAAW,IAAI,CAAC,SAAS,+CAA+C,GAAG,CAAC,QAAQ;EAC3F,eAAe;mCACkB,GAAG,CAAC,QAAQ;;;;;;;;;;;;;;;;;;YAkBnC,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,SAAS,UAAU,GAAG,CAAC,MAAM;;;;EAI5D,WAAW;;;;;EAKX,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8MAiC8L,CAAC;AAC/M,CAAC","sourcesContent":["import type { ResolvedToolContext } from \"../shared/agent/tool.factory.js\";\nimport type { IterationContext } from \"./chat.prompt.modules.js\";\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// NEGOTIATOR PERSONA SYSTEM PROMPT (P4.1)\n// ═══════════════════════════════════════════════════════════════════════════════\n//\n// The direct chat line between a user and their personal negotiator agent\n// (the `type='personal'` agent row). Unlike the orchestrator prompt, this\n// persona works for exactly one client: it reports on the client's\n// negotiations and opportunities, explains decisions from the negotiation\n// record, and acts only on explicit client instruction.\n//\n// P4.5 (IND-413): the negotiator also manages the client's signals, profile\n// knowledge, premises, community memberships, and contacts — discovery is\n// purely signal-based, so shaping signals here IS how the client steers\n// matching. It still has no direct discovery capability: matching runs in\n// the background from the signals.\n\n/** Identity options resolved from the user's personal negotiator agent row. */\nexport interface NegotiatorPromptOptions {\n /** The negotiator agent's display name (e.g. \"Ada's Negotiator\"). */\n agentName: string;\n /** The negotiator agent's description, when set on the agent row. */\n agentDescription?: string;\n}\n\n/**\n * Builds the system prompt for the negotiator chat persona.\n *\n * Grounded in the client's preloaded user/profile context; everything else\n * (negotiations, opportunities, signals, premises) must be fetched through\n * the client-scoped toolset each turn.\n *\n * @param ctx - Resolved tool context for the current session\n * @param opts - Identity from the client's personal negotiator agent row\n * @param _iterCtx - Iteration context (unused — the negotiator prompt has no\n * dynamic modules; the nudge is injected by the agent loop)\n * @returns The complete system prompt string\n */\nexport function buildNegotiatorSystemContent(\n ctx: ResolvedToolContext,\n opts: NegotiatorPromptOptions,\n _iterCtx?: IterationContext,\n): string {\n const userContext = JSON.stringify(ctx.user, null, 2);\n const profileContext = ctx.userProfile\n ? JSON.stringify(ctx.userProfile, null, 2)\n : \"null\";\n const descriptionLine = opts.agentDescription?.trim()\n ? `\\n${opts.agentDescription.trim()}\\n`\n : \"\";\n\n return `You are ${opts.agentName}, the personal negotiator agent working for ${ctx.userName}.\n${descriptionLine}\nYou work for exactly one client: ${ctx.userName}. You represent them in negotiations with other members' agents across the network, and this chat is your direct line to them. Your job here is to keep your client informed about what you have been doing on their behalf, explain your reasoning honestly, and act only on their explicit instructions.\n\n## What you do in this chat\n- **Report on negotiations**: when the client asks what is happening, look up their negotiations and summarize status, counterparties, and where things stand.\n- **Explain decisions**: when the client asks why something was pursued, declined, or stalled (\"why did you pass on X?\"), find the relevant negotiation and answer from the actual record — the messages, outcomes, and reasoning stored there. Never reconstruct a rationale from memory.\n- **Review and act on opportunities**: show the client the opportunities currently waiting on them and what accepting or passing would mean; accept or pass on one only when they explicitly say so.\n- **Manage their signals**: their active intents (signals) define what you negotiate for — and matching is driven entirely by them. When the client tells you what they are looking for, draft a clear, specific signal and create it; refine or retire signals when they ask. If a signal request is vague, read their profile and existing signals first, then propose a sharper wording before creating it. If they paste a link describing what they want, read it first and synthesize the signal from its content.\n- **Keep their knowledge current**: when the client shares a new fact about themselves (\"I moved to Berlin\", \"I stopped consulting\"), update their profile context or premises so future negotiations reflect reality. Read before you write — update the existing entry instead of duplicating it.\n- **Handle memberships**: list the communities they belong to and join or leave communities when they ask.\n- **Manage their contacts**: look up, add, remove, or import contacts when they ask (when contact features are enabled).\n- **Act on instruction**: every write — a negotiation response, an opportunity decision, a signal, a profile or premise change, a membership change, a contact change — happens only when the client explicitly asks for it in this conversation. Never write anything the client did not just ask for.\n\n## What you cannot do here\n- **No direct discovery.** You cannot run matching or search for people yourself. Matching happens automatically in the background from the client's signals — shaping the signals is how you steer it. New matches appear on the client's home page and in this chat as opportunities.\n- **No community administration.** You can join or leave communities for the client, but you cannot create, rename, or delete communities — point them to the app for that.\n- You cannot push updates after this conversation ends. You only report when asked.\n\n## Session\n- Client: ${ctx.userName} (${ctx.userEmail}), id: ${ctx.userId}\n\n### Client (preloaded context)\n\\`\\`\\`json\n${userContext}\n\\`\\`\\`\n\n### Client Context (preloaded context)\n\\`\\`\\`json\n${profileContext}\n\\`\\`\\`\n\n## Tools Reference\n\n| Tool | Params | What it does |\n|------|--------|-------------|\n| **list_negotiations** | status?, limit? | List the client's negotiations |\n| **get_negotiation** | negotiationId | Full negotiation record: messages, outcome, reasoning |\n| **respond_to_negotiation** | negotiationId, ... | Act on a negotiation — ONLY on explicit client instruction |\n| **list_opportunities** | — | List the client's actionable opportunities |\n| **update_opportunity** | opportunityId, status | Accept/pass an opportunity — ONLY on explicit client instruction |\n| **read_intents** / **search_intents** | — / query | The client's active signals (what they're looking for) |\n| **create_intent** | description, networkId? | Draft a new signal — returns a proposal card the client approves in the UI |\n| **update_intent** / **delete_intent** | intentId, ... | Refine or retire a signal on instruction |\n| **read_intent_indexes** / **create_intent_index** / **delete_intent_index** | intentId, networkId | Where a signal is placed across communities |\n| **read_user_contexts** / **create_user_context** / **update_user_context** | ... | The client's profile knowledge — read before writing |\n| **preview_user_context** / **confirm_user_context** | ... | Preview/confirm profile updates from sources |\n| **read_premises** / **create_premise** / **update_premise** / **retract_premise** | ... | The client's premises (facts they've established) |\n| **read_networks** / **read_network_memberships** | — | The client's communities and memberships |\n| **create_network_membership** / **delete_network_membership** | networkId | Join/leave a community on instruction |\n| **list_contacts** / **search_contacts** / **add_contact** / **remove_contact** | ... | The client's contacts |\n| **import_contacts** / **import_gmail_contacts** | ... | Bulk contact import on instruction |\n| **scrape_url** | url, objective | Read a link the client pasted (e.g. before drafting a signal from it) |\n\n## Grounding rules\n- **Never fabricate.** Every claim about a negotiation, opportunity, signal, or premise must come from a tool result in this conversation. If you have not looked it up this turn, look it up before answering. Only the client's identity and profile above are preloaded.\n- **Check tool results before confirming.** Never claim an action succeeded without a successful tool result for it.\n- **Be honest about your own actions.** If the record shows you made a judgment call the client disagrees with, explain the reasoning from the record — do not get defensive, and do not invent justifications the record does not support.\n- **Pass proposal cards through verbatim.** When a tool result contains a fenced code block meant for the app (e.g. \\`\\`\\`intent_proposal from create_intent), include that block verbatim in your reply — the app renders it as an interactive card the client approves or skips. Never write such a block yourself without a backing tool result.\n- **Never expose IDs, UUIDs, tool names, or raw JSON** to the client. Translate everything into natural language; refer to people and opportunities by name. (Fenced proposal blocks from tool results are the one exception — they are rendered as cards, not shown as JSON.)\n- **Respond in the language of the client's latest message.**\n- **Voice**: first person, loyal but candid, calm and concise. No hype, no networking clichés, no exaggeration. You are their agent, not a salesperson.\n- When calling tools, first write a short natural sentence plus a \\`>\\` blockquote describing what you are checking (e.g. \"> Checking the record with Alice\"), then leave an empty line after the blockquote.`;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "4.5.0-rc.328.1",
3
+ "version": "4.5.0-rc.329.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",