@salesforce/plugin-agent 1.33.0 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -20
- package/lib/commands/agent/preview/sessions.d.ts +3 -0
- package/lib/commands/agent/preview/sessions.js +9 -3
- package/lib/commands/agent/preview/sessions.js.map +1 -1
- package/lib/commands/agent/preview/start.js +7 -1
- package/lib/commands/agent/preview/start.js.map +1 -1
- package/lib/previewSessionStore.d.ts +1 -45
- package/lib/previewSessionStore.js +1 -137
- package/lib/previewSessionStore.js.map +1 -1
- package/messages/agent.preview.sessions.md +10 -2
- package/oclif.manifest.json +92 -92
- package/package.json +4 -4
- package/schemas/agent-preview-sessions.json +10 -0
package/README.md
CHANGED
|
@@ -126,7 +126,7 @@ EXAMPLES
|
|
|
126
126
|
$ sf agent activate --api-name Resort_Manager --version 2 --target-org my-org
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
_See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
129
|
+
_See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/activate.ts)_
|
|
130
130
|
|
|
131
131
|
## `sf agent create`
|
|
132
132
|
|
|
@@ -193,7 +193,7 @@ EXAMPLES
|
|
|
193
193
|
$ sf agent create --name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
|
|
194
194
|
```
|
|
195
195
|
|
|
196
|
-
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
196
|
+
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/create.ts)_
|
|
197
197
|
|
|
198
198
|
## `sf agent deactivate`
|
|
199
199
|
|
|
@@ -234,7 +234,7 @@ EXAMPLES
|
|
|
234
234
|
$ sf agent deactivate --api-name Resort_Manager --target-org my-org
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
-
_See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
237
|
+
_See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/deactivate.ts)_
|
|
238
238
|
|
|
239
239
|
## `sf agent generate agent-spec`
|
|
240
240
|
|
|
@@ -341,7 +341,7 @@ EXAMPLES
|
|
|
341
341
|
$ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
|
|
342
342
|
```
|
|
343
343
|
|
|
344
|
-
_See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
344
|
+
_See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/generate/agent-spec.ts)_
|
|
345
345
|
|
|
346
346
|
## `sf agent generate authoring-bundle`
|
|
347
347
|
|
|
@@ -418,7 +418,7 @@ EXAMPLES
|
|
|
418
418
|
other-package-dir/main/default --target-org my-dev-org
|
|
419
419
|
```
|
|
420
420
|
|
|
421
|
-
_See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
421
|
+
_See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/generate/authoring-bundle.ts)_
|
|
422
422
|
|
|
423
423
|
## `sf agent generate template`
|
|
424
424
|
|
|
@@ -480,7 +480,7 @@ EXAMPLES
|
|
|
480
480
|
my-package --source-org my-scratch-org
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
-
_See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
483
|
+
_See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/generate/template.ts)_
|
|
484
484
|
|
|
485
485
|
## `sf agent generate test-spec`
|
|
486
486
|
|
|
@@ -545,7 +545,7 @@ EXAMPLES
|
|
|
545
545
|
force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml
|
|
546
546
|
```
|
|
547
547
|
|
|
548
|
-
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
548
|
+
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/generate/test-spec.ts)_
|
|
549
549
|
|
|
550
550
|
## `sf agent preview`
|
|
551
551
|
|
|
@@ -618,7 +618,7 @@ EXAMPLES
|
|
|
618
618
|
$ sf agent preview --use-live-actions --apex-debug --output-dir transcripts/my-preview
|
|
619
619
|
```
|
|
620
620
|
|
|
621
|
-
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
621
|
+
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/preview.ts)_
|
|
622
622
|
|
|
623
623
|
## `sf agent preview end`
|
|
624
624
|
|
|
@@ -673,7 +673,7 @@ EXAMPLES
|
|
|
673
673
|
$ sf agent preview end --authoring-bundle My_Local_Agent
|
|
674
674
|
```
|
|
675
675
|
|
|
676
|
-
_See code: [src/commands/agent/preview/end.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
676
|
+
_See code: [src/commands/agent/preview/end.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/preview/end.ts)_
|
|
677
677
|
|
|
678
678
|
## `sf agent preview send`
|
|
679
679
|
|
|
@@ -731,7 +731,7 @@ EXAMPLES
|
|
|
731
731
|
$ sf agent preview send --utterance "what can you help me with?" --authoring-bundle My_Local_Agent
|
|
732
732
|
```
|
|
733
733
|
|
|
734
|
-
_See code: [src/commands/agent/preview/send.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
734
|
+
_See code: [src/commands/agent/preview/send.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/preview/send.ts)_
|
|
735
735
|
|
|
736
736
|
## `sf agent preview sessions`
|
|
737
737
|
|
|
@@ -753,7 +753,7 @@ DESCRIPTION
|
|
|
753
753
|
"agent preview end" commands with the --session-id flag.
|
|
754
754
|
|
|
755
755
|
Programmatic agent preview sessions can be started for both published activated agents and by using an agent's local
|
|
756
|
-
authoring bundle, which contains its Agent Script file.
|
|
756
|
+
authoring bundle, which contains its Agent Script file. In this command's output table, the Agent column contains
|
|
757
757
|
either the API name of the authoring bundle or the published agent, whichever was used when starting the session. In
|
|
758
758
|
the table, if the same API name has multiple rows with different session IDs, then it means that you previously
|
|
759
759
|
started multiple preview sessions with the associated agent.
|
|
@@ -764,7 +764,7 @@ EXAMPLES
|
|
|
764
764
|
$ sf agent preview sessions
|
|
765
765
|
```
|
|
766
766
|
|
|
767
|
-
_See code: [src/commands/agent/preview/sessions.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
767
|
+
_See code: [src/commands/agent/preview/sessions.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/preview/sessions.ts)_
|
|
768
768
|
|
|
769
769
|
## `sf agent preview start`
|
|
770
770
|
|
|
@@ -829,7 +829,7 @@ EXAMPLES
|
|
|
829
829
|
$ sf agent preview start --api-name My_Published_Agent
|
|
830
830
|
```
|
|
831
831
|
|
|
832
|
-
_See code: [src/commands/agent/preview/start.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
832
|
+
_See code: [src/commands/agent/preview/start.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/preview/start.ts)_
|
|
833
833
|
|
|
834
834
|
## `sf agent publish authoring-bundle`
|
|
835
835
|
|
|
@@ -878,7 +878,7 @@ EXAMPLES
|
|
|
878
878
|
$ sf agent publish authoring-bundle --api-name MyAuthoringbundle --target-org my-dev-org
|
|
879
879
|
```
|
|
880
880
|
|
|
881
|
-
_See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
881
|
+
_See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/publish/authoring-bundle.ts)_
|
|
882
882
|
|
|
883
883
|
## `sf agent test create`
|
|
884
884
|
|
|
@@ -933,7 +933,7 @@ EXAMPLES
|
|
|
933
933
|
$ sf agent test create --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview
|
|
934
934
|
```
|
|
935
935
|
|
|
936
|
-
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
936
|
+
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/test/create.ts)_
|
|
937
937
|
|
|
938
938
|
## `sf agent test list`
|
|
939
939
|
|
|
@@ -968,7 +968,7 @@ EXAMPLES
|
|
|
968
968
|
$ sf agent test list --target-org my-org
|
|
969
969
|
```
|
|
970
970
|
|
|
971
|
-
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
971
|
+
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/test/list.ts)_
|
|
972
972
|
|
|
973
973
|
## `sf agent test results`
|
|
974
974
|
|
|
@@ -1034,7 +1034,7 @@ FLAG DESCRIPTIONS
|
|
|
1034
1034
|
expression when using custom evaluations.
|
|
1035
1035
|
```
|
|
1036
1036
|
|
|
1037
|
-
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
1037
|
+
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/test/results.ts)_
|
|
1038
1038
|
|
|
1039
1039
|
## `sf agent test resume`
|
|
1040
1040
|
|
|
@@ -1107,7 +1107,7 @@ FLAG DESCRIPTIONS
|
|
|
1107
1107
|
expression when using custom evaluations.
|
|
1108
1108
|
```
|
|
1109
1109
|
|
|
1110
|
-
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
1110
|
+
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/test/resume.ts)_
|
|
1111
1111
|
|
|
1112
1112
|
## `sf agent test run`
|
|
1113
1113
|
|
|
@@ -1181,7 +1181,7 @@ FLAG DESCRIPTIONS
|
|
|
1181
1181
|
expression when using custom evaluations.
|
|
1182
1182
|
```
|
|
1183
1183
|
|
|
1184
|
-
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
1184
|
+
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/test/run.ts)_
|
|
1185
1185
|
|
|
1186
1186
|
## `sf agent validate authoring-bundle`
|
|
1187
1187
|
|
|
@@ -1228,6 +1228,6 @@ EXAMPLES
|
|
|
1228
1228
|
$ sf agent validate authoring-bundle --api-name MyAuthoringBundle --target-org my-dev-org
|
|
1229
1229
|
```
|
|
1230
1230
|
|
|
1231
|
-
_See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
1231
|
+
_See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.34.0/src/commands/agent/validate/authoring-bundle.ts)_
|
|
1232
1232
|
|
|
1233
1233
|
<!-- commandsstop -->
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { SessionType } from '../../../previewSessionStore.js';
|
|
2
3
|
export type AgentPreviewSessionsResult = Array<{
|
|
3
4
|
agentId: string;
|
|
4
5
|
displayName?: string;
|
|
5
6
|
sessionId: string;
|
|
7
|
+
timestamp?: string;
|
|
8
|
+
sessionType?: SessionType;
|
|
6
9
|
}>;
|
|
7
10
|
export default class AgentPreviewSessions extends SfCommand<AgentPreviewSessionsResult> {
|
|
8
11
|
static readonly summary: string;
|
|
@@ -29,9 +29,9 @@ export default class AgentPreviewSessions extends SfCommand {
|
|
|
29
29
|
async run() {
|
|
30
30
|
const entries = await listCachedSessions(this.project);
|
|
31
31
|
const rows = [];
|
|
32
|
-
for (const { agentId, displayName,
|
|
33
|
-
for (const sessionId of
|
|
34
|
-
rows.push({ agentId, displayName, sessionId });
|
|
32
|
+
for (const { agentId, displayName, sessions } of entries) {
|
|
33
|
+
for (const { sessionId, timestamp, sessionType } of sessions) {
|
|
34
|
+
rows.push({ agentId, displayName, sessionId, timestamp, sessionType });
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
if (rows.length === 0) {
|
|
@@ -43,15 +43,21 @@ export default class AgentPreviewSessions extends SfCommand {
|
|
|
43
43
|
}
|
|
44
44
|
const agentColumnHeader = messages.getMessage('output.tableHeader.agent');
|
|
45
45
|
const sessionIdHeader = messages.getMessage('output.tableHeader.sessionId');
|
|
46
|
+
const timestampHeader = messages.getMessage('output.tableHeader.timestamp');
|
|
47
|
+
const sessionTypeHeader = messages.getMessage('output.tableHeader.sessionType');
|
|
46
48
|
const tableData = rows.map((r) => ({
|
|
47
49
|
agent: r.displayName ?? r.agentId,
|
|
48
50
|
sessionId: r.sessionId,
|
|
51
|
+
timestamp: r.timestamp ?? '',
|
|
52
|
+
sessionType: r.sessionType ?? '',
|
|
49
53
|
}));
|
|
50
54
|
this.table({
|
|
51
55
|
data: tableData,
|
|
52
56
|
columns: [
|
|
53
57
|
{ key: 'agent', name: agentColumnHeader },
|
|
54
58
|
{ key: 'sessionId', name: sessionIdHeader },
|
|
59
|
+
{ key: 'timestamp', name: timestampHeader },
|
|
60
|
+
{ key: 'sessionType', name: sessionTypeHeader },
|
|
55
61
|
],
|
|
56
62
|
});
|
|
57
63
|
return rows;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../../../src/commands/agent/preview/s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iB,EAAE;gBACzC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE;gBAC3C,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE;gBAC3C,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,iBAAiB,EAAE;aAChD;SACF,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC"}
|
|
@@ -117,11 +117,17 @@ export default class AgentPreviewStart extends SfCommand {
|
|
|
117
117
|
throw new SfError(messages.getMessage('error.previewStartFailed', [wrapped.message]), 'PreviewStartFailed', [wrapped.message], 4, wrapped);
|
|
118
118
|
}
|
|
119
119
|
const displayName = flags['authoring-bundle'] ?? flags['api-name'];
|
|
120
|
-
|
|
120
|
+
const sessionType = resolveSessionType(agent, simulateActions);
|
|
121
|
+
await createCache(agent, { displayName, sessionType });
|
|
121
122
|
await Lifecycle.getInstance().emitTelemetry({ eventName: 'agent_preview_start_success' });
|
|
122
123
|
const result = { sessionId: session.sessionId, agentApiName: agentIdentifier };
|
|
123
124
|
this.log(messages.getMessage('output.sessionId', [session.sessionId]));
|
|
124
125
|
return result;
|
|
125
126
|
}
|
|
126
127
|
}
|
|
128
|
+
function resolveSessionType(agent, simulateActions) {
|
|
129
|
+
if (agent instanceof ProductionAgent)
|
|
130
|
+
return 'published';
|
|
131
|
+
return simulateActions ? 'simulated' : 'live';
|
|
132
|
+
}
|
|
127
133
|
//# sourceMappingURL=start.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../../src/commands/agent/preview/start.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EA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AAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC;AAChD,CAAC"}
|
|
@@ -1,45 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ProductionAgent, ScriptAgent } from '@salesforce/agents';
|
|
3
|
-
export type SessionMeta = {
|
|
4
|
-
displayName?: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Save a marker so send/end can validate that the session was started for this agent.
|
|
8
|
-
* Caller must have started the session (agent has sessionId set). Uses agent.getHistoryDir() for the path.
|
|
9
|
-
* Pass displayName (authoring bundle name or production agent API name) so "agent preview sessions" can show it.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createCache(agent: ScriptAgent | ProductionAgent, options?: {
|
|
12
|
-
displayName?: string;
|
|
13
|
-
}): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Validate that the session was started for this agent (marker file exists in agent's history dir for current sessionId).
|
|
16
|
-
* Caller must set sessionId on the agent (agent.setSessionId) before calling.
|
|
17
|
-
* Throws SfError if the session marker is not found.
|
|
18
|
-
*/
|
|
19
|
-
export declare function validatePreviewSession(agent: ScriptAgent | ProductionAgent): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Remove the session marker so this session is no longer considered "active" for send/end without --session-id.
|
|
22
|
-
* Call after ending the session. Caller must set sessionId on the agent before calling.
|
|
23
|
-
*/
|
|
24
|
-
export declare function removeCache(agent: ScriptAgent | ProductionAgent): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* List session IDs that have a cache marker (started via "agent preview start") for this agent.
|
|
27
|
-
* Uses project path and agent's storage ID to find .sfdx/agents/<agentId>/sessions/<sessionId>/session-meta.json.
|
|
28
|
-
*/
|
|
29
|
-
export declare function getCachedSessionIds(project: SfProject, agent: ScriptAgent | ProductionAgent): Promise<string[]>;
|
|
30
|
-
/**
|
|
31
|
-
* Return the single "current" session ID when safe: exactly one cached session for this agent.
|
|
32
|
-
* Returns undefined when there are zero or multiple sessions (caller should require --session-id).
|
|
33
|
-
*/
|
|
34
|
-
export declare function getCurrentSessionId(project: SfProject, agent: ScriptAgent | ProductionAgent): Promise<string | undefined>;
|
|
35
|
-
export type CachedSessionEntry = {
|
|
36
|
-
agentId: string;
|
|
37
|
-
displayName?: string;
|
|
38
|
-
sessionIds: string[];
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* List all cached preview sessions in the project, grouped by agent ID.
|
|
42
|
-
* displayName (when present in session-meta.json) is the authoring bundle name or production agent API name for display.
|
|
43
|
-
* Use this to show users which sessions exist so they can end or clean up.
|
|
44
|
-
*/
|
|
45
|
-
export declare function listCachedSessions(project: SfProject): Promise<CachedSessionEntry[]>;
|
|
1
|
+
export { createPreviewSessionCache as createCache, validatePreviewSession, removePreviewSessionCache as removeCache, getCachedPreviewSessionIds as getCachedSessionIds, getCurrentPreviewSessionId as getCurrentSessionId, listCachedPreviewSessions as listCachedSessions, type SessionType, type PreviewSessionMeta, type CachedPreviewSessionInfo, type CachedPreviewSessionEntry, } from '@salesforce/agents';
|
|
@@ -13,141 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
import { join } from 'node:path';
|
|
18
|
-
import { SfError } from '@salesforce/core';
|
|
19
|
-
const SESSION_META_FILE = 'session-meta.json';
|
|
20
|
-
/**
|
|
21
|
-
* Save a marker so send/end can validate that the session was started for this agent.
|
|
22
|
-
* Caller must have started the session (agent has sessionId set). Uses agent.getHistoryDir() for the path.
|
|
23
|
-
* Pass displayName (authoring bundle name or production agent API name) so "agent preview sessions" can show it.
|
|
24
|
-
*/
|
|
25
|
-
export async function createCache(agent, options) {
|
|
26
|
-
const historyDir = await agent.getHistoryDir();
|
|
27
|
-
const metaPath = join(historyDir, SESSION_META_FILE);
|
|
28
|
-
const meta = { displayName: options?.displayName };
|
|
29
|
-
await writeFile(metaPath, JSON.stringify(meta), 'utf-8');
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Validate that the session was started for this agent (marker file exists in agent's history dir for current sessionId).
|
|
33
|
-
* Caller must set sessionId on the agent (agent.setSessionId) before calling.
|
|
34
|
-
* Throws SfError if the session marker is not found.
|
|
35
|
-
*/
|
|
36
|
-
export async function validatePreviewSession(agent) {
|
|
37
|
-
const historyDir = await agent.getHistoryDir();
|
|
38
|
-
const metaPath = join(historyDir, SESSION_META_FILE);
|
|
39
|
-
try {
|
|
40
|
-
await readFile(metaPath, 'utf-8');
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
throw new SfError('No preview session found for this session ID. Run "sf agent preview start" first.', 'PreviewSessionNotFound');
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Remove the session marker so this session is no longer considered "active" for send/end without --session-id.
|
|
48
|
-
* Call after ending the session. Caller must set sessionId on the agent before calling.
|
|
49
|
-
*/
|
|
50
|
-
export async function removeCache(agent) {
|
|
51
|
-
const historyDir = await agent.getHistoryDir();
|
|
52
|
-
const metaPath = join(historyDir, SESSION_META_FILE);
|
|
53
|
-
try {
|
|
54
|
-
await unlink(metaPath);
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
// already removed or never created
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* List session IDs that have a cache marker (started via "agent preview start") for this agent.
|
|
62
|
-
* Uses project path and agent's storage ID to find .sfdx/agents/<agentId>/sessions/<sessionId>/session-meta.json.
|
|
63
|
-
*/
|
|
64
|
-
export async function getCachedSessionIds(project, agent) {
|
|
65
|
-
const agentId = agent.getAgentIdForStorage();
|
|
66
|
-
const base = join(project.getPath(), '.sfdx');
|
|
67
|
-
const sessionsDir = join(base, 'agents', agentId, 'sessions');
|
|
68
|
-
const sessionIds = [];
|
|
69
|
-
try {
|
|
70
|
-
const entries = await readdir(sessionsDir, { withFileTypes: true });
|
|
71
|
-
const dirs = entries.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
72
|
-
const hasMarker = await Promise.all(dirs.map(async (name) => {
|
|
73
|
-
try {
|
|
74
|
-
await readFile(join(sessionsDir, name, SESSION_META_FILE), 'utf-8');
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
}));
|
|
81
|
-
dirs.forEach((name, i) => {
|
|
82
|
-
if (hasMarker[i])
|
|
83
|
-
sessionIds.push(name);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
// sessions dir missing or unreadable
|
|
88
|
-
}
|
|
89
|
-
return sessionIds;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Return the single "current" session ID when safe: exactly one cached session for this agent.
|
|
93
|
-
* Returns undefined when there are zero or multiple sessions (caller should require --session-id).
|
|
94
|
-
*/
|
|
95
|
-
export async function getCurrentSessionId(project, agent) {
|
|
96
|
-
const ids = await getCachedSessionIds(project, agent);
|
|
97
|
-
return ids.length === 1 ? ids[0] : undefined;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* List all cached preview sessions in the project, grouped by agent ID.
|
|
101
|
-
* displayName (when present in session-meta.json) is the authoring bundle name or production agent API name for display.
|
|
102
|
-
* Use this to show users which sessions exist so they can end or clean up.
|
|
103
|
-
*/
|
|
104
|
-
export async function listCachedSessions(project) {
|
|
105
|
-
const base = join(project.getPath(), '.sfdx', 'agents');
|
|
106
|
-
const result = [];
|
|
107
|
-
try {
|
|
108
|
-
const agentDirs = await readdir(base, { withFileTypes: true });
|
|
109
|
-
const entries = await Promise.all(agentDirs
|
|
110
|
-
.filter((ent) => ent.isDirectory())
|
|
111
|
-
.map(async (ent) => {
|
|
112
|
-
const agentId = ent.name;
|
|
113
|
-
const sessionsDir = join(base, agentId, 'sessions');
|
|
114
|
-
let sessionIds = [];
|
|
115
|
-
let displayName;
|
|
116
|
-
try {
|
|
117
|
-
const sessionDirs = await readdir(sessionsDir, { withFileTypes: true });
|
|
118
|
-
const withMarker = await Promise.all(sessionDirs
|
|
119
|
-
.filter((s) => s.isDirectory())
|
|
120
|
-
.map(async (s) => {
|
|
121
|
-
try {
|
|
122
|
-
await readFile(join(sessionsDir, s.name, SESSION_META_FILE), 'utf-8');
|
|
123
|
-
return s.name;
|
|
124
|
-
}
|
|
125
|
-
catch {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
}));
|
|
129
|
-
sessionIds = withMarker.filter((id) => id !== null);
|
|
130
|
-
if (sessionIds.length > 0) {
|
|
131
|
-
try {
|
|
132
|
-
const raw = await readFile(join(sessionsDir, sessionIds[0], SESSION_META_FILE), 'utf-8');
|
|
133
|
-
const meta = JSON.parse(raw);
|
|
134
|
-
displayName = meta.displayName;
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
// ignore
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
catch {
|
|
142
|
-
// no sessions dir or unreadable
|
|
143
|
-
}
|
|
144
|
-
return { agentId, displayName, sessionIds };
|
|
145
|
-
}));
|
|
146
|
-
result.push(...entries.filter((e) => e.sessionIds.length > 0));
|
|
147
|
-
}
|
|
148
|
-
catch {
|
|
149
|
-
// no agents dir or unreadable
|
|
150
|
-
}
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
16
|
+
export { createPreviewSessionCache as createCache, validatePreviewSession, removePreviewSessionCache as removeCache, getCachedPreviewSessionIds as getCachedSessionIds, getCurrentPreviewSessionId as getCurrentSessionId, listCachedPreviewSessions as listCachedSessions, } from '@salesforce/agents';
|
|
153
17
|
//# sourceMappingURL=previewSessionStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewSessionStore.js","sourceRoot":"","sources":["../src/previewSessionStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"previewSessionStore.js","sourceRoot":"","sources":["../src/previewSessionStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,yBAAyB,IAAI,WAAW,EACxC,sBAAsB,EACtB,yBAAyB,IAAI,WAAW,EACxC,0BAA0B,IAAI,mBAAmB,EACjD,0BAA0B,IAAI,mBAAmB,EACjD,yBAAyB,IAAI,kBAAkB,GAKhD,MAAM,oBAAoB,CAAC"}
|
|
@@ -6,7 +6,7 @@ List all known programmatic agent preview sessions.
|
|
|
6
6
|
|
|
7
7
|
This command lists the agent preview sessions that were started with the "agent preview start" command and are still in the local cache. Use this command to discover specific session IDs that you can pass to the "agent preview send" or "agent preview end" commands with the --session-id flag.
|
|
8
8
|
|
|
9
|
-
Programmatic agent preview sessions can be started for both published activated agents and by using an agent's local authoring bundle, which contains its Agent Script file.
|
|
9
|
+
Programmatic agent preview sessions can be started for both published activated agents and by using an agent's local authoring bundle, which contains its Agent Script file. In this command's output table, the Agent column contains either the API name of the authoring bundle or the published agent, whichever was used when starting the session. In the table, if the same API name has multiple rows with different session IDs, then it means that you previously started multiple preview sessions with the associated agent.
|
|
10
10
|
|
|
11
11
|
# output.empty
|
|
12
12
|
|
|
@@ -20,8 +20,16 @@ Agent (authoring bundle or API name)
|
|
|
20
20
|
|
|
21
21
|
Session ID
|
|
22
22
|
|
|
23
|
+
# output.tableHeader.timestamp
|
|
24
|
+
|
|
25
|
+
Started At
|
|
26
|
+
|
|
27
|
+
# output.tableHeader.sessionType
|
|
28
|
+
|
|
29
|
+
Session Type
|
|
30
|
+
|
|
23
31
|
# examples
|
|
24
32
|
|
|
25
33
|
- List all cached agent preview sessions:
|
|
26
34
|
|
|
27
|
-
|
|
35
|
+
<%= config.bin %> <%= command.id %>
|
package/oclif.manifest.json
CHANGED
|
@@ -868,6 +868,96 @@
|
|
|
868
868
|
"test-spec:generate:agent"
|
|
869
869
|
]
|
|
870
870
|
},
|
|
871
|
+
"agent:publish:authoring-bundle": {
|
|
872
|
+
"aliases": [],
|
|
873
|
+
"args": {},
|
|
874
|
+
"description": "An authoring bundle is a metadata type (named aiAuthoringBundle) that provides the blueprint for an agent. The metadata type contains two files: the standard metatada XML file and an Agent Script file (extension \".agent\") that fully describes the agent using the Agent Script language.\n\nWhen you publish an authoring bundle to your org, a number of things happen. First, this command validates that the Agent Script file successfully compiles. If there are compilation errors, the command exits and you must fix the Agent Script file to continue. Once the Agent Script file compiles, then it's published to the org, which in turn creates new associated metadata (Bot, BotVersion, GenAiX), or new versions of the metadata if the agent already exists. The new or updated metadata is retrieved back to your DX project; specify the --skip-retrieve flag to skip this step. Finally, the authoring bundle metadata (AiAuthoringBundle) is deployed to your org.\n\nThis command uses the API name of the authoring bundle.",
|
|
875
|
+
"examples": [
|
|
876
|
+
"Publish an authoring bundle by being prompted for its API name; use your default org:\n<%= config.bin %> <%= command.id %>",
|
|
877
|
+
"Publish an authoring bundle with API name MyAuthoringBundle to the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --target-org my-dev-org"
|
|
878
|
+
],
|
|
879
|
+
"flags": {
|
|
880
|
+
"json": {
|
|
881
|
+
"description": "Format output as json.",
|
|
882
|
+
"helpGroup": "GLOBAL",
|
|
883
|
+
"name": "json",
|
|
884
|
+
"allowNo": false,
|
|
885
|
+
"type": "boolean"
|
|
886
|
+
},
|
|
887
|
+
"flags-dir": {
|
|
888
|
+
"helpGroup": "GLOBAL",
|
|
889
|
+
"name": "flags-dir",
|
|
890
|
+
"summary": "Import flag values from a directory.",
|
|
891
|
+
"hasDynamicHelp": false,
|
|
892
|
+
"multiple": false,
|
|
893
|
+
"type": "option"
|
|
894
|
+
},
|
|
895
|
+
"target-org": {
|
|
896
|
+
"char": "o",
|
|
897
|
+
"name": "target-org",
|
|
898
|
+
"noCacheDefault": true,
|
|
899
|
+
"required": true,
|
|
900
|
+
"summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
|
|
901
|
+
"hasDynamicHelp": true,
|
|
902
|
+
"multiple": false,
|
|
903
|
+
"type": "option"
|
|
904
|
+
},
|
|
905
|
+
"api-version": {
|
|
906
|
+
"description": "Override the api version used for api requests made by this command",
|
|
907
|
+
"name": "api-version",
|
|
908
|
+
"hasDynamicHelp": false,
|
|
909
|
+
"multiple": false,
|
|
910
|
+
"type": "option"
|
|
911
|
+
},
|
|
912
|
+
"api-name": {
|
|
913
|
+
"char": "n",
|
|
914
|
+
"name": "api-name",
|
|
915
|
+
"summary": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
|
|
916
|
+
"hasDynamicHelp": false,
|
|
917
|
+
"multiple": false,
|
|
918
|
+
"type": "option"
|
|
919
|
+
},
|
|
920
|
+
"skip-retrieve": {
|
|
921
|
+
"name": "skip-retrieve",
|
|
922
|
+
"summary": "Don't retrieve the metadata associated with the agent to your DX project.",
|
|
923
|
+
"allowNo": false,
|
|
924
|
+
"type": "boolean"
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
"hasDynamicHelp": true,
|
|
928
|
+
"hiddenAliases": [],
|
|
929
|
+
"id": "agent:publish:authoring-bundle",
|
|
930
|
+
"pluginAlias": "@salesforce/plugin-agent",
|
|
931
|
+
"pluginName": "@salesforce/plugin-agent",
|
|
932
|
+
"pluginType": "core",
|
|
933
|
+
"strict": true,
|
|
934
|
+
"summary": "Publish an authoring bundle to your org, which results in a new agent or a new version of an existing agent.",
|
|
935
|
+
"enableJsonFlag": true,
|
|
936
|
+
"requiresProject": true,
|
|
937
|
+
"FLAGGABLE_PROMPTS": {
|
|
938
|
+
"api-name": {
|
|
939
|
+
"message": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
|
|
940
|
+
"promptMessage": "API name of the authoring bundle to publish"
|
|
941
|
+
}
|
|
942
|
+
},
|
|
943
|
+
"isESM": true,
|
|
944
|
+
"relativePath": [
|
|
945
|
+
"lib",
|
|
946
|
+
"commands",
|
|
947
|
+
"agent",
|
|
948
|
+
"publish",
|
|
949
|
+
"authoring-bundle.js"
|
|
950
|
+
],
|
|
951
|
+
"aliasPermutations": [],
|
|
952
|
+
"permutations": [
|
|
953
|
+
"agent:publish:authoring-bundle",
|
|
954
|
+
"publish:agent:authoring-bundle",
|
|
955
|
+
"publish:authoring-bundle:agent",
|
|
956
|
+
"agent:authoring-bundle:publish",
|
|
957
|
+
"authoring-bundle:agent:publish",
|
|
958
|
+
"authoring-bundle:publish:agent"
|
|
959
|
+
]
|
|
960
|
+
},
|
|
871
961
|
"agent:preview:end": {
|
|
872
962
|
"aliases": [],
|
|
873
963
|
"args": {},
|
|
@@ -1128,7 +1218,7 @@
|
|
|
1128
1218
|
"agent:preview:sessions": {
|
|
1129
1219
|
"aliases": [],
|
|
1130
1220
|
"args": {},
|
|
1131
|
-
"description": "This command lists the agent preview sessions that were started with the \"agent preview start\" command and are still in the local cache. Use this command to discover specific session IDs that you can pass to the \"agent preview send\" or \"agent preview end\" commands with the --session-id flag.\n\nProgrammatic agent preview sessions can be started for both published activated agents and by using an agent's local authoring bundle, which contains its Agent Script file.
|
|
1221
|
+
"description": "This command lists the agent preview sessions that were started with the \"agent preview start\" command and are still in the local cache. Use this command to discover specific session IDs that you can pass to the \"agent preview send\" or \"agent preview end\" commands with the --session-id flag.\n\nProgrammatic agent preview sessions can be started for both published activated agents and by using an agent's local authoring bundle, which contains its Agent Script file. In this command's output table, the Agent column contains either the API name of the authoring bundle or the published agent, whichever was used when starting the session. In the table, if the same API name has multiple rows with different session IDs, then it means that you previously started multiple preview sessions with the associated agent.",
|
|
1132
1222
|
"examples": [
|
|
1133
1223
|
"List all cached agent preview sessions:\n<%= config.bin %> <%= command.id %>"
|
|
1134
1224
|
],
|
|
@@ -1324,96 +1414,6 @@
|
|
|
1324
1414
|
"start:preview:agent"
|
|
1325
1415
|
]
|
|
1326
1416
|
},
|
|
1327
|
-
"agent:publish:authoring-bundle": {
|
|
1328
|
-
"aliases": [],
|
|
1329
|
-
"args": {},
|
|
1330
|
-
"description": "An authoring bundle is a metadata type (named aiAuthoringBundle) that provides the blueprint for an agent. The metadata type contains two files: the standard metatada XML file and an Agent Script file (extension \".agent\") that fully describes the agent using the Agent Script language.\n\nWhen you publish an authoring bundle to your org, a number of things happen. First, this command validates that the Agent Script file successfully compiles. If there are compilation errors, the command exits and you must fix the Agent Script file to continue. Once the Agent Script file compiles, then it's published to the org, which in turn creates new associated metadata (Bot, BotVersion, GenAiX), or new versions of the metadata if the agent already exists. The new or updated metadata is retrieved back to your DX project; specify the --skip-retrieve flag to skip this step. Finally, the authoring bundle metadata (AiAuthoringBundle) is deployed to your org.\n\nThis command uses the API name of the authoring bundle.",
|
|
1331
|
-
"examples": [
|
|
1332
|
-
"Publish an authoring bundle by being prompted for its API name; use your default org:\n<%= config.bin %> <%= command.id %>",
|
|
1333
|
-
"Publish an authoring bundle with API name MyAuthoringBundle to the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --target-org my-dev-org"
|
|
1334
|
-
],
|
|
1335
|
-
"flags": {
|
|
1336
|
-
"json": {
|
|
1337
|
-
"description": "Format output as json.",
|
|
1338
|
-
"helpGroup": "GLOBAL",
|
|
1339
|
-
"name": "json",
|
|
1340
|
-
"allowNo": false,
|
|
1341
|
-
"type": "boolean"
|
|
1342
|
-
},
|
|
1343
|
-
"flags-dir": {
|
|
1344
|
-
"helpGroup": "GLOBAL",
|
|
1345
|
-
"name": "flags-dir",
|
|
1346
|
-
"summary": "Import flag values from a directory.",
|
|
1347
|
-
"hasDynamicHelp": false,
|
|
1348
|
-
"multiple": false,
|
|
1349
|
-
"type": "option"
|
|
1350
|
-
},
|
|
1351
|
-
"target-org": {
|
|
1352
|
-
"char": "o",
|
|
1353
|
-
"name": "target-org",
|
|
1354
|
-
"noCacheDefault": true,
|
|
1355
|
-
"required": true,
|
|
1356
|
-
"summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
|
|
1357
|
-
"hasDynamicHelp": true,
|
|
1358
|
-
"multiple": false,
|
|
1359
|
-
"type": "option"
|
|
1360
|
-
},
|
|
1361
|
-
"api-version": {
|
|
1362
|
-
"description": "Override the api version used for api requests made by this command",
|
|
1363
|
-
"name": "api-version",
|
|
1364
|
-
"hasDynamicHelp": false,
|
|
1365
|
-
"multiple": false,
|
|
1366
|
-
"type": "option"
|
|
1367
|
-
},
|
|
1368
|
-
"api-name": {
|
|
1369
|
-
"char": "n",
|
|
1370
|
-
"name": "api-name",
|
|
1371
|
-
"summary": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
|
|
1372
|
-
"hasDynamicHelp": false,
|
|
1373
|
-
"multiple": false,
|
|
1374
|
-
"type": "option"
|
|
1375
|
-
},
|
|
1376
|
-
"skip-retrieve": {
|
|
1377
|
-
"name": "skip-retrieve",
|
|
1378
|
-
"summary": "Don't retrieve the metadata associated with the agent to your DX project.",
|
|
1379
|
-
"allowNo": false,
|
|
1380
|
-
"type": "boolean"
|
|
1381
|
-
}
|
|
1382
|
-
},
|
|
1383
|
-
"hasDynamicHelp": true,
|
|
1384
|
-
"hiddenAliases": [],
|
|
1385
|
-
"id": "agent:publish:authoring-bundle",
|
|
1386
|
-
"pluginAlias": "@salesforce/plugin-agent",
|
|
1387
|
-
"pluginName": "@salesforce/plugin-agent",
|
|
1388
|
-
"pluginType": "core",
|
|
1389
|
-
"strict": true,
|
|
1390
|
-
"summary": "Publish an authoring bundle to your org, which results in a new agent or a new version of an existing agent.",
|
|
1391
|
-
"enableJsonFlag": true,
|
|
1392
|
-
"requiresProject": true,
|
|
1393
|
-
"FLAGGABLE_PROMPTS": {
|
|
1394
|
-
"api-name": {
|
|
1395
|
-
"message": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
|
|
1396
|
-
"promptMessage": "API name of the authoring bundle to publish"
|
|
1397
|
-
}
|
|
1398
|
-
},
|
|
1399
|
-
"isESM": true,
|
|
1400
|
-
"relativePath": [
|
|
1401
|
-
"lib",
|
|
1402
|
-
"commands",
|
|
1403
|
-
"agent",
|
|
1404
|
-
"publish",
|
|
1405
|
-
"authoring-bundle.js"
|
|
1406
|
-
],
|
|
1407
|
-
"aliasPermutations": [],
|
|
1408
|
-
"permutations": [
|
|
1409
|
-
"agent:publish:authoring-bundle",
|
|
1410
|
-
"publish:agent:authoring-bundle",
|
|
1411
|
-
"publish:authoring-bundle:agent",
|
|
1412
|
-
"agent:authoring-bundle:publish",
|
|
1413
|
-
"authoring-bundle:agent:publish",
|
|
1414
|
-
"authoring-bundle:publish:agent"
|
|
1415
|
-
]
|
|
1416
|
-
},
|
|
1417
1417
|
"agent:test:create": {
|
|
1418
1418
|
"aliases": [],
|
|
1419
1419
|
"args": {},
|
|
@@ -2340,5 +2340,5 @@
|
|
|
2340
2340
|
]
|
|
2341
2341
|
}
|
|
2342
2342
|
},
|
|
2343
|
-
"version": "1.
|
|
2343
|
+
"version": "1.34.0"
|
|
2344
2344
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-agent",
|
|
3
3
|
"description": "Commands to interact with Salesforce agents",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.34.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"enableO11y": true,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@inquirer/prompts": "^7.10.1",
|
|
13
13
|
"@oclif/core": "^4",
|
|
14
14
|
"@oclif/multi-stage-output": "^0.8.36",
|
|
15
|
-
"@salesforce/agents": "^1.
|
|
15
|
+
"@salesforce/agents": "^1.2.0",
|
|
16
16
|
"@salesforce/core": "^8.28.3",
|
|
17
17
|
"@salesforce/kit": "^3.2.6",
|
|
18
18
|
"@salesforce/sf-plugins-core": "^12.2.6",
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
"exports": "./lib/index.js",
|
|
241
241
|
"type": "module",
|
|
242
242
|
"sfdx": {
|
|
243
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.
|
|
244
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.
|
|
243
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.34.0.crt",
|
|
244
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.34.0.sig"
|
|
245
245
|
}
|
|
246
246
|
}
|
|
@@ -15,11 +15,21 @@
|
|
|
15
15
|
},
|
|
16
16
|
"sessionId": {
|
|
17
17
|
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
"timestamp": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"sessionType": {
|
|
23
|
+
"$ref": "#/definitions/SessionType"
|
|
18
24
|
}
|
|
19
25
|
},
|
|
20
26
|
"required": ["agentId", "sessionId"],
|
|
21
27
|
"additionalProperties": false
|
|
22
28
|
}
|
|
29
|
+
},
|
|
30
|
+
"SessionType": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"enum": ["simulated", "live", "published"]
|
|
23
33
|
}
|
|
24
34
|
}
|
|
25
35
|
}
|