@stackfactor/client-api 1.6.2 → 1.7.2
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 +38 -36
- package/dist/cjs/lib/index.d.ts +1 -0
- package/dist/cjs/lib/index.d.ts.map +1 -1
- package/dist/cjs/lib/index.js +3 -2
- package/dist/cjs/lib/index.js.map +1 -1
- package/dist/cjs/lib/knowledgeBaseAgent.d.ts +142 -0
- package/dist/cjs/lib/knowledgeBaseAgent.d.ts.map +1 -0
- package/dist/cjs/lib/knowledgeBaseAgent.js +98 -0
- package/dist/cjs/lib/knowledgeBaseAgent.js.map +1 -0
- package/dist/esm/lib/index.d.ts +1 -0
- package/dist/esm/lib/index.d.ts.map +1 -1
- package/dist/esm/lib/index.js +1 -0
- package/dist/esm/lib/index.js.map +1 -1
- package/dist/esm/lib/knowledgeBaseAgent.d.ts +142 -0
- package/dist/esm/lib/knowledgeBaseAgent.d.ts.map +1 -0
- package/dist/esm/lib/knowledgeBaseAgent.js +90 -0
- package/dist/esm/lib/knowledgeBaseAgent.js.map +1 -0
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -46,42 +46,43 @@ address
|
|
|
46
46
|
|
|
47
47
|
### Available Modules
|
|
48
48
|
|
|
49
|
-
| Import Name | Description
|
|
50
|
-
| ------------------------------- |
|
|
51
|
-
| `actionNotifications` | User action notifications
|
|
52
|
-
| `address` | Address validation and autocomplete
|
|
53
|
-
| `aiAssistant` | AI assistant conversations and voice
|
|
54
|
-
| `aiModelRates` | What the platform charges for AI use
|
|
55
|
-
| `avatar` | User and element avatars
|
|
56
|
-
| `client` | Configured Axios HTTP client instance
|
|
57
|
-
| `config` | Platform configuration
|
|
58
|
-
| `contentGenerator` | AI-powered content generation
|
|
59
|
-
| `customFields` | Custom field definitions
|
|
60
|
-
| `dashboard` | Dashboard card management
|
|
61
|
-
| `departmentTraingPlans` | Department training plans
|
|
62
|
-
| `groups` | User group management
|
|
63
|
-
| `integration` | Integration management
|
|
64
|
-
| `integrationConfiguration` | Integration configuration
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
49
|
+
| Import Name | Description |
|
|
50
|
+
| ------------------------------- | --------------------------------------- |
|
|
51
|
+
| `actionNotifications` | User action notifications |
|
|
52
|
+
| `address` | Address validation and autocomplete |
|
|
53
|
+
| `aiAssistant` | AI assistant conversations and voice |
|
|
54
|
+
| `aiModelRates` | What the platform charges for AI use |
|
|
55
|
+
| `avatar` | User and element avatars |
|
|
56
|
+
| `client` | Configured Axios HTTP client instance |
|
|
57
|
+
| `config` | Platform configuration |
|
|
58
|
+
| `contentGenerator` | AI-powered content generation |
|
|
59
|
+
| `customFields` | Custom field definitions |
|
|
60
|
+
| `dashboard` | Dashboard card management |
|
|
61
|
+
| `departmentTraingPlans` | Department training plans |
|
|
62
|
+
| `groups` | User group management |
|
|
63
|
+
| `integration` | Integration management |
|
|
64
|
+
| `integrationConfiguration` | Integration configuration |
|
|
65
|
+
| `knowledgeBaseAgent` | Knowledge-base calls an agent run makes |
|
|
66
|
+
| `learningContent` | Learning content authoring |
|
|
67
|
+
| `learningPath` | Learning path management |
|
|
68
|
+
| `logger` | Logging utilities |
|
|
69
|
+
| `microSkillsQuizes` | Micro-skill quiz management |
|
|
70
|
+
| `quotas` | Usage quotas |
|
|
71
|
+
| `role` | Role management |
|
|
72
|
+
| `roleTemplate` | Role template management |
|
|
73
|
+
| `security` | Auth connections, MFA, Auth0 sync |
|
|
74
|
+
| `session` | Current user + tenant context |
|
|
75
|
+
| `skill` | Skill management |
|
|
76
|
+
| `skillAssessment` | Skill assessment management |
|
|
77
|
+
| `skillAssessmentTestingSession` | Assessment testing sessions |
|
|
78
|
+
| `skillTemplate` | Skill template management |
|
|
79
|
+
| `onboarding` | Onboarding step tracking |
|
|
80
|
+
| `team` | Team management |
|
|
81
|
+
| `tenant` | Tenant settings |
|
|
82
|
+
| `trainingPlan` | Training plan management |
|
|
83
|
+
| `trainingPlanProficiencyLevel` | Training plan proficiency levels |
|
|
84
|
+
| `userInformation` | User business profile properties |
|
|
85
|
+
| `users` | User accounts and authentication |
|
|
85
86
|
|
|
86
87
|
Constants `DOCUMENT_VERSION`, `RESPONSE_TYPE`, `PERMISSIONS`, and `PERMISSION_DESCRIPTIONS` are also exported directly.
|
|
87
88
|
|
|
@@ -106,6 +107,7 @@ Full method-level documentation for each module is available in the [doc/](doc/)
|
|
|
106
107
|
- [Groups](doc/groups.md)
|
|
107
108
|
- [Integration](doc/integration.md)
|
|
108
109
|
- [Integration Configuration](doc/integrationConfiguration.md)
|
|
110
|
+
- [Knowledge Base Agent](doc/knowledgeBaseAgent.md)
|
|
109
111
|
- [Learning Content](doc/learningContent.md)
|
|
110
112
|
- [Learning Path](doc/learningPath.md)
|
|
111
113
|
- [Logger](doc/logger.md)
|
package/dist/cjs/lib/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * as integrationConfiguration from "./integrationConfiguration.js";
|
|
|
23
23
|
export * as groups from "./groups.js";
|
|
24
24
|
export * as incident from "./incident.js";
|
|
25
25
|
export * as knowledgeBase from "./knowledgeBase.js";
|
|
26
|
+
export * as knowledgeBaseAgent from "./knowledgeBaseAgent.js";
|
|
26
27
|
export * as knowledgeBaseSourceConnectors from "./integrations/knowledgeBaseSourceConnectors.js";
|
|
27
28
|
export * as labSessions from "./labSessions.js";
|
|
28
29
|
export * as learnerFeedback from "./learnerFeedback.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../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,yBAAyB,CAAC;AAC9D,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,6BAA6B,MAAM,oCAAoC,CAAC;AACpF,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,4BAA4B,MAAM,qCAAqC,CAAC;AACpF,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC"}
|
package/dist/cjs/lib/index.js
CHANGED
|
@@ -36,8 +36,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
exports.users = exports.serviceAccounts = exports.userInformation = exports.trainingPlanProficiencyLevel = exports.trainingPlan = exports.tenant = exports.team = exports.onboarding = exports.standardTemplate = exports.standard = exports.skillTemplate = exports.skillAssessmentTestingSession = exports.skillAssessment = void 0;
|
|
39
|
+
exports.session = exports.security = exports.sdlcProfiles = exports.sdlcEvaluationRuns = exports.sdlcConfigurations = exports.roleTemplate = exports.role = exports.requirementTemplate = exports.requirement = exports.repositoryPipelines = exports.reports = exports.quotas = exports.policyTemplate = exports.policy = exports.microSkillsQuizes = exports.logger = exports.partnerships = exports.learningPath = exports.learningContent = exports.learnerFeedback = exports.labSessions = exports.knowledgeBaseSourceConnectors = exports.knowledgeBaseAgent = exports.knowledgeBase = exports.incident = exports.groups = exports.integrationConfiguration = exports.integration = exports.dashboard = exports.customFields = exports.controlTemplate = exports.controlResults = exports.control = exports.contentGenerator = exports.isSocketError = exports.config = exports.channelProgrammes = exports.address = exports.avatar = exports.aiModelRates = exports.billingProfiles = exports.artifactCatalog = exports.aiAssistant = exports.shouldReturnError = exports.setSessionRefresher = exports.getErrorType = exports.getErrorInformation = exports.errorToString = exports.client = exports.actionNotifications = void 0;
|
|
40
|
+
exports.users = exports.serviceAccounts = exports.userInformation = exports.trainingPlanProficiencyLevel = exports.trainingPlan = exports.tenant = exports.team = exports.onboarding = exports.standardTemplate = exports.standard = exports.skillTemplate = exports.skillAssessmentTestingSession = exports.skillAssessment = exports.skill = void 0;
|
|
41
41
|
exports.actionNotifications = __importStar(require("./actionNotifications.js"));
|
|
42
42
|
var axiosClient_js_1 = require("./axiosClient.js");
|
|
43
43
|
Object.defineProperty(exports, "client", { enumerable: true, get: function () { return axiosClient_js_1.client; } });
|
|
@@ -68,6 +68,7 @@ exports.integrationConfiguration = __importStar(require("./integrationConfigurat
|
|
|
68
68
|
exports.groups = __importStar(require("./groups.js"));
|
|
69
69
|
exports.incident = __importStar(require("./incident.js"));
|
|
70
70
|
exports.knowledgeBase = __importStar(require("./knowledgeBase.js"));
|
|
71
|
+
exports.knowledgeBaseAgent = __importStar(require("./knowledgeBaseAgent.js"));
|
|
71
72
|
exports.knowledgeBaseSourceConnectors = __importStar(require("./integrations/knowledgeBaseSourceConnectors.js"));
|
|
72
73
|
exports.labSessions = __importStar(require("./labSessions.js"));
|
|
73
74
|
exports.learnerFeedback = __importStar(require("./learnerFeedback.js"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gFAAgE;AAChE,mDAO0B;AANxB,wGAAA,MAAM,OAAA;AACN,+GAAA,aAAa,OAAA;AACb,qHAAA,mBAAmB,OAAA;AACnB,8GAAA,YAAY,OAAA;AACZ,qHAAA,mBAAmB,OAAA;AACnB,mHAAA,iBAAiB,OAAA;AAGnB,gEAAgD;AAChD,wEAAwD;AACxD,wEAAwD;AACxD,kEAAkD;AAClD,sDAAsC;AACtC,wDAAwC;AACxC,4EAA4D;AAC5D,sDAAsC;AACtC,iDAA+B;AAC/B,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AAEtB,uFAAuE;AACvE,wDAAwC;AACxC,sEAAsD;AACtD,wEAAwD;AACxD,kEAAkD;AAClD,4DAA4C;AAC5C,gEAAgD;AAChD,0FAA0E;AAC1E,sDAAsC;AACtC,0DAA0C;AAC1C,oEAAoD;AACpD,iHAAiG;AACjG,gEAAgD;AAChD,wEAAwD;AACxD,wEAAwD;AACxD,kEAAkD;AAClD,kEAAkD;AAClD,sDAAsC;AACtC,4EAA4D;AAC5D,sDAAsC;AACtC,sEAAsD;AACtD,sDAAsC;AACtC,wDAAwC;AACxC,gFAAgE;AAChE,gEAAgD;AAChD,gFAAgE;AAChE,kDAAkC;AAClC,kEAAkD;AAClD,8EAA8D;AAC9D,8EAA8D;AAC9D,kEAAkD;AAClD,0DAA0C;AAC1C,wDAAwC;AACxC,oDAAoC;AACpC,yEAAyD;AACzD,oGAAoF;AACpF,oEAAoD;AACpD,0DAA0C;AAC1C,0EAA0D;AAC1D,8DAA8C;AAC9C,mDAAmC;AACnC,uDAAuC;AACvC,mEAAmD;AACnD,oGAAoF;AACpF,wEAAwD;AACxD,wEAAwD;AACxD,oDAAoC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gFAAgE;AAChE,mDAO0B;AANxB,wGAAA,MAAM,OAAA;AACN,+GAAA,aAAa,OAAA;AACb,qHAAA,mBAAmB,OAAA;AACnB,8GAAA,YAAY,OAAA;AACZ,qHAAA,mBAAmB,OAAA;AACnB,mHAAA,iBAAiB,OAAA;AAGnB,gEAAgD;AAChD,wEAAwD;AACxD,wEAAwD;AACxD,kEAAkD;AAClD,sDAAsC;AACtC,wDAAwC;AACxC,4EAA4D;AAC5D,sDAAsC;AACtC,iDAA+B;AAC/B,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AAEtB,uFAAuE;AACvE,wDAAwC;AACxC,sEAAsD;AACtD,wEAAwD;AACxD,kEAAkD;AAClD,4DAA4C;AAC5C,gEAAgD;AAChD,0FAA0E;AAC1E,sDAAsC;AACtC,0DAA0C;AAC1C,oEAAoD;AACpD,8EAA8D;AAC9D,iHAAiG;AACjG,gEAAgD;AAChD,wEAAwD;AACxD,wEAAwD;AACxD,kEAAkD;AAClD,kEAAkD;AAClD,sDAAsC;AACtC,4EAA4D;AAC5D,sDAAsC;AACtC,sEAAsD;AACtD,sDAAsC;AACtC,wDAAwC;AACxC,gFAAgE;AAChE,gEAAgD;AAChD,gFAAgE;AAChE,kDAAkC;AAClC,kEAAkD;AAClD,8EAA8D;AAC9D,8EAA8D;AAC9D,kEAAkD;AAClD,0DAA0C;AAC1C,wDAAwC;AACxC,oDAAoC;AACpC,yEAAyD;AACzD,oGAAoF;AACpF,oEAAoD;AACpD,0DAA0C;AAC1C,0EAA0D;AAC1D,8DAA8C;AAC9C,mDAAmC;AACnC,uDAAuC;AACvC,mEAAmD;AACnD,oGAAoF;AACpF,wEAAwD;AACxD,wEAAwD;AACxD,oDAAoC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/** What a search asks for beside the query. Retrieval is task-driven: there is no proficiency filter. */
|
|
2
|
+
export interface SearchOptions {
|
|
3
|
+
/** Keep chunks of these content types only. */
|
|
4
|
+
contentTypeFilter?: string[];
|
|
5
|
+
/** How many chunks at most, 1–50. */
|
|
6
|
+
topK?: number;
|
|
7
|
+
}
|
|
8
|
+
/** A retrieved chunk: its text and where it came from, embeddings stripped. */
|
|
9
|
+
export interface RetrievedChunk {
|
|
10
|
+
_id: string;
|
|
11
|
+
documentId: string;
|
|
12
|
+
text: string;
|
|
13
|
+
[field: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
/** What a sync run is handed when it starts: its knowledge base and source, without credentials. */
|
|
16
|
+
export interface SyncContext {
|
|
17
|
+
knowledgeBase: {
|
|
18
|
+
_id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
embeddingModel: string | null;
|
|
21
|
+
embeddingProvider: string | null;
|
|
22
|
+
embeddingDimensions: number | null;
|
|
23
|
+
};
|
|
24
|
+
/** The source subdocument, `authentication` removed. */
|
|
25
|
+
source: Record<string, unknown> & {
|
|
26
|
+
_id: string;
|
|
27
|
+
name?: string;
|
|
28
|
+
};
|
|
29
|
+
correlationId: string;
|
|
30
|
+
/** The source's last completed sync, the incremental hint for listing; null for a first sync. */
|
|
31
|
+
since: string | null;
|
|
32
|
+
}
|
|
33
|
+
/** How a sync run ended. */
|
|
34
|
+
export interface SyncOutcome {
|
|
35
|
+
/** The correlation id the run was started with. */
|
|
36
|
+
correlationId?: string | null;
|
|
37
|
+
/** True closes the outstanding request; false leaves it standing and records the error. */
|
|
38
|
+
completed: boolean;
|
|
39
|
+
/** How many documents the source holds, when the run counted them. */
|
|
40
|
+
count?: number;
|
|
41
|
+
lastError?: string | null;
|
|
42
|
+
}
|
|
43
|
+
/** Which page of the source to list. */
|
|
44
|
+
export interface DocumentPage {
|
|
45
|
+
/** The `nextCursor` of the previous page; omitted restarts at page one. */
|
|
46
|
+
cursor?: string | null;
|
|
47
|
+
/** The source's last sync, as an ISO date: a connector may list only what changed since. */
|
|
48
|
+
since?: string | null;
|
|
49
|
+
/** The source's own filters, forwarded to the connector. */
|
|
50
|
+
filters?: Record<string, unknown> | null;
|
|
51
|
+
}
|
|
52
|
+
/** One page of what the source holds, as the connector listed it. */
|
|
53
|
+
export interface ListedDocuments {
|
|
54
|
+
documents: ListedDocument[];
|
|
55
|
+
nextCursor: string | null;
|
|
56
|
+
[field: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
/** One entry of a LIST_DOCUMENTS page: whatever the connector listed, with the source's own id. */
|
|
59
|
+
export interface ListedDocument {
|
|
60
|
+
id: string;
|
|
61
|
+
name?: string;
|
|
62
|
+
mimeType?: string;
|
|
63
|
+
[field: string]: unknown;
|
|
64
|
+
}
|
|
65
|
+
/** What ingesting one document came to. */
|
|
66
|
+
export interface IngestOutcome {
|
|
67
|
+
documentId: string | null;
|
|
68
|
+
/** created · updated · unchanged_bytes · unchanged_content · failed */
|
|
69
|
+
outcome: string;
|
|
70
|
+
/** Why it failed, for a failed outcome. */
|
|
71
|
+
error?: string;
|
|
72
|
+
/** Set when the content changed and its chunks were replaced and embedded. */
|
|
73
|
+
chunkCount?: number;
|
|
74
|
+
tokenCount?: number;
|
|
75
|
+
dimensions?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Retrieves chunks for a task-driven query, for the person the run acts for:
|
|
79
|
+
* the knowledge base's ACL judges that person, not the run's own account.
|
|
80
|
+
* POST /api/v1/knowledge-base/:id/search
|
|
81
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
82
|
+
* @param {String} query The task, as text (1–4000 characters)
|
|
83
|
+
* @param {SearchOptions} options `contentTypeFilter`, `topK`
|
|
84
|
+
* @param {String} token The run's AGENT token
|
|
85
|
+
* @returns {Promise<{chunks: RetrievedChunk[]}>}
|
|
86
|
+
*/
|
|
87
|
+
export declare const search: (knowledgeBaseId: string, query: string, options: SearchOptions, token: string) => Promise<{
|
|
88
|
+
chunks: RetrievedChunk[];
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Announces a sync run and receives its context. Rejects with 409 while
|
|
92
|
+
* another run of the same source is outstanding under a different correlation
|
|
93
|
+
* id, and with 404 when the knowledge base or the source is gone.
|
|
94
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/sync/start
|
|
95
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
96
|
+
* @param {String} sourceId The source subdocument
|
|
97
|
+
* @param {String} correlationId The run's correlation id, from the SYNCHRONIZE event
|
|
98
|
+
* @param {String} token The run's AGENT token
|
|
99
|
+
* @returns {Promise<SyncContext>}
|
|
100
|
+
*/
|
|
101
|
+
export declare const startSync: (knowledgeBaseId: string, sourceId: string, correlationId: string, token: string) => Promise<SyncContext>;
|
|
102
|
+
/**
|
|
103
|
+
* Records how a sync run ended. A completed run closes the outstanding
|
|
104
|
+
* request; one that did not complete leaves it standing and records why.
|
|
105
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/sync/finish
|
|
106
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
107
|
+
* @param {String} sourceId The source subdocument
|
|
108
|
+
* @param {SyncOutcome} outcome `completed`, and `count`, `lastError`, `correlationId` when there are any
|
|
109
|
+
* @param {String} token The run's AGENT token
|
|
110
|
+
* @returns {Promise<{ok: true}>}
|
|
111
|
+
*/
|
|
112
|
+
export declare const finishSync: (knowledgeBaseId: string, sourceId: string, outcome: SyncOutcome, token: string) => Promise<{
|
|
113
|
+
ok: true;
|
|
114
|
+
}>;
|
|
115
|
+
/**
|
|
116
|
+
* Lists one page of what the source holds, under the source's stored
|
|
117
|
+
* credentials. The run loops on `nextCursor`; without passing it back every
|
|
118
|
+
* call lists page one again.
|
|
119
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/documents/list
|
|
120
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
121
|
+
* @param {String} sourceId The source subdocument
|
|
122
|
+
* @param {DocumentPage} page `cursor`, `since`, `filters`
|
|
123
|
+
* @param {String} token The run's AGENT token
|
|
124
|
+
* @returns {Promise<ListedDocuments>}
|
|
125
|
+
*/
|
|
126
|
+
export declare const listSourceDocuments: (knowledgeBaseId: string, sourceId: string, page: DocumentPage, token: string) => Promise<ListedDocuments>;
|
|
127
|
+
/**
|
|
128
|
+
* Ingests one listed document: the backend fetches it, captures its ACL,
|
|
129
|
+
* applies the hash gates, parses and persists it, and when its content changed
|
|
130
|
+
* replaces and embeds its chunks. A document that could not be ingested is an
|
|
131
|
+
* outcome (`failed`, with its error), not a rejection; an embedding failure
|
|
132
|
+
* rejects, so the run may try the document again.
|
|
133
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/documents
|
|
134
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
135
|
+
* @param {String} sourceId The source subdocument
|
|
136
|
+
* @param {ListedDocument} document One entry of a listed page, as the connector listed it
|
|
137
|
+
* @param {String|null} correlationId The run's correlation id, stamped on the document
|
|
138
|
+
* @param {String} token The run's AGENT token
|
|
139
|
+
* @returns {Promise<IngestOutcome>}
|
|
140
|
+
*/
|
|
141
|
+
export declare const ingestDocument: (knowledgeBaseId: string, sourceId: string, document: ListedDocument, correlationId: string | null, token: string) => Promise<IngestOutcome>;
|
|
142
|
+
//# sourceMappingURL=knowledgeBaseAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledgeBaseAgent.d.ts","sourceRoot":"","sources":["../../../src/lib/knowledgeBaseAgent.ts"],"names":[],"mappings":"AAwCA,yGAAyG;AACzG,MAAM,WAAW,aAAa;IAC5B,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,+EAA+E;AAC/E,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC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eAAe,CAOvB,CAAC;AAEJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,GACzB,iBAAiB,MAAM,EACvB,UAAU,MAAM,EAChB,UAAU,cAAc,EACxB,eAAe,MAAM,GAAG,IAAI,EAC5B,OAAO,MAAM,KACZ,OAAO,CAAC,aAAa,CAOrB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ingestDocument = exports.listSourceDocuments = exports.finishSync = exports.startSync = exports.search = void 0;
|
|
4
|
+
const axiosClient_js_1 = require("./axiosClient.js");
|
|
5
|
+
//
|
|
6
|
+
// The knowledge-base calls an agent run makes.
|
|
7
|
+
//
|
|
8
|
+
// Retrieval for a generation run, and the steps of a synchronisation run, over
|
|
9
|
+
// the backend's agent-only knowledge-base routes, which name the knowledge base
|
|
10
|
+
// and the source in the path as the management routes do. Every route
|
|
11
|
+
// admits only an AGENT token and then asks for an ordinary permission the
|
|
12
|
+
// integration declares: `VIEW_KNOWLEDGE_BASE` to search, `MANAGE_KB_SOURCES`
|
|
13
|
+
// to synchronise. There is no user-facing search: retrieval is internal to the
|
|
14
|
+
// agents by design.
|
|
15
|
+
//
|
|
16
|
+
// The sync agent is data-blind. It orchestrates — one page of documents at a
|
|
17
|
+
// time, one document at a time — and the backend does the work: fetching,
|
|
18
|
+
// parsing, chunking and embedding happen there, and the answers carry outcomes
|
|
19
|
+
// and counts, never the content.
|
|
20
|
+
//
|
|
21
|
+
const BASE = "/api/v1/knowledge-base";
|
|
22
|
+
const sourceOf = (knowledgeBaseId, sourceId) => `${BASE}/${encodeURIComponent(knowledgeBaseId)}/sources/${encodeURIComponent(sourceId)}`;
|
|
23
|
+
const headers = (token) => ({ headers: { authorization: token } });
|
|
24
|
+
const answer = (request) => new Promise((resolve, reject) => {
|
|
25
|
+
request
|
|
26
|
+
.then((response) => resolve(response.data))
|
|
27
|
+
.catch((error) => reject(error));
|
|
28
|
+
});
|
|
29
|
+
// Sends only the fields that have a value, so the backend's validators see an
|
|
30
|
+
// omitted option as omitted rather than as `undefined`.
|
|
31
|
+
const compact = (object) => Object.fromEntries(Object.entries(object).filter(([, value]) => value !== undefined));
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves chunks for a task-driven query, for the person the run acts for:
|
|
34
|
+
* the knowledge base's ACL judges that person, not the run's own account.
|
|
35
|
+
* POST /api/v1/knowledge-base/:id/search
|
|
36
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
37
|
+
* @param {String} query The task, as text (1–4000 characters)
|
|
38
|
+
* @param {SearchOptions} options `contentTypeFilter`, `topK`
|
|
39
|
+
* @param {String} token The run's AGENT token
|
|
40
|
+
* @returns {Promise<{chunks: RetrievedChunk[]}>}
|
|
41
|
+
*/
|
|
42
|
+
const search = (knowledgeBaseId, query, options, token) => answer(axiosClient_js_1.client.post(`${BASE}/${encodeURIComponent(knowledgeBaseId)}/search`, { query, ...compact(options ?? {}) }, headers(token)));
|
|
43
|
+
exports.search = search;
|
|
44
|
+
/**
|
|
45
|
+
* Announces a sync run and receives its context. Rejects with 409 while
|
|
46
|
+
* another run of the same source is outstanding under a different correlation
|
|
47
|
+
* id, and with 404 when the knowledge base or the source is gone.
|
|
48
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/sync/start
|
|
49
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
50
|
+
* @param {String} sourceId The source subdocument
|
|
51
|
+
* @param {String} correlationId The run's correlation id, from the SYNCHRONIZE event
|
|
52
|
+
* @param {String} token The run's AGENT token
|
|
53
|
+
* @returns {Promise<SyncContext>}
|
|
54
|
+
*/
|
|
55
|
+
const startSync = (knowledgeBaseId, sourceId, correlationId, token) => answer(axiosClient_js_1.client.post(`${sourceOf(knowledgeBaseId, sourceId)}/sync/start`, { correlationId }, headers(token)));
|
|
56
|
+
exports.startSync = startSync;
|
|
57
|
+
/**
|
|
58
|
+
* Records how a sync run ended. A completed run closes the outstanding
|
|
59
|
+
* request; one that did not complete leaves it standing and records why.
|
|
60
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/sync/finish
|
|
61
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
62
|
+
* @param {String} sourceId The source subdocument
|
|
63
|
+
* @param {SyncOutcome} outcome `completed`, and `count`, `lastError`, `correlationId` when there are any
|
|
64
|
+
* @param {String} token The run's AGENT token
|
|
65
|
+
* @returns {Promise<{ok: true}>}
|
|
66
|
+
*/
|
|
67
|
+
const finishSync = (knowledgeBaseId, sourceId, outcome, token) => answer(axiosClient_js_1.client.post(`${sourceOf(knowledgeBaseId, sourceId)}/sync/finish`, compact(outcome), headers(token)));
|
|
68
|
+
exports.finishSync = finishSync;
|
|
69
|
+
/**
|
|
70
|
+
* Lists one page of what the source holds, under the source's stored
|
|
71
|
+
* credentials. The run loops on `nextCursor`; without passing it back every
|
|
72
|
+
* call lists page one again.
|
|
73
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/documents/list
|
|
74
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
75
|
+
* @param {String} sourceId The source subdocument
|
|
76
|
+
* @param {DocumentPage} page `cursor`, `since`, `filters`
|
|
77
|
+
* @param {String} token The run's AGENT token
|
|
78
|
+
* @returns {Promise<ListedDocuments>}
|
|
79
|
+
*/
|
|
80
|
+
const listSourceDocuments = (knowledgeBaseId, sourceId, page, token) => answer(axiosClient_js_1.client.post(`${sourceOf(knowledgeBaseId, sourceId)}/documents/list`, compact(page ?? {}), headers(token)));
|
|
81
|
+
exports.listSourceDocuments = listSourceDocuments;
|
|
82
|
+
/**
|
|
83
|
+
* Ingests one listed document: the backend fetches it, captures its ACL,
|
|
84
|
+
* applies the hash gates, parses and persists it, and when its content changed
|
|
85
|
+
* replaces and embeds its chunks. A document that could not be ingested is an
|
|
86
|
+
* outcome (`failed`, with its error), not a rejection; an embedding failure
|
|
87
|
+
* rejects, so the run may try the document again.
|
|
88
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/documents
|
|
89
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
90
|
+
* @param {String} sourceId The source subdocument
|
|
91
|
+
* @param {ListedDocument} document One entry of a listed page, as the connector listed it
|
|
92
|
+
* @param {String|null} correlationId The run's correlation id, stamped on the document
|
|
93
|
+
* @param {String} token The run's AGENT token
|
|
94
|
+
* @returns {Promise<IngestOutcome>}
|
|
95
|
+
*/
|
|
96
|
+
const ingestDocument = (knowledgeBaseId, sourceId, document, correlationId, token) => answer(axiosClient_js_1.client.post(`${sourceOf(knowledgeBaseId, sourceId)}/documents`, { document, ...(correlationId ? { correlationId } : {}) }, headers(token)));
|
|
97
|
+
exports.ingestDocument = ingestDocument;
|
|
98
|
+
//# sourceMappingURL=knowledgeBaseAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledgeBaseAgent.js","sourceRoot":"","sources":["../../../src/lib/knowledgeBaseAgent.ts"],"names":[],"mappings":";;;AACA,qDAA0C;AAE1C,EAAE;AACF,+CAA+C;AAC/C,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,sEAAsE;AACtE,0EAA0E;AAC1E,6EAA6E;AAC7E,+EAA+E;AAC/E,oBAAoB;AACpB,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,+EAA+E;AAC/E,iCAAiC;AACjC,EAAE;AAEF,MAAM,IAAI,GAAG,wBAAwB,CAAC;AACtC,MAAM,QAAQ,GAAG,CAAC,eAAuB,EAAE,QAAgB,EAAE,EAAE,CAC7D,GAAG,IAAI,IAAI,kBAAkB,CAAC,eAAe,CAAC,YAAY,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;AAE3F,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;AAE3E,MAAM,MAAM,GAAG,CAAI,OAA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eAAuB,EACvB,QAAgB,EAChB,OAAoB,EACpB,KAAa,EACU,EAAE,CACzB,MAAM,CACJ,uBAAM,CAAC,IAAI,CACT,GAAG,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,cAAc,EACpD,OAAO,CAAC,OAAO,CAAC,EAChB,OAAO,CAAC,KAAK,CAAC,CACf,CACF,CAAC;AAZS,QAAA,UAAU,cAYnB;AAEJ;;;;;;;;;;GAUG;AACI,MAAM,mBAAmB,GAAG,CACjC,eAAuB,EACvB,QAAgB,EAChB,IAAkB,EAClB,KAAa,EACa,EAAE,CAC5B,MAAM,CACJ,uBAAM,CAAC,IAAI,CACT,GAAG,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,iBAAiB,EACvD,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,EACnB,OAAO,CAAC,KAAK,CAAC,CACf,CACF,CAAC;AAZS,QAAA,mBAAmB,uBAY5B;AAEJ;;;;;;;;;;;;;GAaG;AACI,MAAM,cAAc,GAAG,CAC5B,eAAuB,EACvB,QAAgB,EAChB,QAAwB,EACxB,aAA4B,EAC5B,KAAa,EACW,EAAE,CAC1B,MAAM,CACJ,uBAAM,CAAC,IAAI,CACT,GAAG,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,YAAY,EAClD,EAAE,QAAQ,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EACzD,OAAO,CAAC,KAAK,CAAC,CACf,CACF,CAAC;AAbS,QAAA,cAAc,kBAavB"}
|
package/dist/esm/lib/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * as integrationConfiguration from "./integrationConfiguration.js";
|
|
|
23
23
|
export * as groups from "./groups.js";
|
|
24
24
|
export * as incident from "./incident.js";
|
|
25
25
|
export * as knowledgeBase from "./knowledgeBase.js";
|
|
26
|
+
export * as knowledgeBaseAgent from "./knowledgeBaseAgent.js";
|
|
26
27
|
export * as knowledgeBaseSourceConnectors from "./integrations/knowledgeBaseSourceConnectors.js";
|
|
27
28
|
export * as labSessions from "./labSessions.js";
|
|
28
29
|
export * as learnerFeedback from "./learnerFeedback.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,EACL,MAAM,EACN,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,gBAAgB,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,WAAW,MAAM,kBAAkB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AO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,6BAA6B,MAAM,oCAAoC,CAAC;AACpF,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,4BAA4B,MAAM,qCAAqC,CAAC;AACpF,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC"}
|
package/dist/esm/lib/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export * as integrationConfiguration from "./integrationConfiguration.js";
|
|
|
21
21
|
export * as groups from "./groups.js";
|
|
22
22
|
export * as incident from "./incident.js";
|
|
23
23
|
export * as knowledgeBase from "./knowledgeBase.js";
|
|
24
|
+
export * as knowledgeBaseAgent from "./knowledgeBaseAgent.js";
|
|
24
25
|
export * as knowledgeBaseSourceConnectors from "./integrations/knowledgeBaseSourceConnectors.js";
|
|
25
26
|
export * as labSessions from "./labSessions.js";
|
|
26
27
|
export * as learnerFeedback from "./learnerFeedback.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,EACL,MAAM,EACN,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,gBAAgB,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,wBAAwB,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,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O,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,6BAA6B,MAAM,oCAAoC,CAAC;AACpF,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,4BAA4B,MAAM,qCAAqC,CAAC;AACpF,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/** What a search asks for beside the query. Retrieval is task-driven: there is no proficiency filter. */
|
|
2
|
+
export interface SearchOptions {
|
|
3
|
+
/** Keep chunks of these content types only. */
|
|
4
|
+
contentTypeFilter?: string[];
|
|
5
|
+
/** How many chunks at most, 1–50. */
|
|
6
|
+
topK?: number;
|
|
7
|
+
}
|
|
8
|
+
/** A retrieved chunk: its text and where it came from, embeddings stripped. */
|
|
9
|
+
export interface RetrievedChunk {
|
|
10
|
+
_id: string;
|
|
11
|
+
documentId: string;
|
|
12
|
+
text: string;
|
|
13
|
+
[field: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
/** What a sync run is handed when it starts: its knowledge base and source, without credentials. */
|
|
16
|
+
export interface SyncContext {
|
|
17
|
+
knowledgeBase: {
|
|
18
|
+
_id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
embeddingModel: string | null;
|
|
21
|
+
embeddingProvider: string | null;
|
|
22
|
+
embeddingDimensions: number | null;
|
|
23
|
+
};
|
|
24
|
+
/** The source subdocument, `authentication` removed. */
|
|
25
|
+
source: Record<string, unknown> & {
|
|
26
|
+
_id: string;
|
|
27
|
+
name?: string;
|
|
28
|
+
};
|
|
29
|
+
correlationId: string;
|
|
30
|
+
/** The source's last completed sync, the incremental hint for listing; null for a first sync. */
|
|
31
|
+
since: string | null;
|
|
32
|
+
}
|
|
33
|
+
/** How a sync run ended. */
|
|
34
|
+
export interface SyncOutcome {
|
|
35
|
+
/** The correlation id the run was started with. */
|
|
36
|
+
correlationId?: string | null;
|
|
37
|
+
/** True closes the outstanding request; false leaves it standing and records the error. */
|
|
38
|
+
completed: boolean;
|
|
39
|
+
/** How many documents the source holds, when the run counted them. */
|
|
40
|
+
count?: number;
|
|
41
|
+
lastError?: string | null;
|
|
42
|
+
}
|
|
43
|
+
/** Which page of the source to list. */
|
|
44
|
+
export interface DocumentPage {
|
|
45
|
+
/** The `nextCursor` of the previous page; omitted restarts at page one. */
|
|
46
|
+
cursor?: string | null;
|
|
47
|
+
/** The source's last sync, as an ISO date: a connector may list only what changed since. */
|
|
48
|
+
since?: string | null;
|
|
49
|
+
/** The source's own filters, forwarded to the connector. */
|
|
50
|
+
filters?: Record<string, unknown> | null;
|
|
51
|
+
}
|
|
52
|
+
/** One page of what the source holds, as the connector listed it. */
|
|
53
|
+
export interface ListedDocuments {
|
|
54
|
+
documents: ListedDocument[];
|
|
55
|
+
nextCursor: string | null;
|
|
56
|
+
[field: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
/** One entry of a LIST_DOCUMENTS page: whatever the connector listed, with the source's own id. */
|
|
59
|
+
export interface ListedDocument {
|
|
60
|
+
id: string;
|
|
61
|
+
name?: string;
|
|
62
|
+
mimeType?: string;
|
|
63
|
+
[field: string]: unknown;
|
|
64
|
+
}
|
|
65
|
+
/** What ingesting one document came to. */
|
|
66
|
+
export interface IngestOutcome {
|
|
67
|
+
documentId: string | null;
|
|
68
|
+
/** created · updated · unchanged_bytes · unchanged_content · failed */
|
|
69
|
+
outcome: string;
|
|
70
|
+
/** Why it failed, for a failed outcome. */
|
|
71
|
+
error?: string;
|
|
72
|
+
/** Set when the content changed and its chunks were replaced and embedded. */
|
|
73
|
+
chunkCount?: number;
|
|
74
|
+
tokenCount?: number;
|
|
75
|
+
dimensions?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Retrieves chunks for a task-driven query, for the person the run acts for:
|
|
79
|
+
* the knowledge base's ACL judges that person, not the run's own account.
|
|
80
|
+
* POST /api/v1/knowledge-base/:id/search
|
|
81
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
82
|
+
* @param {String} query The task, as text (1–4000 characters)
|
|
83
|
+
* @param {SearchOptions} options `contentTypeFilter`, `topK`
|
|
84
|
+
* @param {String} token The run's AGENT token
|
|
85
|
+
* @returns {Promise<{chunks: RetrievedChunk[]}>}
|
|
86
|
+
*/
|
|
87
|
+
export declare const search: (knowledgeBaseId: string, query: string, options: SearchOptions, token: string) => Promise<{
|
|
88
|
+
chunks: RetrievedChunk[];
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Announces a sync run and receives its context. Rejects with 409 while
|
|
92
|
+
* another run of the same source is outstanding under a different correlation
|
|
93
|
+
* id, and with 404 when the knowledge base or the source is gone.
|
|
94
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/sync/start
|
|
95
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
96
|
+
* @param {String} sourceId The source subdocument
|
|
97
|
+
* @param {String} correlationId The run's correlation id, from the SYNCHRONIZE event
|
|
98
|
+
* @param {String} token The run's AGENT token
|
|
99
|
+
* @returns {Promise<SyncContext>}
|
|
100
|
+
*/
|
|
101
|
+
export declare const startSync: (knowledgeBaseId: string, sourceId: string, correlationId: string, token: string) => Promise<SyncContext>;
|
|
102
|
+
/**
|
|
103
|
+
* Records how a sync run ended. A completed run closes the outstanding
|
|
104
|
+
* request; one that did not complete leaves it standing and records why.
|
|
105
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/sync/finish
|
|
106
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
107
|
+
* @param {String} sourceId The source subdocument
|
|
108
|
+
* @param {SyncOutcome} outcome `completed`, and `count`, `lastError`, `correlationId` when there are any
|
|
109
|
+
* @param {String} token The run's AGENT token
|
|
110
|
+
* @returns {Promise<{ok: true}>}
|
|
111
|
+
*/
|
|
112
|
+
export declare const finishSync: (knowledgeBaseId: string, sourceId: string, outcome: SyncOutcome, token: string) => Promise<{
|
|
113
|
+
ok: true;
|
|
114
|
+
}>;
|
|
115
|
+
/**
|
|
116
|
+
* Lists one page of what the source holds, under the source's stored
|
|
117
|
+
* credentials. The run loops on `nextCursor`; without passing it back every
|
|
118
|
+
* call lists page one again.
|
|
119
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/documents/list
|
|
120
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
121
|
+
* @param {String} sourceId The source subdocument
|
|
122
|
+
* @param {DocumentPage} page `cursor`, `since`, `filters`
|
|
123
|
+
* @param {String} token The run's AGENT token
|
|
124
|
+
* @returns {Promise<ListedDocuments>}
|
|
125
|
+
*/
|
|
126
|
+
export declare const listSourceDocuments: (knowledgeBaseId: string, sourceId: string, page: DocumentPage, token: string) => Promise<ListedDocuments>;
|
|
127
|
+
/**
|
|
128
|
+
* Ingests one listed document: the backend fetches it, captures its ACL,
|
|
129
|
+
* applies the hash gates, parses and persists it, and when its content changed
|
|
130
|
+
* replaces and embeds its chunks. A document that could not be ingested is an
|
|
131
|
+
* outcome (`failed`, with its error), not a rejection; an embedding failure
|
|
132
|
+
* rejects, so the run may try the document again.
|
|
133
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/documents
|
|
134
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
135
|
+
* @param {String} sourceId The source subdocument
|
|
136
|
+
* @param {ListedDocument} document One entry of a listed page, as the connector listed it
|
|
137
|
+
* @param {String|null} correlationId The run's correlation id, stamped on the document
|
|
138
|
+
* @param {String} token The run's AGENT token
|
|
139
|
+
* @returns {Promise<IngestOutcome>}
|
|
140
|
+
*/
|
|
141
|
+
export declare const ingestDocument: (knowledgeBaseId: string, sourceId: string, document: ListedDocument, correlationId: string | null, token: string) => Promise<IngestOutcome>;
|
|
142
|
+
//# sourceMappingURL=knowledgeBaseAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledgeBaseAgent.d.ts","sourceRoot":"","sources":["../../../src/lib/knowledgeBaseAgent.ts"],"names":[],"mappings":"AAwCA,yGAAyG;AACzG,MAAM,WAAW,aAAa;IAC5B,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,+EAA+E;AAC/E,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,oGAAoG;AACpG,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;QACjC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;KACpC,CAAC;IACF,wDAAwD;IACxD,MAAM,EAAE,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AChB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,GACjB,iBAAiB,MAAM,EACvB,OAAO,MAAM,EACb,SAAS,aAAa,EACtB,OAAO,MAAM,KACZ,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,EAAE,CAAA;CAAE,CAOpC,CAAC;AAEJ;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GACpB,iBAAiB,MAAM,EACvB,UAAU,MAAM,EAChB,eAAe,MAAM,EACrB,OAAO,MAAM,KACZ,OAAO,CAAC,WAAW,CAOnB,CAAC;AAEJ;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,GACrB,iBAAiB,MAAM,EACvB,UAAU,MAAM,EAChB,SAAS,WAAW,EACpB,OAAO,MAAM,KACZ,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAOpB,CAAC;AAEJ;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAC9B,iBAAiB,MAAM,EACvB,UAAU,MAAM,EAChB,MAAM,YAAY,EAClB,OAAO,MAAM,KACZ,OAAO,CAAC,eAAe,CAOvB,CAAC;AAEJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,GACzB,iBAAiB,MAAM,EACvB,UAAU,MAAM,EAChB,UAAU,cAAc,EACxB,eAAe,MAAM,GAAG,IAAI,EAC5B,OAAO,MAAM,KACZ,OAAO,CAAC,aAAa,CAOrB,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { client } from "./axiosClient.js";
|
|
2
|
+
//
|
|
3
|
+
// The knowledge-base calls an agent run makes.
|
|
4
|
+
//
|
|
5
|
+
// Retrieval for a generation run, and the steps of a synchronisation run, over
|
|
6
|
+
// the backend's agent-only knowledge-base routes, which name the knowledge base
|
|
7
|
+
// and the source in the path as the management routes do. Every route
|
|
8
|
+
// admits only an AGENT token and then asks for an ordinary permission the
|
|
9
|
+
// integration declares: `VIEW_KNOWLEDGE_BASE` to search, `MANAGE_KB_SOURCES`
|
|
10
|
+
// to synchronise. There is no user-facing search: retrieval is internal to the
|
|
11
|
+
// agents by design.
|
|
12
|
+
//
|
|
13
|
+
// The sync agent is data-blind. It orchestrates — one page of documents at a
|
|
14
|
+
// time, one document at a time — and the backend does the work: fetching,
|
|
15
|
+
// parsing, chunking and embedding happen there, and the answers carry outcomes
|
|
16
|
+
// and counts, never the content.
|
|
17
|
+
//
|
|
18
|
+
const BASE = "/api/v1/knowledge-base";
|
|
19
|
+
const sourceOf = (knowledgeBaseId, sourceId) => `${BASE}/${encodeURIComponent(knowledgeBaseId)}/sources/${encodeURIComponent(sourceId)}`;
|
|
20
|
+
const headers = (token) => ({ headers: { authorization: token } });
|
|
21
|
+
const answer = (request) => new Promise((resolve, reject) => {
|
|
22
|
+
request
|
|
23
|
+
.then((response) => resolve(response.data))
|
|
24
|
+
.catch((error) => reject(error));
|
|
25
|
+
});
|
|
26
|
+
// Sends only the fields that have a value, so the backend's validators see an
|
|
27
|
+
// omitted option as omitted rather than as `undefined`.
|
|
28
|
+
const compact = (object) => Object.fromEntries(Object.entries(object).filter(([, value]) => value !== undefined));
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves chunks for a task-driven query, for the person the run acts for:
|
|
31
|
+
* the knowledge base's ACL judges that person, not the run's own account.
|
|
32
|
+
* POST /api/v1/knowledge-base/:id/search
|
|
33
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
34
|
+
* @param {String} query The task, as text (1–4000 characters)
|
|
35
|
+
* @param {SearchOptions} options `contentTypeFilter`, `topK`
|
|
36
|
+
* @param {String} token The run's AGENT token
|
|
37
|
+
* @returns {Promise<{chunks: RetrievedChunk[]}>}
|
|
38
|
+
*/
|
|
39
|
+
export const search = (knowledgeBaseId, query, options, token) => answer(client.post(`${BASE}/${encodeURIComponent(knowledgeBaseId)}/search`, { query, ...compact(options ?? {}) }, headers(token)));
|
|
40
|
+
/**
|
|
41
|
+
* Announces a sync run and receives its context. Rejects with 409 while
|
|
42
|
+
* another run of the same source is outstanding under a different correlation
|
|
43
|
+
* id, and with 404 when the knowledge base or the source is gone.
|
|
44
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/sync/start
|
|
45
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
46
|
+
* @param {String} sourceId The source subdocument
|
|
47
|
+
* @param {String} correlationId The run's correlation id, from the SYNCHRONIZE event
|
|
48
|
+
* @param {String} token The run's AGENT token
|
|
49
|
+
* @returns {Promise<SyncContext>}
|
|
50
|
+
*/
|
|
51
|
+
export const startSync = (knowledgeBaseId, sourceId, correlationId, token) => answer(client.post(`${sourceOf(knowledgeBaseId, sourceId)}/sync/start`, { correlationId }, headers(token)));
|
|
52
|
+
/**
|
|
53
|
+
* Records how a sync run ended. A completed run closes the outstanding
|
|
54
|
+
* request; one that did not complete leaves it standing and records why.
|
|
55
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/sync/finish
|
|
56
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
57
|
+
* @param {String} sourceId The source subdocument
|
|
58
|
+
* @param {SyncOutcome} outcome `completed`, and `count`, `lastError`, `correlationId` when there are any
|
|
59
|
+
* @param {String} token The run's AGENT token
|
|
60
|
+
* @returns {Promise<{ok: true}>}
|
|
61
|
+
*/
|
|
62
|
+
export const finishSync = (knowledgeBaseId, sourceId, outcome, token) => answer(client.post(`${sourceOf(knowledgeBaseId, sourceId)}/sync/finish`, compact(outcome), headers(token)));
|
|
63
|
+
/**
|
|
64
|
+
* Lists one page of what the source holds, under the source's stored
|
|
65
|
+
* credentials. The run loops on `nextCursor`; without passing it back every
|
|
66
|
+
* call lists page one again.
|
|
67
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/documents/list
|
|
68
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
69
|
+
* @param {String} sourceId The source subdocument
|
|
70
|
+
* @param {DocumentPage} page `cursor`, `since`, `filters`
|
|
71
|
+
* @param {String} token The run's AGENT token
|
|
72
|
+
* @returns {Promise<ListedDocuments>}
|
|
73
|
+
*/
|
|
74
|
+
export const listSourceDocuments = (knowledgeBaseId, sourceId, page, token) => answer(client.post(`${sourceOf(knowledgeBaseId, sourceId)}/documents/list`, compact(page ?? {}), headers(token)));
|
|
75
|
+
/**
|
|
76
|
+
* Ingests one listed document: the backend fetches it, captures its ACL,
|
|
77
|
+
* applies the hash gates, parses and persists it, and when its content changed
|
|
78
|
+
* replaces and embeds its chunks. A document that could not be ingested is an
|
|
79
|
+
* outcome (`failed`, with its error), not a rejection; an embedding failure
|
|
80
|
+
* rejects, so the run may try the document again.
|
|
81
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/documents
|
|
82
|
+
* @param {String} knowledgeBaseId The knowledge base
|
|
83
|
+
* @param {String} sourceId The source subdocument
|
|
84
|
+
* @param {ListedDocument} document One entry of a listed page, as the connector listed it
|
|
85
|
+
* @param {String|null} correlationId The run's correlation id, stamped on the document
|
|
86
|
+
* @param {String} token The run's AGENT token
|
|
87
|
+
* @returns {Promise<IngestOutcome>}
|
|
88
|
+
*/
|
|
89
|
+
export const ingestDocument = (knowledgeBaseId, sourceId, document, correlationId, token) => answer(client.post(`${sourceOf(knowledgeBaseId, sourceId)}/documents`, { document, ...(correlationId ? { correlationId } : {}) }, headers(token)));
|
|
90
|
+
//# sourceMappingURL=knowledgeBaseAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledgeBaseAgent.js","sourceRoot":"","sources":["../../../src/lib/knowledgeBaseAgent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,EAAE;AACF,+CAA+C;AAC/C,EAAE;AAC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AC,IAAI,CACT,GAAG,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,YAAY,EAClD,EAAE,QAAQ,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EACzD,OAAO,CAAC,KAAK,CAAC,CACf,CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackfactor/client-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Node.js library for the StackFactor API",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"build:cjs": "tsc --project tsconfig.cjs.json && node scripts/write-dist-manifest.mjs commonjs dist/cjs",
|
|
29
29
|
"build:watch": "tsc --watch",
|
|
30
30
|
"prepublishOnly": "npm run build",
|
|
31
|
-
"test": "
|
|
32
|
-
"test:coverage": "
|
|
31
|
+
"test": "npm run build && node --experimental-test-module-mocks --test test/*.test.mjs",
|
|
32
|
+
"test:coverage": "npm run build && node --experimental-test-module-mocks --experimental-test-coverage --test --test-reporter=tap test/*.test.mjs",
|
|
33
33
|
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
34
34
|
"ar-auth": "npm config set @stackfactor:registry https://us-central1-npm.pkg.dev/virtual-development-team/sf-devenv-npm-private/; TOKEN=$(gcloud auth print-access-token 2>/dev/null || curl -sfH 'Metadata-Flavor: Google' http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token | sed -n 's/.*\"access_token\":\"\\([^\"]*\\)\".*/\\1/p'); test -n \"$TOKEN\" || { echo 'ar-auth: no credential — run: gcloud auth login' >&2; exit 1; }; npm config set //us-central1-npm.pkg.dev/virtual-development-team/sf-devenv-npm-private/:_authToken \"$TOKEN\"; npm config set //us-central1-npm.pkg.dev/virtual-development-team/:_authToken \"$TOKEN\"; echo 'ar-auth: Artifact Registry scope + token configured'",
|
|
35
35
|
"reinstall": "npm run ar-auth && npm ci",
|
|
@@ -48,12 +48,15 @@
|
|
|
48
48
|
"url": "https://github.com/StackFactor/stackfactor-client-api/issues"
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://github.com/StackFactor/stackfactor-client-api#readme",
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=22.3.0"
|
|
53
|
+
},
|
|
51
54
|
"dependencies": {
|
|
52
|
-
"axios": "^1.
|
|
53
|
-
"dotenv": "^
|
|
55
|
+
"axios": "^1.20.0",
|
|
56
|
+
"dotenv": "^18.0.4",
|
|
54
57
|
"https": "latest",
|
|
55
|
-
"node-html-parser": "^9.0.
|
|
56
|
-
"socket.io-client": "^4.8.
|
|
58
|
+
"node-html-parser": "^9.0.4",
|
|
59
|
+
"socket.io-client": "^4.8.4"
|
|
57
60
|
},
|
|
58
61
|
"browser": {
|
|
59
62
|
"dotenv": false
|
|
@@ -61,15 +64,12 @@
|
|
|
61
64
|
"devDependencies": {
|
|
62
65
|
"@eslint/js": "^10.0.1",
|
|
63
66
|
"@types/axios": "^0.14.4",
|
|
64
|
-
"@types/
|
|
65
|
-
"@
|
|
66
|
-
"@typescript-eslint/
|
|
67
|
-
"
|
|
68
|
-
"eslint": "^
|
|
69
|
-
"
|
|
70
|
-
"globals": "^17.9.0",
|
|
71
|
-
"jest": "^30.0.0",
|
|
72
|
-
"ts-jest": "^29.2.5",
|
|
67
|
+
"@types/node": "^26.6.3",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.71.0",
|
|
69
|
+
"@typescript-eslint/parser": "^8.71.0",
|
|
70
|
+
"eslint": "^10.11.0",
|
|
71
|
+
"eslint-plugin-sonarjs": "^4.2.2",
|
|
72
|
+
"globals": "^17.12.0",
|
|
73
73
|
"typescript": "^6.0.3"
|
|
74
74
|
}
|
|
75
75
|
}
|