@apotech-os/support-kit 6.0.0 → 6.2.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/README.md +12 -3
- package/dist/{chunk-CRFNVCS7.js → chunk-W2QU5367.js} +9 -5
- package/dist/chunk-W2QU5367.js.map +1 -0
- package/dist/index.cjs +36 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +31 -4
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +386 -244
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +13 -1
- package/dist/ui/index.d.ts +13 -1
- package/dist/ui/index.js +389 -248
- package/dist/ui/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-CRFNVCS7.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -157,14 +157,18 @@ function isStopMessage(message) {
|
|
|
157
157
|
const cleaned = normalise(message).replace(/^[^\p{L}\d]+|[^\p{L}\d]+$/gu, "").replace(/\s+/g, " ");
|
|
158
158
|
return STOP_PHRASES.has(cleaned);
|
|
159
159
|
}
|
|
160
|
+
var ATTACHMENT_MARKER_ONLY = /^\[Pièces? jointes? : \d+ fichiers?\]$/;
|
|
161
|
+
function isCustomerTurnWithWords(message) {
|
|
162
|
+
return message.role === "user" && !ATTACHMENT_MARKER_ONLY.test(message.content.trim());
|
|
163
|
+
}
|
|
160
164
|
function firstCustomerMessage(conversation) {
|
|
161
|
-
return conversation.messages.find(
|
|
165
|
+
return conversation.messages.find(isCustomerTurnWithWords)?.content ?? null;
|
|
162
166
|
}
|
|
163
167
|
function lastCustomerMessage(conversation) {
|
|
164
168
|
const { messages } = conversation;
|
|
165
169
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
166
170
|
const message = messages[i];
|
|
167
|
-
if (message
|
|
171
|
+
if (message && isCustomerTurnWithWords(message)) return message.content;
|
|
168
172
|
}
|
|
169
173
|
return null;
|
|
170
174
|
}
|
|
@@ -4828,9 +4832,22 @@ async function createAgentHandler(ctx, input) {
|
|
|
4828
4832
|
return toAgent(await ctx.api.create("agent", { ...base, promptName }));
|
|
4829
4833
|
}
|
|
4830
4834
|
const created = await ctx.api.create("agent", { ...base, promptName: PENDING_PROMPT_NAME });
|
|
4831
|
-
const
|
|
4835
|
+
const derivedName = `agent/${created.id}`;
|
|
4836
|
+
const withPromptName = await ctx.api.update("agent", created.id, { promptName: derivedName });
|
|
4837
|
+
await seedInitialVersion(ctx, derivedName, input.systemPromptSnapshot?.trim() ?? "");
|
|
4832
4838
|
return toAgent(withPromptName);
|
|
4833
4839
|
}
|
|
4840
|
+
async function seedInitialVersion(ctx, promptName, content) {
|
|
4841
|
+
if (!content) return;
|
|
4842
|
+
try {
|
|
4843
|
+
const { version } = await ctx.api.prompts.createVersion(promptName, { content });
|
|
4844
|
+
await ctx.api.prompts.promote(promptName, version, "production");
|
|
4845
|
+
} catch (err) {
|
|
4846
|
+
ctx.logger.warn(
|
|
4847
|
+
`create-agent: could not seed "${promptName}" with its initial version \u2014 the text is kept as the agent's fallback (${err instanceof Error ? err.message : String(err)})`
|
|
4848
|
+
);
|
|
4849
|
+
}
|
|
4850
|
+
}
|
|
4834
4851
|
var DEFAULT_KEY_VALUE = "default";
|
|
4835
4852
|
function buildSetDefaultAgentFunctionDef(config) {
|
|
4836
4853
|
return {
|
|
@@ -5872,7 +5889,21 @@ var KIT_PAGES = [
|
|
|
5872
5889
|
icon: "library"
|
|
5873
5890
|
},
|
|
5874
5891
|
{ key: "test-page", path: "test", title: "Banc de test", icon: "flask-conical" },
|
|
5875
|
-
{ key: "quality-page", path: "quality", title: "Qualit\xE9", icon: "flask-conical" }
|
|
5892
|
+
{ key: "quality-page", path: "quality", title: "Qualit\xE9", icon: "flask-conical" },
|
|
5893
|
+
// The SAME screen as `settingsPage`, declared a second time as an app page.
|
|
5894
|
+
// Not a gratuitous duplicate: `getAvailableTargets()`
|
|
5895
|
+
// (`apps/api/src/platform-data/spaces.service.ts`) enumerates only
|
|
5896
|
+
// views/pages/records, so a `settingsPage` can be mounted in NO Space — by
|
|
5897
|
+
// construction (docs/app-platform/app-settings-page-spec.md §2). A `pages[]`
|
|
5898
|
+
// entry can. Both surfaces mount the same component, which reads and writes
|
|
5899
|
+
// through `useAppSettings()`; that store is keyed by the app slug, so there
|
|
5900
|
+
// is ONE `AppSetting` row behind the two, never two copies to reconcile.
|
|
5901
|
+
//
|
|
5902
|
+
// The path cannot be 'settings': the CLI would derive `dist/ui/settings.js`
|
|
5903
|
+
// from it — the entry `settingsPage` already claims — and the manifest would
|
|
5904
|
+
// be rejected (app-kit `contracts.ts`, "collides with the bundle the CLI
|
|
5905
|
+
// emits for a pages[] path").
|
|
5906
|
+
{ key: "reglages-page", path: "reglages", title: "R\xE9glages", icon: "settings" }
|
|
5876
5907
|
];
|
|
5877
5908
|
function buildPages(config) {
|
|
5878
5909
|
return KIT_PAGES.map(({ key, path, title, icon }) => ({
|
|
@@ -5933,6 +5964,7 @@ function buildSupportPipeline(config) {
|
|
|
5933
5964
|
exports.AGENT_GUARDRAILS = AGENT_GUARDRAILS;
|
|
5934
5965
|
exports.AGENT_STATUSES = AGENT_STATUSES;
|
|
5935
5966
|
exports.AGENT_TOOLS = AGENT_TOOLS;
|
|
5967
|
+
exports.ATTACHMENT_MARKER_ONLY = ATTACHMENT_MARKER_ONLY;
|
|
5936
5968
|
exports.CANDIDATE_MIN_LENGTH = CANDIDATE_MIN_LENGTH;
|
|
5937
5969
|
exports.DEFAULT_CHANNEL_PROMPT_EMAIL = DEFAULT_CHANNEL_PROMPT_EMAIL;
|
|
5938
5970
|
exports.DEFAULT_CHANNEL_PROMPT_WHATSAPP = DEFAULT_CHANNEL_PROMPT_WHATSAPP;
|