@indexnetwork/protocol 1.2.1-rc.125.1 → 1.3.0-rc.126.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/dist/chat/chat-streaming.types.d.ts +20 -2
- package/dist/chat/chat-streaming.types.d.ts.map +1 -1
- package/dist/chat/chat-streaming.types.js +6 -0
- package/dist/chat/chat-streaming.types.js.map +1 -1
- package/dist/chat/chat.agent.d.ts +7 -0
- package/dist/chat/chat.agent.d.ts.map +1 -1
- package/dist/chat/chat.agent.js.map +1 -1
- package/dist/chat/chat.streamer.d.ts.map +1 -1
- package/dist/chat/chat.streamer.js +7 -1
- package/dist/chat/chat.streamer.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/negotiation/negotiation.summarizer.d.ts +13 -0
- package/dist/negotiation/negotiation.summarizer.d.ts.map +1 -0
- package/dist/negotiation/negotiation.summarizer.js +86 -0
- package/dist/negotiation/negotiation.summarizer.js.map +1 -0
- package/dist/opportunity/discovery-question.helper.d.ts +3 -2
- package/dist/opportunity/discovery-question.helper.d.ts.map +1 -1
- package/dist/opportunity/discovery-question.helper.js +1 -1
- package/dist/opportunity/discovery-question.helper.js.map +1 -1
- package/dist/opportunity/opportunity.discover.d.ts +8 -0
- package/dist/opportunity/opportunity.discover.d.ts.map +1 -1
- package/dist/opportunity/opportunity.discover.js +93 -60
- package/dist/opportunity/opportunity.discover.js.map +1 -1
- package/dist/opportunity/opportunity.tools.d.ts.map +1 -1
- package/dist/opportunity/opportunity.tools.js +1 -0
- package/dist/opportunity/opportunity.tools.js.map +1 -1
- package/dist/opportunity/question.prompt.d.ts +8 -2
- package/dist/opportunity/question.prompt.d.ts.map +1 -1
- package/dist/opportunity/question.prompt.js +25 -59
- package/dist/opportunity/question.prompt.js.map +1 -1
- package/dist/shared/agent/model.config.d.ts +5 -0
- package/dist/shared/agent/model.config.d.ts.map +1 -1
- package/dist/shared/agent/model.config.js +16 -0
- package/dist/shared/agent/model.config.js.map +1 -1
- package/dist/shared/agent/tool.factory.d.ts.map +1 -1
- package/dist/shared/agent/tool.factory.js +1 -0
- package/dist/shared/agent/tool.factory.js.map +1 -1
- package/dist/shared/agent/tool.helpers.d.ts +5 -0
- package/dist/shared/agent/tool.helpers.d.ts.map +1 -1
- package/dist/shared/agent/tool.helpers.js.map +1 -1
- package/dist/shared/interfaces/negotiation-summary.interface.d.ts +21 -0
- package/dist/shared/interfaces/negotiation-summary.interface.d.ts.map +1 -0
- package/dist/shared/interfaces/negotiation-summary.interface.js +2 -0
- package/dist/shared/interfaces/negotiation-summary.interface.js.map +1 -0
- package/dist/shared/observability/trace.d.ts +61 -0
- package/dist/shared/observability/trace.d.ts.map +1 -0
- package/dist/shared/observability/trace.js +146 -0
- package/dist/shared/observability/trace.js.map +1 -0
- package/dist/shared/schemas/negotiation-digest.schema.d.ts +59 -0
- package/dist/shared/schemas/negotiation-digest.schema.d.ts.map +1 -0
- package/dist/shared/schemas/negotiation-digest.schema.js +34 -0
- package/dist/shared/schemas/negotiation-digest.schema.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol-side contract for summarizing discovery negotiations into compact
|
|
3
|
+
* digests. The protocol layer only sees this shape; the LLM implementation
|
|
4
|
+
* (NegotiationSummarizer) is injected through dependency wiring.
|
|
5
|
+
*
|
|
6
|
+
* Pattern mirrors ChatSummaryReader: protocol defines the read shape, the
|
|
7
|
+
* backend (or any consumer) provides the implementation.
|
|
8
|
+
*/
|
|
9
|
+
import type { DiscoveryNegotiation } from "../../opportunity/question.prompt.js";
|
|
10
|
+
import type { DiscoveryNegotiationDigest } from "../schemas/negotiation-digest.schema.js";
|
|
11
|
+
export interface NegotiationSummaryReader {
|
|
12
|
+
/**
|
|
13
|
+
* Summarize a single negotiation into a compact digest.
|
|
14
|
+
*
|
|
15
|
+
* @returns the digest, or `null` when summarization fails (caller should
|
|
16
|
+
* fall back to a deterministic minimal digest so questions can still
|
|
17
|
+
* be generated).
|
|
18
|
+
*/
|
|
19
|
+
summarize(negotiation: DiscoveryNegotiation): Promise<DiscoveryNegotiationDigest | null>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=negotiation-summary.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiation-summary.interface.d.ts","sourceRoot":"","sources":["../../../src/shared/interfaces/negotiation-summary.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAE1F,MAAM,WAAW,wBAAwB;IACvC;;;;;;OAMG;IACH,SAAS,CAAC,WAAW,EAAE,oBAAoB,GAAG,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAC;CAC1F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiation-summary.interface.js","sourceRoot":"","sources":["../../../src/shared/interfaces/negotiation-summary.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrap an async function so it emits `graph_start` / `graph_end` events around
|
|
3
|
+
* its execution. `durationMs` is measured in wall time. If the wrapped
|
|
4
|
+
* function throws, `graph_end` still fires before the error propagates.
|
|
5
|
+
*
|
|
6
|
+
* Use ONLY for actual LangGraph compiled state machines (Opportunity graph,
|
|
7
|
+
* Negotiation graph, etc). For logical groupings of inline work, use
|
|
8
|
+
* `tracePhase` — it has a distinct visual in the trace UI so users can tell
|
|
9
|
+
* "this is a graph" from "this is a phase".
|
|
10
|
+
*/
|
|
11
|
+
export declare function traceGraph<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
|
12
|
+
/**
|
|
13
|
+
* Wrap an async function so it emits `phase_start` / `phase_end` events around
|
|
14
|
+
* its execution. Phases are logical groupings of inline async work — they
|
|
15
|
+
* share container semantics with graphs (they can host agents) but render
|
|
16
|
+
* differently in the trace UI to make it clear they're NOT LangGraph state
|
|
17
|
+
* machines.
|
|
18
|
+
*/
|
|
19
|
+
export declare function tracePhase<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Wrap an async function so it emits `agent_start` / `agent_end` events. The
|
|
22
|
+
* optional `summarize` callback produces a short string shown in the trace
|
|
23
|
+
* panel; receives the wrapped function's resolved value.
|
|
24
|
+
*/
|
|
25
|
+
export declare function traceAgent<T>(name: string, fn: () => Promise<T>, summarize?: (value: T) => string | undefined): Promise<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Method decorator. Wraps the decorated async method in `traceGraph(name, ...)`.
|
|
28
|
+
* Use on class methods that represent a logical "graph" (a sub-flow with
|
|
29
|
+
* internal agent calls).
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* class RefinePhase {
|
|
33
|
+
* @TraceGraph("Refine")
|
|
34
|
+
* async run() { ... }
|
|
35
|
+
* }
|
|
36
|
+
*/
|
|
37
|
+
export declare function TraceGraph(name: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Method decorator. Wraps the decorated async method in `traceAgent(name, ...)`.
|
|
40
|
+
* Use on class methods that represent a single agent step (one LLM call,
|
|
41
|
+
* one summarization, etc).
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* class ChatSummary {
|
|
45
|
+
* @TraceAgent("Chat summary")
|
|
46
|
+
* async run() { ... }
|
|
47
|
+
* }
|
|
48
|
+
*/
|
|
49
|
+
export declare function TraceAgent(name: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Method decorator. Wraps the decorated async method in `tracePhase(name, ...)`.
|
|
52
|
+
* Use for logical groupings of inline work that aren't LangGraph state machines.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* class RefinePhase {
|
|
56
|
+
* @TracePhase("Refine")
|
|
57
|
+
* async run() { ... }
|
|
58
|
+
* }
|
|
59
|
+
*/
|
|
60
|
+
export declare function TracePhase(name: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
61
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../src/shared/observability/trace.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CASlF;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CASlF;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,GAC3C,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,KAAK,IAAI,CASnH;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,KAAK,IAAI,CASnH;AAED;;;;;;;;;GASG;AAEH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,KAAK,IAAI,CASnH"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trace helpers — wrap async work in `graph_start`/`graph_end` or
|
|
3
|
+
* `agent_start`/`agent_end` events automatically. Pulls the emitter from the
|
|
4
|
+
* ambient request context so callers don't pass it manually.
|
|
5
|
+
*
|
|
6
|
+
* Available in two flavours:
|
|
7
|
+
* - Functional: `traceGraph(name, fn)` / `traceAgent(name, fn)` — for inline
|
|
8
|
+
* blocks. Returns whatever the wrapped function returns.
|
|
9
|
+
* - Decorator: `@TraceGraph(name)` / `@TraceAgent(name)` — for class methods.
|
|
10
|
+
* Uses the legacy decorator shape already adopted by `@Timed()`.
|
|
11
|
+
*/
|
|
12
|
+
import { requestContext } from "./request-context.js";
|
|
13
|
+
function getEmitter() {
|
|
14
|
+
const raw = requestContext.getStore()?.traceEmitter;
|
|
15
|
+
// The ambient TraceEmitter is typed against a constrained event union; we
|
|
16
|
+
// emit a broader shape here. Same wide-cast pattern used elsewhere
|
|
17
|
+
// (see opportunity.graph.ts, opportunity.discover.ts).
|
|
18
|
+
return raw;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Wrap an async function so it emits `graph_start` / `graph_end` events around
|
|
22
|
+
* its execution. `durationMs` is measured in wall time. If the wrapped
|
|
23
|
+
* function throws, `graph_end` still fires before the error propagates.
|
|
24
|
+
*
|
|
25
|
+
* Use ONLY for actual LangGraph compiled state machines (Opportunity graph,
|
|
26
|
+
* Negotiation graph, etc). For logical groupings of inline work, use
|
|
27
|
+
* `tracePhase` — it has a distinct visual in the trace UI so users can tell
|
|
28
|
+
* "this is a graph" from "this is a phase".
|
|
29
|
+
*/
|
|
30
|
+
export async function traceGraph(name, fn) {
|
|
31
|
+
const emit = getEmitter();
|
|
32
|
+
emit?.({ type: "graph_start", name });
|
|
33
|
+
const start = Date.now();
|
|
34
|
+
try {
|
|
35
|
+
return await fn();
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
emit?.({ type: "graph_end", name, durationMs: Date.now() - start });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Wrap an async function so it emits `phase_start` / `phase_end` events around
|
|
43
|
+
* its execution. Phases are logical groupings of inline async work — they
|
|
44
|
+
* share container semantics with graphs (they can host agents) but render
|
|
45
|
+
* differently in the trace UI to make it clear they're NOT LangGraph state
|
|
46
|
+
* machines.
|
|
47
|
+
*/
|
|
48
|
+
export async function tracePhase(name, fn) {
|
|
49
|
+
const emit = getEmitter();
|
|
50
|
+
emit?.({ type: "phase_start", name });
|
|
51
|
+
const start = Date.now();
|
|
52
|
+
try {
|
|
53
|
+
return await fn();
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
emit?.({ type: "phase_end", name, durationMs: Date.now() - start });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Wrap an async function so it emits `agent_start` / `agent_end` events. The
|
|
61
|
+
* optional `summarize` callback produces a short string shown in the trace
|
|
62
|
+
* panel; receives the wrapped function's resolved value.
|
|
63
|
+
*/
|
|
64
|
+
export async function traceAgent(name, fn, summarize) {
|
|
65
|
+
const emit = getEmitter();
|
|
66
|
+
emit?.({ type: "agent_start", name });
|
|
67
|
+
const start = Date.now();
|
|
68
|
+
let value;
|
|
69
|
+
try {
|
|
70
|
+
value = await fn();
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
emit?.({ type: "agent_end", name, durationMs: Date.now() - start });
|
|
74
|
+
throw err;
|
|
75
|
+
}
|
|
76
|
+
const durationMs = Date.now() - start;
|
|
77
|
+
const summary = summarize?.(value);
|
|
78
|
+
emit?.({ type: "agent_end", name, durationMs, ...(summary ? { summary } : {}) });
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Method decorator. Wraps the decorated async method in `traceGraph(name, ...)`.
|
|
83
|
+
* Use on class methods that represent a logical "graph" (a sub-flow with
|
|
84
|
+
* internal agent calls).
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* class RefinePhase {
|
|
88
|
+
* @TraceGraph("Refine")
|
|
89
|
+
* async run() { ... }
|
|
90
|
+
* }
|
|
91
|
+
*/
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
+
export function TraceGraph(name) {
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
+
return function (_target, _propertyKey, descriptor) {
|
|
96
|
+
const original = descriptor.value;
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
+
descriptor.value = function (...args) {
|
|
99
|
+
return traceGraph(name, () => original.apply(this, args));
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Method decorator. Wraps the decorated async method in `traceAgent(name, ...)`.
|
|
105
|
+
* Use on class methods that represent a single agent step (one LLM call,
|
|
106
|
+
* one summarization, etc).
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* class ChatSummary {
|
|
110
|
+
* @TraceAgent("Chat summary")
|
|
111
|
+
* async run() { ... }
|
|
112
|
+
* }
|
|
113
|
+
*/
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
115
|
+
export function TraceAgent(name) {
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
|
+
return function (_target, _propertyKey, descriptor) {
|
|
118
|
+
const original = descriptor.value;
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
120
|
+
descriptor.value = function (...args) {
|
|
121
|
+
return traceAgent(name, () => original.apply(this, args));
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Method decorator. Wraps the decorated async method in `tracePhase(name, ...)`.
|
|
127
|
+
* Use for logical groupings of inline work that aren't LangGraph state machines.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* class RefinePhase {
|
|
131
|
+
* @TracePhase("Refine")
|
|
132
|
+
* async run() { ... }
|
|
133
|
+
* }
|
|
134
|
+
*/
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
136
|
+
export function TracePhase(name) {
|
|
137
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
138
|
+
return function (_target, _propertyKey, descriptor) {
|
|
139
|
+
const original = descriptor.value;
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
|
+
descriptor.value = function (...args) {
|
|
142
|
+
return tracePhase(name, () => original.apply(this, args));
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/shared/observability/trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,SAAS,UAAU;IACjB,MAAM,GAAG,GAAG,cAAc,CAAC,QAAQ,EAAE,EAAE,YAAY,CAAC;IACpD,0EAA0E;IAC1E,mEAAmE;IACnE,uDAAuD;IACvD,OAAO,GAAqC,CAAC;AAC/C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAI,IAAY,EAAE,EAAoB;IACpE,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;IAC1B,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,CAA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AAC;AAED;;;;;;;;;GASG;AACH,8DAA8D;AAC9D,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,8DAA8D;IAC9D,OAAO,UAAU,OAAY,EAAE,YAAoB,EAAE,UAA8B;QACjF,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,8DAA8D;QAC9D,UAAU,CAAC,KAAK,GAAG,UAAqB,GAAG,IAAW;YACpD,OAAO,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NegotiationDigest — compact, fixed-size structured summary of one discovery
|
|
3
|
+
* negotiation. Produced by the negotiation summarizer; consumed by the
|
|
4
|
+
* decision-question generator in place of raw negotiations.
|
|
5
|
+
*
|
|
6
|
+
* Goal: cap the question generator's per-negotiation prompt budget so that a
|
|
7
|
+
* 10-candidate discovery turn produces a ~1.5 KB prompt instead of a 60+ KB
|
|
8
|
+
* blob that stalls upstream LLM providers.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
export declare const DiscoveryNegotiationDigestSchema: z.ZodObject<{
|
|
12
|
+
/** Abstract counterparty descriptor (no PII, no IDs). E.g. "AI infra founder, Berlin". */
|
|
13
|
+
counterpartyHint: z.ZodString;
|
|
14
|
+
/** The network the negotiation ran under (community prompt). */
|
|
15
|
+
indexContext: z.ZodString;
|
|
16
|
+
/** Whether the negotiation produced an opportunity. */
|
|
17
|
+
outcomeRole: z.ZodEnum<["opportunity", "no-opportunity"]>;
|
|
18
|
+
/** When `outcomeRole === "no-opportunity"`, why the negotiation didn't yield one. Null otherwise. */
|
|
19
|
+
outcomeReason: z.ZodNullable<z.ZodEnum<["turn_cap", "timeout", "rejected", "stalled"]>>;
|
|
20
|
+
/**
|
|
21
|
+
* One-sentence (≤180 chars) summary of the decisive moment or pattern in
|
|
22
|
+
* this negotiation. Written for the downstream question generator — should
|
|
23
|
+
* highlight a fact or tension that could inform a clarifying question.
|
|
24
|
+
*/
|
|
25
|
+
keyTake: z.ZodString;
|
|
26
|
+
/** Suggested roles agreed by both parties. Null when no agreement reached. */
|
|
27
|
+
suggestedRoles: z.ZodNullable<z.ZodObject<{
|
|
28
|
+
ownUser: z.ZodEnum<["agent", "patient", "peer"]>;
|
|
29
|
+
otherUser: z.ZodEnum<["agent", "patient", "peer"]>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
ownUser: "agent" | "patient" | "peer";
|
|
32
|
+
otherUser: "agent" | "patient" | "peer";
|
|
33
|
+
}, {
|
|
34
|
+
ownUser: "agent" | "patient" | "peer";
|
|
35
|
+
otherUser: "agent" | "patient" | "peer";
|
|
36
|
+
}>>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
suggestedRoles: {
|
|
39
|
+
ownUser: "agent" | "patient" | "peer";
|
|
40
|
+
otherUser: "agent" | "patient" | "peer";
|
|
41
|
+
} | null;
|
|
42
|
+
counterpartyHint: string;
|
|
43
|
+
indexContext: string;
|
|
44
|
+
outcomeRole: "opportunity" | "no-opportunity";
|
|
45
|
+
outcomeReason: "timeout" | "stalled" | "rejected" | "turn_cap" | null;
|
|
46
|
+
keyTake: string;
|
|
47
|
+
}, {
|
|
48
|
+
suggestedRoles: {
|
|
49
|
+
ownUser: "agent" | "patient" | "peer";
|
|
50
|
+
otherUser: "agent" | "patient" | "peer";
|
|
51
|
+
} | null;
|
|
52
|
+
counterpartyHint: string;
|
|
53
|
+
indexContext: string;
|
|
54
|
+
outcomeRole: "opportunity" | "no-opportunity";
|
|
55
|
+
outcomeReason: "timeout" | "stalled" | "rejected" | "turn_cap" | null;
|
|
56
|
+
keyTake: string;
|
|
57
|
+
}>;
|
|
58
|
+
export type DiscoveryNegotiationDigest = z.infer<typeof DiscoveryNegotiationDigestSchema>;
|
|
59
|
+
//# sourceMappingURL=negotiation-digest.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiation-digest.schema.d.ts","sourceRoot":"","sources":["../../../src/shared/schemas/negotiation-digest.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gCAAgC;IAC3C,0FAA0F;;IAE1F,gEAAgE;;IAEhE,uDAAuD;;IAEvD,qGAAqG;;IAErG;;;;OAIG;;IAEH,8EAA8E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO9E,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NegotiationDigest — compact, fixed-size structured summary of one discovery
|
|
3
|
+
* negotiation. Produced by the negotiation summarizer; consumed by the
|
|
4
|
+
* decision-question generator in place of raw negotiations.
|
|
5
|
+
*
|
|
6
|
+
* Goal: cap the question generator's per-negotiation prompt budget so that a
|
|
7
|
+
* 10-candidate discovery turn produces a ~1.5 KB prompt instead of a 60+ KB
|
|
8
|
+
* blob that stalls upstream LLM providers.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
export const DiscoveryNegotiationDigestSchema = z.object({
|
|
12
|
+
/** Abstract counterparty descriptor (no PII, no IDs). E.g. "AI infra founder, Berlin". */
|
|
13
|
+
counterpartyHint: z.string().min(1).max(120),
|
|
14
|
+
/** The network the negotiation ran under (community prompt). */
|
|
15
|
+
indexContext: z.string().min(1).max(120),
|
|
16
|
+
/** Whether the negotiation produced an opportunity. */
|
|
17
|
+
outcomeRole: z.enum(["opportunity", "no-opportunity"]),
|
|
18
|
+
/** When `outcomeRole === "no-opportunity"`, why the negotiation didn't yield one. Null otherwise. */
|
|
19
|
+
outcomeReason: z.enum(["turn_cap", "timeout", "rejected", "stalled"]).nullable(),
|
|
20
|
+
/**
|
|
21
|
+
* One-sentence (≤180 chars) summary of the decisive moment or pattern in
|
|
22
|
+
* this negotiation. Written for the downstream question generator — should
|
|
23
|
+
* highlight a fact or tension that could inform a clarifying question.
|
|
24
|
+
*/
|
|
25
|
+
keyTake: z.string().min(1).max(180),
|
|
26
|
+
/** Suggested roles agreed by both parties. Null when no agreement reached. */
|
|
27
|
+
suggestedRoles: z
|
|
28
|
+
.object({
|
|
29
|
+
ownUser: z.enum(["agent", "patient", "peer"]),
|
|
30
|
+
otherUser: z.enum(["agent", "patient", "peer"]),
|
|
31
|
+
})
|
|
32
|
+
.nullable(),
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=negotiation-digest.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiation-digest.schema.js","sourceRoot":"","sources":["../../../src/shared/schemas/negotiation-digest.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,0FAA0F;IAC1F,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAC5C,gEAAgE;IAChE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACxC,uDAAuD;IACvD,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IACtD,qGAAqG;IACrG,aAAa,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE;IAChF;;;;OAIG;IACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACnC,8EAA8E;IAC9E,cAAc,EAAE,CAAC;SACd,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAC7C,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;KAChD,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC"}
|