@nexusclawhq/cli 0.3.21 → 0.3.23
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/CHANGELOG.md +21 -0
- package/dist/build-info.json +4 -4
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/index.d.ts +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/index.js +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/index.js.map +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.d.ts +21 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.js +21 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.js.map +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/index.d.ts +42 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.d.ts +21 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.js +21 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.js.map +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/system-object-persistence.d.ts +21 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/system-object-persistence.js +29 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/system-object-persistence.js.map +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/package.json +4 -0
- package/dist/nexus-cli/src/commands/commands.test.js +3 -3
- package/dist/nexus-cli/src/commands/commands.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/data/query.d.ts +7 -0
- package/dist/nexus-cli/src/commands/data/query.js +29 -9
- package/dist/nexus-cli/src/commands/data/query.js.map +1 -1
- package/dist/nexus-cli/src/commands/data/query.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/data/query.test.js +31 -0
- package/dist/nexus-cli/src/commands/data/query.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/deployment/history.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/deployment/history.test.js +16 -0
- package/dist/nexus-cli/src/commands/deployment/history.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/deployment/index.d.ts +4 -0
- package/dist/nexus-cli/src/commands/deployment/index.js +16 -3
- package/dist/nexus-cli/src/commands/deployment/index.js.map +1 -1
- package/dist/nexus-cli/src/commands/deployment/report.d.ts +1 -0
- package/dist/nexus-cli/src/commands/deployment/report.js +16 -35
- package/dist/nexus-cli/src/commands/deployment/report.js.map +1 -1
- package/dist/nexus-cli/src/commands/deployment/report.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/deployment/report.test.js +14 -0
- package/dist/nexus-cli/src/commands/deployment/report.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/deployment/resume.js +16 -2
- package/dist/nexus-cli/src/commands/deployment/resume.js.map +1 -1
- package/dist/nexus-cli/src/commands/dx-json-option.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/dx-json-option.test.js +50 -0
- package/dist/nexus-cli/src/commands/dx-json-option.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/dx-workflows.e2e.test.js +39 -1
- package/dist/nexus-cli/src/commands/dx-workflows.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/dx.js +199 -13
- package/dist/nexus-cli/src/commands/dx.js.map +1 -1
- package/dist/nexus-cli/src/commands/employee/deploy.e2e.test.js +29 -0
- package/dist/nexus-cli/src/commands/employee/deploy.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/employee/deploy.js +6 -2
- package/dist/nexus-cli/src/commands/employee/deploy.js.map +1 -1
- package/dist/nexus-cli/src/commands/generate/class.js +6 -1
- package/dist/nexus-cli/src/commands/generate/class.js.map +1 -1
- package/dist/nexus-cli/src/commands/generate/component.js +6 -1
- package/dist/nexus-cli/src/commands/generate/component.js.map +1 -1
- package/dist/nexus-cli/src/commands/generate/generate-result.d.ts +6 -0
- package/dist/nexus-cli/src/commands/generate/generate-result.js +52 -0
- package/dist/nexus-cli/src/commands/generate/generate-result.js.map +1 -0
- package/dist/nexus-cli/src/commands/generate/project.js +6 -0
- package/dist/nexus-cli/src/commands/generate/project.js.map +1 -1
- package/dist/nexus-cli/src/commands/generate/test.js +6 -1
- package/dist/nexus-cli/src/commands/generate/test.js.map +1 -1
- package/dist/nexus-cli/src/commands/generate/trigger.js +6 -1
- package/dist/nexus-cli/src/commands/generate/trigger.js.map +1 -1
- package/dist/nexus-cli/src/commands/log/get.js +11 -6
- package/dist/nexus-cli/src/commands/log/get.js.map +1 -1
- package/dist/nexus-cli/src/commands/log/list.js +15 -11
- package/dist/nexus-cli/src/commands/log/list.js.map +1 -1
- package/dist/nexus-cli/src/commands/log-sandbox-contract.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/log-sandbox-contract.test.js +25 -0
- package/dist/nexus-cli/src/commands/log-sandbox-contract.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/machine-json-surface.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/machine-json-surface.test.js +87 -0
- package/dist/nexus-cli/src/commands/machine-json-surface.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/metadata/deploy.js +44 -11
- package/dist/nexus-cli/src/commands/metadata/deploy.js.map +1 -1
- package/dist/nexus-cli/src/commands/metadata/diff.js +31 -4
- package/dist/nexus-cli/src/commands/metadata/diff.js.map +1 -1
- package/dist/nexus-cli/src/commands/metadata/export.e2e.test.js +25 -19
- package/dist/nexus-cli/src/commands/metadata/export.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/metadata/export.js +36 -5
- package/dist/nexus-cli/src/commands/metadata/export.js.map +1 -1
- package/dist/nexus-cli/src/commands/metadata/validate-source.d.ts +4 -0
- package/dist/nexus-cli/src/commands/metadata/validate-source.js +31 -2
- package/dist/nexus-cli/src/commands/metadata/validate-source.js.map +1 -1
- package/dist/nexus-cli/src/commands/metadata/validate-source.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/metadata/validate-source.test.js +23 -0
- package/dist/nexus-cli/src/commands/metadata/validate-source.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/org/display.js +3 -3
- package/dist/nexus-cli/src/commands/org/display.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/list.js +4 -2
- package/dist/nexus-cli/src/commands/org/list.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/login-web.d.ts +7 -0
- package/dist/nexus-cli/src/commands/org/login-web.js +43 -7
- package/dist/nexus-cli/src/commands/org/login-web.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/login-web.test.js +21 -0
- package/dist/nexus-cli/src/commands/org/login-web.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/open.d.ts +1 -0
- package/dist/nexus-cli/src/commands/org/open.js +8 -2
- package/dist/nexus-cli/src/commands/org/open.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/open.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/org/open.test.js +16 -0
- package/dist/nexus-cli/src/commands/org/open.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/package/history.js +9 -3
- package/dist/nexus-cli/src/commands/package/history.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/install.js +1 -0
- package/dist/nexus-cli/src/commands/package/install.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/list.js +7 -4
- package/dist/nexus-cli/src/commands/package/list.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/list.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/package/list.test.js +33 -0
- package/dist/nexus-cli/src/commands/package/list.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/package/promote.js +32 -7
- package/dist/nexus-cli/src/commands/package/promote.js.map +1 -1
- package/dist/nexus-cli/src/commands/project/index.js +5 -3
- package/dist/nexus-cli/src/commands/project/index.js.map +1 -1
- package/dist/nexus-cli/src/commands/revision/history.js +4 -2
- package/dist/nexus-cli/src/commands/revision/history.js.map +1 -1
- package/dist/nexus-cli/src/commands/safe-write-dry-run.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/safe-write-dry-run.test.js +82 -0
- package/dist/nexus-cli/src/commands/safe-write-dry-run.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/sandbox/create.js +30 -1
- package/dist/nexus-cli/src/commands/sandbox/create.js.map +1 -1
- package/dist/nexus-cli/src/commands/sandbox/list.js +4 -5
- package/dist/nexus-cli/src/commands/sandbox/list.js.map +1 -1
- package/dist/nexus-cli/src/commands/source/pull-baseline.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/source/pull-baseline.test.js +60 -0
- package/dist/nexus-cli/src/commands/source/pull-baseline.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/source/pull.d.ts +7 -0
- package/dist/nexus-cli/src/commands/source/pull.js +32 -5
- package/dist/nexus-cli/src/commands/source/pull.js.map +1 -1
- package/dist/nexus-cli/src/commands/workforce/escalation.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/escalation.js +62 -0
- package/dist/nexus-cli/src/commands/workforce/escalation.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/index.js +4 -0
- package/dist/nexus-cli/src/commands/workforce/index.js.map +1 -1
- package/dist/nexus-cli/src/commands/workforce/knowledge.js +5 -0
- package/dist/nexus-cli/src/commands/workforce/knowledge.js.map +1 -1
- package/dist/nexus-cli/src/commands/workforce/notification.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/notification.js +71 -0
- package/dist/nexus-cli/src/commands/workforce/notification.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/task.js +55 -4
- package/dist/nexus-cli/src/commands/workforce/task.js.map +1 -1
- package/dist/nexus-cli/src/commands/workspace/index.js +5 -2
- package/dist/nexus-cli/src/commands/workspace/index.js.map +1 -1
- package/dist/nexus-cli/src/commands/workspace/workspace.e2e.test.js +4 -4
- package/dist/nexus-cli/src/commands/workspace/workspace.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/services/api-client.d.ts +9 -0
- package/dist/nexus-cli/src/services/api-client.js +99 -11
- package/dist/nexus-cli/src/services/api-client.js.map +1 -1
- package/dist/nexus-cli/src/services/api-client.test.js +118 -8
- package/dist/nexus-cli/src/services/api-client.test.js.map +1 -1
- package/dist/nexus-cli/src/services/auth-store.d.ts +3 -0
- package/dist/nexus-cli/src/services/auth-store.js +24 -0
- package/dist/nexus-cli/src/services/auth-store.js.map +1 -1
- package/dist/nexus-cli/src/services/auth-store.test.js +19 -0
- package/dist/nexus-cli/src/services/auth-store.test.js.map +1 -1
- package/dist/nexus-cli/src/services/pack-registry.js +7 -0
- package/dist/nexus-cli/src/services/pack-registry.js.map +1 -1
- package/dist/nexus-cli/src/services/package-manifest.d.ts +5 -0
- package/dist/nexus-cli/src/services/package-manifest.js +35 -0
- package/dist/nexus-cli/src/services/package-manifest.js.map +1 -1
- package/dist/nexus-cli/src/services/package-manifest.test.d.ts +1 -0
- package/dist/nexus-cli/src/services/package-manifest.test.js +48 -0
- package/dist/nexus-cli/src/services/package-manifest.test.js.map +1 -0
- package/dist/nexus-cli/src/services/user-service-account-remote.js +3 -1
- package/dist/nexus-cli/src/services/user-service-account-remote.js.map +1 -1
- package/dist/nexus-cli/src/services/user-service-account-remote.test.js +5 -0
- package/dist/nexus-cli/src/services/user-service-account-remote.test.js.map +1 -1
- package/dist/nexus-cli/src/services/workforce-conversation-remote.d.ts +52 -0
- package/dist/nexus-cli/src/services/workforce-conversation-remote.js +119 -0
- package/dist/nexus-cli/src/services/workforce-conversation-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-conversation-remote.test.d.ts +1 -0
- package/dist/nexus-cli/src/services/workforce-conversation-remote.test.js +115 -0
- package/dist/nexus-cli/src/services/workforce-conversation-remote.test.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.d.ts +17 -0
- package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.js +10 -0
- package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.js.map +1 -1
- package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.test.d.ts +1 -0
- package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.test.js +65 -0
- package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.test.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-notification-remote.d.ts +61 -0
- package/dist/nexus-cli/src/services/workforce-notification-remote.js +87 -0
- package/dist/nexus-cli/src/services/workforce-notification-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-notification-remote.test.d.ts +1 -0
- package/dist/nexus-cli/src/services/workforce-notification-remote.test.js +78 -0
- package/dist/nexus-cli/src/services/workforce-notification-remote.test.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-orchestration-remote.d.ts +6 -0
- package/dist/nexus-cli/src/services/workforce-orchestration-remote.js +23 -12
- package/dist/nexus-cli/src/services/workforce-orchestration-remote.js.map +1 -1
- package/dist/nexus-cli/src/services/workforce-orchestration-remote.test.d.ts +1 -0
- package/dist/nexus-cli/src/services/workforce-orchestration-remote.test.js +18 -0
- package/dist/nexus-cli/src/services/workforce-orchestration-remote.test.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-test-remote.d.ts +1 -1
- package/dist/nexus-cli/src/services/workforce-test-remote.js +19 -2
- package/dist/nexus-cli/src/services/workforce-test-remote.js.map +1 -1
- package/dist/nexus-cli/src/services/workforce-test-remote.test.js +7 -1
- package/dist/nexus-cli/src/services/workforce-test-remote.test.js.map +1 -1
- package/dist/nexus-cli/src/services/workspace-health.js +6 -0
- package/dist/nexus-cli/src/services/workspace-health.js.map +1 -1
- package/dist/nexus-cli/src/services/workspace-health.test.js +65 -0
- package/dist/nexus-cli/src/services/workspace-health.test.js.map +1 -1
- package/dist/nexus-cli/src/templates/project/templates/base-crm/package.json.tpl +0 -3
- package/dist/nexus-cli/src/templates/project/templates/base-crm/src-index.ts.tpl +2 -0
- package/dist/nexus-cli/src/templates/project/templates/base-crm/tsconfig.json.tpl +2 -2
- package/dist/nexus-cli/src/templates/project/templates/demo-public-channel-store-delivery/package.json.tpl +0 -3
- package/dist/nexus-cli/src/templates/project/templates/demo-public-channel-store-delivery/src-index.ts.tpl +2 -0
- package/dist/nexus-cli/src/templates/project/templates/demo-public-channel-store-delivery/tsconfig.json.tpl +2 -2
- package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/package.json.tpl +0 -3
- package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/src-index.ts.tpl +2 -0
- package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/tsconfig.json.tpl +2 -2
- package/dist/nexus-cli/src/templates/project/templates/empty/package.json.tpl +0 -3
- package/dist/nexus-cli/src/templates/project/templates/empty/src-index.ts.tpl +2 -0
- package/dist/nexus-cli/src/templates/project/templates/empty/tsconfig.json.tpl +2 -2
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/package.json.tpl +0 -3
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/src-index.ts.tpl +2 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/tsconfig.json.tpl +1 -1
- package/dist/nexus-cli/src/templates/project/templates/industry-education/package.json.tpl +0 -3
- package/dist/nexus-cli/src/templates/project/templates/industry-education/src-index.ts.tpl +2 -0
- package/dist/nexus-cli/src/templates/project/templates/industry-education/tsconfig.json.tpl +2 -2
- package/dist/nexus-cli/src/templates/project/templates/industry-finance/package.json.tpl +0 -3
- package/dist/nexus-cli/src/templates/project/templates/industry-finance/src-index.ts.tpl +2 -0
- package/dist/nexus-cli/src/templates/project/templates/industry-finance/tsconfig.json.tpl +2 -2
- package/dist/nexus-cli/src/templates/project/templates/industry-healthcare/package.json.tpl +0 -3
- package/dist/nexus-cli/src/templates/project/templates/industry-healthcare/src-index.ts.tpl +2 -0
- package/dist/nexus-cli/src/templates/project/templates/industry-healthcare/tsconfig.json.tpl +2 -2
- package/dist/nexus-cli/src/templates/project/templates/industry-partner-cloud/package.json.tpl +0 -3
- package/dist/nexus-cli/src/templates/project/templates/industry-partner-cloud/src-index.ts.tpl +2 -0
- package/dist/nexus-cli/src/templates/project/templates/industry-partner-cloud/tsconfig.json.tpl +2 -2
- package/dist/nexus-cli/src/templates/project/templates/industry-retail/package.json.tpl +0 -3
- package/dist/nexus-cli/src/templates/project/templates/industry-retail/src-index.ts.tpl +2 -0
- package/dist/nexus-cli/src/templates/project/templates/industry-retail/tsconfig.json.tpl +2 -2
- package/dist/nexus-cli/src/utils/command-options.d.ts +8 -0
- package/dist/nexus-cli/src/utils/command-options.js +14 -0
- package/dist/nexus-cli/src/utils/command-options.js.map +1 -0
- package/dist/nexus-cli/src/utils/command-options.test.d.ts +1 -0
- package/dist/nexus-cli/src/utils/command-options.test.js +23 -0
- package/dist/nexus-cli/src/utils/command-options.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
interface CopilotMessageView {
|
|
2
|
+
id: string;
|
|
3
|
+
role: string;
|
|
4
|
+
content: string;
|
|
5
|
+
createdAt?: string;
|
|
6
|
+
metadata?: Record<string, unknown> | null;
|
|
7
|
+
}
|
|
8
|
+
interface CopilotConversationView {
|
|
9
|
+
conversation: {
|
|
10
|
+
id: string;
|
|
11
|
+
agentId: string;
|
|
12
|
+
accountId?: string | null;
|
|
13
|
+
channel: string;
|
|
14
|
+
messageCount: number;
|
|
15
|
+
createdAt?: string;
|
|
16
|
+
updatedAt?: string;
|
|
17
|
+
};
|
|
18
|
+
messages: CopilotMessageView[];
|
|
19
|
+
}
|
|
20
|
+
export interface WorkforceConversationTurnResult {
|
|
21
|
+
sessionId: string;
|
|
22
|
+
agentId: string;
|
|
23
|
+
reply: string;
|
|
24
|
+
messageIds: string[];
|
|
25
|
+
tools: string[];
|
|
26
|
+
persisted: boolean;
|
|
27
|
+
messageCount: number;
|
|
28
|
+
executionId: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function converseWorkforceTaskRemote(options: {
|
|
31
|
+
targetOrg: string;
|
|
32
|
+
agentId: string;
|
|
33
|
+
input: string;
|
|
34
|
+
sessionId?: string;
|
|
35
|
+
accountId?: string;
|
|
36
|
+
browserContext?: unknown;
|
|
37
|
+
imageDocumentId?: string;
|
|
38
|
+
}): Promise<WorkforceConversationTurnResult>;
|
|
39
|
+
export declare function getWorkforceConversationRemote(options: {
|
|
40
|
+
targetOrg: string;
|
|
41
|
+
sessionId: string;
|
|
42
|
+
}): Promise<CopilotConversationView | null>;
|
|
43
|
+
export declare function listWorkforceConversationsRemote(options: {
|
|
44
|
+
targetOrg: string;
|
|
45
|
+
agentId?: string;
|
|
46
|
+
accountId?: string;
|
|
47
|
+
query?: string;
|
|
48
|
+
limit?: number;
|
|
49
|
+
}): Promise<{
|
|
50
|
+
items: CopilotConversationView['conversation'][];
|
|
51
|
+
}>;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.converseWorkforceTaskRemote = converseWorkforceTaskRemote;
|
|
4
|
+
exports.getWorkforceConversationRemote = getWorkforceConversationRemote;
|
|
5
|
+
exports.listWorkforceConversationsRemote = listWorkforceConversationsRemote;
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
const api_client_1 = require("./api-client");
|
|
8
|
+
function unwrap(response, operation) {
|
|
9
|
+
if (!response.success) {
|
|
10
|
+
throw new Error(`${operation} failed: ${response.error ?? 'unknown error'}`);
|
|
11
|
+
}
|
|
12
|
+
const value = response.data;
|
|
13
|
+
if (value && typeof value === 'object' && !Array.isArray(value) &&
|
|
14
|
+
'data' in value && 'meta' in value) {
|
|
15
|
+
return value.data;
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
const wait = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
20
|
+
async function readConversation(targetOrg, sessionId) {
|
|
21
|
+
const client = (0, api_client_1.createApiClient)(targetOrg);
|
|
22
|
+
const response = await client.get(`/ai-copilot/conversations/${encodeURIComponent(sessionId)}`);
|
|
23
|
+
return unwrap(response, 'conversation read');
|
|
24
|
+
}
|
|
25
|
+
async function converseWorkforceTaskRemote(options) {
|
|
26
|
+
const client = (0, api_client_1.createApiClient)(options.targetOrg);
|
|
27
|
+
const sessionId = options.sessionId ?? (0, node_crypto_1.randomUUID)();
|
|
28
|
+
const before = options.sessionId
|
|
29
|
+
? await readConversation(options.targetOrg, sessionId)
|
|
30
|
+
: null;
|
|
31
|
+
if (before && before.conversation.agentId !== options.agentId) {
|
|
32
|
+
throw new Error('CONVERSATION_AGENT_MISMATCH: session belongs to another agent');
|
|
33
|
+
}
|
|
34
|
+
const history = (before?.messages ?? []).slice(-20).map((message) => ({
|
|
35
|
+
role: message.role === 'assistant' ? 'assistant' : 'user',
|
|
36
|
+
content: message.content,
|
|
37
|
+
}));
|
|
38
|
+
const events = await client.postSse('/ai-copilot/converse', {
|
|
39
|
+
message: options.input,
|
|
40
|
+
history,
|
|
41
|
+
agentId: options.agentId,
|
|
42
|
+
accountId: options.accountId ?? before?.conversation.accountId ?? undefined,
|
|
43
|
+
sessionId,
|
|
44
|
+
sessionMode: 'text',
|
|
45
|
+
channel: 'cli',
|
|
46
|
+
browserContext: options.browserContext,
|
|
47
|
+
imageDocumentId: options.imageDocumentId,
|
|
48
|
+
});
|
|
49
|
+
const remoteError = events.find((event) => event.event === 'error');
|
|
50
|
+
if (remoteError) {
|
|
51
|
+
const message = typeof remoteError.data === 'object' && remoteError.data
|
|
52
|
+
? String(remoteError.data.message ?? 'unknown error')
|
|
53
|
+
: String(remoteError.data);
|
|
54
|
+
throw new Error(`COPILOT_CONVERSE_FAILED: ${message}`);
|
|
55
|
+
}
|
|
56
|
+
const done = [...events].reverse().find((event) => event.event === 'done');
|
|
57
|
+
const doneData = typeof done?.data === 'object' && done.data
|
|
58
|
+
? done.data
|
|
59
|
+
: undefined;
|
|
60
|
+
const reply = doneData
|
|
61
|
+
? String(doneData.text ?? '')
|
|
62
|
+
: '';
|
|
63
|
+
if (!reply)
|
|
64
|
+
throw new Error('COPILOT_CONVERSE_INCOMPLETE: stream ended without done text');
|
|
65
|
+
const executionId = typeof doneData?.executionId === 'string'
|
|
66
|
+
? doneData.executionId
|
|
67
|
+
: '';
|
|
68
|
+
if (!executionId) {
|
|
69
|
+
throw new Error('COPILOT_CONVERSE_UNATTRIBUTED: done event omitted executionId');
|
|
70
|
+
}
|
|
71
|
+
const expectedCount = (before?.conversation.messageCount ?? 0) + 2;
|
|
72
|
+
let after = null;
|
|
73
|
+
for (let attempt = 0; attempt < 8; attempt += 1) {
|
|
74
|
+
after = await readConversation(options.targetOrg, sessionId);
|
|
75
|
+
if ((after?.conversation.messageCount ?? 0) >= expectedCount)
|
|
76
|
+
break;
|
|
77
|
+
await wait(100);
|
|
78
|
+
}
|
|
79
|
+
const priorIds = new Set((before?.messages ?? []).map((message) => message.id));
|
|
80
|
+
const readbackMessageIds = (after?.messages ?? [])
|
|
81
|
+
.filter((message) => !priorIds.has(message.id))
|
|
82
|
+
.map((message) => message.id);
|
|
83
|
+
const directMessageIds = [doneData?.userMessageId, doneData?.assistantMessageId]
|
|
84
|
+
.filter((id) => typeof id === 'string' && id.length > 0);
|
|
85
|
+
const messageIds = directMessageIds.length === 2 ? directMessageIds : readbackMessageIds;
|
|
86
|
+
return {
|
|
87
|
+
sessionId,
|
|
88
|
+
agentId: options.agentId,
|
|
89
|
+
reply,
|
|
90
|
+
messageIds,
|
|
91
|
+
tools: events
|
|
92
|
+
.filter((event) => event.event === 'tool')
|
|
93
|
+
.map((event) => typeof event.data === 'object' && event.data
|
|
94
|
+
? String(event.data.name ?? '')
|
|
95
|
+
: '')
|
|
96
|
+
.filter(Boolean),
|
|
97
|
+
persisted: messageIds.length >= 2,
|
|
98
|
+
messageCount: after?.conversation.messageCount ?? 0,
|
|
99
|
+
executionId,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
async function getWorkforceConversationRemote(options) {
|
|
103
|
+
return readConversation(options.targetOrg, options.sessionId);
|
|
104
|
+
}
|
|
105
|
+
async function listWorkforceConversationsRemote(options) {
|
|
106
|
+
const params = new URLSearchParams();
|
|
107
|
+
if (options.agentId)
|
|
108
|
+
params.set('agentId', options.agentId);
|
|
109
|
+
if (options.accountId)
|
|
110
|
+
params.set('accountId', options.accountId);
|
|
111
|
+
if (options.query)
|
|
112
|
+
params.set('q', options.query);
|
|
113
|
+
if (options.limit !== undefined)
|
|
114
|
+
params.set('limit', String(options.limit));
|
|
115
|
+
const suffix = params.size > 0 ? `?${params.toString()}` : '';
|
|
116
|
+
const client = (0, api_client_1.createApiClient)(options.targetOrg);
|
|
117
|
+
return unwrap(await client.get(`/ai-copilot/conversations${suffix}`), 'conversation list');
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=workforce-conversation-remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workforce-conversation-remote.js","sourceRoot":"","sources":["../../../../src/services/workforce-conversation-remote.ts"],"names":[],"mappings":";;AAqEA,kEA0FC;AAED,wEAKC;AAED,4EAoBC;AA5LD,6CAAyC;AAEzC,6CAA+C;AAkC/C,SAAS,MAAM,CAAI,QAAwD,EAAE,SAAiB;IAC5F,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,YAAY,QAAQ,CAAC,KAAK,IAAI,eAAe,EAAE,CAAC,CAAC;IAC/E,CAAC;IACD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAe,CAAC;IACvC,IACE,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAC3D,MAAM,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,EAClC,CAAC;QACD,OAAQ,KAAqB,CAAC,IAAI,CAAC;IACrC,CAAC;IACD,OAAO,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AAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,IAAI,OAAO,CAAC,SAAS;QAAE,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAClE,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAClD,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;QAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,MAAM,MAAM,GAAG,IAAA,4BAAe,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClD,OAAO,MAAM,CACX,MAAM,MAAM,CAAC,GAAG,CACd,4BAA4B,MAAM,EAAE,CACrC,EACD,mBAAmB,CACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_http_1 = __importDefault(require("node:http"));
|
|
9
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
12
|
+
const auth_store_1 = require("./auth-store");
|
|
13
|
+
const workforce_conversation_remote_1 = require("./workforce-conversation-remote");
|
|
14
|
+
(0, node_test_1.default)('converse reuses server history and returns persisted message IDs', async () => {
|
|
15
|
+
const sessionId = '11111111-1111-4111-8111-111111111111';
|
|
16
|
+
const agentId = '22222222-2222-4222-8222-222222222222';
|
|
17
|
+
const imageDocumentId = '44444444-4444-4444-8444-444444444444';
|
|
18
|
+
const executionId = '55555555-5555-4555-8555-555555555555';
|
|
19
|
+
const requests = [];
|
|
20
|
+
let reads = 0;
|
|
21
|
+
const server = node_http_1.default.createServer((request, response) => {
|
|
22
|
+
const chunks = [];
|
|
23
|
+
request.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
|
|
24
|
+
request.on('end', () => {
|
|
25
|
+
const body = Buffer.concat(chunks).toString('utf8');
|
|
26
|
+
requests.push({ path: request.url ?? '/', body });
|
|
27
|
+
if (request.url === `/ai-copilot/conversations/${sessionId}`) {
|
|
28
|
+
reads += 1;
|
|
29
|
+
response.setHeader('Content-Type', 'application/json');
|
|
30
|
+
response.end(JSON.stringify({
|
|
31
|
+
conversation: {
|
|
32
|
+
id: sessionId,
|
|
33
|
+
agentId,
|
|
34
|
+
channel: 'cli',
|
|
35
|
+
messageCount: reads === 1 ? 2 : 4,
|
|
36
|
+
},
|
|
37
|
+
messages: reads === 1
|
|
38
|
+
? [
|
|
39
|
+
{ id: 'message-1', role: 'user', content: '第一轮' },
|
|
40
|
+
{ id: 'message-2', role: 'assistant', content: '第一轮回复' },
|
|
41
|
+
]
|
|
42
|
+
: [
|
|
43
|
+
{ id: 'message-1', role: 'user', content: '第一轮' },
|
|
44
|
+
{ id: 'message-2', role: 'assistant', content: '第一轮回复' },
|
|
45
|
+
{ id: 'message-3', role: 'user', content: '第二轮' },
|
|
46
|
+
{ id: 'message-4', role: 'assistant', content: '第二轮回复' },
|
|
47
|
+
],
|
|
48
|
+
}));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (request.url === '/ai-copilot/converse') {
|
|
52
|
+
response.setHeader('Content-Type', 'text/event-stream');
|
|
53
|
+
response.end(`event: tool\ndata: {"name":"record.query"}\n\nevent: done\ndata: {"text":"第二轮回复","executionId":"${executionId}","userMessageId":"message-3","assistantMessageId":"message-4"}\n\n`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
response.statusCode = 404;
|
|
57
|
+
response.end('{}');
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
61
|
+
const address = server.address();
|
|
62
|
+
if (!address || typeof address === 'string')
|
|
63
|
+
throw new Error('missing test port');
|
|
64
|
+
const originalCliHome = process.env.NEXUS_CLI_HOME;
|
|
65
|
+
const cliHome = node_fs_1.default.mkdtempSync(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-converse-'));
|
|
66
|
+
process.env.NEXUS_CLI_HOME = cliHome;
|
|
67
|
+
try {
|
|
68
|
+
(0, auth_store_1.saveCredential)({
|
|
69
|
+
alias: 'test-converse',
|
|
70
|
+
instanceUrl: `http://127.0.0.1:${address.port}`,
|
|
71
|
+
accessToken: 'test-token',
|
|
72
|
+
username: 'user-1',
|
|
73
|
+
orgId: '33333333-3333-4333-8333-333333333333',
|
|
74
|
+
});
|
|
75
|
+
const result = await (0, workforce_conversation_remote_1.converseWorkforceTaskRemote)({
|
|
76
|
+
targetOrg: 'test-converse',
|
|
77
|
+
agentId,
|
|
78
|
+
input: '第二轮',
|
|
79
|
+
sessionId,
|
|
80
|
+
browserContext: { type: 'recordPage', objectNameSingular: 'account', recordId: 'account-1' },
|
|
81
|
+
imageDocumentId,
|
|
82
|
+
});
|
|
83
|
+
strict_1.default.deepEqual(result, {
|
|
84
|
+
sessionId,
|
|
85
|
+
agentId,
|
|
86
|
+
reply: '第二轮回复',
|
|
87
|
+
messageIds: ['message-3', 'message-4'],
|
|
88
|
+
tools: ['record.query'],
|
|
89
|
+
persisted: true,
|
|
90
|
+
messageCount: 4,
|
|
91
|
+
executionId,
|
|
92
|
+
});
|
|
93
|
+
const converseBody = JSON.parse(requests.find((request) => request.path === '/ai-copilot/converse')?.body ?? '{}');
|
|
94
|
+
strict_1.default.deepEqual(converseBody.history, [
|
|
95
|
+
{ role: 'user', content: '第一轮' },
|
|
96
|
+
{ role: 'assistant', content: '第一轮回复' },
|
|
97
|
+
]);
|
|
98
|
+
strict_1.default.equal(converseBody.sessionId, sessionId);
|
|
99
|
+
strict_1.default.equal(converseBody.imageDocumentId, imageDocumentId);
|
|
100
|
+
strict_1.default.deepEqual(converseBody.browserContext, {
|
|
101
|
+
type: 'recordPage',
|
|
102
|
+
objectNameSingular: 'account',
|
|
103
|
+
recordId: 'account-1',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
await new Promise((resolve) => server.close(() => resolve()));
|
|
108
|
+
if (originalCliHome === undefined)
|
|
109
|
+
delete process.env.NEXUS_CLI_HOME;
|
|
110
|
+
else
|
|
111
|
+
process.env.NEXUS_CLI_HOME = originalCliHome;
|
|
112
|
+
node_fs_1.default.rmSync(cliHome, { recursive: true, force: true });
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=workforce-conversation-remote.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workforce-conversation-remote.test.js","sourceRoot":"","sources":["../../../../src/services/workforce-conversation-remote.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,sDAAyB;AACzB,0DAA6B;AAC7B,sDAAyB;AACzB,0DAA6B;AAC7B,0DAA6B;AAE7B,6CAA8C;AAC9C,mFAA8E;AAE9E,IAAA,mBAAI,EAAC,kEAAkE,EAAE,KAAK,IAAI,EAAE;IAClF,MAAM,SAAS,GAAG,sCAAsC,CAAC;IACzD,MAAM,OAAO,GAAG,sCAAsC,CAAC;IACvD,MAAM,eAAe,GAAG,sCAAsC,CAAC;IAC/D,MAAM,WAAW,GAAG,sCAAsC,CAAC;IAC3D,MAAM,QAAQ,G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AAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;QAC5D,gBAAM,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,EAAE;YAC5C,IAAI,EAAE,YAAY;YAClB,kBAAkB,EAAE,SAAS;YAC7B,QAAQ,EAAE,WAAW;SACtB,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACpE,IAAI,eAAe,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;;YAChE,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,eAAe,CAAC;QAClD,iBAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -44,6 +44,20 @@ export declare function reorderGuardrailsRemote(options: {
|
|
|
44
44
|
targetOrg: string;
|
|
45
45
|
orderedIds: string[];
|
|
46
46
|
}): Promise<boolean>;
|
|
47
|
+
export interface EmbeddingRouteDiagnosticView {
|
|
48
|
+
providerConfigKey: string | null;
|
|
49
|
+
position: number;
|
|
50
|
+
resolutionSource: string;
|
|
51
|
+
selectedModelId: string | null;
|
|
52
|
+
eligible: boolean;
|
|
53
|
+
reasonCodes: string[];
|
|
54
|
+
}
|
|
55
|
+
export interface EmbeddingRoutingReadinessView {
|
|
56
|
+
workspaceId: string;
|
|
57
|
+
ready: boolean;
|
|
58
|
+
policyState: string;
|
|
59
|
+
candidates: EmbeddingRouteDiagnosticView[];
|
|
60
|
+
}
|
|
47
61
|
export interface IngestResult {
|
|
48
62
|
documentTitle: string;
|
|
49
63
|
totalChunks: number;
|
|
@@ -103,3 +117,6 @@ export declare function deleteKnowledgeDocumentRemote(options: {
|
|
|
103
117
|
export declare function reembedFailedChunksRemote(options: {
|
|
104
118
|
targetOrg: string;
|
|
105
119
|
}): Promise<number>;
|
|
120
|
+
export declare function getEmbeddingRoutingReadinessRemote(options: {
|
|
121
|
+
targetOrg: string;
|
|
122
|
+
}): Promise<EmbeddingRoutingReadinessView>;
|
|
@@ -11,6 +11,7 @@ exports.ingestKnowledgeFileRemote = ingestKnowledgeFileRemote;
|
|
|
11
11
|
exports.ingestKnowledgeUrlRemote = ingestKnowledgeUrlRemote;
|
|
12
12
|
exports.deleteKnowledgeDocumentRemote = deleteKnowledgeDocumentRemote;
|
|
13
13
|
exports.reembedFailedChunksRemote = reembedFailedChunksRemote;
|
|
14
|
+
exports.getEmbeddingRoutingReadinessRemote = getEmbeddingRoutingReadinessRemote;
|
|
14
15
|
const api_client_1 = require("./api-client");
|
|
15
16
|
const CREATE_GUARDRAIL = `
|
|
16
17
|
mutation CreateGuardrailRule($input: CreateGuardrailRuleInput!) {
|
|
@@ -98,6 +99,10 @@ const DELETE_KNOWLEDGE_DOCUMENT = `
|
|
|
98
99
|
mutation DeleteKnowledgeDocument($sourceRecordId: String!) { deleteKnowledgeDocument(sourceRecordId: $sourceRecordId) }`;
|
|
99
100
|
const REEMBED_FAILED = `
|
|
100
101
|
mutation ReembedFailedChunks { reembedFailedChunks }`;
|
|
102
|
+
const EMBEDDING_ROUTING_READINESS = `
|
|
103
|
+
query KnowledgeEmbeddingRoutingReadiness {
|
|
104
|
+
knowledgeEmbeddingRoutingReadiness
|
|
105
|
+
}`;
|
|
101
106
|
async function createKnowledgeChunkRemote(options) {
|
|
102
107
|
const client = (0, api_client_1.createApiClient)(options.targetOrg);
|
|
103
108
|
const input = { title: options.title, content: options.content };
|
|
@@ -171,4 +176,9 @@ async function reembedFailedChunksRemote(options) {
|
|
|
171
176
|
const data = await client.graphql(REEMBED_FAILED, {});
|
|
172
177
|
return data;
|
|
173
178
|
}
|
|
179
|
+
async function getEmbeddingRoutingReadinessRemote(options) {
|
|
180
|
+
const client = (0, api_client_1.createApiClient)(options.targetOrg);
|
|
181
|
+
const data = await client.graphql(EMBEDDING_ROUTING_READINESS, {});
|
|
182
|
+
return data.knowledgeEmbeddingRoutingReadiness;
|
|
183
|
+
}
|
|
174
184
|
//# sourceMappingURL=workforce-guardrail-knowledge-remote.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workforce-guardrail-knowledge-remote.js","sourceRoot":"","sources":["../../../../src/services/workforce-guardrail-knowledge-remote.ts"],"names":[],"mappings":";;AAgDA,sDAsBC;AAED,sDAsBC;AAED,sDAOC;AAED,sDASC;AAED,0DASC;
|
|
1
|
+
{"version":3,"file":"workforce-guardrail-knowledge-remote.js","sourceRoot":"","sources":["../../../../src/services/workforce-guardrail-knowledge-remote.ts"],"names":[],"mappings":";;AAgDA,sDAsBC;AAED,sDAsBC;AAED,sDAOC;AAED,sDASC;AAED,0DASC;AAqED,gEAyBC;AAED,oDAqBC;AAED,8DAgBC;AAED,4DAYC;AAED,sEASC;AAED,8DAMC;AAGD,gFAQC;AAhTD,6CAA+C;AAe/C,MAAM,gBAAgB,GAAG;;;EAGvB,CAAC;AAEH,MAAM,gBAAgB,GAAG;;;EAGvB,CAAC;AAEH,MAAM,gBAAgB,GAAG;wEAC+C,CAAC;AAEzE,MAAM,gBAAgB,GAAG;;;EAGvB,CAAC;AAEH,MAAM,kBAAkB,GAAG;sGAC2E,CAAC;AAchG,KAAK,UAAU,qBAAqB,CAAC,OAQ3C;IACC,MAAM,MAAM,GAAG,IAAA,4BAAe,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,KAAK,GAA4B;QACrC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC;IACF,IAAI,OAAO,CAAC,WAAW,KAAK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AAI,CAAC,kCAAkC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_http_1 = __importDefault(require("node:http"));
|
|
9
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
12
|
+
const auth_store_1 = require("./auth-store");
|
|
13
|
+
const workforce_guardrail_knowledge_remote_1 = require("./workforce-guardrail-knowledge-remote");
|
|
14
|
+
(0, node_test_1.default)('embedding readiness uses the authenticated workspace and returns secret-free diagnostics', async () => {
|
|
15
|
+
let requestPayload;
|
|
16
|
+
const readiness = {
|
|
17
|
+
workspaceId: 'workspace-1',
|
|
18
|
+
ready: false,
|
|
19
|
+
policyState: 'active',
|
|
20
|
+
candidates: [{
|
|
21
|
+
providerConfigKey: 'cloud', position: 0, resolutionSource: 'policy_primary',
|
|
22
|
+
selectedModelId: 'text-embedding-v3', eligible: false,
|
|
23
|
+
reasonCodes: ['PROVIDER_SECRET_NOT_ENCRYPTED_STORE'],
|
|
24
|
+
}],
|
|
25
|
+
};
|
|
26
|
+
const server = node_http_1.default.createServer((request, response) => {
|
|
27
|
+
const chunks = [];
|
|
28
|
+
request.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
|
|
29
|
+
request.on('end', () => {
|
|
30
|
+
requestPayload = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
31
|
+
response.setHeader('Content-Type', 'application/json');
|
|
32
|
+
response.end(JSON.stringify({ data: { knowledgeEmbeddingRoutingReadiness: readiness } }));
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
36
|
+
const address = server.address();
|
|
37
|
+
if (!address || typeof address === 'string')
|
|
38
|
+
throw new Error('missing port');
|
|
39
|
+
const oldHome = process.env.NEXUS_CLI_HOME;
|
|
40
|
+
const cliHome = node_fs_1.default.mkdtempSync(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-knowledge-readiness-'));
|
|
41
|
+
process.env.NEXUS_CLI_HOME = cliHome;
|
|
42
|
+
try {
|
|
43
|
+
(0, auth_store_1.saveCredential)({
|
|
44
|
+
alias: 'readiness-test',
|
|
45
|
+
instanceUrl: `http://127.0.0.1:${address.port}`,
|
|
46
|
+
accessToken: 'token',
|
|
47
|
+
username: 'operator',
|
|
48
|
+
orgId: 'workspace-1',
|
|
49
|
+
});
|
|
50
|
+
const result = await (0, workforce_guardrail_knowledge_remote_1.getEmbeddingRoutingReadinessRemote)({ targetOrg: 'readiness-test' });
|
|
51
|
+
strict_1.default.deepEqual(result, readiness);
|
|
52
|
+
strict_1.default.match(String(requestPayload?.query), /knowledgeEmbeddingRoutingReadiness/);
|
|
53
|
+
strict_1.default.deepEqual(requestPayload?.variables, {});
|
|
54
|
+
strict_1.default.doesNotMatch(JSON.stringify(result), /secretRef|endpoint|env:/i);
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
await new Promise((resolve) => server.close(() => resolve()));
|
|
58
|
+
if (oldHome === undefined)
|
|
59
|
+
delete process.env.NEXUS_CLI_HOME;
|
|
60
|
+
else
|
|
61
|
+
process.env.NEXUS_CLI_HOME = oldHome;
|
|
62
|
+
node_fs_1.default.rmSync(cliHome, { recursive: true, force: true });
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=workforce-guardrail-knowledge-remote.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workforce-guardrail-knowledge-remote.test.js","sourceRoot":"","sources":["../../../../src/services/workforce-guardrail-knowledge-remote.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,sDAAyB;AACzB,0DAA6B;AAC7B,sDAAyB;AACzB,0DAA6B;AAC7B,0DAA6B;AAE7B,6CAA8C;AAC9C,iGAA4F;AAE5F,IAAA,mBAAI,EAAC,0FAA0F,EAAE,KAAK,IAAI,EAAE;IAC1G,IAAI,cAAmD,CAAC;IACxD,MAAM,SAAS,GAAG;QAChB,WAAW,EAAE,aAAa;QAC1B,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,QAAQ;QACrB,UAAU,EAAE,CAAC;gBACX,iBAAiB,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,gBAAgB,EAAE,gBAAgB;gBAC3E,eAAe,EAAE,mBAAmB,EAAE,QAAQ,EAAE,KAAK;gBACrD,WAAW,EAAE,CAAC,qCAAqC,CAAC;aACrD,CAAC;KACH,CAAC;IACF,MAAM,MAAM,GAAG,mBAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;QACrD,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACrB,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACpE,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;YACvD,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,kCA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AAC,EAAE,0BAA0B,CAAC,CAAC;IAC1E,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACpE,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;;YACxD,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,OAAO,CAAC;QAC1C,iBAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export interface WorkforceNotificationView {
|
|
2
|
+
id: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
type: string;
|
|
5
|
+
title: string;
|
|
6
|
+
body: string;
|
|
7
|
+
severity: string;
|
|
8
|
+
idempotencyKey?: string | null;
|
|
9
|
+
relatedObject?: string | null;
|
|
10
|
+
relatedRecordId?: string | null;
|
|
11
|
+
read: boolean;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
}
|
|
14
|
+
export interface WorkforceEscalationRuleView {
|
|
15
|
+
id: string;
|
|
16
|
+
workspaceId: string;
|
|
17
|
+
name: string;
|
|
18
|
+
objectName: string;
|
|
19
|
+
isActive: boolean;
|
|
20
|
+
entries?: Array<Record<string, unknown>>;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function listWorkforceNotificationsRemote(options: {
|
|
25
|
+
targetOrg: string;
|
|
26
|
+
read?: boolean;
|
|
27
|
+
type?: string;
|
|
28
|
+
idempotencyKey?: string;
|
|
29
|
+
}): Promise<WorkforceNotificationView[]>;
|
|
30
|
+
export declare function createWorkforceNotificationRemote(options: {
|
|
31
|
+
targetOrg: string;
|
|
32
|
+
userId: string;
|
|
33
|
+
type: string;
|
|
34
|
+
title: string;
|
|
35
|
+
body: string;
|
|
36
|
+
severity: string;
|
|
37
|
+
idempotencyKey: string;
|
|
38
|
+
relatedObject?: string;
|
|
39
|
+
relatedRecordId?: string;
|
|
40
|
+
}): Promise<{
|
|
41
|
+
notification: WorkforceNotificationView;
|
|
42
|
+
idempotentReplay: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
export declare function listWorkforceEscalationRulesRemote(options: {
|
|
45
|
+
targetOrg: string;
|
|
46
|
+
}): Promise<WorkforceEscalationRuleView[]>;
|
|
47
|
+
export declare function createWorkforceEscalationRuleRemote(options: {
|
|
48
|
+
targetOrg: string;
|
|
49
|
+
name: string;
|
|
50
|
+
}): Promise<WorkforceEscalationRuleView>;
|
|
51
|
+
export declare function addWorkforceEscalationRuleEntryRemote(options: {
|
|
52
|
+
targetOrg: string;
|
|
53
|
+
input: Record<string, unknown>;
|
|
54
|
+
}): Promise<Record<string, unknown>>;
|
|
55
|
+
export declare function activateWorkforceEscalationRuleRemote(options: {
|
|
56
|
+
targetOrg: string;
|
|
57
|
+
ruleId: string;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
activated: boolean;
|
|
60
|
+
rule: WorkforceEscalationRuleView | null;
|
|
61
|
+
}>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listWorkforceNotificationsRemote = listWorkforceNotificationsRemote;
|
|
4
|
+
exports.createWorkforceNotificationRemote = createWorkforceNotificationRemote;
|
|
5
|
+
exports.listWorkforceEscalationRulesRemote = listWorkforceEscalationRulesRemote;
|
|
6
|
+
exports.createWorkforceEscalationRuleRemote = createWorkforceEscalationRuleRemote;
|
|
7
|
+
exports.addWorkforceEscalationRuleEntryRemote = addWorkforceEscalationRuleEntryRemote;
|
|
8
|
+
exports.activateWorkforceEscalationRuleRemote = activateWorkforceEscalationRuleRemote;
|
|
9
|
+
const api_client_1 = require("./api-client");
|
|
10
|
+
const workforce_common_1 = require("./workforce-common");
|
|
11
|
+
const NOTIFICATION_FIELDS = `
|
|
12
|
+
id userId type title body severity idempotencyKey
|
|
13
|
+
relatedObject relatedRecordId read readAt createdAt
|
|
14
|
+
`;
|
|
15
|
+
const RULE_FIELDS = `
|
|
16
|
+
id workspaceId name objectName isActive createdAt updatedAt
|
|
17
|
+
entries { id escalationRuleId sortOrder ageMinutes criteriaExpression
|
|
18
|
+
businessHoursId notifyUserIds notifyEmailTemplateId reassignToUserId
|
|
19
|
+
reassignToQueueId createdAt }
|
|
20
|
+
`;
|
|
21
|
+
async function listWorkforceNotificationsRemote(options) {
|
|
22
|
+
const data = await (0, api_client_1.createApiClient)(options.targetOrg).graphql(`query WorkforceNotifications($filter: NotificationFilterInput) {
|
|
23
|
+
notifications(filter: $filter) { ${NOTIFICATION_FIELDS} }
|
|
24
|
+
}`, { filter: {
|
|
25
|
+
read: options.read,
|
|
26
|
+
type: options.type,
|
|
27
|
+
idempotencyKey: options.idempotencyKey,
|
|
28
|
+
} });
|
|
29
|
+
return data.notifications;
|
|
30
|
+
}
|
|
31
|
+
async function createWorkforceNotificationRemote(options) {
|
|
32
|
+
const before = await listWorkforceNotificationsRemote({
|
|
33
|
+
targetOrg: options.targetOrg,
|
|
34
|
+
idempotencyKey: options.idempotencyKey,
|
|
35
|
+
});
|
|
36
|
+
const data = await (0, api_client_1.createApiClient)(options.targetOrg).graphql(`mutation WorkforceCreateNotification($input: CreateNotificationInput!) {
|
|
37
|
+
createNotification(input: $input) { ${NOTIFICATION_FIELDS} }
|
|
38
|
+
}`, { input: {
|
|
39
|
+
userId: options.userId,
|
|
40
|
+
type: options.type,
|
|
41
|
+
title: options.title,
|
|
42
|
+
body: options.body,
|
|
43
|
+
severity: options.severity,
|
|
44
|
+
idempotencyKey: options.idempotencyKey,
|
|
45
|
+
relatedObject: options.relatedObject,
|
|
46
|
+
relatedRecordId: options.relatedRecordId,
|
|
47
|
+
} });
|
|
48
|
+
return {
|
|
49
|
+
notification: data.createNotification,
|
|
50
|
+
idempotentReplay: before.some((item) => item.id === data.createNotification.id),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async function listWorkforceEscalationRulesRemote(options) {
|
|
54
|
+
const workspaceId = (0, workforce_common_1.resolveWorkspaceId)(options.targetOrg);
|
|
55
|
+
const data = await (0, api_client_1.createApiClient)(options.targetOrg).graphql(`query WorkforceEscalationRules($workspaceId: String!) {
|
|
56
|
+
escalationRules(workspaceId: $workspaceId) { ${RULE_FIELDS} }
|
|
57
|
+
}`, { workspaceId });
|
|
58
|
+
return data.escalationRules;
|
|
59
|
+
}
|
|
60
|
+
async function createWorkforceEscalationRuleRemote(options) {
|
|
61
|
+
const workspaceId = (0, workforce_common_1.resolveWorkspaceId)(options.targetOrg);
|
|
62
|
+
const data = await (0, api_client_1.createApiClient)(options.targetOrg).graphql(`mutation WorkforceCreateEscalationRule($input: CreateEscalationRuleInput!) {
|
|
63
|
+
createEscalationRule(input: $input) { ${RULE_FIELDS} }
|
|
64
|
+
}`, { input: { workspaceId, name: options.name } });
|
|
65
|
+
return data.createEscalationRule;
|
|
66
|
+
}
|
|
67
|
+
async function addWorkforceEscalationRuleEntryRemote(options) {
|
|
68
|
+
const data = await (0, api_client_1.createApiClient)(options.targetOrg).graphql(`mutation WorkforceAddEscalationRuleEntry($input: CreateEscalationRuleEntryInput!) {
|
|
69
|
+
addEscalationRuleEntry(input: $input) {
|
|
70
|
+
id escalationRuleId sortOrder ageMinutes criteriaExpression businessHoursId
|
|
71
|
+
notifyUserIds notifyEmailTemplateId reassignToUserId reassignToQueueId createdAt
|
|
72
|
+
}
|
|
73
|
+
}`, { input: options.input });
|
|
74
|
+
return data.addEscalationRuleEntry;
|
|
75
|
+
}
|
|
76
|
+
async function activateWorkforceEscalationRuleRemote(options) {
|
|
77
|
+
const workspaceId = (0, workforce_common_1.resolveWorkspaceId)(options.targetOrg);
|
|
78
|
+
const client = (0, api_client_1.createApiClient)(options.targetOrg);
|
|
79
|
+
const mutation = await client.graphql(`mutation WorkforceActivateEscalationRule($ruleId: String!, $workspaceId: String!) {
|
|
80
|
+
activateEscalationRule(ruleId: $ruleId, workspaceId: $workspaceId)
|
|
81
|
+
}`, { ruleId: options.ruleId, workspaceId });
|
|
82
|
+
const readback = await client.graphql(`query WorkforceEscalationRule($id: String!) {
|
|
83
|
+
escalationRule(id: $id) { ${RULE_FIELDS} }
|
|
84
|
+
}`, { id: options.ruleId });
|
|
85
|
+
return { activated: mutation.activateEscalationRule, rule: readback.escalationRule };
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=workforce-notification-remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workforce-notification-remote.js","sourceRoot":"","sources":["../../../../src/services/workforce-notification-remote.ts"],"names":[],"mappings":";;AAuCA,4EAgBC;AAED,8EAiCC;AAED,gFAUC;AAED,kFAWC;AAED,sFAaC;AAED,sFAmBC;AAvJD,6CAA+C;AAC/C,yDAAwD;AA2BxD,MAAM,mBAAmB,GAAG;;;CAG3B,CAAC;AACF,MAAM,WAAW,GAAG;;;;;CAKnB,CAAC;AAEK,KAAK,UAAU,gCAAgC,CAAC,OAKtD;IACC,MAAM,IAAI,GAAG,MAAM,IAAA,4BAAe,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,CAE1D;uCACkC,mBAAmB;IACtD,EAAE,EAAE,MAAM,EAAE;YACZ,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,cAAc,EAAE,OAAO,CAAC,cAAc;SACvC,EAAE,CAAC,CAAC;IACL,OAAO,IAAI,CAAC,aAAa,CAAC;AAC5B,CAAC;AAEM,KAAK,UAAU,iCAAiC,CAAC,OAUvD;IACC,MAAM,MAAM,GAAG,MAAM,gCAAgC,CAAC;QACpD,SAAS,EAAE,OAAO,CAAC,SAAS;QAC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