@adminide-stack/yantra-mobile 12.0.28-alpha.51 → 12.0.28-alpha.58
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/lib/assets/icon.png +0 -0
- package/lib/components/CustomDrawer.js +358 -0
- package/lib/components/CustomDrawer.js.map +1 -0
- package/lib/components/GatewayToolbarButtonMobile.js +84 -0
- package/lib/components/GatewayToolbarButtonMobile.js.map +1 -0
- package/lib/components/YantraBrandLoader.js +94 -0
- package/lib/components/YantraBrandLoader.js.map +1 -0
- package/lib/compute.js +37 -5
- package/lib/compute.js.map +1 -1
- package/lib/config/constants.js +16 -0
- package/lib/config/constants.js.map +1 -0
- package/lib/config/env-config.js +74 -19
- package/lib/config/env-config.js.map +1 -1
- package/lib/contexts/GatewayContext.js +77 -0
- package/lib/contexts/GatewayContext.js.map +1 -0
- package/lib/graphql/agentGatewayDocuments.js +53 -0
- package/lib/graphql/agentGatewayDocuments.js.map +1 -0
- package/lib/hooks/useCdecliAutoConnect.js +219 -0
- package/lib/hooks/useCdecliAutoConnect.js.map +1 -0
- package/lib/hooks/useCdecliChannel.js +226 -0
- package/lib/hooks/useCdecliChannel.js.map +1 -0
- package/lib/hooks/useChatApi.js +220 -170
- package/lib/hooks/useChatApi.js.map +1 -1
- package/lib/hooks/useChatStream.js +232 -58
- package/lib/hooks/useChatStream.js.map +1 -1
- package/lib/hooks/useGatewayConnection.js +123 -0
- package/lib/hooks/useGatewayConnection.js.map +1 -0
- package/lib/hooks/useGatewayRegistry.js +28 -0
- package/lib/hooks/useGatewayRegistry.js.map +1 -0
- package/lib/hooks/usePrerequisiteIds.js +122 -0
- package/lib/hooks/usePrerequisiteIds.js.map +1 -0
- package/lib/hooks/useWorkspaceProvisioner.js +236 -0
- package/lib/hooks/useWorkspaceProvisioner.js.map +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/routes.json +8 -5
- package/lib/screens/Home/HomeScreen.js +420 -97
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/ChatHistoryLanding.js +229 -0
- package/lib/screens/Home/components/ChatHistoryLanding.js.map +1 -0
- package/lib/screens/Home/components/DeepSearchModal.js +334 -0
- package/lib/screens/Home/components/DeepSearchModal.js.map +1 -0
- package/lib/screens/Home/deepSearchUtils.js +41 -0
- package/lib/screens/Home/deepSearchUtils.js.map +1 -0
- package/lib/screens/NewChat/index.js +75 -0
- package/lib/screens/NewChat/index.js.map +1 -0
- package/lib/services/agentSessionManager.js +451 -0
- package/lib/services/agentSessionManager.js.map +1 -0
- package/lib/services/gatewayApiKeyBridge.js +4 -0
- package/lib/services/gatewayApiKeyBridge.js.map +1 -0
- package/lib/services/gatewayClient.js +470 -0
- package/lib/services/gatewayClient.js.map +1 -0
- package/lib/utils/gatewaySelectionStorage.js +21 -0
- package/lib/utils/gatewaySelectionStorage.js.map +1 -0
- package/package.json +7 -3
package/lib/compute.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getFilteredRoutes } from '@common-stack/client-react/lib/utils/filteredRoutes.js';
|
|
2
2
|
const yantraMobilePageStore = [{
|
|
3
3
|
key: "home",
|
|
4
|
-
path: "/l/home",
|
|
4
|
+
path: "/:orgName/l/home",
|
|
5
5
|
name: "Home",
|
|
6
6
|
exact: true,
|
|
7
7
|
index: true,
|
|
@@ -11,7 +11,8 @@ const yantraMobilePageStore = [{
|
|
|
11
11
|
menu_position: "side",
|
|
12
12
|
props: {
|
|
13
13
|
initialParams: {
|
|
14
|
-
initialSessionId: null
|
|
14
|
+
initialSessionId: null,
|
|
15
|
+
orgName: null
|
|
15
16
|
},
|
|
16
17
|
options: {
|
|
17
18
|
title: "Yantra",
|
|
@@ -19,15 +20,46 @@ const yantraMobilePageStore = [{
|
|
|
19
20
|
headerTitleStyle: {
|
|
20
21
|
fontWeight: "bold"
|
|
21
22
|
},
|
|
22
|
-
drawerLabel: "
|
|
23
|
+
drawerLabel: "Chat",
|
|
23
24
|
headerTitleAlign: "left",
|
|
24
25
|
gestureEnabled: false,
|
|
25
|
-
swipeEnabled: false
|
|
26
|
+
swipeEnabled: false,
|
|
27
|
+
animation: "fade",
|
|
28
|
+
animationTypeForReplace: "pop"
|
|
26
29
|
}
|
|
27
30
|
},
|
|
28
31
|
componentPath: "@adminide-stack/yantra-mobile/lib/screens/Home/index.js",
|
|
29
32
|
hasComponent: true
|
|
30
|
-
}
|
|
33
|
+
}
|
|
34
|
+
// {
|
|
35
|
+
// key: 'chat',
|
|
36
|
+
// path: '/:orgName/l/chat',
|
|
37
|
+
// name: 'Chat',
|
|
38
|
+
// exact: true,
|
|
39
|
+
// index: true,
|
|
40
|
+
// priority: 1,
|
|
41
|
+
// hideInMenu: true,
|
|
42
|
+
// auth: true,
|
|
43
|
+
// menu_position: 'side',
|
|
44
|
+
// component: () => import('./screens/Home'),
|
|
45
|
+
// permissions: ['*'],
|
|
46
|
+
// extraPermissions: ['*'],
|
|
47
|
+
// props: {
|
|
48
|
+
// initialParams: { initialSessionId: null, orgName: null },
|
|
49
|
+
// options: {
|
|
50
|
+
// title: 'Yantra',
|
|
51
|
+
// headerTintColor: 'black',
|
|
52
|
+
// headerTitleStyle: {
|
|
53
|
+
// fontWeight: 'bold',
|
|
54
|
+
// },
|
|
55
|
+
// drawerLabel: 'Chat',
|
|
56
|
+
// headerTitleAlign: 'left',
|
|
57
|
+
// gestureEnabled: false,
|
|
58
|
+
// swipeEnabled: false,
|
|
59
|
+
// },
|
|
60
|
+
// },
|
|
61
|
+
// },
|
|
62
|
+
];
|
|
31
63
|
const selectedRoutes = ["home"];
|
|
32
64
|
const filteredRoutes = getFilteredRoutes(yantraMobilePageStore, selectedRoutes);
|
|
33
65
|
export { filteredRoutes, yantraMobilePageStore }; //# sourceMappingURL=compute.js.map
|
package/lib/compute.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute.js","sources":["../src/compute.ts"],"sourcesContent":["/* eslint-disable import/no-extraneous-dependencies */\nimport { getFilteredRoutes } from '@common-stack/client-react/lib/utils/filteredRoutes.js';\nimport type { IRouteModule } from '@common-stack/core';\n\nexport const yantraMobilePageStore: IRouteModule[] = [\n {\n key: 'home',\n path: '/l/home',\n name: 'Home',\n exact: true,\n index: true,\n priority: 1,\n hideInMenu: true,\n auth: true,\n menu_position: 'side',\n component: () => import('./screens/Home'),\n props: {\n initialParams: { initialSessionId: null },\n options: {\n title: 'Yantra',\n headerTintColor: 'black',\n headerTitleStyle: {\n fontWeight: 'bold',\n },\n drawerLabel: '
|
|
1
|
+
{"version":3,"file":"compute.js","sources":["../src/compute.ts"],"sourcesContent":["/* eslint-disable import/no-extraneous-dependencies */\nimport { getFilteredRoutes } from '@common-stack/client-react/lib/utils/filteredRoutes.js';\nimport type { IRouteModule } from '@common-stack/core';\n\nexport const yantraMobilePageStore: IRouteModule[] = [\n {\n key: 'home',\n path: '/:orgName/l/home',\n name: 'Home',\n exact: true,\n index: true,\n priority: 1,\n hideInMenu: true,\n auth: true,\n menu_position: 'side',\n component: () => import('./screens/Home'),\n props: {\n initialParams: { initialSessionId: null, orgName: null },\n options: {\n title: 'Yantra',\n headerTintColor: 'black',\n headerTitleStyle: {\n fontWeight: 'bold',\n },\n drawerLabel: 'Chat',\n headerTitleAlign: 'left',\n gestureEnabled: false,\n swipeEnabled: false,\n animation: 'fade',\n animationTypeForReplace: 'pop',\n },\n },\n },\n // {\n // key: 'chat',\n // path: '/:orgName/l/chat',\n // name: 'Chat',\n // exact: true,\n // index: true,\n // priority: 1,\n // hideInMenu: true,\n // auth: true,\n // menu_position: 'side',\n // component: () => import('./screens/Home'),\n // permissions: ['*'],\n // extraPermissions: ['*'],\n // props: {\n // initialParams: { initialSessionId: null, orgName: null },\n // options: {\n // title: 'Yantra',\n // headerTintColor: 'black',\n // headerTitleStyle: {\n // fontWeight: 'bold',\n // },\n // drawerLabel: 'Chat',\n // headerTitleAlign: 'left',\n // gestureEnabled: false,\n // swipeEnabled: false,\n // },\n // },\n // },\n];\n\nconst selectedRoutes = ['home'];\n\nconst filteredRoutes = getFilteredRoutes(yantraMobilePageStore, selectedRoutes);\n\nexport { filteredRoutes };\n"],"names":[],"mappings":"uFAGO,MAAM,qBAAwC,GAAA;AAAA,EAAC;AAAA,IACpD,GAAK,EAAA,MAAA;AAAA,IACL,IAAM,EAAA,kBAAA;AAAA,IACN,IAAM,EAAA,MAAA;AAAA,IACN,KAAO,EAAA,IAAA;AAAA,IACP,KAAO,EAAA,IAAA;AAAA,IACP,QAAU,EAAA,CAAA;AAAA,IACV,UAAY,EAAA,IAAA;AAAA,IACZ,IAAM,EAAA,IAAA;AAAA,IACN,aAAe,EAAA,MAAA;AAAA,IACf,SAAA,EAAW,MAAM,OAAO,yBAAgB,CAAA;AAAA,IACxC,KAAO,EAAA;AAAA,MACL,aAAe,EAAA;AAAA,QACb,gBAAkB,EAAA,IAAA;AAAA,QAClB,OAAS,EAAA;AAAA,OACX;AAAA,MACA,OAAS,EAAA;AAAA,QACP,KAAO,EAAA,QAAA;AAAA,QACP,eAAiB,EAAA,OAAA;AAAA,QACjB,gBAAkB,EAAA;AAAA,UAChB,UAAY,EAAA;AAAA,SACd;AAAA,QACA,WAAa,EAAA,MAAA;AAAA,QACb,gBAAkB,EAAA,MAAA;AAAA,QAClB,cAAgB,EAAA,KAAA;AAAA,QAChB,YAAc,EAAA,KAAA;AAAA,QACd,SAAW,EAAA,MAAA;AAAA,QACX,uBAAyB,EAAA;AAAA;AAC3B;AACF;AACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA;AACA,MAAM,cAAA,GAAiB,CAAC,MAAM,CAAA;AACxB,MAAA,cAAA,GAAiB,iBAAkB,CAAA,qBAAA,EAAuB,cAAc"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const CDECLI_GATEWAY = {
|
|
2
|
+
name: "CDeCLI",
|
|
3
|
+
description: "CDeCLI agent and skills",
|
|
4
|
+
channelType: "cdecli-serve",
|
|
5
|
+
extensionId: "",
|
|
6
|
+
icon: "terminal",
|
|
7
|
+
isBuiltin: true,
|
|
8
|
+
priority: 90
|
|
9
|
+
};
|
|
10
|
+
const BUILTIN_MOBILE_GATEWAYS = {
|
|
11
|
+
cdecli: CDECLI_GATEWAY
|
|
12
|
+
};
|
|
13
|
+
const STORAGE_KEYS = {
|
|
14
|
+
GATEWAY_SELECTION: "yantra_gateway_selection"
|
|
15
|
+
};
|
|
16
|
+
const MAX_CONCURRENT_TASKS = 3;export{BUILTIN_MOBILE_GATEWAYS,MAX_CONCURRENT_TASKS,STORAGE_KEYS};//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../src/config/constants.ts"],"sourcesContent":["/** Minimal gateway types for mobile — aligned with account/browser. */\n\nexport type GatewayId = string;\n\nexport interface GatewayEntry {\n name: string;\n description: string;\n channelType: string;\n extensionId: string;\n icon: string;\n isBuiltin: boolean;\n priority: number;\n endpoint?: string;\n persistenceMode?: 'backend' | 'frontend';\n}\n\n/** CDeCLI / cdecli-serve (hosted agent). */\nconst CDECLI_GATEWAY: GatewayEntry = {\n name: 'CDeCLI',\n description: 'CDeCLI agent and skills',\n channelType: 'cdecli-serve',\n extensionId: '',\n icon: 'terminal',\n isBuiltin: true,\n priority: 90,\n};\n\n/** Built-in gateways when UiLayout settings are not loaded (e.g. React Native). */\nexport const BUILTIN_MOBILE_GATEWAYS: Record<string, GatewayEntry> = {\n cdecli: CDECLI_GATEWAY,\n};\n\nexport const STORAGE_KEYS = {\n GATEWAY_SELECTION: 'yantra_gateway_selection',\n} as const;\n\n/** Maximum concurrent agent tasks (same cap as browser). */\nexport const MAX_CONCURRENT_TASKS = 3;\n"],"names":[],"mappings":"AAgBA,MAAM,cAA+B,GAAA;AAAA,EACnC,IAAM,EAAA,QAAA;AAAA,EACN,WAAa,EAAA,yBAAA;AAAA,EACb,WAAa,EAAA,cAAA;AAAA,EACb,WAAa,EAAA,EAAA;AAAA,EACb,IAAM,EAAA,UAAA;AAAA,EACN,SAAW,EAAA,IAAA;AAAA,EACX,QAAU,EAAA;AACZ,CAAA;AAGO,MAAM,uBAAwD,GAAA;AAAA,EACnE,MAAQ,EAAA;AACV;AACO,MAAM,YAAe,GAAA;AAAA,EAC1B,iBAAmB,EAAA;AACrB;AAGO,MAAM,oBAAuB,GAAA"}
|
package/lib/config/env-config.js
CHANGED
|
@@ -1,20 +1,75 @@
|
|
|
1
|
-
import {cleanEnv,str}from'envalid';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import {cleanEnv,str,bool,num}from'envalid';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
const env = process.APP_ENV || process.env;
|
|
21
|
+
const baseConfig = cleanEnv(env, {
|
|
22
|
+
GRAPHQL_URL: str({
|
|
23
|
+
default: "http://localhost:8080/graphql"
|
|
24
|
+
}),
|
|
25
|
+
CLIENT_URL: str({
|
|
26
|
+
default: "http://localhost:3000"
|
|
27
|
+
}),
|
|
28
|
+
APP_NAME: str({
|
|
29
|
+
default: "Yantra"
|
|
30
|
+
}),
|
|
31
|
+
GROQ_API_KEY: str({
|
|
32
|
+
default: ""
|
|
33
|
+
}),
|
|
34
|
+
CDECLI_AGENT_ENDPOINT: str({
|
|
35
|
+
default: "https://cdecli-agent.cdebase.dev"
|
|
36
|
+
}),
|
|
37
|
+
CDECLI_AGENT_AUTH_TOKEN: str({
|
|
38
|
+
default: ""
|
|
39
|
+
}),
|
|
40
|
+
/** Seconds to wait for CDeCLI stream completion before timing out (then fallback chat API runs). Min 15, max 600. */
|
|
41
|
+
CDECLI_CHAT_RESPONSE_TIMEOUT_SEC: num({
|
|
42
|
+
default: 45
|
|
43
|
+
}),
|
|
44
|
+
BACKEND_URL: str({
|
|
45
|
+
default: ""
|
|
46
|
+
}),
|
|
47
|
+
USE_PROXY_STAGING_GATEWAY: bool({
|
|
48
|
+
default: false
|
|
49
|
+
}),
|
|
50
|
+
PROXY_STAGING_GATEWAY_URL: str({
|
|
51
|
+
default: ""
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
function resolveAgentGatewayGraphqlUrl() {
|
|
55
|
+
if (baseConfig.USE_PROXY_STAGING_GATEWAY && baseConfig.PROXY_STAGING_GATEWAY_URL) {
|
|
56
|
+
return baseConfig.PROXY_STAGING_GATEWAY_URL;
|
|
18
57
|
}
|
|
19
|
-
|
|
20
|
-
)
|
|
58
|
+
if (baseConfig.GRAPHQL_URL) return baseConfig.GRAPHQL_URL;
|
|
59
|
+
if (baseConfig.BACKEND_URL) return `${baseConfig.BACKEND_URL.replace(/\/$/, "")}/graphql`;
|
|
60
|
+
return "/graphql";
|
|
61
|
+
}
|
|
62
|
+
function resolveBaseWsUrl(graphqlUrl) {
|
|
63
|
+
const base = graphqlUrl.replace(/\/graphql$/, "");
|
|
64
|
+
return base.replace(/^http/, "ws");
|
|
65
|
+
}
|
|
66
|
+
function resolveAgentGatewayWsUrl(graphqlUrl) {
|
|
67
|
+
return `${resolveBaseWsUrl(graphqlUrl)}/ws/openclaw-chat`;
|
|
68
|
+
}
|
|
69
|
+
const agentGatewayGraphqlUrl = resolveAgentGatewayGraphqlUrl();
|
|
70
|
+
const clampedCdecliTimeoutSec = Math.min(600, Math.max(15, Math.round(baseConfig.CDECLI_CHAT_RESPONSE_TIMEOUT_SEC)));
|
|
71
|
+
const config = __spreadProps(__spreadValues({}, baseConfig), {
|
|
72
|
+
CDECLI_CHAT_RESPONSE_TIMEOUT_SEC: clampedCdecliTimeoutSec,
|
|
73
|
+
AGENT_GATEWAY_GRAPHQL_URL: agentGatewayGraphqlUrl,
|
|
74
|
+
AGENT_GATEWAY_WS_URL: resolveAgentGatewayWsUrl(agentGatewayGraphqlUrl)
|
|
75
|
+
});export{config};//# sourceMappingURL=env-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-config.js","sources":["../../src/config/env-config.ts"],"sourcesContent":["import { str, cleanEnv } from 'envalid';\n\nconst env = (process as
|
|
1
|
+
{"version":3,"file":"env-config.js","sources":["../../src/config/env-config.ts"],"sourcesContent":["import { str, cleanEnv, bool, num } from 'envalid';\n\nconst env = (process as { APP_ENV?: NodeJS.ProcessEnv; env?: NodeJS.ProcessEnv }).APP_ENV || process.env;\n\nconst baseConfig = cleanEnv(env, {\n GRAPHQL_URL: str({ default: 'http://localhost:8080/graphql' }),\n CLIENT_URL: str({ default: 'http://localhost:3000' }),\n APP_NAME: str({ default: 'Yantra' }),\n GROQ_API_KEY: str({ default: '' }),\n CDECLI_AGENT_ENDPOINT: str({ default: 'https://cdecli-agent.cdebase.dev' }),\n CDECLI_AGENT_AUTH_TOKEN: str({ default: '' }),\n /** Seconds to wait for CDeCLI stream completion before timing out (then fallback chat API runs). Min 15, max 600. */\n CDECLI_CHAT_RESPONSE_TIMEOUT_SEC: num({ default: 45 }),\n BACKEND_URL: str({ default: '' }),\n USE_PROXY_STAGING_GATEWAY: bool({ default: false }),\n PROXY_STAGING_GATEWAY_URL: str({ default: '' }),\n});\n\nfunction resolveAgentGatewayGraphqlUrl(): string {\n if (baseConfig.USE_PROXY_STAGING_GATEWAY && baseConfig.PROXY_STAGING_GATEWAY_URL) {\n return baseConfig.PROXY_STAGING_GATEWAY_URL;\n }\n if (baseConfig.GRAPHQL_URL) return baseConfig.GRAPHQL_URL;\n if (baseConfig.BACKEND_URL) return `${baseConfig.BACKEND_URL.replace(/\\/$/, '')}/graphql`;\n return '/graphql';\n}\n\nfunction resolveBaseWsUrl(graphqlUrl: string): string {\n const base = graphqlUrl.replace(/\\/graphql$/, '');\n return base.replace(/^http/, 'ws');\n}\n\nfunction resolveAgentGatewayWsUrl(graphqlUrl: string): string {\n return `${resolveBaseWsUrl(graphqlUrl)}/ws/openclaw-chat`;\n}\n\nconst agentGatewayGraphqlUrl = resolveAgentGatewayGraphqlUrl();\n\nconst clampedCdecliTimeoutSec = Math.min(600, Math.max(15, Math.round(baseConfig.CDECLI_CHAT_RESPONSE_TIMEOUT_SEC)));\n\nexport const config = {\n ...baseConfig,\n CDECLI_CHAT_RESPONSE_TIMEOUT_SEC: clampedCdecliTimeoutSec,\n AGENT_GATEWAY_GRAPHQL_URL: agentGatewayGraphqlUrl,\n AGENT_GATEWAY_WS_URL: resolveAgentGatewayWsUrl(agentGatewayGraphqlUrl),\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AACA,MAAM,GAAA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A,MAAM,IAAO,GAAA,UAAA,CAAW,OAAQ,CAAA,YAAA,EAAc,EAAE,CAAA;AAChD,EAAO,OAAA,IAAA,CAAK,OAAQ,CAAA,OAAA,EAAS,IAAI,CAAA;AACnC;AACA,SAAS,yBAAyB,UAA4B,EAAA;AAC5D,EAAO,OAAA,CAAA,EAAG,gBAAiB,CAAA,UAAU,CAAC,CAAA,iBAAA,CAAA;AACxC;AACA,MAAM,yBAAyB,6BAA8B,EAAA;AAC7D,MAAM,uBAA0B,GAAA,IAAA,CAAK,GAAI,CAAA,GAAA,EAAK,IAAK,CAAA,GAAA,CAAI,EAAI,EAAA,IAAA,CAAK,KAAM,CAAA,UAAA,CAAW,gCAAgC,CAAC,CAAC,CAAA;AACtG,MAAA,MAAA,GAAS,iCACjB,UADiB,CAAA,EAAA;AAAA,EAEpB,gCAAkC,EAAA,uBAAA;AAAA,EAClC,yBAA2B,EAAA,sBAAA;AAAA,EAC3B,oBAAA,EAAsB,yBAAyB,sBAAsB;AACvE,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {useContext,createContext,useState,useEffect,useCallback,useMemo}from'react';import {useGatewayRegistry}from'../hooks/useGatewayRegistry.js';import {GatewaySelectionStorage}from'../utils/gatewaySelectionStorage.js';const GatewayContext = createContext(null);
|
|
2
|
+
GatewayContext.displayName = "GatewayContext";
|
|
3
|
+
function GatewayContextProvider({
|
|
4
|
+
children
|
|
5
|
+
}) {
|
|
6
|
+
const {
|
|
7
|
+
gateways,
|
|
8
|
+
gatewayList,
|
|
9
|
+
loading
|
|
10
|
+
} = useGatewayRegistry();
|
|
11
|
+
const safeGateways = gateways && typeof gateways === "object" ? gateways : {};
|
|
12
|
+
const safeGatewayList = Array.isArray(gatewayList) ? gatewayList : [];
|
|
13
|
+
const hasGateway = (gatewayId) => Object.prototype.hasOwnProperty.call(safeGateways, gatewayId);
|
|
14
|
+
const [selectedGatewayId, setGatewayId] = useState("cdecli");
|
|
15
|
+
const [activeSkill, setActiveSkill] = useState(null);
|
|
16
|
+
const [storageReady, setStorageReady] = useState(false);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
let cancelled = false;
|
|
19
|
+
GatewaySelectionStorage.load().then((s) => {
|
|
20
|
+
if (cancelled) return;
|
|
21
|
+
if (s.selectedGatewayId) {
|
|
22
|
+
setGatewayId(s.selectedGatewayId);
|
|
23
|
+
}
|
|
24
|
+
setStorageReady(true);
|
|
25
|
+
});
|
|
26
|
+
return () => {
|
|
27
|
+
cancelled = true;
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
var _a;
|
|
32
|
+
if (!storageReady || loading) return;
|
|
33
|
+
if (selectedGatewayId && hasGateway(selectedGatewayId)) return;
|
|
34
|
+
const fallbackId = hasGateway("cdecli") ? "cdecli" : ((_a = safeGatewayList[0]) == null ? void 0 : _a.id) || "";
|
|
35
|
+
if (fallbackId) {
|
|
36
|
+
setGatewayId(fallbackId);
|
|
37
|
+
GatewaySelectionStorage.save({
|
|
38
|
+
selectedGatewayId: fallbackId
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}, [storageReady, loading, safeGateways, safeGatewayList, selectedGatewayId]);
|
|
42
|
+
const setSelectedGateway = useCallback((gatewayId) => {
|
|
43
|
+
if (!hasGateway(gatewayId)) return;
|
|
44
|
+
setGatewayId(gatewayId);
|
|
45
|
+
void GatewaySelectionStorage.save({
|
|
46
|
+
selectedGatewayId: gatewayId
|
|
47
|
+
});
|
|
48
|
+
setActiveSkill(null);
|
|
49
|
+
}, [safeGateways]);
|
|
50
|
+
const selectedGateway = selectedGatewayId && safeGateways[selectedGatewayId] || safeGatewayList[0] || {
|
|
51
|
+
name: "",
|
|
52
|
+
description: "",
|
|
53
|
+
channelType: "",
|
|
54
|
+
extensionId: "",
|
|
55
|
+
icon: "plug",
|
|
56
|
+
isBuiltin: false,
|
|
57
|
+
priority: 0
|
|
58
|
+
};
|
|
59
|
+
const value = useMemo(() => ({
|
|
60
|
+
selectedGatewayId,
|
|
61
|
+
selectedGateway,
|
|
62
|
+
gateways: safeGateways,
|
|
63
|
+
gatewayList: safeGatewayList,
|
|
64
|
+
setSelectedGateway,
|
|
65
|
+
loading,
|
|
66
|
+
activeSkill,
|
|
67
|
+
setActiveSkill
|
|
68
|
+
}), [selectedGatewayId, selectedGateway, safeGateways, safeGatewayList, setSelectedGateway, loading, activeSkill]);
|
|
69
|
+
return /* @__PURE__ */ jsx(GatewayContext.Provider, { value, children });
|
|
70
|
+
}
|
|
71
|
+
function useGatewayContext() {
|
|
72
|
+
const context = useContext(GatewayContext);
|
|
73
|
+
if (!context) {
|
|
74
|
+
throw new Error("useGatewayContext must be used within GatewayContextProvider");
|
|
75
|
+
}
|
|
76
|
+
return context;
|
|
77
|
+
}export{GatewayContextProvider,useGatewayContext};//# sourceMappingURL=GatewayContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GatewayContext.js","sources":["../../src/contexts/GatewayContext.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport type { GatewayEntry, GatewayId } from '../config/constants';\nimport { useGatewayRegistry } from '../hooks/useGatewayRegistry';\nimport { GatewaySelectionStorage } from '../utils/gatewaySelectionStorage';\n\nexport interface GatewayContextValue {\n selectedGatewayId: GatewayId;\n selectedGateway: GatewayEntry;\n gateways: Record<string, GatewayEntry>;\n gatewayList: Array<{ id: string } & GatewayEntry>;\n setSelectedGateway: (gatewayId: GatewayId) => void;\n loading: boolean;\n activeSkill: string | null;\n setActiveSkill: (skill: string | null) => void;\n}\n\nconst GatewayContext = createContext<GatewayContextValue | null>(null);\nGatewayContext.displayName = 'GatewayContext';\n\nexport function GatewayContextProvider({ children }: { children: ReactNode }) {\n const { gateways, gatewayList, loading } = useGatewayRegistry();\n const safeGateways = gateways && typeof gateways === 'object' ? gateways : {};\n const safeGatewayList = Array.isArray(gatewayList) ? gatewayList : [];\n const hasGateway = (gatewayId: string) => Object.prototype.hasOwnProperty.call(safeGateways, gatewayId);\n\n const [selectedGatewayId, setGatewayId] = useState<GatewayId>('cdecli');\n const [activeSkill, setActiveSkill] = useState<string | null>(null);\n const [storageReady, setStorageReady] = useState(false);\n\n useEffect(() => {\n let cancelled = false;\n GatewaySelectionStorage.load().then((s) => {\n if (cancelled) return;\n if (s.selectedGatewayId) {\n setGatewayId(s.selectedGatewayId);\n }\n setStorageReady(true);\n });\n return () => {\n cancelled = true;\n };\n }, []);\n\n useEffect(() => {\n if (!storageReady || loading) return;\n if (selectedGatewayId && hasGateway(selectedGatewayId)) return;\n const fallbackId = hasGateway('cdecli') ? 'cdecli' : safeGatewayList[0]?.id || '';\n if (fallbackId) {\n setGatewayId(fallbackId);\n GatewaySelectionStorage.save({ selectedGatewayId: fallbackId });\n }\n }, [storageReady, loading, safeGateways, safeGatewayList, selectedGatewayId]);\n\n const setSelectedGateway = useCallback(\n (gatewayId: GatewayId) => {\n if (!hasGateway(gatewayId)) return;\n setGatewayId(gatewayId);\n void GatewaySelectionStorage.save({ selectedGatewayId: gatewayId });\n setActiveSkill(null);\n },\n [safeGateways],\n );\n\n const selectedGateway: GatewayEntry = (selectedGatewayId && safeGateways[selectedGatewayId]) ||\n safeGatewayList[0] || {\n name: '',\n description: '',\n channelType: '',\n extensionId: '',\n icon: 'plug',\n isBuiltin: false,\n priority: 0,\n };\n\n const value = useMemo<GatewayContextValue>(\n () => ({\n selectedGatewayId,\n selectedGateway,\n gateways: safeGateways,\n gatewayList: safeGatewayList,\n setSelectedGateway,\n loading,\n activeSkill,\n setActiveSkill,\n }),\n [selectedGatewayId, selectedGateway, safeGateways, safeGatewayList, setSelectedGateway, loading, activeSkill],\n );\n\n return <GatewayContext.Provider value={value}>{children}</GatewayContext.Provider>;\n}\n\nexport function useGatewayContext(): GatewayContextValue {\n const context = useContext(GatewayContext);\n if (!context) {\n throw new Error('useGatewayContext must be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AAA,YAAA;AAAA,IACV,WAAa,EAAA,eAAA;AAAA,IACb,kBAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF,CAAA,EAAI,CAAC,iBAAmB,EAAA,eAAA,EAAiB,cAAc,eAAiB,EAAA,kBAAA,EAAoB,OAAS,EAAA,WAAW,CAAC,CAAA;AACjH,EAAA,uBAAQ,GAAA,CAAA,cAAA,CAAe,QAAf,EAAA,EAAwB,OAAe,QAAS,EAAA,CAAA;AAC1D;AACO,SAAS,iBAAyC,GAAA;AACvD,EAAM,MAAA,OAAA,GAAU,WAAW,cAAc,CAAA;AACzC,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,8DAA8D,CAAA;AAAA;AAEhF,EAAO,OAAA,OAAA;AACT"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {gql}from'@apollo/client/index.js';const OPENCLAW_INSTANCES_QUERY = gql`
|
|
2
|
+
query GetOpenClawInstances($projectId: String!) {
|
|
3
|
+
openclawInstances(projectId: $projectId) {
|
|
4
|
+
userId
|
|
5
|
+
slug
|
|
6
|
+
url
|
|
7
|
+
status
|
|
8
|
+
projectId
|
|
9
|
+
replicas
|
|
10
|
+
readyReplicas
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
const PROVISION_OPENCLAW_MUTATION = gql`
|
|
15
|
+
mutation ProvisionOpenClaw($input: ProvisionOpenClawInput!) {
|
|
16
|
+
provisionOpenClaw(input: $input) {
|
|
17
|
+
userId
|
|
18
|
+
slug
|
|
19
|
+
url
|
|
20
|
+
status
|
|
21
|
+
projectId
|
|
22
|
+
replicas
|
|
23
|
+
readyReplicas
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
const START_OPENCLAW_MUTATION = gql`
|
|
28
|
+
mutation StartOpenClaw($projectId: String!, $userId: String!) {
|
|
29
|
+
startOpenClaw(projectId: $projectId, userId: $userId) {
|
|
30
|
+
userId
|
|
31
|
+
slug
|
|
32
|
+
url
|
|
33
|
+
status
|
|
34
|
+
projectId
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
const DELETE_OPENCLAW_MUTATION = gql`
|
|
39
|
+
mutation DeleteOpenClaw($projectId: String!, $userId: String!) {
|
|
40
|
+
deleteOpenClaw(projectId: $projectId, userId: $userId)
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
const OPENCLAW_CHAT_CONNECTION_QUERY = gql`
|
|
44
|
+
query OpenClawChatConnection($projectId: String!, $userId: String!) {
|
|
45
|
+
openclawChatConnection(projectId: $projectId, userId: $userId) {
|
|
46
|
+
wsUrl
|
|
47
|
+
token
|
|
48
|
+
url
|
|
49
|
+
proxyToken
|
|
50
|
+
expiresAt
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`;export{DELETE_OPENCLAW_MUTATION,OPENCLAW_CHAT_CONNECTION_QUERY,OPENCLAW_INSTANCES_QUERY,PROVISION_OPENCLAW_MUTATION,START_OPENCLAW_MUTATION};//# sourceMappingURL=agentGatewayDocuments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentGatewayDocuments.js","sources":["../../src/graphql/agentGatewayDocuments.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const OPENCLAW_INSTANCES_QUERY = gql`\n query GetOpenClawInstances($projectId: String!) {\n openclawInstances(projectId: $projectId) {\n userId\n slug\n url\n status\n projectId\n replicas\n readyReplicas\n }\n }\n`;\n\nexport const PROVISION_OPENCLAW_MUTATION = gql`\n mutation ProvisionOpenClaw($input: ProvisionOpenClawInput!) {\n provisionOpenClaw(input: $input) {\n userId\n slug\n url\n status\n projectId\n replicas\n readyReplicas\n }\n }\n`;\n\nexport const START_OPENCLAW_MUTATION = gql`\n mutation StartOpenClaw($projectId: String!, $userId: String!) {\n startOpenClaw(projectId: $projectId, userId: $userId) {\n userId\n slug\n url\n status\n projectId\n }\n }\n`;\n\nexport const DELETE_OPENCLAW_MUTATION = gql`\n mutation DeleteOpenClaw($projectId: String!, $userId: String!) {\n deleteOpenClaw(projectId: $projectId, userId: $userId)\n }\n`;\n\nexport const OPENCLAW_CHAT_CONNECTION_QUERY = gql`\n query OpenClawChatConnection($projectId: String!, $userId: String!) {\n openclawChatConnection(projectId: $projectId, userId: $userId) {\n wsUrl\n token\n url\n proxyToken\n expiresAt\n }\n }\n`;\n"],"names":[],"mappings":"0CACO,MAAM,wBAA2B,GAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAajC,MAAM,2BAA8B,GAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAapC,MAAM,uBAA0B,GAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWhC,MAAM,wBAA2B,GAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAKjC,MAAM,8BAAiC,GAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import {useState,useRef,useCallback,useEffect}from'react';import {useGatewayConnectMutation,useGatewayDisconnectMutation,useCreateSecretApiTokenMutation,useRevealSecretApiTokenMutation,useGetUserSystemTokenQuery}from'common/graphql';import {config}from'../config/env-config.js';import {usePrerequisiteIds}from'./usePrerequisiteIds.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
const CHANNEL_TYPE = "cdecli-serve";
|
|
21
|
+
function useCdecliAutoConnect(isSelected, channelId) {
|
|
22
|
+
const [status, setStatus] = useState("idle");
|
|
23
|
+
const [error, setError] = useState(null);
|
|
24
|
+
const [persistenceMode, setPersistenceMode] = useState(void 0);
|
|
25
|
+
const [activeSkill, setActiveSkill] = useState(null);
|
|
26
|
+
const connectingRef = useRef(false);
|
|
27
|
+
const connectedRef = useRef(false);
|
|
28
|
+
const {
|
|
29
|
+
orgName,
|
|
30
|
+
projectId,
|
|
31
|
+
tagId,
|
|
32
|
+
accountUserId,
|
|
33
|
+
loading: prerequisitesLoading
|
|
34
|
+
} = usePrerequisiteIds();
|
|
35
|
+
const accountId = accountUserId != null ? accountUserId : "default";
|
|
36
|
+
const prevChannelIdRef = useRef(channelId);
|
|
37
|
+
const [connectMutation] = useGatewayConnectMutation();
|
|
38
|
+
const [disconnectMutation] = useGatewayDisconnectMutation();
|
|
39
|
+
const [createTokenMutation] = useCreateSecretApiTokenMutation();
|
|
40
|
+
const [revealTokenMutation] = useRevealSecretApiTokenMutation();
|
|
41
|
+
const {
|
|
42
|
+
data: systemTokenData,
|
|
43
|
+
refetch: refetchSystemToken
|
|
44
|
+
} = useGetUserSystemTokenQuery({
|
|
45
|
+
skip: !isSelected,
|
|
46
|
+
fetchPolicy: "network-only"
|
|
47
|
+
});
|
|
48
|
+
const obtainSystemToken = useCallback(async () => {
|
|
49
|
+
var _a, _b, _c, _d;
|
|
50
|
+
try {
|
|
51
|
+
let tokenId = (_b = (_a = systemTokenData == null ? void 0 : systemTokenData.getUserSystemToken) == null ? void 0 : _a.id) != null ? _b : null;
|
|
52
|
+
if (!tokenId) {
|
|
53
|
+
if (!orgName || !projectId) return null;
|
|
54
|
+
const {
|
|
55
|
+
data: createData
|
|
56
|
+
} = await createTokenMutation({
|
|
57
|
+
variables: {
|
|
58
|
+
input: {
|
|
59
|
+
name: "System Token",
|
|
60
|
+
expiryInSeconds: 31536e3,
|
|
61
|
+
isSystemToken: true,
|
|
62
|
+
environmentTagId: tagId,
|
|
63
|
+
orgName: orgName || "default",
|
|
64
|
+
projectId: projectId || "default"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
tokenId = (_d = (_c = createData == null ? void 0 : createData.createSecretApiToken) == null ? void 0 : _c.id) != null ? _d : null;
|
|
69
|
+
await refetchSystemToken();
|
|
70
|
+
}
|
|
71
|
+
if (!tokenId) return null;
|
|
72
|
+
const {
|
|
73
|
+
data: revealData
|
|
74
|
+
} = await revealTokenMutation({
|
|
75
|
+
variables: {
|
|
76
|
+
id: tokenId
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return (revealData == null ? void 0 : revealData.revealSecretApiToken) || null;
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.error("[useCdecliAutoConnect] obtainSystemToken error:", err);
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}, [systemTokenData, createTokenMutation, revealTokenMutation, refetchSystemToken, orgName, projectId, tagId]);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (!isSelected) {
|
|
87
|
+
connectingRef.current = false;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (prerequisitesLoading || !accountUserId) return;
|
|
91
|
+
if (connectedRef.current || connectingRef.current) {
|
|
92
|
+
if (channelId && prevChannelIdRef.current !== channelId) {
|
|
93
|
+
prevChannelIdRef.current = channelId;
|
|
94
|
+
connectedRef.current = false;
|
|
95
|
+
} else {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const doConnect = async () => {
|
|
100
|
+
var _a;
|
|
101
|
+
connectingRef.current = true;
|
|
102
|
+
setStatus("connecting");
|
|
103
|
+
setError(null);
|
|
104
|
+
try {
|
|
105
|
+
const endpoint = config.CDECLI_AGENT_ENDPOINT || "https://cdecli-agent.cdebase.dev";
|
|
106
|
+
const token = await obtainSystemToken();
|
|
107
|
+
if (!token) {
|
|
108
|
+
console.warn("[useCdecliAutoConnect] No system token, connecting without auth");
|
|
109
|
+
}
|
|
110
|
+
const {
|
|
111
|
+
data
|
|
112
|
+
} = await connectMutation({
|
|
113
|
+
variables: {
|
|
114
|
+
input: {
|
|
115
|
+
channelType: CHANNEL_TYPE,
|
|
116
|
+
accountId,
|
|
117
|
+
options: __spreadValues(__spreadValues({
|
|
118
|
+
endpoint: endpoint.trim()
|
|
119
|
+
}, token ? {
|
|
120
|
+
token
|
|
121
|
+
} : {}), channelId ? {
|
|
122
|
+
chatId: channelId
|
|
123
|
+
} : {})
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
const result = data == null ? void 0 : data.gatewayConnect;
|
|
128
|
+
console.log("[useCdecliAutoConnect] connectMutation result (account=%s):", accountId, JSON.stringify(result));
|
|
129
|
+
if (result == null ? void 0 : result.persistenceMode) {
|
|
130
|
+
setPersistenceMode(result.persistenceMode);
|
|
131
|
+
}
|
|
132
|
+
if ((result == null ? void 0 : result.state) === "CONNECTED" || (result == null ? void 0 : result.connected)) {
|
|
133
|
+
setStatus("connected");
|
|
134
|
+
connectedRef.current = true;
|
|
135
|
+
} else if ((result == null ? void 0 : result.state) === "ERROR") {
|
|
136
|
+
setStatus("error");
|
|
137
|
+
setError((_a = result.lastError) != null ? _a : "Failed to connect to CDeCLI agent");
|
|
138
|
+
connectedRef.current = false;
|
|
139
|
+
} else {
|
|
140
|
+
setStatus("connected");
|
|
141
|
+
connectedRef.current = true;
|
|
142
|
+
}
|
|
143
|
+
} catch (err) {
|
|
144
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
145
|
+
console.error("[useCdecliAutoConnect] connect error:", msg);
|
|
146
|
+
setStatus("error");
|
|
147
|
+
setError(msg);
|
|
148
|
+
connectedRef.current = false;
|
|
149
|
+
} finally {
|
|
150
|
+
connectingRef.current = false;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
doConnect();
|
|
154
|
+
}, [isSelected, obtainSystemToken, connectMutation, accountId, prerequisitesLoading, accountUserId, channelId]);
|
|
155
|
+
const connectWithSkill = useCallback(async (skill, model, systemPrompt, skillId) => {
|
|
156
|
+
var _a;
|
|
157
|
+
console.log("[useCdecliAutoConnect] connectWithSkill called with skill=%s skillId=%s model=%s systemPrompt=%d chars", skill, skillId != null ? skillId : "", model, (_a = systemPrompt == null ? void 0 : systemPrompt.length) != null ? _a : 0);
|
|
158
|
+
setStatus("connecting");
|
|
159
|
+
setError(null);
|
|
160
|
+
try {
|
|
161
|
+
const endpoint = config.CDECLI_AGENT_ENDPOINT || "https://cdecli-agent.cdebase.dev";
|
|
162
|
+
const token = await obtainSystemToken();
|
|
163
|
+
console.log("[useCdecliAutoConnect] connectWithSkill sending mutation with skill=%s", skill);
|
|
164
|
+
const {
|
|
165
|
+
data
|
|
166
|
+
} = await connectMutation({
|
|
167
|
+
variables: {
|
|
168
|
+
input: {
|
|
169
|
+
channelType: CHANNEL_TYPE,
|
|
170
|
+
accountId,
|
|
171
|
+
options: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({
|
|
172
|
+
endpoint: endpoint.trim()
|
|
173
|
+
}, token ? {
|
|
174
|
+
token
|
|
175
|
+
} : {}), {
|
|
176
|
+
skill
|
|
177
|
+
}), skillId ? {
|
|
178
|
+
skillId
|
|
179
|
+
} : {}), model ? {
|
|
180
|
+
model
|
|
181
|
+
} : {}), systemPrompt ? {
|
|
182
|
+
systemPrompt
|
|
183
|
+
} : {}), channelId ? {
|
|
184
|
+
chatId: channelId
|
|
185
|
+
} : {})
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
console.log("[useCdecliAutoConnect] connectWithSkill result:", JSON.stringify(data == null ? void 0 : data.gatewayConnect));
|
|
190
|
+
const result = data == null ? void 0 : data.gatewayConnect;
|
|
191
|
+
if (result == null ? void 0 : result.persistenceMode) {
|
|
192
|
+
setPersistenceMode(result.persistenceMode);
|
|
193
|
+
}
|
|
194
|
+
if ((result == null ? void 0 : result.state) === "CONNECTED" || (result == null ? void 0 : result.connected)) {
|
|
195
|
+
setStatus("connected");
|
|
196
|
+
connectedRef.current = true;
|
|
197
|
+
setActiveSkill(skill);
|
|
198
|
+
} else {
|
|
199
|
+
setStatus("connected");
|
|
200
|
+
connectedRef.current = true;
|
|
201
|
+
setActiveSkill(skill);
|
|
202
|
+
}
|
|
203
|
+
} catch (err) {
|
|
204
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
205
|
+
console.error("[useCdecliAutoConnect] connectWithSkill error:", msg);
|
|
206
|
+
setStatus("error");
|
|
207
|
+
setError(msg);
|
|
208
|
+
}
|
|
209
|
+
}, [connectMutation, obtainSystemToken, accountId, channelId]);
|
|
210
|
+
return {
|
|
211
|
+
channelConnected: status === "connected",
|
|
212
|
+
status,
|
|
213
|
+
error,
|
|
214
|
+
persistenceMode,
|
|
215
|
+
activeSkill,
|
|
216
|
+
accountId,
|
|
217
|
+
connectWithSkill
|
|
218
|
+
};
|
|
219
|
+
}export{useCdecliAutoConnect};//# sourceMappingURL=useCdecliAutoConnect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCdecliAutoConnect.js","sources":["../../src/hooks/useCdecliAutoConnect.ts"],"sourcesContent":["/**\n * Auto-connects the cdecli-serve messenger-gateway channel when the CDeCLI\n * gateway is selected from the dropdown. Obtains/creates a system token and\n * calls the `gatewayConnect` mutation so the backend provider has a live\n * session with the cdecli-agent endpoint.\n */\n\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport {\n useGatewayConnectMutation,\n useGatewayDisconnectMutation,\n useGetUserSystemTokenQuery,\n useCreateSecretApiTokenMutation,\n useRevealSecretApiTokenMutation,\n} from 'common/graphql';\nimport { config } from '../config/env-config';\nimport { usePrerequisiteIds } from './usePrerequisiteIds';\n\n// ─── Types ───────────────────────────────────────────────────────\n\nexport type CdecliAutoConnectStatus = 'idle' | 'connecting' | 'connected' | 'error';\n\nexport interface UseCdecliAutoConnectResult {\n /** Whether the backend cdecli-serve channel is connected. */\n channelConnected: boolean;\n /** Current connection status. */\n status: CdecliAutoConnectStatus;\n /** Error message if status is 'error'. */\n error: string | null;\n /** Persistence mode reported by the backend provider ('backend' | 'frontend'). */\n persistenceMode: 'backend' | 'frontend' | undefined;\n /** Active skill name on the current CDeCLI session (null if none). */\n activeSkill: string | null;\n /** Per-user accountId used for this gateway connection. */\n accountId: string;\n /** Reconnect the CDeCLI session with a specific skill pre-activated. */\n connectWithSkill: (skill: string, model?: string, systemPrompt?: string, skillId?: string) => Promise<void>;\n}\n\n// ─── Constants ───────────────────────────────────────────────────\n\nconst CHANNEL_TYPE = 'cdecli-serve';\n\n// ─── Hook ────────────────────────────────────────────────────────\n\n/**\n * When `isSelected` is true, auto-connects the cdecli-serve channel on the\n * messenger-gateway backend using the hosted endpoint and a system token.\n */\nexport function useCdecliAutoConnect(isSelected: boolean, channelId?: string): UseCdecliAutoConnectResult {\n const [status, setStatus] = useState<CdecliAutoConnectStatus>('idle');\n const [error, setError] = useState<string | null>(null);\n const [persistenceMode, setPersistenceMode] = useState<'backend' | 'frontend' | undefined>(undefined);\n const [activeSkill, setActiveSkill] = useState<string | null>(null);\n const connectingRef = useRef(false);\n const connectedRef = useRef(false);\n\n const { orgName, projectId, tagId, accountUserId, loading: prerequisitesLoading } = usePrerequisiteIds();\n\n // Per-user accountId so each user gets their own cdecli-agent session.\n // Wait for the profile query to load before connecting — otherwise all\n // users fall back to 'default' and share a single cdecli-agent session.\n const accountId = accountUserId ?? 'default';\n\n // Track the previous channelId so we can reconnect when the user opens a new chat.\n const prevChannelIdRef = useRef<string | undefined>(channelId);\n\n const [connectMutation] = useGatewayConnectMutation();\n const [disconnectMutation] = useGatewayDisconnectMutation();\n const [createTokenMutation] = useCreateSecretApiTokenMutation();\n const [revealTokenMutation] = useRevealSecretApiTokenMutation();\n const { data: systemTokenData, refetch: refetchSystemToken } = useGetUserSystemTokenQuery({\n skip: !isSelected,\n fetchPolicy: 'network-only',\n });\n\n const obtainSystemToken = useCallback(async (): Promise<string | null> => {\n try {\n let tokenId: string | null = systemTokenData?.getUserSystemToken?.id ?? null;\n\n if (!tokenId) {\n if (!orgName || !projectId) return null;\n const { data: createData } = await createTokenMutation({\n variables: {\n input: {\n name: 'System Token',\n expiryInSeconds: 31536000,\n isSystemToken: true,\n environmentTagId: tagId,\n orgName: orgName || 'default',\n projectId: projectId || 'default',\n },\n },\n });\n tokenId = createData?.createSecretApiToken?.id ?? null;\n await refetchSystemToken();\n }\n\n if (!tokenId) return null;\n\n const { data: revealData } = await revealTokenMutation({\n variables: { id: tokenId },\n });\n return (revealData?.revealSecretApiToken as string) || null;\n } catch (err) {\n console.error('[useCdecliAutoConnect] obtainSystemToken error:', err);\n return null;\n }\n }, [systemTokenData, createTokenMutation, revealTokenMutation, refetchSystemToken, orgName, projectId, tagId]);\n\n // Auto-connect when CDeCLI gateway is selected\n useEffect(() => {\n if (!isSelected) {\n // Reset when deselected, but don't disconnect — keep the session alive\n // so switching back is instant.\n connectingRef.current = false;\n return;\n }\n\n // Wait until the user profile has loaded so accountId is the real\n // user id instead of the 'default' fallback.\n if (prerequisitesLoading || !accountUserId) return;\n\n // Already connected or currently connecting\n if (connectedRef.current || connectingRef.current) {\n // But if channelId changed, force a reconnect to get a fresh agent session\n if (channelId && prevChannelIdRef.current !== channelId) {\n prevChannelIdRef.current = channelId;\n connectedRef.current = false;\n // Fall through to doConnect\n } else {\n return;\n }\n }\n\n const doConnect = async () => {\n connectingRef.current = true;\n setStatus('connecting');\n setError(null);\n\n try {\n const endpoint = config.CDECLI_AGENT_ENDPOINT || 'https://cdecli-agent.cdebase.dev';\n const token = await obtainSystemToken();\n if (!token) {\n console.warn('[useCdecliAutoConnect] No system token, connecting without auth');\n }\n\n const { data } = await connectMutation({\n variables: {\n input: {\n channelType: CHANNEL_TYPE,\n accountId,\n options: {\n endpoint: endpoint.trim(),\n ...(token ? { token } : {}),\n ...(channelId ? { chatId: channelId } : {}),\n },\n },\n },\n });\n\n const result = data?.gatewayConnect as\n | ((typeof data)['gatewayConnect'] & { persistenceMode?: string })\n | undefined;\n console.log(\n '[useCdecliAutoConnect] connectMutation result (account=%s):',\n accountId,\n JSON.stringify(result),\n );\n if (result?.persistenceMode) {\n setPersistenceMode(result.persistenceMode as 'backend' | 'frontend');\n }\n if (result?.state === 'CONNECTED' || result?.connected) {\n setStatus('connected');\n connectedRef.current = true;\n } else if (result?.state === 'ERROR') {\n setStatus('error');\n setError(result.lastError ?? 'Failed to connect to CDeCLI agent');\n connectedRef.current = false;\n } else {\n // Assume connecting — the subscription will push the final state\n setStatus('connected');\n connectedRef.current = true;\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n console.error('[useCdecliAutoConnect] connect error:', msg);\n setStatus('error');\n setError(msg);\n connectedRef.current = false;\n } finally {\n connectingRef.current = false;\n }\n };\n\n doConnect();\n }, [isSelected, obtainSystemToken, connectMutation, accountId, prerequisitesLoading, accountUserId, channelId]);\n\n // Keep the backend session alive across page refreshes and SPA navigations.\n // The backend CdecliServeProvider.connect() will reuse the existing session\n // if the endpoint hasn't changed, preserving conversation context.\n // Only disconnect when the user explicitly switches to a different gateway.\n\n /** Reconnect the CDeCLI session with a specific skill pre-activated. */\n const connectWithSkill = useCallback(\n async (skill: string, model?: string, systemPrompt?: string, skillId?: string) => {\n console.log(\n '[useCdecliAutoConnect] connectWithSkill called with skill=%s skillId=%s model=%s systemPrompt=%d chars',\n skill,\n skillId ?? '',\n model,\n systemPrompt?.length ?? 0,\n );\n setStatus('connecting');\n setError(null);\n\n try {\n const endpoint = config.CDECLI_AGENT_ENDPOINT || 'https://cdecli-agent.cdebase.dev';\n const token = await obtainSystemToken();\n\n console.log('[useCdecliAutoConnect] connectWithSkill sending mutation with skill=%s', skill);\n const { data } = await connectMutation({\n variables: {\n input: {\n channelType: CHANNEL_TYPE,\n accountId,\n options: {\n endpoint: endpoint.trim(),\n ...(token ? { token } : {}),\n skill,\n ...(skillId ? { skillId } : {}),\n ...(model ? { model } : {}),\n ...(systemPrompt ? { systemPrompt } : {}),\n ...(channelId ? { chatId: channelId } : {}),\n },\n },\n },\n });\n\n console.log('[useCdecliAutoConnect] connectWithSkill result:', JSON.stringify(data?.gatewayConnect));\n const result = data?.gatewayConnect as\n | ((typeof data)['gatewayConnect'] & { persistenceMode?: string })\n | undefined;\n if (result?.persistenceMode) {\n setPersistenceMode(result.persistenceMode as 'backend' | 'frontend');\n }\n if (result?.state === 'CONNECTED' || result?.connected) {\n setStatus('connected');\n connectedRef.current = true;\n setActiveSkill(skill);\n } else {\n setStatus('connected');\n connectedRef.current = true;\n setActiveSkill(skill);\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n console.error('[useCdecliAutoConnect] connectWithSkill error:', msg);\n setStatus('error');\n setError(msg);\n }\n },\n [connectMutation, obtainSystemToken, accountId, channelId],\n );\n\n return {\n channelConnected: status === 'connected',\n status,\n error,\n persistenceMode,\n activeSkill,\n accountId,\n connectWithSkill,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAkCA,MAAM,YAAe,GAAA,cAAA;AAQL,SAAA,oBAAA,CAAqB,YAAqB,SAAgD,EAAA;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