@adminforth/agent 1.47.0 → 1.47.2
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/build.log +2 -2
- package/custom/ChatFooter.vue +2 -2
- package/dist/custom/ChatFooter.vue +2 -2
- package/dist/endpoints/chatSurfaces.d.ts +3 -0
- package/dist/endpoints/chatSurfaces.js +40 -0
- package/dist/index.js +2 -0
- package/endpoints/chatSurfaces.ts +37 -0
- package/index.ts +2 -0
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -62,5 +62,5 @@ custom/speech_recognition_frontend/voiceActivityDetection.ts
|
|
|
62
62
|
custom/speech_recognition_frontend/types/
|
|
63
63
|
custom/speech_recognition_frontend/types/voice-activity-detection.d.ts
|
|
64
64
|
|
|
65
|
-
sent 1,667,
|
|
66
|
-
total size is 1,663,
|
|
65
|
+
sent 1,667,711 bytes received 921 bytes 3,337,264.00 bytes/sec
|
|
66
|
+
total size is 1,663,558 speedup is 1.00
|
package/custom/ChatFooter.vue
CHANGED
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
transition-colors duration-200 hover:bg-gray-100
|
|
36
36
|
dark:text-darkListTableHeadingText dark:bg-gray-700 dark:hover:bg-gray-800"
|
|
37
37
|
:class="isModeMenuOpen ? 'bg-gray-100 dark:bg-gray-700' : ''"
|
|
38
|
-
:disabled="agentStore.isResponseInProgress"
|
|
39
38
|
title="Select mode"
|
|
40
39
|
type="button"
|
|
41
40
|
@click="toggleModeMenu"
|
|
42
41
|
>
|
|
43
42
|
{{ agentStore.activeModeName }}
|
|
44
43
|
<IconAngleDownOutline
|
|
45
|
-
class="w-4 h-4 ml-1"
|
|
44
|
+
class="w-4 h-4 ml-1 transition-transform duration-200"
|
|
45
|
+
:class="isModeMenuOpen ? '!rotate-180' : '!rotate-0'"
|
|
46
46
|
/>
|
|
47
47
|
</button>
|
|
48
48
|
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
transition-colors duration-200 hover:bg-gray-100
|
|
36
36
|
dark:text-darkListTableHeadingText dark:bg-gray-700 dark:hover:bg-gray-800"
|
|
37
37
|
:class="isModeMenuOpen ? 'bg-gray-100 dark:bg-gray-700' : ''"
|
|
38
|
-
:disabled="agentStore.isResponseInProgress"
|
|
39
38
|
title="Select mode"
|
|
40
39
|
type="button"
|
|
41
40
|
@click="toggleModeMenu"
|
|
42
41
|
>
|
|
43
42
|
{{ agentStore.activeModeName }}
|
|
44
43
|
<IconAngleDownOutline
|
|
45
|
-
class="w-4 h-4 ml-1"
|
|
44
|
+
class="w-4 h-4 ml-1 transition-transform duration-200"
|
|
45
|
+
:class="isModeMenuOpen ? '!rotate-180' : '!rotate-0'"
|
|
46
46
|
/>
|
|
47
47
|
</button>
|
|
48
48
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export function setupChatSurfaceEndpoints(ctx, server) {
|
|
11
|
+
var _a;
|
|
12
|
+
for (const adapter of (_a = ctx.options.chatSurfaceAdapters) !== null && _a !== void 0 ? _a : []) {
|
|
13
|
+
server.endpoint({
|
|
14
|
+
method: "POST",
|
|
15
|
+
noAuth: true,
|
|
16
|
+
path: `/agent/surface/${adapter.name}/webhook`,
|
|
17
|
+
handler: (endpointInput) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
var _a;
|
|
19
|
+
const surfaceContext = {
|
|
20
|
+
body: endpointInput.body,
|
|
21
|
+
headers: endpointInput.headers,
|
|
22
|
+
abortSignal: endpointInput.abortSignal,
|
|
23
|
+
rawRequest: endpointInput._raw_express_req,
|
|
24
|
+
rawResponse: endpointInput._raw_express_res,
|
|
25
|
+
};
|
|
26
|
+
const incoming = yield adapter.parseIncomingMessage(surfaceContext);
|
|
27
|
+
if (!incoming)
|
|
28
|
+
return { ok: true };
|
|
29
|
+
const sink = yield adapter.createEventSink(surfaceContext, incoming);
|
|
30
|
+
try {
|
|
31
|
+
yield ctx.handleChatSurfaceMessage(adapter, incoming, sink);
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
yield ((_a = sink.close) === null || _a === void 0 ? void 0 : _a.call(sink));
|
|
35
|
+
}
|
|
36
|
+
return { ok: true };
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { AdminForthCheckpointSaver } from "./agent/checkpointer.js";
|
|
|
13
13
|
import { appendCustomSystemPrompt, buildAgentSystemPrompt, DEFAULT_AGENT_SYSTEM_PROMPT } from "./agent/systemPrompt.js";
|
|
14
14
|
import { setupCoreEndpoints } from "./endpoints/core.js";
|
|
15
15
|
import { setupSessionEndpoints } from "./endpoints/sessions.js";
|
|
16
|
+
import { setupChatSurfaceEndpoints } from "./endpoints/chatSurfaces.js";
|
|
16
17
|
import { AgentSessionStore } from "./sessionStore.js";
|
|
17
18
|
import { ChatSurfaceService } from "./chatSurfaceService.js";
|
|
18
19
|
import { AgentTurnService } from "./agentTurnService.js";
|
|
@@ -128,5 +129,6 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
|
|
|
128
129
|
};
|
|
129
130
|
setupCoreEndpoints(endpointContext, server);
|
|
130
131
|
setupSessionEndpoints(endpointContext, server);
|
|
132
|
+
setupChatSurfaceEndpoints(endpointContext, server);
|
|
131
133
|
}
|
|
132
134
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IAdminForthEndpointHandlerInput,
|
|
3
|
+
IHttpServer,
|
|
4
|
+
} from "adminforth";
|
|
5
|
+
import type { ChatSurfaceEndpointsContext } from "./context.js";
|
|
6
|
+
|
|
7
|
+
export function setupChatSurfaceEndpoints(ctx: ChatSurfaceEndpointsContext, server: IHttpServer) {
|
|
8
|
+
for (const adapter of ctx.options.chatSurfaceAdapters ?? []) {
|
|
9
|
+
server.endpoint({
|
|
10
|
+
method: "POST",
|
|
11
|
+
noAuth: true,
|
|
12
|
+
path: `/agent/surface/${adapter.name}/webhook`,
|
|
13
|
+
handler: async (endpointInput: IAdminForthEndpointHandlerInput) => {
|
|
14
|
+
const surfaceContext = {
|
|
15
|
+
body: endpointInput.body,
|
|
16
|
+
headers: endpointInput.headers,
|
|
17
|
+
abortSignal: endpointInput.abortSignal,
|
|
18
|
+
rawRequest: endpointInput._raw_express_req,
|
|
19
|
+
rawResponse: endpointInput._raw_express_res,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const incoming = await adapter.parseIncomingMessage(surfaceContext);
|
|
23
|
+
if (!incoming) return { ok: true };
|
|
24
|
+
|
|
25
|
+
const sink = await adapter.createEventSink(surfaceContext, incoming);
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
await ctx.handleChatSurfaceMessage(adapter, incoming, sink);
|
|
29
|
+
} finally {
|
|
30
|
+
await sink.close?.();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return { ok: true };
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
package/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { AdminForthCheckpointSaver } from "./agent/checkpointer.js";
|
|
|
13
13
|
import { appendCustomSystemPrompt, buildAgentSystemPrompt, DEFAULT_AGENT_SYSTEM_PROMPT} from "./agent/systemPrompt.js";
|
|
14
14
|
import { setupCoreEndpoints } from "./endpoints/core.js";
|
|
15
15
|
import { setupSessionEndpoints } from "./endpoints/sessions.js";
|
|
16
|
+
import { setupChatSurfaceEndpoints } from "./endpoints/chatSurfaces.js";
|
|
16
17
|
import type { AgentEndpointsContext } from "./endpoints/context.js";
|
|
17
18
|
import { AgentSessionStore } from "./sessionStore.js";
|
|
18
19
|
import { ChatSurfaceService } from "./chatSurfaceService.js";
|
|
@@ -155,5 +156,6 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
|
|
|
155
156
|
|
|
156
157
|
setupCoreEndpoints(endpointContext, server);
|
|
157
158
|
setupSessionEndpoints(endpointContext, server);
|
|
159
|
+
setupChatSurfaceEndpoints(endpointContext, server);
|
|
158
160
|
}
|
|
159
161
|
}
|