@apotech-os/support-kit 2.9.1 → 3.0.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/{chunk-CVYJU4SV.js → chunk-KCPVWKUY.js} +7 -13
- package/dist/chunk-KCPVWKUY.js.map +1 -0
- package/dist/index.cjs +45 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -24
- package/dist/index.d.ts +23 -24
- package/dist/index.js +43 -21
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +579 -422
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +410 -253
- package/dist/ui/index.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-CVYJU4SV.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -863,14 +863,14 @@ ${trimmed}` : null;
|
|
|
863
863
|
|
|
864
864
|
// src/graph/revise.ts
|
|
865
865
|
async function reviseDraft(params) {
|
|
866
|
-
const { profile, llm, budget, draft: draft2, verdict, messages, label,
|
|
866
|
+
const { profile, llm, budget, draft: draft2, verdict, messages, label, promptRef } = params;
|
|
867
867
|
const node = profile.nodes.revise;
|
|
868
868
|
if (!node) return draft2;
|
|
869
869
|
let result;
|
|
870
870
|
try {
|
|
871
871
|
result = await llm.complete({
|
|
872
872
|
label,
|
|
873
|
-
model:
|
|
873
|
+
model: node.model,
|
|
874
874
|
reasoning: node.reasoning,
|
|
875
875
|
messages: [...messages, ...buildRevisionTurn(draft2, verdict)],
|
|
876
876
|
tools: [],
|
|
@@ -910,7 +910,6 @@ var revise = async (state, deps) => {
|
|
|
910
910
|
if (!node || !state.conversation || !state.draft || !state.verdict) return {};
|
|
911
911
|
const draftPrompt = await deps.ports.prompt.resolve(profile.prompts.draft);
|
|
912
912
|
const messages = buildDraftMessages(state.conversation, writerSystemPrompt(draftPrompt.text, state.conversation));
|
|
913
|
-
const revisePrompt = await deps.ports.prompt.resolve(profile.prompts.revise);
|
|
914
913
|
const revised = await reviseDraft({
|
|
915
914
|
profile,
|
|
916
915
|
llm: deps.ports.llm,
|
|
@@ -919,8 +918,7 @@ var revise = async (state, deps) => {
|
|
|
919
918
|
verdict: state.verdict,
|
|
920
919
|
messages,
|
|
921
920
|
label: "revise",
|
|
922
|
-
|
|
923
|
-
promptRef: { name: revisePrompt.name, version: revisePrompt.version, resolve: false }
|
|
921
|
+
promptRef: { name: draftPrompt.name, version: draftPrompt.version, resolve: false }
|
|
924
922
|
});
|
|
925
923
|
return { draft: revised, reviseCount: 1 };
|
|
926
924
|
};
|
|
@@ -1286,9 +1284,6 @@ var PROMPT_SLOTS = [
|
|
|
1286
1284
|
function resolvePromptName(slot, config) {
|
|
1287
1285
|
return config.promptNames?.[slot] ?? `${config.promptPrefix}${slot}`;
|
|
1288
1286
|
}
|
|
1289
|
-
function resolveReviseName(config) {
|
|
1290
|
-
return config.promptNames?.revise ?? `${config.promptPrefix}revise`;
|
|
1291
|
-
}
|
|
1292
1287
|
|
|
1293
1288
|
// src/records/ids.ts
|
|
1294
1289
|
var CATEGORY_OBJECT_UID = "8a1c8de3-c288-40a5-9294-a883e1c89784";
|
|
@@ -2543,7 +2538,7 @@ function validateSettings(settings) {
|
|
|
2543
2538
|
function isNonEmptyString(value) {
|
|
2544
2539
|
return typeof value === "string" && value.length > 0;
|
|
2545
2540
|
}
|
|
2546
|
-
var STEPS_REQUIRING_PROMPT = ["triage", "escalate", "evaluate"
|
|
2541
|
+
var STEPS_REQUIRING_PROMPT = ["triage", "escalate", "evaluate"];
|
|
2547
2542
|
function stepsMissingPrompt(nodes) {
|
|
2548
2543
|
if (typeof nodes !== "object" || nodes === null) return [];
|
|
2549
2544
|
const byStep = nodes;
|
|
@@ -3175,7 +3170,6 @@ function buildPromptsTable(config, draft2, nodes) {
|
|
|
3175
3170
|
triage: refFor(nodes.triage, resolvePromptName("triage", config), prompts?.triage),
|
|
3176
3171
|
escalate: refFor(nodes.escalate, resolvePromptName("escalation", config), prompts?.escalation),
|
|
3177
3172
|
evaluate: refFor(nodes.evaluate, resolvePromptName("evaluation", config), prompts?.evaluation),
|
|
3178
|
-
revise: refFor(nodes.revise, resolveReviseName(config), prompts?.revise),
|
|
3179
3173
|
draft: draft2
|
|
3180
3174
|
};
|
|
3181
3175
|
}
|
|
@@ -3848,6 +3842,8 @@ var CREATE_AGENT_INPUT_NAME_UID = "0cb57453-7b02-49ce-875b-7ff079a5810d";
|
|
|
3848
3842
|
var CREATE_AGENT_INPUT_MODEL_ID_UID = "f19f1c10-3145-482b-8c1d-6fd3576596ff";
|
|
3849
3843
|
var CREATE_AGENT_INPUT_PROVIDER_UID = "0dd94db4-f31a-4cd2-b030-1b1a4da5b43e";
|
|
3850
3844
|
var CREATE_AGENT_INPUT_SYSTEM_PROMPT_SNAPSHOT_UID = "d50f3810-b6fe-4c90-b69b-3e36ba502cdb";
|
|
3845
|
+
var CREATE_AGENT_INPUT_PROMPT_NAME_UID = "102d412a-3299-42a2-ac62-6f7c4155508d";
|
|
3846
|
+
var CREATE_AGENT_INPUT_PROMPT_LABEL_UID = "04f8eeba-2d0b-4814-8009-a4a3d1530760";
|
|
3851
3847
|
var SET_DEFAULT_AGENT_INPUT_AGENT_ID_UID = "0686c615-63f8-49a1-b3c7-3542bac76cd6";
|
|
3852
3848
|
var EXT_CHAT_INPUT_MESSAGES_UID = "874e4408-74c0-4188-b923-a0791da4d096";
|
|
3853
3849
|
var EXT_CHAT_INPUT_MODEL_ID_UID = "d63f05b1-165d-45e0-9300-cabe5e22fa42";
|
|
@@ -4671,6 +4667,20 @@ function buildCreateAgentFunctionDef(config) {
|
|
|
4671
4667
|
type: appKit.FieldType.TEXT,
|
|
4672
4668
|
label: "System prompt snapshot",
|
|
4673
4669
|
isNullable: true
|
|
4670
|
+
},
|
|
4671
|
+
{
|
|
4672
|
+
universalIdentifier: CREATE_AGENT_INPUT_PROMPT_NAME_UID,
|
|
4673
|
+
name: "promptName",
|
|
4674
|
+
type: appKit.FieldType.TEXT,
|
|
4675
|
+
label: "Prompt name",
|
|
4676
|
+
isNullable: true
|
|
4677
|
+
},
|
|
4678
|
+
{
|
|
4679
|
+
universalIdentifier: CREATE_AGENT_INPUT_PROMPT_LABEL_UID,
|
|
4680
|
+
name: "promptLabel",
|
|
4681
|
+
type: appKit.FieldType.TEXT,
|
|
4682
|
+
label: "Prompt label",
|
|
4683
|
+
isNullable: true
|
|
4674
4684
|
}
|
|
4675
4685
|
]
|
|
4676
4686
|
};
|
|
@@ -4683,14 +4693,19 @@ async function createAgentHandler(ctx, input) {
|
|
|
4683
4693
|
if (!name) throw new ctx.NonRetriableError("name is required");
|
|
4684
4694
|
const modelId = input?.modelId?.trim();
|
|
4685
4695
|
if (!modelId) throw new ctx.NonRetriableError("modelId is required");
|
|
4686
|
-
const
|
|
4696
|
+
const base = {
|
|
4687
4697
|
name,
|
|
4688
4698
|
modelId,
|
|
4689
4699
|
provider: input.provider?.trim() || DEFAULT_LLM_PROVIDER,
|
|
4690
4700
|
status: "available",
|
|
4691
|
-
|
|
4692
|
-
...input.
|
|
4693
|
-
}
|
|
4701
|
+
...input.systemPromptSnapshot?.trim() ? { systemPromptSnapshot: input.systemPromptSnapshot.trim() } : {},
|
|
4702
|
+
...input.promptLabel?.trim() ? { promptLabel: input.promptLabel.trim() } : {}
|
|
4703
|
+
};
|
|
4704
|
+
const promptName = input.promptName?.trim();
|
|
4705
|
+
if (promptName) {
|
|
4706
|
+
return toAgent(await ctx.api.create("agent", { ...base, promptName }));
|
|
4707
|
+
}
|
|
4708
|
+
const created = await ctx.api.create("agent", { ...base, promptName: PENDING_PROMPT_NAME });
|
|
4694
4709
|
const withPromptName = await ctx.api.update("agent", created.id, { promptName: `agent/${created.id}` });
|
|
4695
4710
|
return toAgent(withPromptName);
|
|
4696
4711
|
}
|
|
@@ -4801,22 +4816,23 @@ function createSyncAgentPromptSnapshotHandler() {
|
|
|
4801
4816
|
async function syncAgentPromptSnapshotHandler(ctx, input) {
|
|
4802
4817
|
const promptName = input?.promptName?.trim();
|
|
4803
4818
|
if (!promptName) throw new ctx.NonRetriableError("promptName is required");
|
|
4804
|
-
const page = await ctx.api.list("agent", { filter: { promptName }
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
+
const page = await ctx.api.list("agent", { filter: { promptName } });
|
|
4820
|
+
let updated = false;
|
|
4821
|
+
for (const record of page.items) {
|
|
4822
|
+
const agent = toAgent(record);
|
|
4823
|
+
try {
|
|
4824
|
+
const ref = agent.promptVersion !== null ? { version: agent.promptVersion } : { label: agent.promptLabel ?? "production" };
|
|
4825
|
+
const detail = await ctx.api.prompts.get(promptName, { ...ref, resolve: false });
|
|
4826
|
+
if (detail.content === agent.systemPromptSnapshot) continue;
|
|
4827
|
+
await ctx.api.update("agent", agent.id, { systemPromptSnapshot: detail.content });
|
|
4828
|
+
updated = true;
|
|
4829
|
+
} catch (error) {
|
|
4830
|
+
ctx.logger.warn(
|
|
4831
|
+
`sync-agent-prompt-snapshot: could not refresh "${promptName}" for agent ${agent.id} \u2014 GET /models keeps serving the previous snapshot (${String(error)})`
|
|
4832
|
+
);
|
|
4833
|
+
}
|
|
4819
4834
|
}
|
|
4835
|
+
return { updated };
|
|
4820
4836
|
}
|
|
4821
4837
|
|
|
4822
4838
|
// src/functions/ext-models.ts
|
|
@@ -5796,7 +5812,6 @@ exports.promptCacheRecord = promptCacheRecord;
|
|
|
5796
5812
|
exports.reclaimStalledSend = reclaimStalledSend;
|
|
5797
5813
|
exports.requiresFollowup = requiresFollowup;
|
|
5798
5814
|
exports.resolvePromptName = resolvePromptName;
|
|
5799
|
-
exports.resolveReviseName = resolveReviseName;
|
|
5800
5815
|
exports.runGuardrails = runGuardrails;
|
|
5801
5816
|
exports.runTicket = runTicket;
|
|
5802
5817
|
exports.settingsToProfile = settingsToProfile;
|