@orthacms/copilot-server 0.0.0-reserve.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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/lib/chat/application/appliers-registrar.d.ts +16 -0
- package/dist/lib/chat/application/appliers-registrar.d.ts.map +1 -0
- package/dist/lib/chat/application/appliers-registrar.js +50 -0
- package/dist/lib/chat/application/capability-profile.service.d.ts +43 -0
- package/dist/lib/chat/application/capability-profile.service.d.ts.map +1 -0
- package/dist/lib/chat/application/capability-profile.service.js +75 -0
- package/dist/lib/chat/application/content-type-summary.service.d.ts +32 -0
- package/dist/lib/chat/application/content-type-summary.service.d.ts.map +1 -0
- package/dist/lib/chat/application/content-type-summary.service.js +64 -0
- package/dist/lib/chat/application/decide-proposal.service.d.ts +80 -0
- package/dist/lib/chat/application/decide-proposal.service.d.ts.map +1 -0
- package/dist/lib/chat/application/decide-proposal.service.js +112 -0
- package/dist/lib/chat/application/dto/create-run.dto.d.ts +138 -0
- package/dist/lib/chat/application/dto/create-run.dto.d.ts.map +1 -0
- package/dist/lib/chat/application/dto/create-run.dto.js +253 -0
- package/dist/lib/chat/application/dto/decide-tool-permission.dto.d.ts +20 -0
- package/dist/lib/chat/application/dto/decide-tool-permission.dto.d.ts.map +1 -0
- package/dist/lib/chat/application/dto/decide-tool-permission.dto.js +44 -0
- package/dist/lib/chat/application/dto/extend-tool-permission.dto.d.ts +18 -0
- package/dist/lib/chat/application/dto/extend-tool-permission.dto.d.ts.map +1 -0
- package/dist/lib/chat/application/dto/extend-tool-permission.dto.js +33 -0
- package/dist/lib/chat/application/dto/list-conversations-query.dto.d.ts +18 -0
- package/dist/lib/chat/application/dto/list-conversations-query.dto.d.ts.map +1 -0
- package/dist/lib/chat/application/dto/list-conversations-query.dto.js +39 -0
- package/dist/lib/chat/application/dto/list-proposals-query.dto.d.ts +15 -0
- package/dist/lib/chat/application/dto/list-proposals-query.dto.d.ts.map +1 -0
- package/dist/lib/chat/application/dto/list-proposals-query.dto.js +41 -0
- package/dist/lib/chat/application/dto/update-conversation.dto.d.ts +68 -0
- package/dist/lib/chat/application/dto/update-conversation.dto.d.ts.map +1 -0
- package/dist/lib/chat/application/dto/update-conversation.dto.js +115 -0
- package/dist/lib/chat/application/proposal-applier.registry.d.ts +27 -0
- package/dist/lib/chat/application/proposal-applier.registry.d.ts.map +1 -0
- package/dist/lib/chat/application/proposal-applier.registry.js +62 -0
- package/dist/lib/chat/application/run-engine.service.d.ts +243 -0
- package/dist/lib/chat/application/run-engine.service.d.ts.map +1 -0
- package/dist/lib/chat/application/run-engine.service.js +1058 -0
- package/dist/lib/chat/application/summarize-tool-output.d.ts +15 -0
- package/dist/lib/chat/application/summarize-tool-output.d.ts.map +1 -0
- package/dist/lib/chat/application/summarize-tool-output.js +61 -0
- package/dist/lib/chat/application/system-prompt.d.ts +81 -0
- package/dist/lib/chat/application/system-prompt.d.ts.map +1 -0
- package/dist/lib/chat/application/system-prompt.js +477 -0
- package/dist/lib/chat/application/tool-permission.broker.d.ts +118 -0
- package/dist/lib/chat/application/tool-permission.broker.d.ts.map +1 -0
- package/dist/lib/chat/application/tool-permission.broker.js +221 -0
- package/dist/lib/chat/http/controllers/create-run.controller.d.ts +30 -0
- package/dist/lib/chat/http/controllers/create-run.controller.d.ts.map +1 -0
- package/dist/lib/chat/http/controllers/create-run.controller.js +159 -0
- package/dist/lib/chat/http/controllers/get-conversation.controller.d.ts +22 -0
- package/dist/lib/chat/http/controllers/get-conversation.controller.d.ts.map +1 -0
- package/dist/lib/chat/http/controllers/get-conversation.controller.js +50 -0
- package/dist/lib/chat/http/controllers/list-conversations.controller.d.ts +20 -0
- package/dist/lib/chat/http/controllers/list-conversations.controller.d.ts.map +1 -0
- package/dist/lib/chat/http/controllers/list-conversations.controller.js +47 -0
- package/dist/lib/chat/http/controllers/list-models.controller.d.ts +35 -0
- package/dist/lib/chat/http/controllers/list-models.controller.d.ts.map +1 -0
- package/dist/lib/chat/http/controllers/list-models.controller.js +48 -0
- package/dist/lib/chat/http/controllers/proposals.controller.d.ts +43 -0
- package/dist/lib/chat/http/controllers/proposals.controller.d.ts.map +1 -0
- package/dist/lib/chat/http/controllers/proposals.controller.js +98 -0
- package/dist/lib/chat/http/controllers/tool-permission.controller.d.ts +57 -0
- package/dist/lib/chat/http/controllers/tool-permission.controller.d.ts.map +1 -0
- package/dist/lib/chat/http/controllers/tool-permission.controller.js +116 -0
- package/dist/lib/chat/http/controllers/update-conversation.controller.d.ts +37 -0
- package/dist/lib/chat/http/controllers/update-conversation.controller.d.ts.map +1 -0
- package/dist/lib/chat/http/controllers/update-conversation.controller.js +108 -0
- package/dist/lib/chat/http/sse-stream.d.ts +41 -0
- package/dist/lib/chat/http/sse-stream.d.ts.map +1 -0
- package/dist/lib/chat/http/sse-stream.js +95 -0
- package/dist/lib/chat/infrastructure/persistence/conversation.repository.d.ts +159 -0
- package/dist/lib/chat/infrastructure/persistence/conversation.repository.d.ts.map +1 -0
- package/dist/lib/chat/infrastructure/persistence/conversation.repository.js +249 -0
- package/dist/lib/chat/infrastructure/persistence/derive-title.d.ts +13 -0
- package/dist/lib/chat/infrastructure/persistence/derive-title.d.ts.map +1 -0
- package/dist/lib/chat/infrastructure/persistence/derive-title.js +35 -0
- package/dist/lib/chat/infrastructure/persistence/proposal.repository.d.ts +86 -0
- package/dist/lib/chat/infrastructure/persistence/proposal.repository.d.ts.map +1 -0
- package/dist/lib/chat/infrastructure/persistence/proposal.repository.js +152 -0
- package/dist/lib/chat/infrastructure/schema/conversations.d.ts +189 -0
- package/dist/lib/chat/infrastructure/schema/conversations.d.ts.map +1 -0
- package/dist/lib/chat/infrastructure/schema/conversations.js +100 -0
- package/dist/lib/chat/infrastructure/schema/external-refs.d.ts +67 -0
- package/dist/lib/chat/infrastructure/schema/external-refs.d.ts.map +1 -0
- package/dist/lib/chat/infrastructure/schema/external-refs.js +28 -0
- package/dist/lib/chat/infrastructure/schema/index.d.ts +5 -0
- package/dist/lib/chat/infrastructure/schema/index.d.ts.map +1 -0
- package/dist/lib/chat/infrastructure/schema/index.js +12 -0
- package/dist/lib/chat/infrastructure/schema/messages.d.ts +264 -0
- package/dist/lib/chat/infrastructure/schema/messages.d.ts.map +1 -0
- package/dist/lib/chat/infrastructure/schema/messages.js +96 -0
- package/dist/lib/chat/infrastructure/schema/proposals.d.ts +328 -0
- package/dist/lib/chat/infrastructure/schema/proposals.d.ts.map +1 -0
- package/dist/lib/chat/infrastructure/schema/proposals.js +87 -0
- package/dist/lib/chat/infrastructure/schema/tool-calls.d.ts +203 -0
- package/dist/lib/chat/infrastructure/schema/tool-calls.d.ts.map +1 -0
- package/dist/lib/chat/infrastructure/schema/tool-calls.js +50 -0
- package/dist/lib/copilot.module.d.ts +30 -0
- package/dist/lib/copilot.module.d.ts.map +1 -0
- package/dist/lib/copilot.module.js +146 -0
- package/dist/lib/copilot.tokens.d.ts +34 -0
- package/dist/lib/copilot.tokens.d.ts.map +1 -0
- package/dist/lib/copilot.tokens.js +38 -0
- package/dist/lib/infrastructure/model-registry.d.ts +22 -0
- package/dist/lib/infrastructure/model-registry.d.ts.map +1 -0
- package/dist/lib/infrastructure/model-registry.js +54 -0
- package/dist/lib/skills/application/dto/create-skill.dto.d.ts +36 -0
- package/dist/lib/skills/application/dto/create-skill.dto.d.ts.map +1 -0
- package/dist/lib/skills/application/dto/create-skill.dto.js +106 -0
- package/dist/lib/skills/application/dto/update-skill.dto.d.ts +28 -0
- package/dist/lib/skills/application/dto/update-skill.dto.d.ts.map +1 -0
- package/dist/lib/skills/application/dto/update-skill.dto.js +96 -0
- package/dist/lib/skills/application/skill-catalog.service.d.ts +97 -0
- package/dist/lib/skills/application/skill-catalog.service.d.ts.map +1 -0
- package/dist/lib/skills/application/skill-catalog.service.js +157 -0
- package/dist/lib/skills/http/controllers/list-skills.controller.d.ts +19 -0
- package/dist/lib/skills/http/controllers/list-skills.controller.d.ts.map +1 -0
- package/dist/lib/skills/http/controllers/list-skills.controller.js +50 -0
- package/dist/lib/skills/http/controllers/manage-skills.controller.d.ts +64 -0
- package/dist/lib/skills/http/controllers/manage-skills.controller.d.ts.map +1 -0
- package/dist/lib/skills/http/controllers/manage-skills.controller.js +182 -0
- package/dist/lib/skills/infrastructure/persistence/skill.repository.d.ts +78 -0
- package/dist/lib/skills/infrastructure/persistence/skill.repository.d.ts.map +1 -0
- package/dist/lib/skills/infrastructure/persistence/skill.repository.js +116 -0
- package/dist/lib/skills/infrastructure/schema/index.d.ts +2 -0
- package/dist/lib/skills/infrastructure/schema/index.d.ts.map +1 -0
- package/dist/lib/skills/infrastructure/schema/index.js +6 -0
- package/dist/lib/skills/infrastructure/schema/skills.d.ts +212 -0
- package/dist/lib/skills/infrastructure/schema/skills.d.ts.map +1 -0
- package/dist/lib/skills/infrastructure/schema/skills.js +78 -0
- package/dist/lib/types/copilot-config.d.ts +55 -0
- package/dist/lib/types/copilot-config.d.ts.map +1 -0
- package/dist/lib/types/copilot-config.js +2 -0
- package/dist/lib/utils/copilot-plugin.d.ts +66 -0
- package/dist/lib/utils/copilot-plugin.d.ts.map +1 -0
- package/dist/lib/utils/copilot-plugin.js +87 -0
- package/migrations/0000_copilot_chat.sql +48 -0
- package/migrations/0001_proposals.sql +34 -0
- package/migrations/0002_drop_workspace_policies.sql +1 -0
- package/migrations/0003_conversation_allowed_tools.sql +1 -0
- package/migrations/0004_message_attachments.sql +1 -0
- package/migrations/0005_skills.sql +19 -0
- package/migrations/0006_conversation_model_choice.sql +1 -0
- package/migrations/meta/0000_snapshot.json +390 -0
- package/migrations/meta/0001_snapshot.json +657 -0
- package/migrations/meta/0002_snapshot.json +610 -0
- package/migrations/meta/0003_snapshot.json +617 -0
- package/migrations/meta/0004_snapshot.json +623 -0
- package/migrations/meta/0005_snapshot.json +771 -0
- package/migrations/meta/0006_snapshot.json +777 -0
- package/migrations/meta/_journal.json +55 -0
- package/package.json +46 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/** Longest message we accept. Bounds the prompt before the model bounds it. */
|
|
2
|
+
export declare const MAX_MESSAGE_LENGTH = 8000;
|
|
3
|
+
/**
|
|
4
|
+
* Files one turn may carry.
|
|
5
|
+
*
|
|
6
|
+
* A ceiling rather than none, because each attachment costs a resolve and a
|
|
7
|
+
* line of prompt, and a request naming two hundred ids would spend both before
|
|
8
|
+
* the model is ever called.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MAX_RUN_ATTACHMENTS = 8;
|
|
11
|
+
/** The surfaces a run can be started from (design §2). */
|
|
12
|
+
export declare const RUN_SURFACES: readonly ["chat", "palette", "entry", "records"];
|
|
13
|
+
/**
|
|
14
|
+
* Where the user was when they asked. Every field is optional — the chat panel
|
|
15
|
+
* knows only the workspace, the entry editor knows the type and the entry.
|
|
16
|
+
*
|
|
17
|
+
* **This class exists because of the host's strict `ValidationPipe`.** It runs
|
|
18
|
+
* with `whitelist: true` + `forbidNonWhitelisted: true`, and those apply to
|
|
19
|
+
* nested objects too: without `@ValidateNested()` + `@Type()` here, a nested
|
|
20
|
+
* `context` object is not traversed as a DTO at all — its properties are
|
|
21
|
+
* stripped by the whitelist and the handler silently receives `{}`. Declaring
|
|
22
|
+
* the nested class is what makes the payload arrive intact.
|
|
23
|
+
*/
|
|
24
|
+
export declare class RunContextDto {
|
|
25
|
+
/** Where the run was started from. */
|
|
26
|
+
surface?: (typeof RUN_SURFACES)[number];
|
|
27
|
+
/** The content type in view, if any. */
|
|
28
|
+
contentType?: string;
|
|
29
|
+
/** The entry in view, if any. */
|
|
30
|
+
entryId?: string;
|
|
31
|
+
/** The content locale in view, if any. */
|
|
32
|
+
locale?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* One file attached to a turn — an **id only**.
|
|
36
|
+
*
|
|
37
|
+
* The client has the whole asset view in hand after uploading, and sending the
|
|
38
|
+
* name and size along would save the server a lookup. It deliberately does not:
|
|
39
|
+
* the id is the only part the server can verify, and everything the model is
|
|
40
|
+
* told about a file has to come from the row rather than from the request, or a
|
|
41
|
+
* caller could describe someone else's asset — or their own — as anything they
|
|
42
|
+
* liked.
|
|
43
|
+
*
|
|
44
|
+
* A class rather than a bare string array for the same reason `RunContextDto`
|
|
45
|
+
* is a class: the strict pipe traverses a nested array only with
|
|
46
|
+
* `@ValidateNested({ each: true })` + `@Type()`, and it leaves room for a
|
|
47
|
+
* per-attachment field later without changing the wire shape.
|
|
48
|
+
*/
|
|
49
|
+
export declare class RunAttachmentDto {
|
|
50
|
+
/** The media asset's id, as returned by the upload it came from. */
|
|
51
|
+
assetId: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* One skill attached to a turn — a **name only**.
|
|
55
|
+
*
|
|
56
|
+
* The same discipline as {@link RunAttachmentDto}, and the reason is sharper
|
|
57
|
+
* here: a skill's `instructions` are prompt text, so a request that could carry
|
|
58
|
+
* a body would let anyone holding `copilot:use` write their own system prompt.
|
|
59
|
+
* The name is the only part the server can check, and everything the model is
|
|
60
|
+
* told comes from the catalogue row it resolves to.
|
|
61
|
+
*
|
|
62
|
+
* A class rather than a bare string array because the strict pipe traverses a
|
|
63
|
+
* nested array only with `@ValidateNested({ each: true })` + `@Type()`.
|
|
64
|
+
*/
|
|
65
|
+
export declare class RunSkillDto {
|
|
66
|
+
/** The skill's machine name, as served by `GET /api/copilot/skills`. */
|
|
67
|
+
name: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Body of `POST /api/copilot/runs`.
|
|
71
|
+
*
|
|
72
|
+
* Every field the client may send is declared here, including the nested
|
|
73
|
+
* context above — the host's pipe sets `forbidNonWhitelisted: true`, so an
|
|
74
|
+
* undeclared key is a **400 naming the property**, not a silently ignored
|
|
75
|
+
* extra. That is the behaviour we want (a typo'd field is a loud failure), but
|
|
76
|
+
* it means adding a client-side field without adding it here breaks the request
|
|
77
|
+
* with an error that reads as unrelated.
|
|
78
|
+
*/
|
|
79
|
+
export declare class CreateRunDto {
|
|
80
|
+
/** What the user typed. */
|
|
81
|
+
message: string;
|
|
82
|
+
/** Continue this thread. Omit to start a new one. */
|
|
83
|
+
conversationId?: string;
|
|
84
|
+
/**
|
|
85
|
+
* The admin UI's locale, so the model answers in the language the person
|
|
86
|
+
* is reading (`docs/design/copilot.md` §8, "Localized output"). Sent by the
|
|
87
|
+
* client rather than inferred from `Accept-Language`, because the admin's
|
|
88
|
+
* locale is an app preference, not a browser one.
|
|
89
|
+
*/
|
|
90
|
+
uiLocale?: string;
|
|
91
|
+
/**
|
|
92
|
+
* The registered provider to run on — one of the names in
|
|
93
|
+
* `GET /api/copilot/models`. Omit to let the host's resolver decide.
|
|
94
|
+
*
|
|
95
|
+
* Naming a provider is **not** an escalation: the registry is fixed at boot
|
|
96
|
+
* by the operator, so the worst a caller can do is pick a different backend
|
|
97
|
+
* the operator already configured. An unregistered name is refused.
|
|
98
|
+
*/
|
|
99
|
+
provider?: string;
|
|
100
|
+
/**
|
|
101
|
+
* The model id to run on, from the chosen provider's list. Omit for that
|
|
102
|
+
* provider's default. A user switches model by sending a different value on
|
|
103
|
+
* the next turn — the choice is **per run**, so a conversation can start
|
|
104
|
+
* cheap and escalate.
|
|
105
|
+
*
|
|
106
|
+
* The thread does carry a `modelChoice` (see `UpdateConversationDto`), and
|
|
107
|
+
* it is a memory rather than a pin: it is what the picker is *seeded* from
|
|
108
|
+
* when a saved conversation is reopened, and nothing about it constrains
|
|
109
|
+
* what this field may be on the next turn.
|
|
110
|
+
*/
|
|
111
|
+
model?: string;
|
|
112
|
+
/** Where the user is. */
|
|
113
|
+
context?: RunContextDto;
|
|
114
|
+
/**
|
|
115
|
+
* Files the user attached to this turn, already uploaded to the media
|
|
116
|
+
* library through `POST /api/media/assets`.
|
|
117
|
+
*
|
|
118
|
+
* Uploading is **not** part of the run: it happens first, over the ordinary
|
|
119
|
+
* media route, with the user's own session and their own `media:create`.
|
|
120
|
+
* That is what keeps the authority model intact — attaching a file is the
|
|
121
|
+
* person uploading it, exactly as they would from the Media Library, from a
|
|
122
|
+
* different button. The copilot never gains a write path; by the time a run
|
|
123
|
+
* starts, the asset already exists and this names it.
|
|
124
|
+
*/
|
|
125
|
+
attachments?: RunAttachmentDto[];
|
|
126
|
+
/**
|
|
127
|
+
* Skills the person attached to this turn, by name.
|
|
128
|
+
*
|
|
129
|
+
* Per turn rather than pinned to the thread, like the model choice: a
|
|
130
|
+
* conversation can rewrite one paragraph under the house style skill and
|
|
131
|
+
* the next under none. The workspace's always-on skills are **not** listed
|
|
132
|
+
* here — they are in force whatever the client sends, and a client that
|
|
133
|
+
* could omit them could turn workspace configuration off by not asking for
|
|
134
|
+
* it.
|
|
135
|
+
*/
|
|
136
|
+
skills?: RunSkillDto[];
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=create-run.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-run.dto.d.ts","sourceRoot":"","sources":["../../../../../src/lib/chat/application/dto/create-run.dto.ts"],"names":[],"mappings":"AAqBA,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB,OAAQ,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,0DAA0D;AAC1D,eAAO,MAAM,YAAY,kDAAmD,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IACtB,sCAAsC;IAItC,OAAO,CAAC,EAAE,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IAExC,wCAAwC;IAKxC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,iCAAiC;IAKjC,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,0CAA0C;IAK1C,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gBAAgB;IACzB,oEAAoE;IAGpE,OAAO,EAAG,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,WAAW;IACpB,wEAAwE;IAUxE,IAAI,EAAG,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAY;IACrB,2BAA2B;IAK3B,OAAO,EAAG,MAAM,CAAC;IAEjB,qDAAqD;IAIrD,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IAKH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;OAOG;IAKH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;OAUG;IAKH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,yBAAyB;IAMzB,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;;;;;;;OAUG;IAOH,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAEjC;;;;;;;;;OASG;IAOH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateRunDto = exports.RunSkillDto = exports.RunAttachmentDto = exports.RunContextDto = exports.RUN_SURFACES = exports.MAX_RUN_ATTACHMENTS = exports.MAX_MESSAGE_LENGTH = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const class_transformer_1 = require("class-transformer");
|
|
7
|
+
const class_validator_1 = require("class-validator");
|
|
8
|
+
const copilot_domain_1 = require("@orthacms/copilot-domain");
|
|
9
|
+
/** Longest message we accept. Bounds the prompt before the model bounds it. */
|
|
10
|
+
exports.MAX_MESSAGE_LENGTH = 8_000;
|
|
11
|
+
/**
|
|
12
|
+
* Files one turn may carry.
|
|
13
|
+
*
|
|
14
|
+
* A ceiling rather than none, because each attachment costs a resolve and a
|
|
15
|
+
* line of prompt, and a request naming two hundred ids would spend both before
|
|
16
|
+
* the model is ever called.
|
|
17
|
+
*/
|
|
18
|
+
exports.MAX_RUN_ATTACHMENTS = 8;
|
|
19
|
+
/** The surfaces a run can be started from (design §2). */
|
|
20
|
+
exports.RUN_SURFACES = ['chat', 'palette', 'entry', 'records'];
|
|
21
|
+
/**
|
|
22
|
+
* Where the user was when they asked. Every field is optional — the chat panel
|
|
23
|
+
* knows only the workspace, the entry editor knows the type and the entry.
|
|
24
|
+
*
|
|
25
|
+
* **This class exists because of the host's strict `ValidationPipe`.** It runs
|
|
26
|
+
* with `whitelist: true` + `forbidNonWhitelisted: true`, and those apply to
|
|
27
|
+
* nested objects too: without `@ValidateNested()` + `@Type()` here, a nested
|
|
28
|
+
* `context` object is not traversed as a DTO at all — its properties are
|
|
29
|
+
* stripped by the whitelist and the handler silently receives `{}`. Declaring
|
|
30
|
+
* the nested class is what makes the payload arrive intact.
|
|
31
|
+
*/
|
|
32
|
+
class RunContextDto {
|
|
33
|
+
/** Where the run was started from. */
|
|
34
|
+
surface;
|
|
35
|
+
/** The content type in view, if any. */
|
|
36
|
+
contentType;
|
|
37
|
+
/** The entry in view, if any. */
|
|
38
|
+
entryId;
|
|
39
|
+
/** The content locale in view, if any. */
|
|
40
|
+
locale;
|
|
41
|
+
}
|
|
42
|
+
exports.RunContextDto = RunContextDto;
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
(0, swagger_1.ApiPropertyOptional)({ enum: exports.RUN_SURFACES }),
|
|
45
|
+
(0, class_validator_1.IsOptional)(),
|
|
46
|
+
(0, class_validator_1.IsIn)(exports.RUN_SURFACES),
|
|
47
|
+
tslib_1.__metadata("design:type", Object)
|
|
48
|
+
], RunContextDto.prototype, "surface", void 0);
|
|
49
|
+
tslib_1.__decorate([
|
|
50
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, maxLength: 128 }),
|
|
51
|
+
(0, class_validator_1.IsOptional)(),
|
|
52
|
+
(0, class_validator_1.IsString)(),
|
|
53
|
+
(0, class_validator_1.MaxLength)(128),
|
|
54
|
+
tslib_1.__metadata("design:type", String)
|
|
55
|
+
], RunContextDto.prototype, "contentType", void 0);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, maxLength: 64 }),
|
|
58
|
+
(0, class_validator_1.IsOptional)(),
|
|
59
|
+
(0, class_validator_1.IsString)(),
|
|
60
|
+
(0, class_validator_1.MaxLength)(64),
|
|
61
|
+
tslib_1.__metadata("design:type", String)
|
|
62
|
+
], RunContextDto.prototype, "entryId", void 0);
|
|
63
|
+
tslib_1.__decorate([
|
|
64
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, maxLength: 35 }),
|
|
65
|
+
(0, class_validator_1.IsOptional)(),
|
|
66
|
+
(0, class_validator_1.IsString)(),
|
|
67
|
+
(0, class_validator_1.MaxLength)(35),
|
|
68
|
+
tslib_1.__metadata("design:type", String)
|
|
69
|
+
], RunContextDto.prototype, "locale", void 0);
|
|
70
|
+
/**
|
|
71
|
+
* One file attached to a turn — an **id only**.
|
|
72
|
+
*
|
|
73
|
+
* The client has the whole asset view in hand after uploading, and sending the
|
|
74
|
+
* name and size along would save the server a lookup. It deliberately does not:
|
|
75
|
+
* the id is the only part the server can verify, and everything the model is
|
|
76
|
+
* told about a file has to come from the row rather than from the request, or a
|
|
77
|
+
* caller could describe someone else's asset — or their own — as anything they
|
|
78
|
+
* liked.
|
|
79
|
+
*
|
|
80
|
+
* A class rather than a bare string array for the same reason `RunContextDto`
|
|
81
|
+
* is a class: the strict pipe traverses a nested array only with
|
|
82
|
+
* `@ValidateNested({ each: true })` + `@Type()`, and it leaves room for a
|
|
83
|
+
* per-attachment field later without changing the wire shape.
|
|
84
|
+
*/
|
|
85
|
+
class RunAttachmentDto {
|
|
86
|
+
/** The media asset's id, as returned by the upload it came from. */
|
|
87
|
+
assetId;
|
|
88
|
+
}
|
|
89
|
+
exports.RunAttachmentDto = RunAttachmentDto;
|
|
90
|
+
tslib_1.__decorate([
|
|
91
|
+
(0, swagger_1.ApiProperty)({ type: String, format: 'uuid' }),
|
|
92
|
+
(0, class_validator_1.IsUUID)(),
|
|
93
|
+
tslib_1.__metadata("design:type", String)
|
|
94
|
+
], RunAttachmentDto.prototype, "assetId", void 0);
|
|
95
|
+
/**
|
|
96
|
+
* One skill attached to a turn — a **name only**.
|
|
97
|
+
*
|
|
98
|
+
* The same discipline as {@link RunAttachmentDto}, and the reason is sharper
|
|
99
|
+
* here: a skill's `instructions` are prompt text, so a request that could carry
|
|
100
|
+
* a body would let anyone holding `copilot:use` write their own system prompt.
|
|
101
|
+
* The name is the only part the server can check, and everything the model is
|
|
102
|
+
* told comes from the catalogue row it resolves to.
|
|
103
|
+
*
|
|
104
|
+
* A class rather than a bare string array because the strict pipe traverses a
|
|
105
|
+
* nested array only with `@ValidateNested({ each: true })` + `@Type()`.
|
|
106
|
+
*/
|
|
107
|
+
class RunSkillDto {
|
|
108
|
+
/** The skill's machine name, as served by `GET /api/copilot/skills`. */
|
|
109
|
+
name;
|
|
110
|
+
}
|
|
111
|
+
exports.RunSkillDto = RunSkillDto;
|
|
112
|
+
tslib_1.__decorate([
|
|
113
|
+
(0, swagger_1.ApiProperty)({
|
|
114
|
+
type: String,
|
|
115
|
+
maxLength: copilot_domain_1.MAX_SKILL_NAME_LENGTH,
|
|
116
|
+
pattern: copilot_domain_1.SKILL_NAME_PATTERN.source,
|
|
117
|
+
example: 'house-style'
|
|
118
|
+
}),
|
|
119
|
+
(0, class_validator_1.IsString)(),
|
|
120
|
+
(0, class_validator_1.MaxLength)(copilot_domain_1.MAX_SKILL_NAME_LENGTH),
|
|
121
|
+
(0, class_validator_1.Matches)(copilot_domain_1.SKILL_NAME_PATTERN),
|
|
122
|
+
tslib_1.__metadata("design:type", String)
|
|
123
|
+
], RunSkillDto.prototype, "name", void 0);
|
|
124
|
+
/**
|
|
125
|
+
* Body of `POST /api/copilot/runs`.
|
|
126
|
+
*
|
|
127
|
+
* Every field the client may send is declared here, including the nested
|
|
128
|
+
* context above — the host's pipe sets `forbidNonWhitelisted: true`, so an
|
|
129
|
+
* undeclared key is a **400 naming the property**, not a silently ignored
|
|
130
|
+
* extra. That is the behaviour we want (a typo'd field is a loud failure), but
|
|
131
|
+
* it means adding a client-side field without adding it here breaks the request
|
|
132
|
+
* with an error that reads as unrelated.
|
|
133
|
+
*/
|
|
134
|
+
class CreateRunDto {
|
|
135
|
+
/** What the user typed. */
|
|
136
|
+
message;
|
|
137
|
+
/** Continue this thread. Omit to start a new one. */
|
|
138
|
+
conversationId;
|
|
139
|
+
/**
|
|
140
|
+
* The admin UI's locale, so the model answers in the language the person
|
|
141
|
+
* is reading (`docs/design/copilot.md` §8, "Localized output"). Sent by the
|
|
142
|
+
* client rather than inferred from `Accept-Language`, because the admin's
|
|
143
|
+
* locale is an app preference, not a browser one.
|
|
144
|
+
*/
|
|
145
|
+
uiLocale;
|
|
146
|
+
/**
|
|
147
|
+
* The registered provider to run on — one of the names in
|
|
148
|
+
* `GET /api/copilot/models`. Omit to let the host's resolver decide.
|
|
149
|
+
*
|
|
150
|
+
* Naming a provider is **not** an escalation: the registry is fixed at boot
|
|
151
|
+
* by the operator, so the worst a caller can do is pick a different backend
|
|
152
|
+
* the operator already configured. An unregistered name is refused.
|
|
153
|
+
*/
|
|
154
|
+
provider;
|
|
155
|
+
/**
|
|
156
|
+
* The model id to run on, from the chosen provider's list. Omit for that
|
|
157
|
+
* provider's default. A user switches model by sending a different value on
|
|
158
|
+
* the next turn — the choice is **per run**, so a conversation can start
|
|
159
|
+
* cheap and escalate.
|
|
160
|
+
*
|
|
161
|
+
* The thread does carry a `modelChoice` (see `UpdateConversationDto`), and
|
|
162
|
+
* it is a memory rather than a pin: it is what the picker is *seeded* from
|
|
163
|
+
* when a saved conversation is reopened, and nothing about it constrains
|
|
164
|
+
* what this field may be on the next turn.
|
|
165
|
+
*/
|
|
166
|
+
model;
|
|
167
|
+
/** Where the user is. */
|
|
168
|
+
context;
|
|
169
|
+
/**
|
|
170
|
+
* Files the user attached to this turn, already uploaded to the media
|
|
171
|
+
* library through `POST /api/media/assets`.
|
|
172
|
+
*
|
|
173
|
+
* Uploading is **not** part of the run: it happens first, over the ordinary
|
|
174
|
+
* media route, with the user's own session and their own `media:create`.
|
|
175
|
+
* That is what keeps the authority model intact — attaching a file is the
|
|
176
|
+
* person uploading it, exactly as they would from the Media Library, from a
|
|
177
|
+
* different button. The copilot never gains a write path; by the time a run
|
|
178
|
+
* starts, the asset already exists and this names it.
|
|
179
|
+
*/
|
|
180
|
+
attachments;
|
|
181
|
+
/**
|
|
182
|
+
* Skills the person attached to this turn, by name.
|
|
183
|
+
*
|
|
184
|
+
* Per turn rather than pinned to the thread, like the model choice: a
|
|
185
|
+
* conversation can rewrite one paragraph under the house style skill and
|
|
186
|
+
* the next under none. The workspace's always-on skills are **not** listed
|
|
187
|
+
* here — they are in force whatever the client sends, and a client that
|
|
188
|
+
* could omit them could turn workspace configuration off by not asking for
|
|
189
|
+
* it.
|
|
190
|
+
*/
|
|
191
|
+
skills;
|
|
192
|
+
}
|
|
193
|
+
exports.CreateRunDto = CreateRunDto;
|
|
194
|
+
tslib_1.__decorate([
|
|
195
|
+
(0, swagger_1.ApiProperty)({ type: String, minLength: 1, maxLength: exports.MAX_MESSAGE_LENGTH }),
|
|
196
|
+
(0, class_validator_1.IsString)(),
|
|
197
|
+
(0, class_validator_1.MinLength)(1),
|
|
198
|
+
(0, class_validator_1.MaxLength)(exports.MAX_MESSAGE_LENGTH),
|
|
199
|
+
tslib_1.__metadata("design:type", String)
|
|
200
|
+
], CreateRunDto.prototype, "message", void 0);
|
|
201
|
+
tslib_1.__decorate([
|
|
202
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, format: 'uuid' }),
|
|
203
|
+
(0, class_validator_1.IsOptional)(),
|
|
204
|
+
(0, class_validator_1.IsUUID)(),
|
|
205
|
+
tslib_1.__metadata("design:type", String)
|
|
206
|
+
], CreateRunDto.prototype, "conversationId", void 0);
|
|
207
|
+
tslib_1.__decorate([
|
|
208
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, maxLength: 35, default: 'en' }),
|
|
209
|
+
(0, class_validator_1.IsOptional)(),
|
|
210
|
+
(0, class_validator_1.IsString)(),
|
|
211
|
+
(0, class_validator_1.MaxLength)(35),
|
|
212
|
+
tslib_1.__metadata("design:type", String)
|
|
213
|
+
], CreateRunDto.prototype, "uiLocale", void 0);
|
|
214
|
+
tslib_1.__decorate([
|
|
215
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, maxLength: 64 }),
|
|
216
|
+
(0, class_validator_1.IsOptional)(),
|
|
217
|
+
(0, class_validator_1.IsString)(),
|
|
218
|
+
(0, class_validator_1.MaxLength)(64),
|
|
219
|
+
tslib_1.__metadata("design:type", String)
|
|
220
|
+
], CreateRunDto.prototype, "provider", void 0);
|
|
221
|
+
tslib_1.__decorate([
|
|
222
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, maxLength: 128 }),
|
|
223
|
+
(0, class_validator_1.IsOptional)(),
|
|
224
|
+
(0, class_validator_1.IsString)(),
|
|
225
|
+
(0, class_validator_1.MaxLength)(128),
|
|
226
|
+
tslib_1.__metadata("design:type", String)
|
|
227
|
+
], CreateRunDto.prototype, "model", void 0);
|
|
228
|
+
tslib_1.__decorate([
|
|
229
|
+
(0, swagger_1.ApiPropertyOptional)({ type: RunContextDto }),
|
|
230
|
+
(0, class_validator_1.IsOptional)(),
|
|
231
|
+
(0, class_validator_1.IsObject)(),
|
|
232
|
+
(0, class_validator_1.ValidateNested)(),
|
|
233
|
+
(0, class_transformer_1.Type)(() => RunContextDto),
|
|
234
|
+
tslib_1.__metadata("design:type", RunContextDto)
|
|
235
|
+
], CreateRunDto.prototype, "context", void 0);
|
|
236
|
+
tslib_1.__decorate([
|
|
237
|
+
(0, swagger_1.ApiPropertyOptional)({ type: [RunAttachmentDto] }),
|
|
238
|
+
(0, class_validator_1.IsOptional)(),
|
|
239
|
+
(0, class_validator_1.IsArray)(),
|
|
240
|
+
(0, class_validator_1.ArrayMaxSize)(exports.MAX_RUN_ATTACHMENTS),
|
|
241
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
242
|
+
(0, class_transformer_1.Type)(() => RunAttachmentDto),
|
|
243
|
+
tslib_1.__metadata("design:type", Array)
|
|
244
|
+
], CreateRunDto.prototype, "attachments", void 0);
|
|
245
|
+
tslib_1.__decorate([
|
|
246
|
+
(0, swagger_1.ApiPropertyOptional)({ type: [RunSkillDto], maxItems: copilot_domain_1.MAX_RUN_SKILLS }),
|
|
247
|
+
(0, class_validator_1.IsOptional)(),
|
|
248
|
+
(0, class_validator_1.IsArray)(),
|
|
249
|
+
(0, class_validator_1.ArrayMaxSize)(copilot_domain_1.MAX_RUN_SKILLS),
|
|
250
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
251
|
+
(0, class_transformer_1.Type)(() => RunSkillDto),
|
|
252
|
+
tslib_1.__metadata("design:type", Array)
|
|
253
|
+
], CreateRunDto.prototype, "skills", void 0);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ToolPermissionDecision } from '@orthacms/copilot-domain';
|
|
2
|
+
/**
|
|
3
|
+
* Body of `POST /api/copilot/runs/:runId/permission`.
|
|
4
|
+
*
|
|
5
|
+
* Every property is declared because the host's `ValidationPipe` runs with
|
|
6
|
+
* `forbidNonWhitelisted` — an undeclared key is a 400 naming it.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DecideToolPermissionDto {
|
|
9
|
+
/**
|
|
10
|
+
* The tool call being answered, from the `tool-permission-request` frame.
|
|
11
|
+
*
|
|
12
|
+
* A plain string, not a UUID: it is the **provider's** call id, and the two
|
|
13
|
+
* wire formats mint those differently (`toolu_…` from one, `call_…` from
|
|
14
|
+
* the other). Validating it as a UUID would reject every real run.
|
|
15
|
+
*/
|
|
16
|
+
callId: string;
|
|
17
|
+
/** Run it once, run it for the rest of this thread, or refuse it. */
|
|
18
|
+
decision: ToolPermissionDecision;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=decide-tool-permission.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decide-tool-permission.dto.d.ts","sourceRoot":"","sources":["../../../../../src/lib/chat/application/dto/decide-tool-permission.dto.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAKvE;;;;;GAKG;AACH,qBAAa,uBAAuB;IAChC;;;;;;OAMG;IAQH,MAAM,EAAG,MAAM,CAAC;IAEhB,qEAAqE;IAOrE,QAAQ,EAAG,sBAAsB,CAAC;CACrC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DecideToolPermissionDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const class_validator_1 = require("class-validator");
|
|
7
|
+
/** The three answers a parked run accepts. */
|
|
8
|
+
const DECISIONS = ['once', 'chat', 'deny'];
|
|
9
|
+
/**
|
|
10
|
+
* Body of `POST /api/copilot/runs/:runId/permission`.
|
|
11
|
+
*
|
|
12
|
+
* Every property is declared because the host's `ValidationPipe` runs with
|
|
13
|
+
* `forbidNonWhitelisted` — an undeclared key is a 400 naming it.
|
|
14
|
+
*/
|
|
15
|
+
class DecideToolPermissionDto {
|
|
16
|
+
/**
|
|
17
|
+
* The tool call being answered, from the `tool-permission-request` frame.
|
|
18
|
+
*
|
|
19
|
+
* A plain string, not a UUID: it is the **provider's** call id, and the two
|
|
20
|
+
* wire formats mint those differently (`toolu_…` from one, `call_…` from
|
|
21
|
+
* the other). Validating it as a UUID would reject every real run.
|
|
22
|
+
*/
|
|
23
|
+
callId;
|
|
24
|
+
/** Run it once, run it for the rest of this thread, or refuse it. */
|
|
25
|
+
decision;
|
|
26
|
+
}
|
|
27
|
+
exports.DecideToolPermissionDto = DecideToolPermissionDto;
|
|
28
|
+
tslib_1.__decorate([
|
|
29
|
+
(0, swagger_1.ApiProperty)({
|
|
30
|
+
description: 'The `id` from the tool-permission-request frame this answers.'
|
|
31
|
+
}),
|
|
32
|
+
(0, class_validator_1.IsString)(),
|
|
33
|
+
(0, class_validator_1.MinLength)(1),
|
|
34
|
+
(0, class_validator_1.MaxLength)(200),
|
|
35
|
+
tslib_1.__metadata("design:type", String)
|
|
36
|
+
], DecideToolPermissionDto.prototype, "callId", void 0);
|
|
37
|
+
tslib_1.__decorate([
|
|
38
|
+
(0, swagger_1.ApiProperty)({
|
|
39
|
+
enum: [...DECISIONS],
|
|
40
|
+
description: '`once` runs this call; `chat` also stops asking about this tool in this thread; `deny` refuses it.'
|
|
41
|
+
}),
|
|
42
|
+
(0, class_validator_1.IsIn)(DECISIONS),
|
|
43
|
+
tslib_1.__metadata("design:type", String)
|
|
44
|
+
], DecideToolPermissionDto.prototype, "decision", void 0);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Body of `POST /api/copilot/runs/:runId/permission/extend`.
|
|
3
|
+
*
|
|
4
|
+
* Every property is declared because the host's `ValidationPipe` runs with
|
|
5
|
+
* `forbidNonWhitelisted` — an undeclared key is a 400 naming it.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExtendToolPermissionDto {
|
|
8
|
+
/**
|
|
9
|
+
* The tool call whose wait is being extended, from the
|
|
10
|
+
* `tool-permission-request` frame.
|
|
11
|
+
*
|
|
12
|
+
* A plain string, not a UUID, for the same reason as
|
|
13
|
+
* `DecideToolPermissionDto.callId`: it is the **provider's** call id and the
|
|
14
|
+
* two wire formats mint those differently.
|
|
15
|
+
*/
|
|
16
|
+
callId: string;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=extend-tool-permission.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extend-tool-permission.dto.d.ts","sourceRoot":"","sources":["../../../../../src/lib/chat/application/dto/extend-tool-permission.dto.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,qBAAa,uBAAuB;IAChC;;;;;;;OAOG;IAQH,MAAM,EAAG,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtendToolPermissionDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const class_validator_1 = require("class-validator");
|
|
7
|
+
/**
|
|
8
|
+
* Body of `POST /api/copilot/runs/:runId/permission/extend`.
|
|
9
|
+
*
|
|
10
|
+
* Every property is declared because the host's `ValidationPipe` runs with
|
|
11
|
+
* `forbidNonWhitelisted` — an undeclared key is a 400 naming it.
|
|
12
|
+
*/
|
|
13
|
+
class ExtendToolPermissionDto {
|
|
14
|
+
/**
|
|
15
|
+
* The tool call whose wait is being extended, from the
|
|
16
|
+
* `tool-permission-request` frame.
|
|
17
|
+
*
|
|
18
|
+
* A plain string, not a UUID, for the same reason as
|
|
19
|
+
* `DecideToolPermissionDto.callId`: it is the **provider's** call id and the
|
|
20
|
+
* two wire formats mint those differently.
|
|
21
|
+
*/
|
|
22
|
+
callId;
|
|
23
|
+
}
|
|
24
|
+
exports.ExtendToolPermissionDto = ExtendToolPermissionDto;
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, swagger_1.ApiProperty)({
|
|
27
|
+
description: 'The `id` from the tool-permission-request frame to extend.'
|
|
28
|
+
}),
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.MinLength)(1),
|
|
31
|
+
(0, class_validator_1.MaxLength)(200),
|
|
32
|
+
tslib_1.__metadata("design:type", String)
|
|
33
|
+
], ExtendToolPermissionDto.prototype, "callId", void 0);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query parameters for `GET /api/copilot/conversations`.
|
|
3
|
+
*
|
|
4
|
+
* Every property is declared because the host's `ValidationPipe` runs with
|
|
5
|
+
* `forbidNonWhitelisted` — an undeclared key is a 400 naming it.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ListConversationsQueryDto {
|
|
8
|
+
/**
|
|
9
|
+
* List archived threads instead of active ones. Omitted, the caller gets
|
|
10
|
+
* their active threads — the list the rail renders.
|
|
11
|
+
*
|
|
12
|
+
* The two sets are **disjoint by design**: archiving is "hide this from the
|
|
13
|
+
* list", so an archived thread appearing in the default list alongside its
|
|
14
|
+
* active siblings would defeat the whole point of the flag.
|
|
15
|
+
*/
|
|
16
|
+
archived?: boolean;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=list-conversations-query.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-conversations-query.dto.d.ts","sourceRoot":"","sources":["../../../../../src/lib/chat/application/dto/list-conversations-query.dto.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,qBAAa,yBAAyB;IAClC;;;;;;;OAOG;IAYH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListConversationsQueryDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const class_transformer_1 = require("class-transformer");
|
|
7
|
+
const class_validator_1 = require("class-validator");
|
|
8
|
+
/**
|
|
9
|
+
* Query parameters for `GET /api/copilot/conversations`.
|
|
10
|
+
*
|
|
11
|
+
* Every property is declared because the host's `ValidationPipe` runs with
|
|
12
|
+
* `forbidNonWhitelisted` — an undeclared key is a 400 naming it.
|
|
13
|
+
*/
|
|
14
|
+
class ListConversationsQueryDto {
|
|
15
|
+
/**
|
|
16
|
+
* List archived threads instead of active ones. Omitted, the caller gets
|
|
17
|
+
* their active threads — the list the rail renders.
|
|
18
|
+
*
|
|
19
|
+
* The two sets are **disjoint by design**: archiving is "hide this from the
|
|
20
|
+
* list", so an archived thread appearing in the default list alongside its
|
|
21
|
+
* active siblings would defeat the whole point of the flag.
|
|
22
|
+
*/
|
|
23
|
+
archived;
|
|
24
|
+
}
|
|
25
|
+
exports.ListConversationsQueryDto = ListConversationsQueryDto;
|
|
26
|
+
tslib_1.__decorate([
|
|
27
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false,
|
|
30
|
+
description: 'List archived threads instead of active ones. Defaults to false.'
|
|
31
|
+
}),
|
|
32
|
+
(0, class_validator_1.IsOptional)()
|
|
33
|
+
// A query parameter is a string, and `Boolean('false')` is `true` — the
|
|
34
|
+
// exact coercion trap `transform: true` alone walks into. Compare instead.
|
|
35
|
+
,
|
|
36
|
+
(0, class_transformer_1.Transform)(({ value }) => value === true || value === 'true'),
|
|
37
|
+
(0, class_validator_1.IsBoolean)(),
|
|
38
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
39
|
+
], ListConversationsQueryDto.prototype, "archived", void 0);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ProposalStatus } from '@orthacms/copilot-domain';
|
|
2
|
+
/**
|
|
3
|
+
* Query parameters for `GET /api/copilot/proposals`.
|
|
4
|
+
*
|
|
5
|
+
* Every property is declared because the host's `ValidationPipe` runs with
|
|
6
|
+
* `forbidNonWhitelisted` — an undeclared key is a 400 naming it, and an
|
|
7
|
+
* undeclared *nested* one would be silently stripped.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ListProposalsQueryDto {
|
|
10
|
+
/** Restrict to one status. Omitted, every proposal is returned. */
|
|
11
|
+
status?: ProposalStatus;
|
|
12
|
+
/** Restrict to the proposals made in one thread. */
|
|
13
|
+
conversationId?: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=list-proposals-query.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-proposals-query.dto.d.ts","sourceRoot":"","sources":["../../../../../src/lib/chat/application/dto/list-proposals-query.dto.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK/D;;;;;;GAMG;AACH,qBAAa,qBAAqB;IAC9B,mEAAmE;IAQnE,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB,oDAAoD;IASpD,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListProposalsQueryDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const class_validator_1 = require("class-validator");
|
|
7
|
+
/** The statuses a caller may filter the queue by. */
|
|
8
|
+
const STATUSES = ['pending', 'accepted', 'rejected'];
|
|
9
|
+
/**
|
|
10
|
+
* Query parameters for `GET /api/copilot/proposals`.
|
|
11
|
+
*
|
|
12
|
+
* Every property is declared because the host's `ValidationPipe` runs with
|
|
13
|
+
* `forbidNonWhitelisted` — an undeclared key is a 400 naming it, and an
|
|
14
|
+
* undeclared *nested* one would be silently stripped.
|
|
15
|
+
*/
|
|
16
|
+
class ListProposalsQueryDto {
|
|
17
|
+
/** Restrict to one status. Omitted, every proposal is returned. */
|
|
18
|
+
status;
|
|
19
|
+
/** Restrict to the proposals made in one thread. */
|
|
20
|
+
conversationId;
|
|
21
|
+
}
|
|
22
|
+
exports.ListProposalsQueryDto = ListProposalsQueryDto;
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
25
|
+
enum: [...STATUSES],
|
|
26
|
+
description: 'Restrict to one status. Omit for the whole history; `pending` is the review queue.'
|
|
27
|
+
}),
|
|
28
|
+
(0, class_validator_1.IsOptional)(),
|
|
29
|
+
(0, class_validator_1.IsIn)(STATUSES),
|
|
30
|
+
tslib_1.__metadata("design:type", String)
|
|
31
|
+
], ListProposalsQueryDto.prototype, "status", void 0);
|
|
32
|
+
tslib_1.__decorate([
|
|
33
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
34
|
+
type: String,
|
|
35
|
+
format: 'uuid',
|
|
36
|
+
description: 'Restrict to one conversation — what the chat panel asks for when re-opening a thread.'
|
|
37
|
+
}),
|
|
38
|
+
(0, class_validator_1.IsOptional)(),
|
|
39
|
+
(0, class_validator_1.IsUUID)(),
|
|
40
|
+
tslib_1.__metadata("design:type", String)
|
|
41
|
+
], ListProposalsQueryDto.prototype, "conversationId", void 0);
|