@apotech-os/support-kit 2.9.1 → 2.10.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/index.cjs +41 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -19
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +536 -378
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +396 -238
- package/dist/ui/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3848,6 +3848,8 @@ var CREATE_AGENT_INPUT_NAME_UID = "0cb57453-7b02-49ce-875b-7ff079a5810d";
|
|
|
3848
3848
|
var CREATE_AGENT_INPUT_MODEL_ID_UID = "f19f1c10-3145-482b-8c1d-6fd3576596ff";
|
|
3849
3849
|
var CREATE_AGENT_INPUT_PROVIDER_UID = "0dd94db4-f31a-4cd2-b030-1b1a4da5b43e";
|
|
3850
3850
|
var CREATE_AGENT_INPUT_SYSTEM_PROMPT_SNAPSHOT_UID = "d50f3810-b6fe-4c90-b69b-3e36ba502cdb";
|
|
3851
|
+
var CREATE_AGENT_INPUT_PROMPT_NAME_UID = "102d412a-3299-42a2-ac62-6f7c4155508d";
|
|
3852
|
+
var CREATE_AGENT_INPUT_PROMPT_LABEL_UID = "04f8eeba-2d0b-4814-8009-a4a3d1530760";
|
|
3851
3853
|
var SET_DEFAULT_AGENT_INPUT_AGENT_ID_UID = "0686c615-63f8-49a1-b3c7-3542bac76cd6";
|
|
3852
3854
|
var EXT_CHAT_INPUT_MESSAGES_UID = "874e4408-74c0-4188-b923-a0791da4d096";
|
|
3853
3855
|
var EXT_CHAT_INPUT_MODEL_ID_UID = "d63f05b1-165d-45e0-9300-cabe5e22fa42";
|
|
@@ -4671,6 +4673,20 @@ function buildCreateAgentFunctionDef(config) {
|
|
|
4671
4673
|
type: appKit.FieldType.TEXT,
|
|
4672
4674
|
label: "System prompt snapshot",
|
|
4673
4675
|
isNullable: true
|
|
4676
|
+
},
|
|
4677
|
+
{
|
|
4678
|
+
universalIdentifier: CREATE_AGENT_INPUT_PROMPT_NAME_UID,
|
|
4679
|
+
name: "promptName",
|
|
4680
|
+
type: appKit.FieldType.TEXT,
|
|
4681
|
+
label: "Prompt name",
|
|
4682
|
+
isNullable: true
|
|
4683
|
+
},
|
|
4684
|
+
{
|
|
4685
|
+
universalIdentifier: CREATE_AGENT_INPUT_PROMPT_LABEL_UID,
|
|
4686
|
+
name: "promptLabel",
|
|
4687
|
+
type: appKit.FieldType.TEXT,
|
|
4688
|
+
label: "Prompt label",
|
|
4689
|
+
isNullable: true
|
|
4674
4690
|
}
|
|
4675
4691
|
]
|
|
4676
4692
|
};
|
|
@@ -4683,14 +4699,19 @@ async function createAgentHandler(ctx, input) {
|
|
|
4683
4699
|
if (!name) throw new ctx.NonRetriableError("name is required");
|
|
4684
4700
|
const modelId = input?.modelId?.trim();
|
|
4685
4701
|
if (!modelId) throw new ctx.NonRetriableError("modelId is required");
|
|
4686
|
-
const
|
|
4702
|
+
const base = {
|
|
4687
4703
|
name,
|
|
4688
4704
|
modelId,
|
|
4689
4705
|
provider: input.provider?.trim() || DEFAULT_LLM_PROVIDER,
|
|
4690
4706
|
status: "available",
|
|
4691
|
-
|
|
4692
|
-
...input.
|
|
4693
|
-
}
|
|
4707
|
+
...input.systemPromptSnapshot?.trim() ? { systemPromptSnapshot: input.systemPromptSnapshot.trim() } : {},
|
|
4708
|
+
...input.promptLabel?.trim() ? { promptLabel: input.promptLabel.trim() } : {}
|
|
4709
|
+
};
|
|
4710
|
+
const promptName = input.promptName?.trim();
|
|
4711
|
+
if (promptName) {
|
|
4712
|
+
return toAgent(await ctx.api.create("agent", { ...base, promptName }));
|
|
4713
|
+
}
|
|
4714
|
+
const created = await ctx.api.create("agent", { ...base, promptName: PENDING_PROMPT_NAME });
|
|
4694
4715
|
const withPromptName = await ctx.api.update("agent", created.id, { promptName: `agent/${created.id}` });
|
|
4695
4716
|
return toAgent(withPromptName);
|
|
4696
4717
|
}
|
|
@@ -4801,22 +4822,23 @@ function createSyncAgentPromptSnapshotHandler() {
|
|
|
4801
4822
|
async function syncAgentPromptSnapshotHandler(ctx, input) {
|
|
4802
4823
|
const promptName = input?.promptName?.trim();
|
|
4803
4824
|
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
|
-
|
|
4825
|
+
const page = await ctx.api.list("agent", { filter: { promptName } });
|
|
4826
|
+
let updated = false;
|
|
4827
|
+
for (const record of page.items) {
|
|
4828
|
+
const agent = toAgent(record);
|
|
4829
|
+
try {
|
|
4830
|
+
const ref = agent.promptVersion !== null ? { version: agent.promptVersion } : { label: agent.promptLabel ?? "production" };
|
|
4831
|
+
const detail = await ctx.api.prompts.get(promptName, { ...ref, resolve: false });
|
|
4832
|
+
if (detail.content === agent.systemPromptSnapshot) continue;
|
|
4833
|
+
await ctx.api.update("agent", agent.id, { systemPromptSnapshot: detail.content });
|
|
4834
|
+
updated = true;
|
|
4835
|
+
} catch (error) {
|
|
4836
|
+
ctx.logger.warn(
|
|
4837
|
+
`sync-agent-prompt-snapshot: could not refresh "${promptName}" for agent ${agent.id} \u2014 GET /models keeps serving the previous snapshot (${String(error)})`
|
|
4838
|
+
);
|
|
4839
|
+
}
|
|
4819
4840
|
}
|
|
4841
|
+
return { updated };
|
|
4820
4842
|
}
|
|
4821
4843
|
|
|
4822
4844
|
// src/functions/ext-models.ts
|