@carlonicora/nestjs-neo4jsonapi 4.3.2 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/responder/factories/responder.context.factory.d.ts +2 -1
- package/dist/agents/responder/factories/responder.context.factory.d.ts.map +1 -1
- package/dist/agents/responder/factories/responder.context.factory.js.map +1 -1
- package/dist/agents/responder/services/responder.service.d.ts +16 -1
- package/dist/agents/responder/services/responder.service.d.ts.map +1 -1
- package/dist/agents/responder/services/responder.service.js +14 -2
- package/dist/agents/responder/services/responder.service.js.map +1 -1
- package/dist/bootstrap/app.module.factory.d.ts.map +1 -1
- package/dist/bootstrap/app.module.factory.js +2 -0
- package/dist/bootstrap/app.module.factory.js.map +1 -1
- package/dist/bootstrap/bootstrap.options.d.ts +35 -0
- package/dist/bootstrap/bootstrap.options.d.ts.map +1 -1
- package/dist/common/handlers/relationship.handlers.d.ts +2 -0
- package/dist/common/handlers/relationship.handlers.d.ts.map +1 -1
- package/dist/common/handlers/relationship.handlers.js +1 -0
- package/dist/common/handlers/relationship.handlers.js.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +4 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/repositories/handbook.ai-source-query.provider.d.ts +34 -0
- package/dist/common/repositories/handbook.ai-source-query.provider.d.ts.map +1 -0
- package/dist/common/repositories/handbook.ai-source-query.provider.js +58 -0
- package/dist/common/repositories/handbook.ai-source-query.provider.js.map +1 -0
- package/dist/common/repositories/index.d.ts +1 -0
- package/dist/common/repositories/index.d.ts.map +1 -1
- package/dist/common/repositories/index.js +1 -0
- package/dist/common/repositories/index.js.map +1 -1
- package/dist/common/types/data.limits.d.ts +4 -0
- package/dist/common/types/data.limits.d.ts.map +1 -1
- package/dist/common/utils/chunk-content.util.d.ts +28 -0
- package/dist/common/utils/chunk-content.util.d.ts.map +1 -0
- package/dist/common/utils/chunk-content.util.js +32 -0
- package/dist/common/utils/chunk-content.util.js.map +1 -0
- package/dist/config/base.config.d.ts.map +1 -1
- package/dist/config/base.config.js +1 -0
- package/dist/config/base.config.js.map +1 -1
- package/dist/config/enums/queue.id.d.ts +1 -0
- package/dist/config/enums/queue.id.d.ts.map +1 -1
- package/dist/config/enums/queue.id.js +1 -0
- package/dist/config/enums/queue.id.js.map +1 -1
- package/dist/config/interfaces/config.two.factor.interface.d.ts +10 -3
- package/dist/config/interfaces/config.two.factor.interface.d.ts.map +1 -1
- package/dist/core/core.module.d.ts.map +1 -1
- package/dist/core/core.module.js +8 -1
- package/dist/core/core.module.js.map +1 -1
- package/dist/core/llm/services/model.service.d.ts +13 -0
- package/dist/core/llm/services/model.service.d.ts.map +1 -1
- package/dist/core/llm/services/model.service.js +22 -0
- package/dist/core/llm/services/model.service.js.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.service.d.ts +1 -0
- package/dist/core/neo4j/abstracts/abstract.service.d.ts.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.service.js +9 -1
- package/dist/core/neo4j/abstracts/abstract.service.js.map +1 -1
- package/dist/foundations/assistant/controllers/assistant.controller.d.ts.map +1 -1
- package/dist/foundations/assistant/controllers/assistant.controller.js +6 -2
- package/dist/foundations/assistant/controllers/assistant.controller.js.map +1 -1
- package/dist/foundations/assistant/dtos/assistant-append.dto.d.ts +2 -0
- package/dist/foundations/assistant/dtos/assistant-append.dto.d.ts.map +1 -1
- package/dist/foundations/assistant/dtos/assistant-append.dto.js +10 -0
- package/dist/foundations/assistant/dtos/assistant-append.dto.js.map +1 -1
- package/dist/foundations/assistant/dtos/assistant-post.dto.d.ts +2 -0
- package/dist/foundations/assistant/dtos/assistant-post.dto.d.ts.map +1 -1
- package/dist/foundations/assistant/dtos/assistant-post.dto.js +10 -0
- package/dist/foundations/assistant/dtos/assistant-post.dto.js.map +1 -1
- package/dist/foundations/assistant/services/assistant.service.d.ts +8 -1
- package/dist/foundations/assistant/services/assistant.service.d.ts.map +1 -1
- package/dist/foundations/assistant/services/assistant.service.js +14 -1
- package/dist/foundations/assistant/services/assistant.service.js.map +1 -1
- package/dist/foundations/foundations.modules.d.ts +6 -0
- package/dist/foundations/foundations.modules.d.ts.map +1 -1
- package/dist/foundations/foundations.modules.js +10 -2
- package/dist/foundations/foundations.modules.js.map +1 -1
- package/dist/foundations/handbook/controllers/handbook-thread.controller.d.ts +61 -0
- package/dist/foundations/handbook/controllers/handbook-thread.controller.d.ts.map +1 -0
- package/dist/foundations/handbook/controllers/handbook-thread.controller.js +170 -0
- package/dist/foundations/handbook/controllers/handbook-thread.controller.js.map +1 -0
- package/dist/foundations/handbook/controllers/handbook.controller.d.ts +29 -0
- package/dist/foundations/handbook/controllers/handbook.controller.d.ts.map +1 -0
- package/dist/foundations/handbook/controllers/handbook.controller.js +123 -0
- package/dist/foundations/handbook/controllers/handbook.controller.js.map +1 -0
- package/dist/foundations/handbook/dtos/handbook-page.dto.d.ts +11 -0
- package/dist/foundations/handbook/dtos/handbook-page.dto.d.ts.map +1 -0
- package/dist/foundations/handbook/dtos/handbook-page.dto.js +45 -0
- package/dist/foundations/handbook/dtos/handbook-page.dto.js.map +1 -0
- package/dist/foundations/handbook/dtos/handbook-thread-message-post.dto.d.ts +24 -0
- package/dist/foundations/handbook/dtos/handbook-thread-message-post.dto.d.ts.map +1 -0
- package/dist/foundations/handbook/dtos/handbook-thread-message-post.dto.js +60 -0
- package/dist/foundations/handbook/dtos/handbook-thread-message-post.dto.js.map +1 -0
- package/dist/foundations/handbook/dtos/handbook-thread-patch.dto.d.ts +19 -0
- package/dist/foundations/handbook/dtos/handbook-thread-patch.dto.d.ts.map +1 -0
- package/dist/foundations/handbook/dtos/handbook-thread-patch.dto.js +59 -0
- package/dist/foundations/handbook/dtos/handbook-thread-patch.dto.js.map +1 -0
- package/dist/foundations/handbook/dtos/handbook-thread-post.dto.d.ts +24 -0
- package/dist/foundations/handbook/dtos/handbook-thread-post.dto.d.ts.map +1 -0
- package/dist/foundations/handbook/dtos/handbook-thread-post.dto.js +60 -0
- package/dist/foundations/handbook/dtos/handbook-thread-post.dto.js.map +1 -0
- package/dist/foundations/handbook/entities/handbook-page.d.ts +25 -0
- package/dist/foundations/handbook/entities/handbook-page.d.ts.map +1 -0
- package/dist/foundations/handbook/entities/handbook-page.js +45 -0
- package/dist/foundations/handbook/entities/handbook-page.js.map +1 -0
- package/dist/foundations/handbook/entities/handbook-page.meta.d.ts +3 -0
- package/dist/foundations/handbook/entities/handbook-page.meta.d.ts.map +1 -0
- package/dist/foundations/handbook/entities/handbook-page.meta.js +10 -0
- package/dist/foundations/handbook/entities/handbook-page.meta.js.map +1 -0
- package/dist/foundations/handbook/entities/handbook-section.d.ts +22 -0
- package/dist/foundations/handbook/entities/handbook-section.d.ts.map +1 -0
- package/dist/foundations/handbook/entities/handbook-section.js +24 -0
- package/dist/foundations/handbook/entities/handbook-section.js.map +1 -0
- package/dist/foundations/handbook/entities/handbook-section.meta.d.ts +3 -0
- package/dist/foundations/handbook/entities/handbook-section.meta.d.ts.map +1 -0
- package/dist/foundations/handbook/entities/handbook-section.meta.js +10 -0
- package/dist/foundations/handbook/entities/handbook-section.meta.js.map +1 -0
- package/dist/foundations/handbook/entities/handbook-thread-message.d.ts +36 -0
- package/dist/foundations/handbook/entities/handbook-thread-message.d.ts.map +1 -0
- package/dist/foundations/handbook/entities/handbook-thread-message.js +28 -0
- package/dist/foundations/handbook/entities/handbook-thread-message.js.map +1 -0
- package/dist/foundations/handbook/entities/handbook-thread-message.meta.d.ts +3 -0
- package/dist/foundations/handbook/entities/handbook-thread-message.meta.d.ts.map +1 -0
- package/dist/foundations/handbook/entities/handbook-thread-message.meta.js +10 -0
- package/dist/foundations/handbook/entities/handbook-thread-message.meta.js.map +1 -0
- package/dist/foundations/handbook/entities/handbook-thread.d.ts +47 -0
- package/dist/foundations/handbook/entities/handbook-thread.d.ts.map +1 -0
- package/dist/foundations/handbook/entities/handbook-thread.js +35 -0
- package/dist/foundations/handbook/entities/handbook-thread.js.map +1 -0
- package/dist/foundations/handbook/entities/handbook-thread.meta.d.ts +3 -0
- package/dist/foundations/handbook/entities/handbook-thread.meta.d.ts.map +1 -0
- package/dist/foundations/handbook/entities/handbook-thread.meta.js +10 -0
- package/dist/foundations/handbook/entities/handbook-thread.meta.js.map +1 -0
- package/dist/foundations/handbook/handbook.module.d.ts +21 -0
- package/dist/foundations/handbook/handbook.module.d.ts.map +1 -0
- package/dist/foundations/handbook/handbook.module.js +135 -0
- package/dist/foundations/handbook/handbook.module.js.map +1 -0
- package/dist/foundations/handbook/index.d.ts +23 -0
- package/dist/foundations/handbook/index.d.ts.map +1 -0
- package/dist/foundations/handbook/index.js +39 -0
- package/dist/foundations/handbook/index.js.map +1 -0
- package/dist/foundations/handbook/interfaces/handbook.config.interface.d.ts +26 -0
- package/dist/foundations/handbook/interfaces/handbook.config.interface.d.ts.map +1 -0
- package/dist/foundations/handbook/interfaces/handbook.config.interface.js +10 -0
- package/dist/foundations/handbook/interfaces/handbook.config.interface.js.map +1 -0
- package/dist/foundations/handbook/processors/handbook.processor.d.ts +22 -0
- package/dist/foundations/handbook/processors/handbook.processor.d.ts.map +1 -0
- package/dist/foundations/handbook/processors/handbook.processor.js +108 -0
- package/dist/foundations/handbook/processors/handbook.processor.js.map +1 -0
- package/dist/foundations/handbook/repositories/handbook-page.repository.d.ts +135 -0
- package/dist/foundations/handbook/repositories/handbook-page.repository.d.ts.map +1 -0
- package/dist/foundations/handbook/repositories/handbook-page.repository.js +245 -0
- package/dist/foundations/handbook/repositories/handbook-page.repository.js.map +1 -0
- package/dist/foundations/handbook/repositories/handbook-section.repository.d.ts +36 -0
- package/dist/foundations/handbook/repositories/handbook-section.repository.d.ts.map +1 -0
- package/dist/foundations/handbook/repositories/handbook-section.repository.js +91 -0
- package/dist/foundations/handbook/repositories/handbook-section.repository.js.map +1 -0
- package/dist/foundations/handbook/repositories/handbook-thread-message.repository.d.ts +36 -0
- package/dist/foundations/handbook/repositories/handbook-thread-message.repository.d.ts.map +1 -0
- package/dist/foundations/handbook/repositories/handbook-thread-message.repository.js +63 -0
- package/dist/foundations/handbook/repositories/handbook-thread-message.repository.js.map +1 -0
- package/dist/foundations/handbook/repositories/handbook-thread.repository.d.ts +63 -0
- package/dist/foundations/handbook/repositories/handbook-thread.repository.d.ts.map +1 -0
- package/dist/foundations/handbook/repositories/handbook-thread.repository.js +86 -0
- package/dist/foundations/handbook/repositories/handbook-thread.repository.js.map +1 -0
- package/dist/foundations/handbook/services/handbook-ingest.service.d.ts +101 -0
- package/dist/foundations/handbook/services/handbook-ingest.service.d.ts.map +1 -0
- package/dist/foundations/handbook/services/handbook-ingest.service.js +408 -0
- package/dist/foundations/handbook/services/handbook-ingest.service.js.map +1 -0
- package/dist/foundations/handbook/services/handbook-page.service.d.ts +57 -0
- package/dist/foundations/handbook/services/handbook-page.service.d.ts.map +1 -0
- package/dist/foundations/handbook/services/handbook-page.service.js +116 -0
- package/dist/foundations/handbook/services/handbook-page.service.js.map +1 -0
- package/dist/foundations/handbook/services/handbook-section.service.d.ts +15 -0
- package/dist/foundations/handbook/services/handbook-section.service.d.ts.map +1 -0
- package/dist/foundations/handbook/services/handbook-section.service.js +37 -0
- package/dist/foundations/handbook/services/handbook-section.service.js.map +1 -0
- package/dist/foundations/handbook/services/handbook-thread-message.service.d.ts +27 -0
- package/dist/foundations/handbook/services/handbook-thread-message.service.d.ts.map +1 -0
- package/dist/foundations/handbook/services/handbook-thread-message.service.js +39 -0
- package/dist/foundations/handbook/services/handbook-thread-message.service.js.map +1 -0
- package/dist/foundations/handbook/services/handbook-thread.service.d.ts +164 -0
- package/dist/foundations/handbook/services/handbook-thread.service.d.ts.map +1 -0
- package/dist/foundations/handbook/services/handbook-thread.service.js +297 -0
- package/dist/foundations/handbook/services/handbook-thread.service.js.map +1 -0
- package/dist/foundations/how-to/controllers/how-to.controller.d.ts +7 -1
- package/dist/foundations/how-to/controllers/how-to.controller.d.ts.map +1 -1
- package/dist/foundations/how-to/controllers/how-to.controller.js +18 -12
- package/dist/foundations/how-to/controllers/how-to.controller.js.map +1 -1
- package/dist/foundations/how-to/controllers/how-to.public.controller.d.ts +7 -0
- package/dist/foundations/how-to/controllers/how-to.public.controller.d.ts.map +1 -1
- package/dist/foundations/how-to/controllers/how-to.public.controller.js +7 -0
- package/dist/foundations/how-to/controllers/how-to.public.controller.js.map +1 -1
- package/dist/foundations/how-to/entities/how-to.d.ts.map +1 -1
- package/dist/foundations/how-to/entities/how-to.js +60 -13
- package/dist/foundations/how-to/entities/how-to.js.map +1 -1
- package/dist/foundations/how-to/how-to.module.d.ts +36 -1
- package/dist/foundations/how-to/how-to.module.d.ts.map +1 -1
- package/dist/foundations/how-to/how-to.module.js +80 -4
- package/dist/foundations/how-to/how-to.module.js.map +1 -1
- package/dist/foundations/how-to/index.d.ts +1 -0
- package/dist/foundations/how-to/index.d.ts.map +1 -1
- package/dist/foundations/how-to/index.js +1 -0
- package/dist/foundations/how-to/index.js.map +1 -1
- package/dist/foundations/how-to/interfaces/how-to.config.interface.d.ts +30 -0
- package/dist/foundations/how-to/interfaces/how-to.config.interface.d.ts.map +1 -0
- package/dist/foundations/how-to/interfaces/how-to.config.interface.js +10 -0
- package/dist/foundations/how-to/interfaces/how-to.config.interface.js.map +1 -0
- package/dist/foundations/how-to/processors/how-to.processor.d.ts +3 -1
- package/dist/foundations/how-to/processors/how-to.processor.d.ts.map +1 -1
- package/dist/foundations/how-to/processors/how-to.processor.js +8 -1
- package/dist/foundations/how-to/processors/how-to.processor.js.map +1 -1
- package/dist/foundations/how-to/services/how-to.service.d.ts +4 -0
- package/dist/foundations/how-to/services/how-to.service.d.ts.map +1 -1
- package/dist/foundations/how-to/services/how-to.service.js +47 -24
- package/dist/foundations/how-to/services/how-to.service.js.map +1 -1
- package/dist/foundations/index.d.ts +1 -0
- package/dist/foundations/index.d.ts.map +1 -1
- package/dist/foundations/index.js +1 -0
- package/dist/foundations/index.js.map +1 -1
- package/dist/foundations/two-factor/services/totp.service.d.ts.map +1 -1
- package/dist/foundations/two-factor/services/totp.service.js +2 -1
- package/dist/foundations/two-factor/services/totp.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var HandbookThreadService_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.HandbookThreadService = exports.HANDBOOK_TITLE_MAX_LENGTH = exports.HANDBOOK_MAX_MESSAGES_TO_LLM = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const crypto_1 = require("crypto");
|
|
16
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
17
|
+
const responder_service_1 = require("../../../agents/responder/services/responder.service");
|
|
18
|
+
const agentmessage_type_1 = require("../../../common/enums/agentmessage.type");
|
|
19
|
+
const jsonapi_service_1 = require("../../../core/jsonapi/services/jsonapi.service");
|
|
20
|
+
const abstract_service_1 = require("../../../core/neo4j/abstracts/abstract.service");
|
|
21
|
+
const handbook_thread_1 = require("../entities/handbook-thread");
|
|
22
|
+
const handbook_thread_meta_1 = require("../entities/handbook-thread.meta");
|
|
23
|
+
const handbook_thread_message_1 = require("../entities/handbook-thread-message");
|
|
24
|
+
const handbook_thread_message_meta_1 = require("../entities/handbook-thread-message.meta");
|
|
25
|
+
const handbook_page_repository_1 = require("../repositories/handbook-page.repository");
|
|
26
|
+
const handbook_thread_message_repository_1 = require("../repositories/handbook-thread-message.repository");
|
|
27
|
+
const handbook_thread_repository_1 = require("../repositories/handbook-thread.repository");
|
|
28
|
+
const handbook_thread_message_service_1 = require("./handbook-thread-message.service");
|
|
29
|
+
/** How many prior turns are replayed to the responder as history. */
|
|
30
|
+
exports.HANDBOOK_MAX_MESSAGES_TO_LLM = 20;
|
|
31
|
+
/** Longest auto-generated title, when the responder supplies none. */
|
|
32
|
+
exports.HANDBOOK_TITLE_MAX_LENGTH = 60;
|
|
33
|
+
/**
|
|
34
|
+
* Persisted handbook conversations.
|
|
35
|
+
*
|
|
36
|
+
* The handbook chat deliberately does NOT go through the package `Assistant`.
|
|
37
|
+
* `Assistant` is `isCompanyScoped: true`, and a platform administrator — the
|
|
38
|
+
* only user this feature is for — has no Company, so a company-scoped thread
|
|
39
|
+
* would 404 for exactly that user. Company scoping stays strict; the thread
|
|
40
|
+
* lives here instead, global and owner-scoped.
|
|
41
|
+
*
|
|
42
|
+
* That is why `companyId` is read off CLS and passed through EXACTLY as found,
|
|
43
|
+
* `undefined` included. It is not defaulted, substituted or looked up.
|
|
44
|
+
* `ResponderService.run` types it `string | undefined`; token accounting
|
|
45
|
+
* already tolerates a company-less turn (TokenUsageRepository makes the
|
|
46
|
+
* `BELONGS_TO` edge conditional); and handbook retrieval never consults a
|
|
47
|
+
* company — the handbook branch of the source-query provider matches
|
|
48
|
+
* `(:HandbookPage)` and ignores tenancy altogether.
|
|
49
|
+
*/
|
|
50
|
+
let HandbookThreadService = HandbookThreadService_1 = class HandbookThreadService extends abstract_service_1.AbstractService {
|
|
51
|
+
constructor(jsonApiService, threads, clsService, responder, messages, messageRepository, pages) {
|
|
52
|
+
super(jsonApiService, threads, clsService, handbook_thread_1.HandbookThreadDescriptor.model);
|
|
53
|
+
this.threads = threads;
|
|
54
|
+
this.responder = responder;
|
|
55
|
+
this.messages = messages;
|
|
56
|
+
this.messageRepository = messageRepository;
|
|
57
|
+
this.pages = pages;
|
|
58
|
+
this.descriptor = handbook_thread_1.HandbookThreadDescriptor;
|
|
59
|
+
this.threadLogger = new common_1.Logger(HandbookThreadService_1.name);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Start a thread from its first question: create the thread, run the turn,
|
|
63
|
+
* persist both messages, and title the thread from the answer.
|
|
64
|
+
*
|
|
65
|
+
* The thread node is created FIRST — before the responder runs — so the two
|
|
66
|
+
* messages have a parent to hang from, exactly as
|
|
67
|
+
* `AssistantService.createWithFirstMessage` does. It is created with the
|
|
68
|
+
* fallback title and retitled once the answer exists, because the responder's
|
|
69
|
+
* title is only known after the turn.
|
|
70
|
+
*/
|
|
71
|
+
async createWithFirstMessage(params) {
|
|
72
|
+
const threadId = (0, crypto_1.randomUUID)();
|
|
73
|
+
await this.createFromDTO({
|
|
74
|
+
data: {
|
|
75
|
+
type: handbook_thread_meta_1.handbookThreadMeta.type,
|
|
76
|
+
id: threadId,
|
|
77
|
+
attributes: { title: this.fallbackTitle(params.question) },
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
await this.writeMessage({ threadId, role: "user", content: params.question, position: 0, sources: [] });
|
|
81
|
+
const turn = await this.runTurn({
|
|
82
|
+
question: params.question,
|
|
83
|
+
history: [],
|
|
84
|
+
handbookPageId: params.handbookPageId,
|
|
85
|
+
});
|
|
86
|
+
await this.writeMessage({
|
|
87
|
+
threadId,
|
|
88
|
+
role: "assistant",
|
|
89
|
+
content: turn.answer,
|
|
90
|
+
position: 1,
|
|
91
|
+
sources: turn.sources,
|
|
92
|
+
});
|
|
93
|
+
// `patch` here is the OVERRIDE below, so the owner gate is applied to the
|
|
94
|
+
// retitle as well — the thread was created by this user a moment ago, so it
|
|
95
|
+
// always passes, but the rule stays in one place.
|
|
96
|
+
if (turn.title)
|
|
97
|
+
await this.patch({ id: threadId, title: turn.title });
|
|
98
|
+
this.threadLogger.log(`createWithFirstMessage: threadId=${threadId} questionLength=${params.question.length} sources=${turn.sources.length}`);
|
|
99
|
+
return this.findThreadWithMessages({ threadId });
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Append a question to an existing thread and answer it with the thread's
|
|
103
|
+
* prior messages as history.
|
|
104
|
+
*
|
|
105
|
+
* Returns the two NEW messages as a JSON:API list — the shape
|
|
106
|
+
* `AssistantController.append` returns — so the client appends rather than
|
|
107
|
+
* re-renders. The full thread is one `GET /handbookthreads/:id` away.
|
|
108
|
+
*/
|
|
109
|
+
async appendMessage(params) {
|
|
110
|
+
// Owner gate: `findById` applies `buildUserHasAccess`, so another user's
|
|
111
|
+
// thread is a 403 and an unknown id is a 404 — before anything is written.
|
|
112
|
+
await this.readOwnedThread({ threadId: params.threadId });
|
|
113
|
+
const priorMessages = await this.loadMessages({ threadId: params.threadId });
|
|
114
|
+
const position = await this.messageRepository.getNextPosition({ threadId: params.threadId });
|
|
115
|
+
const userMessageId = await this.writeMessage({
|
|
116
|
+
threadId: params.threadId,
|
|
117
|
+
role: "user",
|
|
118
|
+
content: params.question,
|
|
119
|
+
position,
|
|
120
|
+
sources: [],
|
|
121
|
+
});
|
|
122
|
+
const turn = await this.runTurn({
|
|
123
|
+
question: params.question,
|
|
124
|
+
history: priorMessages.slice(-exports.HANDBOOK_MAX_MESSAGES_TO_LLM).map((message) => ({
|
|
125
|
+
type: message.role === "assistant" ? agentmessage_type_1.AgentMessageType.Assistant : agentmessage_type_1.AgentMessageType.User,
|
|
126
|
+
content: message.content,
|
|
127
|
+
})),
|
|
128
|
+
handbookPageId: params.handbookPageId,
|
|
129
|
+
});
|
|
130
|
+
const assistantMessageId = await this.writeMessage({
|
|
131
|
+
threadId: params.threadId,
|
|
132
|
+
role: "assistant",
|
|
133
|
+
content: turn.answer,
|
|
134
|
+
position: position + 1,
|
|
135
|
+
sources: turn.sources,
|
|
136
|
+
});
|
|
137
|
+
await this.threads.touch({ id: params.threadId });
|
|
138
|
+
this.threadLogger.log(`appendMessage: threadId=${params.threadId} positions=${position}-${position + 1} history=${priorMessages.length}`);
|
|
139
|
+
const written = await this.messageRepository.findByIds({ ids: [userMessageId, assistantMessageId] });
|
|
140
|
+
return this.jsonApiService.buildList(handbook_thread_message_1.HandbookThreadMessageDescriptor.model, this.byPosition(written));
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* One thread with every message it holds, in position order.
|
|
144
|
+
*
|
|
145
|
+
* The messages ride in `included` through the descriptor's `messages`
|
|
146
|
+
* relationship — the same traversal that lets `AssistantController` return an
|
|
147
|
+
* assistant with its messages — so a client renders a selected thread in one
|
|
148
|
+
* call. They are sorted here because a Cypher `OPTIONAL MATCH` collects
|
|
149
|
+
* related nodes in no particular order.
|
|
150
|
+
*/
|
|
151
|
+
async findThreadWithMessages(params) {
|
|
152
|
+
const thread = await this.readOwnedThread({ threadId: params.threadId });
|
|
153
|
+
thread.messages = this.byPosition(thread.messages ?? []);
|
|
154
|
+
return this.jsonApiService.buildSingle(handbook_thread_1.HandbookThreadDescriptor.model, thread);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Rename. Overridden ONLY to close an ordering hole in the inherited
|
|
158
|
+
* implementation: `AbstractService.patch` writes first and reads back
|
|
159
|
+
* afterwards, and `AbstractRepository.patch` matches on `id` alone — it never
|
|
160
|
+
* applies `buildUserHasAccess`. Without the read below, one administrator
|
|
161
|
+
* could rename another's thread and merely be refused the response.
|
|
162
|
+
*/
|
|
163
|
+
async patch(params) {
|
|
164
|
+
await this.readOwnedThread({ threadId: params.id });
|
|
165
|
+
return super.patch(params);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Delete the thread and, through the repository override, its messages.
|
|
169
|
+
*
|
|
170
|
+
* Overridden because the inherited `AbstractService.delete` guards ownership
|
|
171
|
+
* with a COMPANY comparison — `(companyId ?? "") !== entity.company?.id`. A
|
|
172
|
+
* `HandbookThread` is `isCompanyScoped: false`, so `entity.company` is always
|
|
173
|
+
* undefined, and an administrator has no `companyId`: the comparison reduces
|
|
174
|
+
* to `"" !== undefined`, which is true, and EVERY delete would 403. The owner
|
|
175
|
+
* edge is the boundary here, and `readOwnedThread` is what enforces it.
|
|
176
|
+
*/
|
|
177
|
+
async delete(params) {
|
|
178
|
+
await this.readOwnedThread({ threadId: params.id });
|
|
179
|
+
await this.threads.delete({ id: params.id });
|
|
180
|
+
this.threadLogger.log(`delete: threadId=${params.id}`);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Read a thread through the owner-scoped `findById`. A thread belonging to
|
|
184
|
+
* another user raises 403 from `_validateForbidden`; an id that matches
|
|
185
|
+
* nothing comes back null and becomes a 404 here.
|
|
186
|
+
*/
|
|
187
|
+
async readOwnedThread(params) {
|
|
188
|
+
const thread = await this.threads.findById({ id: params.threadId });
|
|
189
|
+
if (!thread)
|
|
190
|
+
throw new common_1.NotFoundException();
|
|
191
|
+
return thread;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Run one handbook turn on the responder and resolve its citations to page
|
|
195
|
+
* paths.
|
|
196
|
+
*
|
|
197
|
+
* `userModuleIds: []` is not a stub: the documentation branch never runs the
|
|
198
|
+
* graph or the planner, and those two are the only readers of that list.
|
|
199
|
+
*
|
|
200
|
+
* `handbookPageId` is forwarded as `limitToHandbookPageId`, which the
|
|
201
|
+
* handbook source-query provider already honours by adding
|
|
202
|
+
* `WHERE data.id = $limitToHandbookPageId` to the `(:HandbookPage)` match.
|
|
203
|
+
* Passed through EXACTLY as received, `undefined` included: an absent value
|
|
204
|
+
* means retrieval spans the whole manual, which is the default a question
|
|
205
|
+
* asked while reading one page usually wants.
|
|
206
|
+
*/
|
|
207
|
+
async runTurn(params) {
|
|
208
|
+
// `|| undefined` collapses the empty string a company-less CLS context can
|
|
209
|
+
// carry into the same absent value, so the responder sees one shape.
|
|
210
|
+
const companyId = this.clsService.get("companyId") || undefined;
|
|
211
|
+
const userId = this.clsService.get("userId");
|
|
212
|
+
const response = await this.responder.run({
|
|
213
|
+
companyId,
|
|
214
|
+
userId,
|
|
215
|
+
userModuleIds: [],
|
|
216
|
+
dataLimits: { handbookMode: true, limitToHandbookPageId: params.handbookPageId },
|
|
217
|
+
messages: params.history,
|
|
218
|
+
question: params.question,
|
|
219
|
+
});
|
|
220
|
+
const chunkIds = (response.sources ?? [])
|
|
221
|
+
.map((source) => source.chunkId)
|
|
222
|
+
.filter((chunkId) => typeof chunkId === "string" && chunkId.length > 0);
|
|
223
|
+
// The repository answers one path per RESOLVABLE chunk, in citation order;
|
|
224
|
+
// several chunks of the same page collapse here. A chunk whose page cannot
|
|
225
|
+
// be resolved never reaches this list, so no source is ever an empty string.
|
|
226
|
+
const paths = await this.pages.findPathsByChunkIds({ chunkIds });
|
|
227
|
+
return {
|
|
228
|
+
answer: response.answer?.answer ?? "",
|
|
229
|
+
title: response.answer?.title?.trim() ?? "",
|
|
230
|
+
sources: [...new Set(paths)],
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/** Persist one message under a thread. Returns the new message's id. */
|
|
234
|
+
async writeMessage(params) {
|
|
235
|
+
const id = (0, crypto_1.randomUUID)();
|
|
236
|
+
await this.messages.createFromDTO({
|
|
237
|
+
data: {
|
|
238
|
+
type: handbook_thread_message_meta_1.handbookThreadMessageMeta.type,
|
|
239
|
+
id,
|
|
240
|
+
attributes: {
|
|
241
|
+
role: params.role,
|
|
242
|
+
content: params.content,
|
|
243
|
+
position: params.position,
|
|
244
|
+
sources: params.sources,
|
|
245
|
+
},
|
|
246
|
+
relationships: {
|
|
247
|
+
thread: { data: { type: handbook_thread_meta_1.handbookThreadMeta.type, id: params.threadId } },
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
return id;
|
|
252
|
+
}
|
|
253
|
+
/** Every message of a thread, oldest first. */
|
|
254
|
+
async loadMessages(params) {
|
|
255
|
+
const messages = await this.messageRepository.findByRelated({
|
|
256
|
+
relationship: handbook_thread_message_1.HandbookThreadMessageDescriptor.relationshipKeys.thread,
|
|
257
|
+
id: params.threadId,
|
|
258
|
+
fetchAll: true,
|
|
259
|
+
orderBy: "position ASC",
|
|
260
|
+
});
|
|
261
|
+
return this.byPosition(messages);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Sort by `position` ascending. Applied even to results that were queried
|
|
265
|
+
* with an ORDER BY: the ordering clause sits ahead of the relationship
|
|
266
|
+
* traversal `buildReturnStatement()` appends, so it is not guaranteed to
|
|
267
|
+
* survive into the rows. Position is the only ordering the client can rely
|
|
268
|
+
* on, so it is asserted where the list is produced.
|
|
269
|
+
*/
|
|
270
|
+
byPosition(messages) {
|
|
271
|
+
return [...messages].sort((a, b) => (a.position ?? 0) - (b.position ?? 0));
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Title for a thread whose answer produced none: the question, trimmed to
|
|
275
|
+
* 60 characters on a word boundary. Mirrors `AssistantService.autoTitle`.
|
|
276
|
+
*/
|
|
277
|
+
fallbackTitle(question) {
|
|
278
|
+
const trimmed = question.trim();
|
|
279
|
+
if (trimmed.length <= exports.HANDBOOK_TITLE_MAX_LENGTH)
|
|
280
|
+
return trimmed;
|
|
281
|
+
const truncated = trimmed.slice(0, exports.HANDBOOK_TITLE_MAX_LENGTH);
|
|
282
|
+
const lastSpace = truncated.lastIndexOf(" ");
|
|
283
|
+
return lastSpace > exports.HANDBOOK_TITLE_MAX_LENGTH / 2 ? truncated.slice(0, lastSpace).trim() : truncated.trim();
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
exports.HandbookThreadService = HandbookThreadService;
|
|
287
|
+
exports.HandbookThreadService = HandbookThreadService = HandbookThreadService_1 = __decorate([
|
|
288
|
+
(0, common_1.Injectable)(),
|
|
289
|
+
__metadata("design:paramtypes", [jsonapi_service_1.JsonApiService,
|
|
290
|
+
handbook_thread_repository_1.HandbookThreadRepository,
|
|
291
|
+
nestjs_cls_1.ClsService,
|
|
292
|
+
responder_service_1.ResponderService,
|
|
293
|
+
handbook_thread_message_service_1.HandbookThreadMessageService,
|
|
294
|
+
handbook_thread_message_repository_1.HandbookThreadMessageRepository,
|
|
295
|
+
handbook_page_repository_1.HandbookPageRepository])
|
|
296
|
+
], HandbookThreadService);
|
|
297
|
+
//# sourceMappingURL=handbook-thread.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handbook-thread.service.js","sourceRoot":"","sources":["../../../../src/foundations/handbook/services/handbook-thread.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAuE;AACvE,mCAAoC;AACpC,2CAAwC;AACxC,4FAAwF;AACxF,+EAA2E;AAG3E,oFAAgF;AAChF,qFAAiF;AACjF,iEAAuF;AACvF,2EAAsE;AACtE,iFAI6C;AAC7C,2FAAqF;AACrF,uFAAkF;AAClF,2GAAqG;AACrG,2FAAsF;AACtF,uFAAiF;AAEjF,qEAAqE;AACxD,QAAA,4BAA4B,GAAG,EAAE,CAAC;AAE/C,sEAAsE;AACzD,QAAA,yBAAyB,GAAG,EAAE,CAAC;AAE5C;;;;;;;;;;;;;;;;GAgBG;AAEI,IAAM,qBAAqB,6BAA3B,MAAM,qBAAsB,SAAQ,kCAG1C;IAIC,YACE,cAA8B,EACb,OAAiC,EAClD,UAAsB,EACL,SAA2B,EAC3B,QAAsC,EACtC,iBAAkD,EAClD,KAA6B;QAE9C,KAAK,CAAC,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,0CAAwB,CAAC,KAAK,CAAC,CAAC;QAP1D,YAAO,GAAP,OAAO,CAA0B;QAEjC,cAAS,GAAT,SAAS,CAAkB;QAC3B,aAAQ,GAAR,QAAQ,CAA8B;QACtC,sBAAiB,GAAjB,iBAAiB,CAAiC;QAClD,UAAK,GAAL,KAAK,CAAwB;QAV7B,eAAU,GAAG,0CAAwB,CAAC;QACx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,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCASO,gCAAc;QACJ,qDAAwB;QACtC,uBAAU;QACM,oCAAgB;QACjB,8DAA4B;QACnB,oEAA+B;QAC3C,iDAAsB;GAdrC,qBAAqB,CA0SjC"}
|
|
@@ -12,11 +12,17 @@ export declare class HowToController {
|
|
|
12
12
|
private readonly relationships;
|
|
13
13
|
constructor(howToService: HowToService, cacheService: CacheService, auditService: AuditService);
|
|
14
14
|
findAll(reply: FastifyReply, query: any, search?: string, fetchAll?: boolean, orderBy?: string): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Re-queue every guide for chunking — without it a guide that was never
|
|
17
|
+
* chunked (or lost its chunks) has no route back into the index.
|
|
18
|
+
*
|
|
19
|
+
* Declared before the `:howToId` routes so "reindex" is never read as an id.
|
|
20
|
+
*/
|
|
21
|
+
reindex(reply: FastifyReply): Promise<void>;
|
|
15
22
|
findById(reply: FastifyReply, howToId: string): Promise<void>;
|
|
16
23
|
create(reply: FastifyReply, body: HowToPostDTO): Promise<void>;
|
|
17
24
|
update(reply: FastifyReply, body: HowToPutDTO): Promise<void>;
|
|
18
25
|
delete(reply: FastifyReply, howToId: string): Promise<void>;
|
|
19
|
-
reindex(reply: FastifyReply): Promise<void>;
|
|
20
26
|
addRelated(reply: FastifyReply, howToId: string, relatedId: string): Promise<void>;
|
|
21
27
|
removeRelated(reply: FastifyReply, howToId: string, relatedId: string): Promise<void>;
|
|
22
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"how-to.controller.d.ts","sourceRoot":"","sources":["../../../../src/foundations/how-to/controllers/how-to.controller.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;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,YAAY,EAC1B,YAAY,EAAE,YAAY;IAIvC,OAAO,CACJ,KAAK,EAAE,YAAY,EACjB,KAAK,EAAE,GAAG,EACF,MAAM,CAAC,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,OAAO,EACnB,OAAO,CAAC,EAAE,MAAM;IAKpC;;;;;OAKG;IAGG,OAAO,CAAQ,KAAK,EAAE,YAAY;IAOlC,QAAQ,CAAQ,KAAK,EAAE,YAAY,EAAoB,OAAO,EAAE,MAAM;IAMtE,MAAM,CAAQ,KAAK,EAAE,YAAY,EAAU,IAAI,EAAE,YAAY;IAe7D,MAAM,CAAQ,KAAK,EAAE,YAAY,EAAU,IAAI,EAAE,WAAW;IAe5D,MAAM,CAAQ,KAAK,EAAE,YAAY,EAAoB,OAAO,EAAE,MAAM;IAMpE,UAAU,CACP,KAAK,EAAE,YAAY,EACR,OAAO,EAAE,MAAM,EACb,SAAS,EAAE,MAAM;IASjC,aAAa,CACV,KAAK,EAAE,YAAY,EACR,OAAO,EAAE,MAAM,EACb,SAAS,EAAE,MAAM;CAKxC"}
|
|
@@ -37,6 +37,16 @@ let HowToController = class HowToController {
|
|
|
37
37
|
async findAll(reply, query, search, fetchAll, orderBy) {
|
|
38
38
|
return this.crud.findAll(reply, { query, search, fetchAll, orderBy });
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Re-queue every guide for chunking — without it a guide that was never
|
|
42
|
+
* chunked (or lost its chunks) has no route back into the index.
|
|
43
|
+
*
|
|
44
|
+
* Declared before the `:howToId` routes so "reindex" is never read as an id.
|
|
45
|
+
*/
|
|
46
|
+
async reindex(reply) {
|
|
47
|
+
await this.howToService.reindexAll();
|
|
48
|
+
reply.send();
|
|
49
|
+
}
|
|
40
50
|
async findById(reply, howToId) {
|
|
41
51
|
return this.crud.findById(reply, howToId);
|
|
42
52
|
}
|
|
@@ -61,10 +71,6 @@ let HowToController = class HowToController {
|
|
|
61
71
|
async delete(reply, howToId) {
|
|
62
72
|
return this.crud.delete(reply, howToId);
|
|
63
73
|
}
|
|
64
|
-
async reindex(reply) {
|
|
65
|
-
await this.howToService.reindexAll();
|
|
66
|
-
reply.send();
|
|
67
|
-
}
|
|
68
74
|
async addRelated(reply, howToId, relatedId) {
|
|
69
75
|
const response = await this.howToService.addRelated({ howToId, relatedId });
|
|
70
76
|
reply.send(response);
|
|
@@ -86,6 +92,14 @@ __decorate([
|
|
|
86
92
|
__metadata("design:paramtypes", [Object, Object, String, Boolean, String]),
|
|
87
93
|
__metadata("design:returntype", Promise)
|
|
88
94
|
], HowToController.prototype, "findAll", null);
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, common_1.Post)(`${how_to_meta_1.howToMeta.endpoint}/reindex`),
|
|
97
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
98
|
+
__param(0, (0, common_1.Res)()),
|
|
99
|
+
__metadata("design:type", Function),
|
|
100
|
+
__metadata("design:paramtypes", [Object]),
|
|
101
|
+
__metadata("design:returntype", Promise)
|
|
102
|
+
], HowToController.prototype, "reindex", null);
|
|
89
103
|
__decorate([
|
|
90
104
|
(0, common_1.Get)(`${how_to_meta_1.howToMeta.endpoint}/:howToId`),
|
|
91
105
|
(0, audit_decorator_1.Audit)(how_to_meta_1.howToMeta, "howToId"),
|
|
@@ -124,14 +138,6 @@ __decorate([
|
|
|
124
138
|
__metadata("design:paramtypes", [Object, String]),
|
|
125
139
|
__metadata("design:returntype", Promise)
|
|
126
140
|
], HowToController.prototype, "delete", null);
|
|
127
|
-
__decorate([
|
|
128
|
-
(0, common_1.Post)(`${how_to_meta_1.howToMeta.endpoint}/reindex`),
|
|
129
|
-
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
130
|
-
__param(0, (0, common_1.Res)()),
|
|
131
|
-
__metadata("design:type", Function),
|
|
132
|
-
__metadata("design:paramtypes", [Object]),
|
|
133
|
-
__metadata("design:returntype", Promise)
|
|
134
|
-
], HowToController.prototype, "reindex", null);
|
|
135
141
|
__decorate([
|
|
136
142
|
(0, common_1.Post)(`${how_to_meta_1.howToMeta.endpoint}/:howToId/related/:relatedId`),
|
|
137
143
|
(0, cache_invalidate_decorator_1.CacheInvalidate)(how_to_meta_1.howToMeta, "howToId"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"how-to.controller.js","sourceRoot":"","sources":["../../../../src/foundations/how-to/controllers/how-to.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAawB;AAExB,gFAAmE;AACnE,sGAAwF;AACxF,4FAA8E;AAC9E,0EAAqE;AACrE,0EAA4E;AAC5E,0FAA4F;AAC5F,8EAA0E;AAC1E,sEAAkE;AAClE,6DAAuD;AACvD,2DAAqD;AACrD,yDAAoD;AACpD,+DAA0D;AAInD,IAAM,eAAe,GAArB,MAAM,eAAe;IAI1B,YACmB,YAA0B,EAC1B,YAA0B,EAC1B,YAA0B;QAF1B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;QAN5B,SAAI,GAAG,IAAA,kCAAkB,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACnD,kBAAa,GAAG,IAAA,kDAA0B,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAMlF,CAAC;IAGE,AAAN,KAAK,CAAC,OAAO,CACJ,KAAmB,EACjB,KAAU,EACF,MAAe,EACb,QAAkB,EACnB,OAAgB;QAElC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IAIK,AAAN,KAAK,CAAC,QAAQ,CAAQ,KAAmB,EAAoB,OAAe;QAC1E,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAIK,AAAN,KAAK,CAAC,MAAM,CAAQ,KAAmB,EAAU,IAAkB;QACjE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAErD,yCAAyC;QACzC,MAAM,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAAC;YAC9C,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;YACrB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW;SAC9C,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;IAKK,AAAN,KAAK,CAAC,MAAM,CAAQ,KAAmB,EAAU,IAAiB;QAChE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAErD,0CAA0C;QAC1C,MAAM,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAAC;YAC9C,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;YACrB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW;SAC9C,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;IAKK,AAAN,KAAK,CAAC,MAAM,CAAQ,KAAmB,EAAoB,OAAe;QACxE,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAIK,AAAN,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"how-to.controller.js","sourceRoot":"","sources":["../../../../src/foundations/how-to/controllers/how-to.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAawB;AAExB,gFAAmE;AACnE,sGAAwF;AACxF,4FAA8E;AAC9E,0EAAqE;AACrE,0EAA4E;AAC5E,0FAA4F;AAC5F,8EAA0E;AAC1E,sEAAkE;AAClE,6DAAuD;AACvD,2DA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,SAAS,CAAC,CAAA;;;;6CAEzD;AAIK;IAFL,IAAA,aAAI,EAAC,GAAG,uBAAS,CAAC,QAAQ,8BAA8B,CAAC;IACzD,IAAA,4CAAe,EAAC,uBAAS,EAAE,SAAS,CAAC;IAEnC,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;;;;iDAIpB;AAKK;IAHL,IAAA,eAAM,EAAC,GAAG,uBAAS,CAAC,QAAQ,8BAA8B,CAAC;IAC3D,IAAA,iBAAQ,EAAC,mBAAU,CAAC,UAAU,CAAC;IAC/B,IAAA,4CAAe,EAAC,uBAAS,EAAE,SAAS,CAAC;IAEnC,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;;;;oDAIpB;0BAjGU,eAAe;IAF3B,IAAA,kBAAS,EAAC,6BAAY,CAAC;IACvB,IAAA,mBAAU,GAAE;qCAMsB,6BAAY;QACZ,4BAAY;QACZ,4BAAY;GAPlC,eAAe,CAkG3B"}
|
|
@@ -3,6 +3,13 @@ import { HowToService } from "../services/how-to.service";
|
|
|
3
3
|
/**
|
|
4
4
|
* Unauthenticated read surface for PUBLISHED help articles (draft = false).
|
|
5
5
|
* Auth in this package is per-controller; omitting JwtAuthGuard makes these routes public.
|
|
6
|
+
*
|
|
7
|
+
* OPT-IN ONLY: this controller is registered exclusively by
|
|
8
|
+
* `HowToModule.forRoot({ publicRoutes: true })`. Importing `HowToModule`
|
|
9
|
+
* statically — or calling `forRoot()` with no arguments — mounts the
|
|
10
|
+
* authenticated `HowToController` alone, so no consumer publishes its guides by
|
|
11
|
+
* accident. The read filter is `draft IS NULL OR draft = false`, which means a
|
|
12
|
+
* guide created without a `draft` property is served here.
|
|
6
13
|
*/
|
|
7
14
|
export declare class HowToPublicController {
|
|
8
15
|
private readonly howToService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"how-to.public.controller.d.ts","sourceRoot":"","sources":["../../../../src/foundations/how-to/controllers/how-to.public.controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D
|
|
1
|
+
{"version":3,"file":"how-to.public.controller.d.ts","sourceRoot":"","sources":["../../../../src/foundations/how-to/controllers/how-to.public.controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,qBACa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAAZ,YAAY,EAAE,YAAY;IAGjD,aAAa,CAAQ,KAAK,EAAE,YAAY,EAAW,KAAK,EAAE,GAAG,EAAiB,IAAI,CAAC,EAAE,MAAM;IAM3F,WAAW,CAAQ,KAAK,EAAE,YAAY,EAAsB,SAAS,EAAE,MAAM,EAAiB,IAAI,EAAE,MAAM;IAM1G,WAAW,CACR,KAAK,EAAE,YAAY,EACN,SAAS,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,EAClB,KAAK,EAAE,GAAG;CAKtB"}
|
|
@@ -19,6 +19,13 @@ const how_to_service_1 = require("../services/how-to.service");
|
|
|
19
19
|
/**
|
|
20
20
|
* Unauthenticated read surface for PUBLISHED help articles (draft = false).
|
|
21
21
|
* Auth in this package is per-controller; omitting JwtAuthGuard makes these routes public.
|
|
22
|
+
*
|
|
23
|
+
* OPT-IN ONLY: this controller is registered exclusively by
|
|
24
|
+
* `HowToModule.forRoot({ publicRoutes: true })`. Importing `HowToModule`
|
|
25
|
+
* statically — or calling `forRoot()` with no arguments — mounts the
|
|
26
|
+
* authenticated `HowToController` alone, so no consumer publishes its guides by
|
|
27
|
+
* accident. The read filter is `draft IS NULL OR draft = false`, which means a
|
|
28
|
+
* guide created without a `draft` property is served here.
|
|
22
29
|
*/
|
|
23
30
|
let HowToPublicController = class HowToPublicController {
|
|
24
31
|
constructor(howToService) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"how-to.public.controller.js","sourceRoot":"","sources":["../../../../src/foundations/how-to/controllers/how-to.public.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoE;AAEpE,yDAAoD;AACpD,+DAA0D;AAE1D
|
|
1
|
+
{"version":3,"file":"how-to.public.controller.js","sourceRoot":"","sources":["../../../../src/foundations/how-to/controllers/how-to.public.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoE;AAEpE,yDAAoD;AACpD,+DAA0D;AAE1D;;;;;;;;;;GAUG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAGrD,AAAN,KAAK,CAAC,aAAa,CAAQ,KAAmB,EAAW,KAAU,EAAiB,IAAa;QAC/F,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvF,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IAGK,AAAN,KAAK,CAAC,WAAW,CAAQ,KAAmB,EAAsB,SAAiB,EAAiB,IAAY;QAC9G,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnF,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IAGK,AAAN,KAAK,CAAC,WAAW,CACR,KAAmB,EACN,SAAiB,EACtB,IAAY,EA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AAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,uDA+F1B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,OAAO,eAAe,CAAC"}
|
|
@@ -12,23 +12,70 @@ const how_to_meta_1 = require("./how-to.meta");
|
|
|
12
12
|
exports.HowToDescriptor = (0, common_1.defineEntity)()({
|
|
13
13
|
...how_to_meta_1.howToMeta,
|
|
14
14
|
isCompanyScoped: false,
|
|
15
|
+
description: "An in-app how-to/help guide (guida): a piece of onboarding/help documentation shown to users of the platform. Global content, visible to every company, optionally scoped to specific app pages via `pages`.",
|
|
16
|
+
chat: {
|
|
17
|
+
summary: (d) => d.name ?? d.id,
|
|
18
|
+
textSearchFields: ["name", "description"],
|
|
19
|
+
},
|
|
15
20
|
fields: {
|
|
16
|
-
name: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
name: {
|
|
22
|
+
type: "string",
|
|
23
|
+
required: true,
|
|
24
|
+
description: 'The title of the how-to guide (e.g. "How to create a proceeding").',
|
|
25
|
+
},
|
|
26
|
+
description: {
|
|
27
|
+
type: "string",
|
|
28
|
+
required: true,
|
|
29
|
+
description: "The guide's body content, stored as BlockNote rich-text-editor JSON (not plain text). Converted to Markdown before AI chunking/indexing.",
|
|
30
|
+
},
|
|
31
|
+
pages: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: 'JSON-encoded array of in-app path fragments (e.g. ["/proceedings", "/documents"]) this guide is relevant for; used to surface contextual help suggestions based on the page the user is currently on.',
|
|
34
|
+
},
|
|
35
|
+
abstract: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "A short AI-generated abstract of the guide's content, produced by the summarisation pass; empty until the guide has been processed.",
|
|
38
|
+
},
|
|
39
|
+
tldr: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "The AI-generated too-long-didn't-read one-liner for the guide, used wherever the full abstract is too long to show.",
|
|
42
|
+
},
|
|
43
|
+
aiStatus: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "AI chunking/indexing status of the guide content (pending, in_progress, completed, failed, ...), driving the background processing pipeline that makes the guide searchable/chat-queryable.",
|
|
46
|
+
},
|
|
47
|
+
howToType: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "The documentation category of the article — one of tutorial, how-to, reference or explanation (the DTO rejects anything else). Combined with `slug` it addresses the article on the public knowledge-base routes, and it filters the published list.",
|
|
50
|
+
},
|
|
51
|
+
slug: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "The URL-safe identifier of the article within its `howToType`; the (howToType, slug) pair uniquely addresses a published article on the public knowledge-base routes.",
|
|
54
|
+
},
|
|
55
|
+
order: {
|
|
56
|
+
type: "number",
|
|
57
|
+
description: "Manual sort position in the published knowledge base: published and related listings are ordered by `order` ascending, then by `name`.",
|
|
58
|
+
},
|
|
59
|
+
summary: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "A short editor-written summary of the article, shown as its teaser in knowledge-base listings and previews.",
|
|
62
|
+
},
|
|
63
|
+
tags: {
|
|
64
|
+
type: "string[]",
|
|
65
|
+
description: "Free-form editorial tags used to label and group articles in the knowledge base.",
|
|
66
|
+
},
|
|
67
|
+
contextualKeys: {
|
|
68
|
+
type: "string[]",
|
|
69
|
+
description: 'Application context keys (e.g. "npc.editor") naming the in-app surfaces this article explains; used to offer the article contextually from where the user is working.',
|
|
70
|
+
},
|
|
71
|
+
draft: {
|
|
72
|
+
type: "boolean",
|
|
73
|
+
description: "The publication gate: while true the article is unpublished and excluded from every public read — the published list, the by-type-and-slug lookup and the related list all require `draft` to be false or unset.",
|
|
74
|
+
},
|
|
29
75
|
},
|
|
30
76
|
computed: {
|
|
31
77
|
relevance: {
|
|
78
|
+
description: "Search relevance score of this guide for the current query, taken from the `score` column of a search query; undefined outside search results.",
|
|
32
79
|
compute: (params) => {
|
|
33
80
|
if (!params.record.has("score"))
|
|
34
81
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"how-to.js","sourceRoot":"","sources":["../../../../src/foundations/how-to/entities/how-to.ts"],"names":[],"mappings":";;;AAAA,4CAAuD;AACvD,+CAA0C;AAwB1C;;;;;GAKG;AACU,QAAA,eAAe,GAAG,IAAA,qBAAY,GAAS,CAAC;IACnD,GAAG,uBAAS;IAEZ,eAAe,EAAE,KAAK;IAEtB,
|
|
1
|
+
{"version":3,"file":"how-to.js","sourceRoot":"","sources":["../../../../src/foundations/how-to/entities/how-to.ts"],"names":[],"mappings":";;;AAAA,4CAAuD;AACvD,+CAA0C;AAwB1C;;;;;GAKG;AACU,QAAA,eAAe,GAAG,IAAA,qBAAY,GAAS,CAAC;IACnD,GAAG,uBAAS;IAEZ,eAAe,EAAE,KAAK;IAEtB,WAAW,EACT,8MAA8M;IAEhN,IAAI,EAAE;QACJ,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE;QAC9B,gBAAgB,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC;KAC1C;IAED,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,oEAAoE;SAClF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,0IAA0I;SAC7I;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,uMAAuM;SAC1M;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,qIAAqI;SACxI;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,qHAAqH;SACxH;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,6LAA6L;SAChM;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,sPAAsP;SACzP;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,uKAAuK;SAC1K;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,wIAAwI;SAC3I;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,6GAA6G;SAChH;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,kFAAkF;SAChG;QACD,cAAc,EAAE;YACd,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,uKAAuK;SAC1K;QACD,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;YACf,WAAW,EACT,kNAAkN;SACrN;KACF;IAED,QAAQ,EAAE;QACR,SAAS,EAAE;YACT,WAAW,EACT,gJAAgJ;YAClJ,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE;gBAClB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;oBAAE,OAAO,SAAS,CAAC;gBAClD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACzC,IAAI,KAAK,EAAE,QAAQ;oBAAE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;gBAC7C,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC;YACpC,CAAC;SACF;KACF;IAED,aAAa,EAAE,EAAE;CAClB,CAAC,CAAC"}
|
|
@@ -1,5 +1,40 @@
|
|
|
1
|
-
import { OnModuleInit } from "@nestjs/common";
|
|
1
|
+
import { DynamicModule, OnModuleInit } from "@nestjs/common";
|
|
2
|
+
import { HowToModuleConfig } from "./interfaces/how-to.config.interface";
|
|
3
|
+
/**
|
|
4
|
+
* HowToModule — authenticated CRUD over help articles, plus an OPT-IN
|
|
5
|
+
* unauthenticated read surface.
|
|
6
|
+
*
|
|
7
|
+
* The static metadata below mounts `HowToController` only, so importing the
|
|
8
|
+
* module as `HowToModule` (no `forRoot()`) publishes nothing: every route it
|
|
9
|
+
* adds is behind `JwtAuthGuard`.
|
|
10
|
+
*
|
|
11
|
+
* Defaults are deliberately inert: with `forRoot()` and no config,
|
|
12
|
+
* `HowToPublicController` is NOT registered and the three `public/howtos/*`
|
|
13
|
+
* routes do not exist. Those routes are unauthenticated by design and their
|
|
14
|
+
* read filter is `draft IS NULL OR draft = false`, which makes a guide created
|
|
15
|
+
* without a `draft` property world-readable — publishing a company's guides is
|
|
16
|
+
* an app-level policy decision, never a side effect of mounting the module.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Inert (library default): authenticated CRUD only, no public routes
|
|
21
|
+
* HowToModule
|
|
22
|
+
* HowToModule.forRoot()
|
|
23
|
+
*
|
|
24
|
+
* // Public knowledge base: adds GET public/howtos and the article routes
|
|
25
|
+
* HowToModule.forRoot({ publicRoutes: true })
|
|
26
|
+
*
|
|
27
|
+
* // Through FoundationsModule, which mounts this module for you
|
|
28
|
+
* FoundationsModule.forRoot({ howTo: { publicRoutes: true } })
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
2
31
|
export declare class HowToModule implements OnModuleInit {
|
|
32
|
+
/**
|
|
33
|
+
* Configure the HowToModule.
|
|
34
|
+
*
|
|
35
|
+
* @param config - Optional configuration merged over DEFAULT_HOW_TO_CONFIG
|
|
36
|
+
*/
|
|
37
|
+
static forRoot(config?: HowToModuleConfig): DynamicModule;
|
|
3
38
|
onModuleInit(): void;
|
|
4
39
|
}
|
|
5
40
|
//# sourceMappingURL=how-to.module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"how-to.module.d.ts","sourceRoot":"","sources":["../../../src/foundations/how-to/how-to.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"how-to.module.d.ts","sourceRoot":"","sources":["../../../src/foundations/how-to/how-to.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAU,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAYrE,OAAO,EAAyB,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAKhG;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAgCa,WAAY,YAAW,YAAY;IAC9C;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,aAAa;IAezD,YAAY;CAGb"}
|