keywordgraph-mcp-server 1.7.3 → 1.8.4
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 +81 -3
- package/dist/api/client.d.ts +3 -1
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +2 -1
- package/dist/api/client.js.map +1 -1
- package/dist/api/config-store.d.ts +11 -0
- package/dist/api/config-store.d.ts.map +1 -1
- package/dist/api/config-store.js +7 -0
- package/dist/api/config-store.js.map +1 -1
- package/dist/config/brand.d.ts.map +1 -1
- package/dist/config/brand.js +11 -0
- package/dist/config/brand.js.map +1 -1
- package/dist/http-server.js +3 -1
- package/dist/http-server.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +110 -11
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +9 -2
- package/dist/instructions.js.map +1 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +32 -0
- package/dist/prompts/index.js.map +1 -1
- package/dist/resources/about.d.ts.map +1 -1
- package/dist/resources/about.js +9 -1
- package/dist/resources/about.js.map +1 -1
- package/dist/schemas/index.d.ts +353 -63
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +407 -31
- package/dist/schemas/index.js.map +1 -1
- package/dist/tools/addProjectLearnings.d.ts +30 -0
- package/dist/tools/addProjectLearnings.d.ts.map +1 -0
- package/dist/tools/addProjectLearnings.js +197 -0
- package/dist/tools/addProjectLearnings.js.map +1 -0
- package/dist/tools/analyzeLlmResults.d.ts +1 -1
- package/dist/tools/analyzeLlmResults.d.ts.map +1 -1
- package/dist/tools/analyzeLlmResults.js +5 -2
- package/dist/tools/analyzeLlmResults.js.map +1 -1
- package/dist/tools/deleteGraph.d.ts +43 -0
- package/dist/tools/deleteGraph.d.ts.map +1 -0
- package/dist/tools/deleteGraph.js +145 -0
- package/dist/tools/deleteGraph.js.map +1 -0
- package/dist/tools/deleteStatements.d.ts +106 -0
- package/dist/tools/deleteStatements.d.ts.map +1 -0
- package/dist/tools/deleteStatements.js +288 -0
- package/dist/tools/deleteStatements.js.map +1 -0
- package/dist/tools/developConceptualBridges.d.ts +1 -1
- package/dist/tools/developLatentTopics.d.ts +1 -1
- package/dist/tools/developTextTool.d.ts +1 -1
- package/dist/tools/enableProjectLearnings.d.ts +27 -0
- package/dist/tools/enableProjectLearnings.d.ts.map +1 -0
- package/dist/tools/enableProjectLearnings.js +68 -0
- package/dist/tools/enableProjectLearnings.js.map +1 -0
- package/dist/tools/generateOntologyGraph.d.ts +10 -3
- package/dist/tools/generateOntologyGraph.d.ts.map +1 -1
- package/dist/tools/generateOntologyGraph.js +142 -34
- package/dist/tools/generateOntologyGraph.js.map +1 -1
- package/dist/tools/generateResearchIdeas.d.ts +1 -1
- package/dist/tools/generateResearchQuestions.d.ts +1 -1
- package/dist/tools/generateResponses.d.ts +1 -1
- package/dist/tools/getProjectLearnings.d.ts +30 -0
- package/dist/tools/getProjectLearnings.d.ts.map +1 -0
- package/dist/tools/getProjectLearnings.js +151 -0
- package/dist/tools/getProjectLearnings.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/optimizeKnowledgeBase.d.ts +40 -0
- package/dist/tools/optimizeKnowledgeBase.d.ts.map +1 -0
- package/dist/tools/optimizeKnowledgeBase.js +230 -0
- package/dist/tools/optimizeKnowledgeBase.js.map +1 -0
- package/dist/tools/optimizeReasoning.d.ts +1 -1
- package/dist/tools/optimizeTextStructure.d.ts +1 -1
- package/dist/tools/submitWorkflowFeedback.d.ts +35 -0
- package/dist/tools/submitWorkflowFeedback.d.ts.map +1 -0
- package/dist/tools/submitWorkflowFeedback.js +62 -0
- package/dist/tools/submitWorkflowFeedback.js.map +1 -0
- package/dist/tools/updateStatements.d.ts +134 -0
- package/dist/tools/updateStatements.d.ts.map +1 -0
- package/dist/tools/updateStatements.js +378 -0
- package/dist/tools/updateStatements.js.map +1 -0
- package/dist/types/index.d.ts +30 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/callTracking.d.ts +29 -0
- package/dist/utils/callTracking.d.ts.map +1 -0
- package/dist/utils/callTracking.js +88 -0
- package/dist/utils/callTracking.js.map +1 -0
- package/dist/utils/feedback.d.ts +63 -0
- package/dist/utils/feedback.d.ts.map +1 -0
- package/dist/utils/feedback.js +115 -0
- package/dist/utils/feedback.js.map +1 -0
- package/dist/utils/graphInput.d.ts +1 -0
- package/dist/utils/graphInput.d.ts.map +1 -1
- package/dist/utils/graphInput.js +1 -1
- package/dist/utils/graphInput.js.map +1 -1
- package/dist/utils/graphLookup.d.ts +29 -0
- package/dist/utils/graphLookup.d.ts.map +1 -0
- package/dist/utils/graphLookup.js +57 -0
- package/dist/utils/graphLookup.js.map +1 -0
- package/dist/utils/knowledgeBase.d.ts +21 -0
- package/dist/utils/knowledgeBase.d.ts.map +1 -0
- package/dist/utils/knowledgeBase.js +110 -0
- package/dist/utils/knowledgeBase.js.map +1 -0
- package/dist/utils/learnings.d.ts +119 -0
- package/dist/utils/learnings.d.ts.map +1 -0
- package/dist/utils/learnings.js +337 -0
- package/dist/utils/learnings.js.map +1 -0
- package/llms-full.infranodus.txt +39 -1
- package/llms-full.txt +39 -1
- package/llms.infranodus.txt +2 -0
- package/llms.txt +2 -0
- package/package.json +3 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const FEEDBACK_SCHEMA_VERSION = 1;
|
|
2
|
+
export declare const FEEDBACK_RULE_VERSION = 1;
|
|
3
|
+
export declare const MAX_TEXT_FIELD_LENGTH = 200;
|
|
4
|
+
export declare const CONSUMPTION: readonly ["none", "some", "most"];
|
|
5
|
+
export declare const NOVELTY: readonly ["nothing_new", "some_new", "mostly_new"];
|
|
6
|
+
export declare const TASK_FIT: readonly ["right_tool", "needed_another", "wrong_tool"];
|
|
7
|
+
export declare const DEFECTS: readonly ["too_generic", "off_topic", "wrong_language", "truncated", "duplicates", "too_long_to_read", "error", "empty"];
|
|
8
|
+
export declare const USER_NEXT: readonly ["built_on_it", "asked_followup", "ignored", "redirected", "unknown"];
|
|
9
|
+
export type Consumption = (typeof CONSUMPTION)[number];
|
|
10
|
+
export type Novelty = (typeof NOVELTY)[number];
|
|
11
|
+
export type TaskFit = (typeof TASK_FIT)[number];
|
|
12
|
+
export type Defect = (typeof DEFECTS)[number];
|
|
13
|
+
export type UserNext = (typeof USER_NEXT)[number];
|
|
14
|
+
export type FeedbackType = "useful" | "partly" | "not_useful";
|
|
15
|
+
export interface FeedbackObservations {
|
|
16
|
+
workflow: string;
|
|
17
|
+
toolsUsed: string[];
|
|
18
|
+
consumption: Consumption;
|
|
19
|
+
usedExample?: string;
|
|
20
|
+
novelty: Novelty;
|
|
21
|
+
taskFit: TaskFit;
|
|
22
|
+
callsNeeded: number;
|
|
23
|
+
defects: Defect[];
|
|
24
|
+
userNext: UserNext;
|
|
25
|
+
reason: string;
|
|
26
|
+
}
|
|
27
|
+
export interface PreviousCallMetrics {
|
|
28
|
+
tool: string;
|
|
29
|
+
durationMs: number;
|
|
30
|
+
isError: boolean;
|
|
31
|
+
retry: boolean;
|
|
32
|
+
at: string;
|
|
33
|
+
}
|
|
34
|
+
export interface FeedbackRecord extends FeedbackObservations {
|
|
35
|
+
workflowId: string;
|
|
36
|
+
grounded: boolean;
|
|
37
|
+
consistent: boolean;
|
|
38
|
+
feedbackType: FeedbackType;
|
|
39
|
+
schemaVersion: number;
|
|
40
|
+
ruleVersion: number;
|
|
41
|
+
client?: string;
|
|
42
|
+
/** Objective metrics of the call that produced the rated output (utils/callTracking.ts). */
|
|
43
|
+
previousCall?: PreviousCallMetrics;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Stable id for "this workflow": the same tools in the same order for the
|
|
47
|
+
* same goal. A second report (e.g. next turn, to fill in `userNext`) gets the
|
|
48
|
+
* same id and is treated as an update by the analysis, not a new data point.
|
|
49
|
+
*/
|
|
50
|
+
export declare function workflowId(toolsUsed: string[], workflow: string): string;
|
|
51
|
+
export declare function capText(value: string | undefined): string | undefined;
|
|
52
|
+
/** A report that claims usage must quote what it used. */
|
|
53
|
+
export declare function isGrounded(consumption: Consumption, usedExample: string | undefined): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Cheap check that the free-text justification does not contradict the
|
|
56
|
+
* enums. Report-quality signal, not output-quality: it never changes what the
|
|
57
|
+
* model said, only flags it.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isConsistent(observations: FeedbackObservations): boolean;
|
|
60
|
+
/** Rule v1 — keep in sync with FEEDBACK_RULE_VERSION and the draft §1.6. */
|
|
61
|
+
export declare function deriveFeedbackType(observations: FeedbackObservations, grounded: boolean): FeedbackType;
|
|
62
|
+
export declare function buildFeedbackRecord(observations: FeedbackObservations, client?: string, previousCall?: PreviousCallMetrics): FeedbackRecord;
|
|
63
|
+
//# sourceMappingURL=feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../src/utils/feedback.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,eAAO,MAAM,WAAW,mCAAoC,CAAC;AAC7D,eAAO,MAAM,OAAO,oDAAqD,CAAC;AAC1E,eAAO,MAAM,QAAQ,yDAA0D,CAAC;AAChF,eAAO,MAAM,OAAO,0HASV,CAAC;AACX,eAAO,MAAM,SAAS,gFAMZ,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACvD,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/C,MAAM,MAAM,OAAO,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AM,CAGxE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAMrE;AAED,0DAA0D;AAC1D,wBAAgB,UAAU,CACzB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,GAAG,SAAS,GAC7B,OAAO,CAGT;AAKD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,oBAAoB,GAAG,OAAO,CASxE;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CACjC,YAAY,EAAE,oBAAoB,EAClC,QAAQ,EAAE,OAAO,GACf,YAAY,CAoBd;AAED,wBAAgB,mBAAmB,CAClC,YAAY,EAAE,oBAAoB,EAClC,MAAM,CAAC,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,mBAAmB,GAChC,cAAc,CAsBhB"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for `submit_workflow_feedback` (see
|
|
3
|
+
* docs/drafts/workflow-feedback-tool.md). Everything here is deterministic
|
|
4
|
+
* and unit-tested; nothing touches the network.
|
|
5
|
+
*
|
|
6
|
+
* The model reports observations, never a score. The rating is derived here
|
|
7
|
+
* so the rule is inspectable and versioned; the raw observations are stored
|
|
8
|
+
* alongside it so the rating can be recomputed in SQL when the rule changes.
|
|
9
|
+
*/
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
export const FEEDBACK_SCHEMA_VERSION = 1;
|
|
12
|
+
export const FEEDBACK_RULE_VERSION = 1;
|
|
13
|
+
export const MAX_TEXT_FIELD_LENGTH = 200;
|
|
14
|
+
export const CONSUMPTION = ["none", "some", "most"];
|
|
15
|
+
export const NOVELTY = ["nothing_new", "some_new", "mostly_new"];
|
|
16
|
+
export const TASK_FIT = ["right_tool", "needed_another", "wrong_tool"];
|
|
17
|
+
export const DEFECTS = [
|
|
18
|
+
"too_generic",
|
|
19
|
+
"off_topic",
|
|
20
|
+
"wrong_language",
|
|
21
|
+
"truncated",
|
|
22
|
+
"duplicates",
|
|
23
|
+
"too_long_to_read",
|
|
24
|
+
"error",
|
|
25
|
+
"empty",
|
|
26
|
+
];
|
|
27
|
+
export const USER_NEXT = [
|
|
28
|
+
"built_on_it",
|
|
29
|
+
"asked_followup",
|
|
30
|
+
"ignored",
|
|
31
|
+
"redirected",
|
|
32
|
+
"unknown",
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* Stable id for "this workflow": the same tools in the same order for the
|
|
36
|
+
* same goal. A second report (e.g. next turn, to fill in `userNext`) gets the
|
|
37
|
+
* same id and is treated as an update by the analysis, not a new data point.
|
|
38
|
+
*/
|
|
39
|
+
export function workflowId(toolsUsed, workflow) {
|
|
40
|
+
const key = `${toolsUsed.join(">")}|${workflow.trim().toLowerCase()}`;
|
|
41
|
+
return createHash("sha1").update(key).digest("hex").slice(0, 10);
|
|
42
|
+
}
|
|
43
|
+
export function capText(value) {
|
|
44
|
+
if (value === undefined)
|
|
45
|
+
return undefined;
|
|
46
|
+
const trimmed = value.trim();
|
|
47
|
+
return trimmed.length > MAX_TEXT_FIELD_LENGTH
|
|
48
|
+
? `${trimmed.slice(0, MAX_TEXT_FIELD_LENGTH - 1)}…`
|
|
49
|
+
: trimmed;
|
|
50
|
+
}
|
|
51
|
+
/** A report that claims usage must quote what it used. */
|
|
52
|
+
export function isGrounded(consumption, usedExample) {
|
|
53
|
+
if (consumption === "none")
|
|
54
|
+
return true;
|
|
55
|
+
return Boolean(usedExample && usedExample.trim().length > 0);
|
|
56
|
+
}
|
|
57
|
+
const NOT_USED_RE = /\b(didn'?t|did not|never|not)\s+(use|used|using|need|needed|incorporate)\b|\bignored\b|\bdiscarded\b|\bunused\b/i;
|
|
58
|
+
const WRONG_TOOL_RE = /\bwrong tool\b|\bshould have (used|called)\b|\bbetter tool\b|\bnot the right tool\b/i;
|
|
59
|
+
/**
|
|
60
|
+
* Cheap check that the free-text justification does not contradict the
|
|
61
|
+
* enums. Report-quality signal, not output-quality: it never changes what the
|
|
62
|
+
* model said, only flags it.
|
|
63
|
+
*/
|
|
64
|
+
export function isConsistent(observations) {
|
|
65
|
+
const reason = observations.reason;
|
|
66
|
+
if (observations.consumption === "most" && NOT_USED_RE.test(reason)) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (observations.taskFit === "right_tool" && WRONG_TOOL_RE.test(reason)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
/** Rule v1 — keep in sync with FEEDBACK_RULE_VERSION and the draft §1.6. */
|
|
75
|
+
export function deriveFeedbackType(observations, grounded) {
|
|
76
|
+
const { consumption, novelty, taskFit, defects } = observations;
|
|
77
|
+
if (consumption === "none" ||
|
|
78
|
+
taskFit === "wrong_tool" ||
|
|
79
|
+
defects.includes("error") ||
|
|
80
|
+
defects.includes("empty")) {
|
|
81
|
+
return "not_useful";
|
|
82
|
+
}
|
|
83
|
+
if (consumption === "most" &&
|
|
84
|
+
novelty !== "nothing_new" &&
|
|
85
|
+
taskFit === "right_tool" &&
|
|
86
|
+
defects.length === 0 &&
|
|
87
|
+
grounded) {
|
|
88
|
+
return "useful";
|
|
89
|
+
}
|
|
90
|
+
return "partly";
|
|
91
|
+
}
|
|
92
|
+
export function buildFeedbackRecord(observations, client, previousCall) {
|
|
93
|
+
const workflow = capText(observations.workflow) ?? "";
|
|
94
|
+
const usedExample = capText(observations.usedExample);
|
|
95
|
+
const grounded = isGrounded(observations.consumption, usedExample);
|
|
96
|
+
const normalized = {
|
|
97
|
+
...observations,
|
|
98
|
+
workflow,
|
|
99
|
+
usedExample,
|
|
100
|
+
reason: capText(observations.reason) ?? "",
|
|
101
|
+
defects: [...new Set(observations.defects)],
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
...normalized,
|
|
105
|
+
workflowId: workflowId(observations.toolsUsed, workflow),
|
|
106
|
+
grounded,
|
|
107
|
+
consistent: isConsistent(normalized),
|
|
108
|
+
feedbackType: deriveFeedbackType(normalized, grounded),
|
|
109
|
+
schemaVersion: FEEDBACK_SCHEMA_VERSION,
|
|
110
|
+
ruleVersion: FEEDBACK_RULE_VERSION,
|
|
111
|
+
...(client ? { client } : {}),
|
|
112
|
+
...(previousCall ? { previousCall } : {}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=feedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.js","sourceRoot":"","sources":["../../src/utils/feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAC7D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,aAAa,EAAE,UAAU,EAAE,YAAY,CAAU,CAAC;AAC1E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,gBAAgB,EAAE,YAAY,CAAU,CAAC;AAChF,MAAM,CAAC,MAAM,OAAO,GAAG;IACtB,aAAa;IACb,WAAW;IACX,gBAAgB;IAChB,WAAW;IACX,YAAY;IACZ,kBAAkB;IAClB,OAAO;IACP,OAAO;CACE,CAAC;AACX,MAAM,CAAC,MAAM,SAAS,GAAG;IACxB,aAAa;IACb,gBAAgB;IAChB,SAAS;IACT,YAAY;IACZ,SAAS;CACA,CAAC;AA0CX;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,SAAmB,EAAE,QAAgB;IAC/D,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ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AAkB,CAAC,UAAU,EAAE,QAAQ,CAAC;QACtD,aAAa,EAAE,uBAAuB;QACtC,WAAW,EAAE,qBAAqB;QAClC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7B,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzC,CAAC;AACH,CAAC"}
|
|
@@ -16,6 +16,7 @@ export type GraphInputResult = {
|
|
|
16
16
|
ok: false;
|
|
17
17
|
error: string;
|
|
18
18
|
};
|
|
19
|
+
export declare function timestampIsParsable(value: string): boolean;
|
|
19
20
|
/**
|
|
20
21
|
* Validate a caller-supplied statements array and its parallel metadata.
|
|
21
22
|
* Returns null when valid, otherwise the error message to hand back.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphInput.d.ts","sourceRoot":"","sources":["../../src/utils/graphInput.ts"],"names":[],"mappings":"AACA,OAAO,EAIN,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,gBAAgB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,MAAM,gBAAgB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,gBAAgB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAC1D;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"graphInput.d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AAM,EAAE,CAAA;CAAE,CAAC;AAM5E,MAAM,MAAM,gBAAgB,GACzB;IACA,EAAE,EAAE,IAAI,CAAC;IACT,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhC;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CACpC,KAAK,EAAE,WAAW,EAAE,EACpB,oBAAoB,EAAE,CACrB,SAAS,EAAE,MAAM,KACb,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GACrE,OAAO,CAAC,gBAAgB,CAAC,CA6E3B"}
|
package/dist/utils/graphInput.js
CHANGED
|
@@ -6,7 +6,7 @@ import { prepareStatementsPayload, prepareWikilinksPayload, statementsContextSet
|
|
|
6
6
|
// it returns false for, which becomes 1970-01-01 downstream. Neither failure is
|
|
7
7
|
// visible to the caller, so anything ambiguous is refused here instead.
|
|
8
8
|
const ISO_DATE = /^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
9
|
-
function timestampIsParsable(value) {
|
|
9
|
+
export function timestampIsParsable(value) {
|
|
10
10
|
const trimmed = value.trim();
|
|
11
11
|
return ISO_DATE.test(trimmed) && Number.isFinite(Date.parse(trimmed));
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphInput.js","sourceRoot":"","sources":["../../src/utils/graphInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAA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AAe,GAAG,yBAAyB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IAC5E,OAAO;QACN,EAAE,EAAE,IAAI;QACR,QAAQ,EAAE,QAA0C;QACpD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ListedGraph {
|
|
2
|
+
id?: number;
|
|
3
|
+
contextName?: string;
|
|
4
|
+
createdAt?: string;
|
|
5
|
+
defaultRevisionUrl?: string | null;
|
|
6
|
+
textProcessingSettings?: {
|
|
7
|
+
categoriesAsMentions?: boolean;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The API runs on several instances, each with its own per-user contexts-list
|
|
12
|
+
* cache (6 min TTL) that is only invalidated on the instance that handled a
|
|
13
|
+
* write. Right after a graph is created, a read may therefore land on an
|
|
14
|
+
* instance that still says it does not exist. A positive answer is
|
|
15
|
+
* authoritative (a graph cannot be listed unless it exists), so reads retry a
|
|
16
|
+
* few times and accept the first positive; a negative is trusted only after
|
|
17
|
+
* every attempt agreed.
|
|
18
|
+
*/
|
|
19
|
+
export declare const READ_ATTEMPTS = 4;
|
|
20
|
+
export declare function firstPositive<T>(attempt: (n: number) => Promise<T | null>, attempts?: number): Promise<T | null>;
|
|
21
|
+
/** The API sometimes returns `error` as an object ({ statusCode, message[] }). */
|
|
22
|
+
export declare function errorText(error: unknown): string;
|
|
23
|
+
/**
|
|
24
|
+
* Exact-name lookup through /listGraphs in the caller's own account
|
|
25
|
+
* (read-only). Returns the listing entry, or null after every retry agreed
|
|
26
|
+
* that the graph is absent.
|
|
27
|
+
*/
|
|
28
|
+
export declare function findGraphByName(graphName: string): Promise<ListedGraph | null>;
|
|
29
|
+
//# sourceMappingURL=graphLookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphLookup.d.ts","sourceRoot":"","sources":["../../src/utils/graphLookup.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,sBAAsB,CAAC,EAAE;QAAE,oBAAoB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC5D;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,wBAAsB,aAAa,CAAC,CAAC,EACpC,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,EACzC,QAAQ,GAAE,MAAsB,GAC9B,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAMnB;AAED,kFAAkF;AAClF,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAShD;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACpC,SAAS,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAa7B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only graph lookup shared by the tools that must know whether a graph
|
|
3
|
+
* exists in the caller's account before they act on it (project learnings,
|
|
4
|
+
* delete_statements). Never creates anything.
|
|
5
|
+
*/
|
|
6
|
+
import { makeInfraNodusRequest } from "../api/client.js";
|
|
7
|
+
/**
|
|
8
|
+
* The API runs on several instances, each with its own per-user contexts-list
|
|
9
|
+
* cache (6 min TTL) that is only invalidated on the instance that handled a
|
|
10
|
+
* write. Right after a graph is created, a read may therefore land on an
|
|
11
|
+
* instance that still says it does not exist. A positive answer is
|
|
12
|
+
* authoritative (a graph cannot be listed unless it exists), so reads retry a
|
|
13
|
+
* few times and accept the first positive; a negative is trusted only after
|
|
14
|
+
* every attempt agreed.
|
|
15
|
+
*/
|
|
16
|
+
export const READ_ATTEMPTS = 4;
|
|
17
|
+
export async function firstPositive(attempt, attempts = READ_ATTEMPTS) {
|
|
18
|
+
for (let n = 0; n < attempts; n++) {
|
|
19
|
+
const result = await attempt(n);
|
|
20
|
+
if (result !== null)
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
/** The API sometimes returns `error` as an object ({ statusCode, message[] }). */
|
|
26
|
+
export function errorText(error) {
|
|
27
|
+
if (typeof error === "string")
|
|
28
|
+
return error;
|
|
29
|
+
if (error && typeof error === "object") {
|
|
30
|
+
const message = error.message;
|
|
31
|
+
if (Array.isArray(message))
|
|
32
|
+
return message.join("; ");
|
|
33
|
+
if (typeof message === "string")
|
|
34
|
+
return message;
|
|
35
|
+
return JSON.stringify(error);
|
|
36
|
+
}
|
|
37
|
+
return String(error);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Exact-name lookup through /listGraphs in the caller's own account
|
|
41
|
+
* (read-only). Returns the listing entry, or null after every retry agreed
|
|
42
|
+
* that the graph is absent.
|
|
43
|
+
*/
|
|
44
|
+
export async function findGraphByName(graphName) {
|
|
45
|
+
return firstPositive(async (n) => {
|
|
46
|
+
const response = (await makeInfraNodusRequest("/listGraphs", {
|
|
47
|
+
query: graphName,
|
|
48
|
+
// Varies the body so no intermediate layer can collapse the retries.
|
|
49
|
+
attempt: n,
|
|
50
|
+
}));
|
|
51
|
+
if (!Array.isArray(response))
|
|
52
|
+
return null;
|
|
53
|
+
const match = response.find((graph) => graph.contextName === graphName);
|
|
54
|
+
return match ?? null;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=graphLookup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphLookup.js","sourceRoot":"","sources":["../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AAE,CAAC;SACV,CAAC,CAAY,CAAC;QACf,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1C,MAAM,KAAK,GAAI,QAA0B,CAAC,IAAI,CAC7C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,CAC1C,CAAC;QACF,OAAO,KAAK,IAAI,IAAI,CAAC;IACtB,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for `optimize_knowledge_base`: turn the graph engine's
|
|
3
|
+
* diversity diagnosis into a reading that makes sense for a code base, a
|
|
4
|
+
* document vault, or a body of procedural knowledge (rules, frameworks,
|
|
5
|
+
* principles). The engine's numbers are the same for any text; what differs
|
|
6
|
+
* is what a "gap" or a "dominant cluster" means for the thing being studied.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FOCUSES: readonly ["general", "codebase", "vault", "procedural"];
|
|
9
|
+
export type Focus = (typeof FOCUSES)[number];
|
|
10
|
+
export declare const STATES: readonly ["biased", "focused", "diversified", "dispersed"];
|
|
11
|
+
export type DiversityState = (typeof STATES)[number];
|
|
12
|
+
interface Reading {
|
|
13
|
+
meaning: string;
|
|
14
|
+
action: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function normalizeState(raw: unknown): DiversityState | undefined;
|
|
17
|
+
export declare function readState(focus: Focus, state: DiversityState): Reading;
|
|
18
|
+
/** Bounded, de-duplicated list helper for report fields. */
|
|
19
|
+
export declare function dedupeList(items: Array<string | undefined>, limit: number): string[];
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=knowledgeBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledgeBase.d.ts","sourceRoot":"","sources":["../../src/utils/knowledgeBase.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,OAAO,yDAA0D,CAAC;AAC/E,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7C,eAAO,MAAM,MAAM,4DAA6D,CAAC;AACjF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,UAAU,OAAO;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CACf;AA6ED,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAIvE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAEtE;AAED,4DAA4D;AAC5D,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAYpF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for `optimize_knowledge_base`: turn the graph engine's
|
|
3
|
+
* diversity diagnosis into a reading that makes sense for a code base, a
|
|
4
|
+
* document vault, or a body of procedural knowledge (rules, frameworks,
|
|
5
|
+
* principles). The engine's numbers are the same for any text; what differs
|
|
6
|
+
* is what a "gap" or a "dominant cluster" means for the thing being studied.
|
|
7
|
+
*/
|
|
8
|
+
export const FOCUSES = ["general", "codebase", "vault", "procedural"];
|
|
9
|
+
export const STATES = ["biased", "focused", "diversified", "dispersed"];
|
|
10
|
+
const READINGS = {
|
|
11
|
+
general: {
|
|
12
|
+
biased: {
|
|
13
|
+
meaning: "One cluster of ideas dominates; the rest orbit it.",
|
|
14
|
+
action: "Develop the under-represented clusters before adding more to the dominant one.",
|
|
15
|
+
},
|
|
16
|
+
focused: {
|
|
17
|
+
meaning: "Coherent and centred, but narrow.",
|
|
18
|
+
action: "Develop the content gaps: the topics listed as under-developed are the cheapest way to widen it.",
|
|
19
|
+
},
|
|
20
|
+
diversified: {
|
|
21
|
+
meaning: "Several strong clusters that barely connect.",
|
|
22
|
+
action: "Bridge the gaps between clusters — the missing links are where the most original ideas sit.",
|
|
23
|
+
},
|
|
24
|
+
dispersed: {
|
|
25
|
+
meaning: "Many small clusters with no shared backbone.",
|
|
26
|
+
action: "Consolidate: pick the most common gap topics and connect the fragments through them.",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
codebase: {
|
|
30
|
+
biased: {
|
|
31
|
+
meaning: "One module or feature area dominates the project: everything depends on it or describes it (a god module, or a product that is really one feature with satellites).",
|
|
32
|
+
action: "Decide whether the dominance is intended. If not, develop the thin areas and cut dependencies on the dominant one; the under-developed list shows which parts of the code base nobody has built out.",
|
|
33
|
+
},
|
|
34
|
+
focused: {
|
|
35
|
+
meaning: "The code base is coherent and centred on a clear purpose, but narrow: little exists beyond the main path.",
|
|
36
|
+
action: "The gaps are the features and integrations that are implied but not built; the under-developed topics are the ones to build next.",
|
|
37
|
+
},
|
|
38
|
+
diversified: {
|
|
39
|
+
meaning: "Several substantial subsystems that hardly talk to each other.",
|
|
40
|
+
action: "The gaps between clusters are missing integrations or glue code — the most actionable state for a product: each gap is a feature that connects two things users already have.",
|
|
41
|
+
},
|
|
42
|
+
dispersed: {
|
|
43
|
+
meaning: "Fragmented: many small parts sharing no entities — features that do not compose, or several projects in one repo.",
|
|
44
|
+
action: "Consolidate around the most common gap topics; consider extracting or removing fragments that connect to nothing.",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
vault: {
|
|
48
|
+
biased: {
|
|
49
|
+
meaning: "The vault keeps returning to one theme; other notes are satellites of it.",
|
|
50
|
+
action: "Grow the satellite themes into their own clusters, or accept the vault as single-topic and prune what does not serve it.",
|
|
51
|
+
},
|
|
52
|
+
focused: {
|
|
53
|
+
meaning: "A coherent vault around one line of thought, not yet exploring its edges.",
|
|
54
|
+
action: "Write into the gaps: the under-developed topics are notes the vault is already pointing at but has not written.",
|
|
55
|
+
},
|
|
56
|
+
diversified: {
|
|
57
|
+
meaning: "Several well-developed themes with few notes linking them.",
|
|
58
|
+
action: "The gaps are the bridge notes waiting to be written — the places where two of your themes would produce a new idea if connected.",
|
|
59
|
+
},
|
|
60
|
+
dispersed: {
|
|
61
|
+
meaning: "Many unconnected notes; no theme is developed enough to organise the others.",
|
|
62
|
+
action: "Pick the most common gap topics as hub notes and link the fragments through them (maps of content).",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
procedural: {
|
|
66
|
+
biased: {
|
|
67
|
+
meaning: "One framework or rule set dominates the procedural knowledge; the others are footnotes to it.",
|
|
68
|
+
action: "Check whether the dominant framework really covers the other situations; develop the thin rule sets or make the dominance explicit.",
|
|
69
|
+
},
|
|
70
|
+
focused: {
|
|
71
|
+
meaning: "A coherent set of rules and frameworks around one way of working, with little guidance beyond it.",
|
|
72
|
+
action: "The gaps are situations the rules do not address; the under-developed topics are frameworks mentioned but not spelled out.",
|
|
73
|
+
},
|
|
74
|
+
diversified: {
|
|
75
|
+
meaning: "Several independent frameworks or rule sets that never reference each other.",
|
|
76
|
+
action: "The gaps are where two frameworks should hand off to each other — write the rules for those transitions, or you have contradictions waiting to happen.",
|
|
77
|
+
},
|
|
78
|
+
dispersed: {
|
|
79
|
+
meaning: "Fragmented procedural knowledge: many rules, no organising principles.",
|
|
80
|
+
action: "Consolidate the rules under the most common gap topics as principles; rules that connect to no principle are candidates for removal.",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
export function normalizeState(raw) {
|
|
85
|
+
if (typeof raw !== "string")
|
|
86
|
+
return undefined;
|
|
87
|
+
const value = raw.toLowerCase();
|
|
88
|
+
return STATES.find((state) => value.includes(state));
|
|
89
|
+
}
|
|
90
|
+
export function readState(focus, state) {
|
|
91
|
+
return READINGS[focus][state];
|
|
92
|
+
}
|
|
93
|
+
/** Bounded, de-duplicated list helper for report fields. */
|
|
94
|
+
export function dedupeList(items, limit) {
|
|
95
|
+
const seen = new Set();
|
|
96
|
+
const out = [];
|
|
97
|
+
for (const item of items) {
|
|
98
|
+
if (!item)
|
|
99
|
+
continue;
|
|
100
|
+
const key = item.trim();
|
|
101
|
+
if (!key || seen.has(key.toLowerCase()))
|
|
102
|
+
continue;
|
|
103
|
+
seen.add(key.toLowerCase());
|
|
104
|
+
out.push(key);
|
|
105
|
+
if (out.length >= limit)
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=knowledgeBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledgeBase.js","sourceRoot":"","sources":["../../src/utils/knowledgeBase.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,CAAU,CAAC;AAG/E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,CAAU,CAAC;AAQjF,MAAM,QAAQ,GAAmD;IAChE,OAAO,EAAE;QACR,MAAM,EAAE;YACP,OAAO,EAAE,oDAAoD;YAC7D,MAAM,EAAE,gFAAgF;SACxF;QACD,OAAO,EAAE;YACR,OAAO,EAAE,mCAAmC;YAC5C,MAAM,EAAE,kGAAkG;SAC1G;QACD,WAAW,EAAE;YACZ,OAAO,EAAE,8CAA8C;YACvD,MAAM,EAAE,6FAA6F;SACrG;QACD,SAAS,EAAE;YACV,OAAO,EAAE,8CAA8C;YACvD,MAAM,EAAE,sFAAsF;SAC9F;KACD;IACD,QAAQ,EAAE;QACT,MAAM,EAAE;YACP,OAAO,EAAE,qKAAqK;YAC9K,MAAM,EAAE,sMAAsM;SAC9M;QACD,OAAO,EAAE;YACR,OAAO,EAAE,2GAA2G;YACpH,MAAM,EAAE,mIAAmI;SAC3I;QACD,WAAW,EAAE;Y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UAAU,UAAU,CAAC,KAAgC,EAAE,KAAa;IACzE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI;YAAE,SAAS;QACpB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACxB,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;YAAE,SAAS;QAClD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;QAC5B,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACd,IAAI,GAAG,CAAC,MAAM,IAAI,KAAK;YAAE,MAAM;IAChC,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { GraphResponse, Statement } from "../types/index.js";
|
|
2
|
+
import { READ_ATTEMPTS, errorText } from "./graphLookup.js";
|
|
3
|
+
export declare const GRAPH_PREFIX = "learn-";
|
|
4
|
+
export declare const MAX_GRAPH_NAME_LENGTH = 28;
|
|
5
|
+
export declare const MARKER_CATEGORY = "learnings-enabled";
|
|
6
|
+
export declare const LEARNING_TYPES: readonly ["location", "trap", "convention", "decision", "workflow", "question", "approach"];
|
|
7
|
+
export type LearningType = (typeof LEARNING_TYPES)[number];
|
|
8
|
+
export declare const TYPE_CATEGORY_PREFIX = "type-";
|
|
9
|
+
export declare const SOURCE_CATEGORY_PREFIX = "source-";
|
|
10
|
+
/** Near-duplicate threshold on word-set Jaccard similarity. */
|
|
11
|
+
export declare const DEDUPE_THRESHOLD = 0.6;
|
|
12
|
+
export declare const MAX_STATEMENT_LENGTH = 400;
|
|
13
|
+
export declare function slugify(input: string): string;
|
|
14
|
+
export declare function learningsGraphName(project: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Not attached to statements any more: a per-client label links every
|
|
17
|
+
* statement of that client and became the most central node of the graph in
|
|
18
|
+
* testing. Kept so `toStoredLearning` can still read graphs written before
|
|
19
|
+
* that change.
|
|
20
|
+
*/
|
|
21
|
+
export declare function sourceCategory(clientName?: string): string;
|
|
22
|
+
export declare function typeCategory(type: LearningType): string;
|
|
23
|
+
export interface RedactionIssue {
|
|
24
|
+
index: number;
|
|
25
|
+
reason: "secret-like" | "too-long" | "empty";
|
|
26
|
+
}
|
|
27
|
+
/** Returns the indices (never the content) of statements that must not be stored. */
|
|
28
|
+
export declare function redactionIssues(statements: string[]): RedactionIssue[];
|
|
29
|
+
export declare function tokenize(statement: string): Set<string>;
|
|
30
|
+
export declare function jaccard(a: Set<string>, b: Set<string>): number;
|
|
31
|
+
export interface DedupeResult {
|
|
32
|
+
statement: string;
|
|
33
|
+
status: "new" | "reinforced";
|
|
34
|
+
/** The existing statement this one reinforces (when status is "reinforced"). */
|
|
35
|
+
matches?: string;
|
|
36
|
+
similarity?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Compare candidates against what the graph already holds. A near-duplicate
|
|
40
|
+
* is not dropped — it is rewritten as a short "Confirmed again" statement so
|
|
41
|
+
* the repeat still raises the weight of the same entity links (that is how
|
|
42
|
+
* frequently re-learned things become central) without duplicating the text.
|
|
43
|
+
*/
|
|
44
|
+
export declare function dedupeAgainstExisting(candidates: string[], existing: string[], threshold?: number): DedupeResult[];
|
|
45
|
+
export interface LearningsGraphInfo {
|
|
46
|
+
exists: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* True for graphs created before 2026-08-28 with `categoriesAsMentions`
|
|
49
|
+
* on (labels are nodes there). Informational only; consent is the marker
|
|
50
|
+
* statement.
|
|
51
|
+
*/
|
|
52
|
+
categoriesOn: boolean;
|
|
53
|
+
id?: number;
|
|
54
|
+
url?: string;
|
|
55
|
+
createdAt?: string;
|
|
56
|
+
}
|
|
57
|
+
export { READ_ATTEMPTS, errorText };
|
|
58
|
+
/** Exact-name lookup through /listGraphs (read-only; never creates anything). */
|
|
59
|
+
export declare function findLearningsGraph(graphName: string): Promise<LearningsGraphInfo>;
|
|
60
|
+
export interface StoredLearning {
|
|
61
|
+
content: string;
|
|
62
|
+
types: string[];
|
|
63
|
+
source?: string;
|
|
64
|
+
categories: string[];
|
|
65
|
+
createdAt?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare function toStoredLearning(statement: Statement): StoredLearning | null;
|
|
68
|
+
export declare function isMarkerStatement(statement: Statement): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Read every statement of the graph (doNotSave; the graph must already exist —
|
|
71
|
+
* a missing name errors and is never created). "Select an existing graph
|
|
72
|
+
* context" on a graph that does exist means the request hit an instance
|
|
73
|
+
* with a stale contexts list (see firstPositive), not a parameter problem.
|
|
74
|
+
*/
|
|
75
|
+
export declare function fetchLearningsGraph(graphName: string): Promise<{
|
|
76
|
+
statements: Statement[];
|
|
77
|
+
response: GraphResponse;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Resolve whether learnings are enabled for a graph name: the graph exists
|
|
81
|
+
* and holds the marker statement written by `createLearningsGraph`. The
|
|
82
|
+
* listing supplies url/createdAt; reading by name is authoritative for
|
|
83
|
+
* existence (a missing graph errors and is never created) and is also what
|
|
84
|
+
* catches a graph the listing does not show yet (see firstPositive).
|
|
85
|
+
*/
|
|
86
|
+
export declare function checkEnabled(graphName: string): Promise<{
|
|
87
|
+
enabled: boolean;
|
|
88
|
+
info: LearningsGraphInfo;
|
|
89
|
+
reason?: "missing" | "not-a-learnings-graph";
|
|
90
|
+
}>;
|
|
91
|
+
export interface AppendResult {
|
|
92
|
+
graphName?: string;
|
|
93
|
+
graphUrl?: string;
|
|
94
|
+
response: GraphResponse;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Append statements (with parallel categories/timestamps) to an existing
|
|
98
|
+
* graph. Sent as a plain statements payload — NOT via prepareStatementsPayload,
|
|
99
|
+
* which would switch `categoriesAsMentions` on and turn the labels into nodes.
|
|
100
|
+
*/
|
|
101
|
+
export declare function appendLearnings(params: {
|
|
102
|
+
graphName: string;
|
|
103
|
+
statements: string[];
|
|
104
|
+
categories: string[][];
|
|
105
|
+
timestamps: string[];
|
|
106
|
+
}): Promise<AppendResult>;
|
|
107
|
+
/**
|
|
108
|
+
* Create the learnings graph. The marker statement (and its
|
|
109
|
+
* `learnings-enabled` category) is what `checkEnabled` looks for.
|
|
110
|
+
*/
|
|
111
|
+
export declare function createLearningsGraph(params: {
|
|
112
|
+
graphName: string;
|
|
113
|
+
slug: string;
|
|
114
|
+
clientName?: string;
|
|
115
|
+
}): Promise<AppendResult>;
|
|
116
|
+
export declare function newestFirst<T extends {
|
|
117
|
+
createdAt?: string;
|
|
118
|
+
}>(items: T[]): T[];
|
|
119
|
+
//# sourceMappingURL=learnings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learnings.d.ts","sourceRoot":"","sources":["../../src/utils/learnings.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EACN,aAAa,EACb,SAAS,EAGT,MAAM,kBAAkB,CAAC;AAE1B,eAAO,MAAM,YAAY,WAAW,CAAC;AACrC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,eAAe,sBAAsB,CAAC;AAEnD,eAAO,MAAM,cAAc,6FAQjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAC5C,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,OAAO,CAAC,K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