@apotech-os/support-kit 3.0.0 → 3.0.1
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-KCPVWKUY.js → chunk-ZFUDQ5VM.js} +9 -3
- package/dist/chunk-ZFUDQ5VM.js.map +1 -0
- package/dist/index.cjs +20 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-KCPVWKUY.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3158,6 +3158,12 @@ function draftPromptRefFor(agent, config) {
|
|
|
3158
3158
|
...agent.systemPromptSnapshot ? { fallback: agent.systemPromptSnapshot } : {}
|
|
3159
3159
|
};
|
|
3160
3160
|
}
|
|
3161
|
+
function draftRebinder(api, categories, config) {
|
|
3162
|
+
return async (classification) => {
|
|
3163
|
+
const category = classification ? findCategoryByTag(categories, classification.category) : null;
|
|
3164
|
+
return draftPromptRefFor(await resolveDraftAgent(api, category?.agentId ?? null), config);
|
|
3165
|
+
};
|
|
3166
|
+
}
|
|
3161
3167
|
function buildPromptsTable(config, draft2, nodes) {
|
|
3162
3168
|
const DEFAULT_LABEL = "production";
|
|
3163
3169
|
const refFor = (node, derivedName, fallback2) => ({
|
|
@@ -4024,7 +4030,15 @@ async function previewTriageHandler(ctx, config, input) {
|
|
|
4024
4030
|
|
|
4025
4031
|
// src/functions/graph-dry-run-core.ts
|
|
4026
4032
|
var DRY_RUN_DEADLINE_MS = 3 * 60 * 1e3;
|
|
4027
|
-
async function
|
|
4033
|
+
async function runFromTriage(deps, rebindDraft) {
|
|
4034
|
+
if (!rebindDraft) return runTicket(deps);
|
|
4035
|
+
const triaged = await runTicket(deps, { until: "triage" });
|
|
4036
|
+
if (triaged.outcome) return triaged;
|
|
4037
|
+
const draft2 = await rebindDraft(triaged.classification);
|
|
4038
|
+
const rebound = { ...deps, profile: { ...deps.profile, prompts: { ...deps.profile.prompts, draft: draft2 } } };
|
|
4039
|
+
return runTicket(rebound, { resume: { classification: triaged.classification, escalated: triaged.escalated } });
|
|
4040
|
+
}
|
|
4041
|
+
async function runGraphDryRun({ base, api, resume, rebindDraft }) {
|
|
4028
4042
|
const recordingReply = createRecordingReplyPort();
|
|
4029
4043
|
const recordingState = createRecordingStatePort(api);
|
|
4030
4044
|
const recordingSend = createRecordingSendPort();
|
|
@@ -4046,7 +4060,7 @@ async function runGraphDryRun({ base, api, resume }) {
|
|
|
4046
4060
|
let result = null;
|
|
4047
4061
|
let error;
|
|
4048
4062
|
try {
|
|
4049
|
-
result = await runTicket(deps,
|
|
4063
|
+
result = resume ? await runTicket(deps, { resume }) : await runFromTriage(deps, rebindDraft);
|
|
4050
4064
|
} catch (err) {
|
|
4051
4065
|
error = err instanceof Error ? err.message : String(err);
|
|
4052
4066
|
}
|
|
@@ -4214,7 +4228,8 @@ async function graphDryRunHandler(ctx, config, input) {
|
|
|
4214
4228
|
// overridden unconditionally by `runGraphDryRun`
|
|
4215
4229
|
};
|
|
4216
4230
|
const resume = forcedCategory ? { classification: forcedClassification(forcedCategory.tagName), escalated: false } : void 0;
|
|
4217
|
-
|
|
4231
|
+
const rebindDraft = input.agentId || forcedCategory ? void 0 : draftRebinder(ctx.api, categories, config);
|
|
4232
|
+
return runGraphDryRun({ base, api: ctx.api, resume, ...rebindDraft ? { rebindDraft } : {} });
|
|
4218
4233
|
}
|
|
4219
4234
|
var DEFAULT_LIMIT = 20;
|
|
4220
4235
|
var MAX_LIMIT = 100;
|
|
@@ -4249,6 +4264,7 @@ async function testAgentsHandler(ctx, config, input) {
|
|
|
4249
4264
|
const categories = await listCategories(ctx.api);
|
|
4250
4265
|
const agent = input.agentId ? toAgent(await ctx.api.get("agent", input.agentId)) : await resolveDraftAgent(ctx.api, null);
|
|
4251
4266
|
const profile = settingsToProfile(settings, buildPromptsTable(config, draftPromptRefFor(agent, config), settings.nodes));
|
|
4267
|
+
const rebindDraft = input.agentId ? void 0 : draftRebinder(ctx.api, categories, config);
|
|
4252
4268
|
const realPorts = buildTicketPorts(ctx);
|
|
4253
4269
|
const refs = explicitIds.length ? explicitIds.slice(0, limit).map((id) => ({ id, channel: "gorgias" })) : await realPorts.conversation.listPending({ viewOrTag: viewId }, limit);
|
|
4254
4270
|
const deadline = AbortSignal.timeout(DRY_RUN_DEADLINE_MS);
|
|
@@ -4275,7 +4291,7 @@ async function testAgentsHandler(ctx, config, input) {
|
|
|
4275
4291
|
send: { mode: "none" }
|
|
4276
4292
|
// overridden unconditionally by `runGraphDryRun`
|
|
4277
4293
|
};
|
|
4278
|
-
results.push(await runGraphDryRun({ base, api: ctx.api }));
|
|
4294
|
+
results.push(await runGraphDryRun({ base, api: ctx.api, ...rebindDraft ? { rebindDraft } : {} }));
|
|
4279
4295
|
}
|
|
4280
4296
|
return { results, autoReplyForced: true };
|
|
4281
4297
|
}
|