@copado/agentia-cli 1.2.0 → 1.3.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/CHANGELOG.md +30 -1
- package/README.md +2205 -1530
- package/dist/commands/auth/get.js +21 -1
- package/dist/commands/auth/set.js +13 -0
- package/dist/commands/auth/unset.js +37 -0
- package/dist/commands/cicd/cloud/commit.js +2 -2
- package/dist/commands/cicd/cloud/promote.js +19 -5
- package/dist/commands/cicd/credential/auth/status.js +2 -2
- package/dist/commands/cicd/credential/auth/web/login.js +2 -2
- package/dist/commands/cicd/credential/create.js +2 -2
- package/dist/commands/cicd/credential/list.js +2 -2
- package/dist/commands/cicd/credential/open.js +2 -2
- package/dist/commands/cicd/credential/update.js +2 -2
- package/dist/commands/cicd/data/commit/create.js +2 -2
- package/dist/commands/cicd/data/commit/list.js +2 -2
- package/dist/commands/cicd/data/dataset-file/content.js +2 -2
- package/dist/commands/cicd/data/dataset-file/list.js +2 -2
- package/dist/commands/cicd/data/filter/add.js +2 -2
- package/dist/commands/cicd/data/filter/delete.js +2 -2
- package/dist/commands/cicd/data/filter/list.js +2 -2
- package/dist/commands/cicd/data/filter/update.js +2 -2
- package/dist/commands/cicd/data/formula/create.js +2 -2
- package/dist/commands/cicd/data/formula/list.js +2 -2
- package/dist/commands/cicd/data/formula/update.js +2 -2
- package/dist/commands/cicd/data/records/match.js +2 -2
- package/dist/commands/cicd/data/records/search.js +2 -2
- package/dist/commands/cicd/data/sobject/fields.js +2 -2
- package/dist/commands/cicd/data/sobject/relationships.js +2 -2
- package/dist/commands/cicd/data/sync/apply.js +2 -2
- package/dist/commands/cicd/data/sync/preview-updates.js +2 -2
- package/dist/commands/cicd/data/template/convert-old.js +2 -2
- package/dist/commands/cicd/data/template/create.js +2 -2
- package/dist/commands/cicd/data/template/delete.js +2 -2
- package/dist/commands/cicd/data/template/get-detail.js +2 -2
- package/dist/commands/cicd/data/template/get.js +2 -2
- package/dist/commands/cicd/data/template/list.js +2 -2
- package/dist/commands/cicd/data/template/open.js +2 -2
- package/dist/commands/cicd/data/template/save-detail.js +2 -2
- package/dist/commands/cicd/environment/auth/status.js +2 -2
- package/dist/commands/cicd/environment/auth/web/login.js +2 -2
- package/dist/commands/cicd/environment/create.js +2 -2
- package/dist/commands/cicd/environment/get.js +2 -2
- package/dist/commands/cicd/environment/list.js +2 -2
- package/dist/commands/cicd/environment/open.js +2 -2
- package/dist/commands/cicd/environment/update.js +2 -2
- package/dist/commands/cicd/extension/create.js +2 -2
- package/dist/commands/cicd/extension/install.js +2 -2
- package/dist/commands/cicd/extension/package.js +2 -2
- package/dist/commands/cicd/extension/publish.js +2 -2
- package/dist/commands/cicd/extension/uninstall.js +2 -2
- package/dist/commands/cicd/extension/validate.js +2 -2
- package/dist/commands/cicd/extension-configuration/get.js +2 -2
- package/dist/commands/cicd/extension-configuration/list.js +2 -2
- package/dist/commands/cicd/extension-configuration/open.js +2 -2
- package/dist/commands/cicd/function/defaults.js +2 -2
- package/dist/commands/cicd/function/delete.js +2 -2
- package/dist/commands/cicd/function/get.js +2 -2
- package/dist/commands/cicd/function/list.js +2 -2
- package/dist/commands/cicd/function/open.js +2 -2
- package/dist/commands/cicd/function/result/get.js +2 -2
- package/dist/commands/cicd/function/result/log/get.js +2 -2
- package/dist/commands/cicd/function/run-local.js +2 -2
- package/dist/commands/cicd/function/run.js +2 -2
- package/dist/commands/cicd/function/upsert.js +2 -2
- package/dist/commands/cicd/health-check.js +2 -2
- package/dist/commands/cicd/job/get.js +2 -2
- package/dist/commands/cicd/job/kill.js +2 -2
- package/dist/commands/cicd/job/list.js +2 -2
- package/dist/commands/cicd/job/log/get.js +2 -2
- package/dist/commands/cicd/job/open.js +2 -2
- package/dist/commands/cicd/job/pause.js +2 -2
- package/dist/commands/cicd/job/result-file/get.js +2 -2
- package/dist/commands/cicd/job/result-file/list.js +2 -2
- package/dist/commands/cicd/job/resume.js +2 -2
- package/dist/commands/cicd/job/run.js +2 -2
- package/dist/commands/cicd/metadata/content/compare.js +2 -2
- package/dist/commands/cicd/metadata/content/get.js +2 -2
- package/dist/commands/cicd/metadata/dependency/list.js +44 -21
- package/dist/commands/cicd/metadata/explore.js +2 -2
- package/dist/commands/cicd/metadata/index/compare.js +2 -2
- package/dist/commands/cicd/metadata/list.js +2 -2
- package/dist/commands/cicd/metadata/refresh/deleted.js +2 -2
- package/dist/commands/cicd/metadata/refresh/run.js +2 -2
- package/dist/commands/cicd/metadata/refresh/status.js +2 -2
- package/dist/commands/cicd/notification/configure.js +2 -2
- package/dist/commands/cicd/notification/get.js +2 -2
- package/dist/commands/cicd/pipeline/automation/activate.js +2 -2
- package/dist/commands/cicd/pipeline/automation/create.js +2 -2
- package/dist/commands/cicd/pipeline/automation/deactivate.js +2 -2
- package/dist/commands/cicd/pipeline/automation/delete.js +2 -2
- package/dist/commands/cicd/pipeline/automation/get.js +2 -2
- package/dist/commands/cicd/pipeline/automation/list.js +2 -2
- package/dist/commands/cicd/pipeline/automation/open.js +2 -2
- package/dist/commands/cicd/pipeline/automation/update.js +2 -2
- package/dist/commands/cicd/pipeline/connection/create.js +2 -2
- package/dist/commands/cicd/pipeline/connection/delete.js +2 -2
- package/dist/commands/cicd/pipeline/connection/list.js +2 -2
- package/dist/commands/cicd/pipeline/connection/open.js +2 -2
- package/dist/commands/cicd/pipeline/connection/update.js +2 -2
- package/dist/commands/cicd/pipeline/create.js +2 -2
- package/dist/commands/cicd/pipeline/get.js +2 -2
- package/dist/commands/cicd/pipeline/list.js +2 -2
- package/dist/commands/cicd/pipeline/open.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/activate.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/create.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/deactivate.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/delete.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/get.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/list.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/open.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/update.js +2 -2
- package/dist/commands/cicd/pipeline/stage-connection/create.js +2 -2
- package/dist/commands/cicd/pipeline/stage-connection/delete.js +2 -2
- package/dist/commands/cicd/pipeline/stage-connection/list.js +2 -2
- package/dist/commands/cicd/pipeline/stage-connection/open.js +2 -2
- package/dist/commands/cicd/pipeline/stage-connection/update.js +2 -2
- package/dist/commands/cicd/pipeline/update.js +2 -2
- package/dist/commands/cicd/project/create.js +2 -2
- package/dist/commands/cicd/project/default/get.js +2 -2
- package/dist/commands/cicd/project/default/set.js +2 -2
- package/dist/commands/cicd/project/default/unset.js +2 -2
- package/dist/commands/cicd/project/delete.js +2 -2
- package/dist/commands/cicd/project/get.js +2 -2
- package/dist/commands/cicd/project/list.js +2 -2
- package/dist/commands/cicd/project/open.js +2 -2
- package/dist/commands/cicd/project/update.js +2 -2
- package/dist/commands/cicd/promotion/conflict/get.js +2 -2
- package/dist/commands/cicd/promotion/conflict/list.js +2 -2
- package/dist/commands/cicd/promotion/conflict/resolve.js +2 -2
- package/dist/commands/cicd/promotion/conflict/unresolve.js +2 -2
- package/dist/commands/cicd/promotion/get.js +2 -2
- package/dist/commands/cicd/promotion/job-step/update.js +2 -2
- package/dist/commands/cicd/promotion/list.js +2 -2
- package/dist/commands/cicd/promotion/open.js +2 -2
- package/dist/commands/cicd/promotion/queue/list.js +28 -0
- package/dist/commands/cicd/promotion/queue/remove.js +37 -0
- package/dist/commands/cicd/promotion/run.js +2 -2
- package/dist/commands/cicd/repository/auth/https/configure.js +2 -2
- package/dist/commands/cicd/repository/auth/oauth/login.js +2 -2
- package/dist/commands/cicd/repository/auth/setup.js +2 -2
- package/dist/commands/cicd/repository/auth/ssh/configure.js +2 -2
- package/dist/commands/cicd/repository/create.js +2 -2
- package/dist/commands/cicd/repository/delete.js +2 -2
- package/dist/commands/cicd/repository/get.js +2 -2
- package/dist/commands/cicd/repository/list.js +2 -2
- package/dist/commands/cicd/repository/open.js +2 -2
- package/dist/commands/cicd/repository/reset.js +2 -2
- package/dist/commands/cicd/repository/update.js +2 -2
- package/dist/commands/cicd/repository/validate.js +2 -2
- package/dist/commands/cicd/stage/create.js +2 -2
- package/dist/commands/cicd/stage/delete.js +2 -2
- package/dist/commands/cicd/stage/get.js +2 -2
- package/dist/commands/cicd/stage/list.js +2 -2
- package/dist/commands/cicd/stage/open.js +2 -2
- package/dist/commands/cicd/stage/update.js +2 -2
- package/dist/commands/cicd/template/defaults.js +2 -2
- package/dist/commands/cicd/template/delete.js +2 -2
- package/dist/commands/cicd/template/get.js +2 -2
- package/dist/commands/cicd/template/list.js +2 -2
- package/dist/commands/cicd/template/upsert.js +2 -2
- package/dist/commands/cicd/user/get.js +2 -2
- package/dist/commands/cicd/work/ahead-behind.js +2 -2
- package/dist/commands/cicd/work/create.js +2 -2
- package/dist/commands/cicd/work/delete.js +2 -2
- package/dist/commands/cicd/work/deployment-step/create.js +2 -2
- package/dist/commands/cicd/work/deployment-step/delete.js +2 -2
- package/dist/commands/cicd/work/deployment-step/list.js +2 -2
- package/dist/commands/cicd/work/deployment-step/reorder.js +2 -2
- package/dist/commands/cicd/work/deployment-step/salesforce-flows.js +2 -2
- package/dist/commands/cicd/work/deployment-step/types.js +2 -2
- package/dist/commands/cicd/work/deployment-step/update.js +2 -2
- package/dist/commands/cicd/work/done.js +2 -2
- package/dist/commands/cicd/work/environment-sync.js +2 -2
- package/dist/commands/cicd/work/get.js +2 -2
- package/dist/commands/cicd/work/list.js +2 -2
- package/dist/commands/cicd/work/open.js +2 -2
- package/dist/commands/cicd/work/promote.js +2 -2
- package/dist/commands/cicd/work/publish.js +2 -2
- package/dist/commands/cicd/work/push.js +2 -2
- package/dist/commands/cicd/work/set.js +2 -2
- package/dist/commands/cicd/work/status.js +2 -2
- package/dist/commands/cicd/work/submit.js +2 -2
- package/dist/commands/cicd/work/test/apex.js +2 -2
- package/dist/commands/cicd/work/test.js +2 -2
- package/dist/commands/cicd/work/update.js +2 -2
- package/dist/commands/help-agent.js +15 -0
- package/dist/commands/help.js +38 -0
- package/dist/commands/history/clear.js +42 -0
- package/dist/commands/history/list.js +50 -0
- package/dist/commands/support.js +15 -0
- package/dist/commands/testing/browser/execute.js +49 -0
- package/dist/commands/testing/browser/history.js +49 -0
- package/dist/commands/testing/browser/inspect.js +35 -0
- package/dist/commands/testing/browser/recorder.js +52 -0
- package/dist/commands/testing/browser/reports.js +33 -0
- package/dist/commands/testing/browser/screenshot.js +27 -0
- package/dist/commands/testing/browser/set-options.js +35 -0
- package/dist/commands/testing/browser/start.js +51 -0
- package/dist/commands/testing/browser/status.js +26 -0
- package/dist/commands/testing/browser/stop.js +34 -0
- package/dist/commands/testing/browser/view.js +35 -0
- package/dist/commands/testing/job/runs/abort.js +1 -1
- package/dist/commands/testing/job/runs/get.js +1 -1
- package/dist/commands/testing/job/runs/list.js +1 -1
- package/dist/commands/testing/job/runs/logs.js +1 -1
- package/dist/commands/testing/job/runs/search.js +1 -1
- package/dist/hooks/init/cicd-connection.js +59 -0
- package/dist/lib/agentia-command.js +69 -6
- package/dist/lib/cicd-command.js +3 -0
- package/dist/lib/cicd-connection.js +22 -0
- package/dist/lib/cicd-gateway.js +2 -1
- package/dist/lib/command-history-sanitization.js +9 -0
- package/dist/lib/command-history.js +11 -0
- package/dist/lib/command-output-buffer.js +6 -1
- package/dist/lib/defaults-store.js +3 -1
- package/dist/lib/dependency-from-changes.js +3 -1
- package/dist/lib/dependency-source-context.js +3 -0
- package/dist/lib/help-agent-command.js +3 -0
- package/dist/lib/help-agent-interaction-history.js +10 -0
- package/dist/lib/help-agent-session.js +3 -0
- package/dist/lib/mcp/result.js +41 -3
- package/dist/lib/mcp/server.js +3 -2
- package/dist/lib/mcp/testing-browser-tools.js +194 -0
- package/dist/lib/mcp/testing-tools.js +4 -3
- package/dist/lib/mcp/tool-annotations.js +32 -12
- package/dist/lib/mcp/tools.js +88 -37
- package/dist/lib/promotion-queue.js +5 -0
- package/dist/lib/promotion-run.js +2 -1
- package/dist/lib/runtime.js +1 -1
- package/dist/lib/support-ai-context.js +11 -0
- package/dist/lib/support-ai-stream-parser.js +4 -0
- package/dist/lib/support-ai.js +9 -0
- package/dist/lib/testing-browser-command.js +6 -0
- package/dist/lib/testing-browser-operations.js +17 -0
- package/dist/lib/testing-browser-requests.js +11 -0
- package/dist/lib/testing-browser-robot.js +9 -0
- package/dist/lib/testing-browser-session.js +14 -0
- package/dist/lib/testing-browser-state.js +17 -0
- package/dist/lib/testing-browser-stream.js +7 -0
- package/dist/lib/testing-browser-types.js +3 -0
- package/dist/lib/testing-browser-viewer-key.js +7 -0
- package/dist/lib/testing-gateway.js +2 -1
- package/dist/lib/testing-operations.js +21 -1
- package/dist/lib/testing-sanitization.js +2 -1
- package/dist/lib/work-promote.js +2 -1
- package/oclif.manifest.json +3108 -1450
- package/package.json +11 -4
- package/templates/skills/agentia-ai/SKILL.md +6 -2
- package/templates/skills/agentia-ai/references/ai-agents.md +19 -1
- package/templates/skills/agentia-cicd/SKILL.md +2 -2
- package/templates/skills/agentia-cicd/references/environments-and-credentials.md +16 -0
- package/templates/skills/agentia-cicd/references/promotions.md +10 -1
- package/templates/skills/agentia-metadata/SKILL.md +9 -3
- package/templates/skills/agentia-metadata/references/metadata-dependency.md +70 -0
- package/templates/skills/agentia-metadata/references/metadata-explore.md +8 -4
- package/templates/skills/agentia-testing/SKILL.md +9 -4
- package/templates/skills/agentia-testing/references/browser-testing.md +93 -0
- package/templates/skills/agentia-testing/references/flow-automation.md +112 -0
- package/templates/skills/agentia-testing/references/qforce.md +88 -0
- package/templates/skills/agentia-testing/references/qweb.md +103 -0
- package/templates/skills/agentia-testing/references/tests.md +17 -9
- package/dist/commands/testing/live/continue.js +0 -16
- package/dist/commands/testing/live/execute.js +0 -43
- package/dist/commands/testing/live/history.js +0 -40
- package/dist/commands/testing/live/inspect.js +0 -31
- package/dist/commands/testing/live/interrupt.js +0 -16
- package/dist/commands/testing/live/recorder.js +0 -42
- package/dist/commands/testing/live/reports.js +0 -31
- package/dist/commands/testing/live/screenshot.js +0 -25
- package/dist/commands/testing/live/set-options.js +0 -35
- package/dist/commands/testing/live/start.js +0 -58
- package/dist/commands/testing/live/status.js +0 -24
- package/dist/commands/testing/live/stop.js +0 -36
- package/dist/commands/testing/live/view.js +0 -36
- package/dist/lib/mcp/testing-live-tools.js +0 -226
- package/dist/lib/testing-live-command.js +0 -8
- package/dist/lib/testing-live-operations.js +0 -25
- package/dist/lib/testing-live-recorder.js +0 -11
- package/dist/lib/testing-live-robot.js +0 -9
- package/dist/lib/testing-live-state.js +0 -12
- package/dist/lib/testing-live-types.js +0 -3
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Command, Errors, ux } from '@oclif/core';
|
|
2
2
|
import { format } from 'node:util';
|
|
3
|
-
import { createTransactionId, runWithGatewayTransactionContext } from './cicd-gateway.js';
|
|
3
|
+
import { createTransactionId, getGatewayClientOrigin, getGatewayTransactionOrigin, runWithGatewayTransactionContext, } from './cicd-gateway.js';
|
|
4
4
|
import { colorizeCliSeverityError, colorizeCliSeverityText } from './cli-severity-color.js';
|
|
5
|
-
import {
|
|
5
|
+
import { COMMAND_HISTORY_TEXT_MAX_BYTES } from './command-history-sanitization.js';
|
|
6
|
+
import { recordCommandHistory } from './command-history.js';
|
|
7
|
+
import { isCommandOutputCaptureActive, runWithCommandOutputCapture, runWithoutCommandOutputCapture, } from './command-output-buffer.js';
|
|
6
8
|
import { rememberIdeCommandError } from './ide-command-events.js';
|
|
7
9
|
import { redactErrorMessage, redactSecrets } from './secret-redaction.js';
|
|
8
10
|
const TRANSACTION_ID_REPORTED = Symbol('agentiaTransactionIdReported');
|
|
@@ -49,13 +51,40 @@ export function formatElapsedSecondsMessage(seconds) {
|
|
|
49
51
|
export class AgentiaCommand extends Command {
|
|
50
52
|
static enableJsonFlag = true;
|
|
51
53
|
static experimental = false;
|
|
54
|
+
commandClientOrigin;
|
|
55
|
+
commandExecutionId;
|
|
56
|
+
commandHistoryCapture;
|
|
57
|
+
commandHistoryError;
|
|
58
|
+
commandHistoryResult;
|
|
59
|
+
commandHistoryStartedAtMs;
|
|
60
|
+
commandHistoryWritten = false;
|
|
52
61
|
commandTransactionId;
|
|
53
62
|
async _run() {
|
|
54
63
|
const transactionId = createTransactionId();
|
|
64
|
+
this.commandClientOrigin = getGatewayTransactionOrigin() ?? getGatewayClientOrigin();
|
|
65
|
+
this.commandExecutionId = createTransactionId();
|
|
66
|
+
this.commandHistoryStartedAtMs = Date.now();
|
|
55
67
|
this.commandTransactionId = transactionId;
|
|
56
|
-
return runWithGatewayTransactionContext({ origin:
|
|
68
|
+
return runWithGatewayTransactionContext({ origin: this.commandClientOrigin, referer: this.id, transactionId }, async () => {
|
|
69
|
+
let caught;
|
|
70
|
+
try {
|
|
71
|
+
const result = await this.runWithHistoryCapture(() => super._run());
|
|
72
|
+
if (this.commandHistoryError === undefined)
|
|
73
|
+
this.commandHistoryResult = result;
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
caught = error instanceof Error ? error : new Error(String(error));
|
|
78
|
+
this.commandHistoryError ??= caught;
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
await this.recordCommandHistoryOnce(this.commandHistoryError ?? caught);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
57
85
|
}
|
|
58
86
|
async catch(error) {
|
|
87
|
+
this.commandHistoryError = error;
|
|
59
88
|
this.reportHumanErrorTransactionId(error);
|
|
60
89
|
if (!this.jsonEnabled()) {
|
|
61
90
|
colorizeCliSeverityError(error, 'error');
|
|
@@ -116,6 +145,7 @@ export class AgentiaCommand extends Command {
|
|
|
116
145
|
};
|
|
117
146
|
}
|
|
118
147
|
toSuccessJson(result) {
|
|
148
|
+
this.commandHistoryResult = result;
|
|
119
149
|
const warnings = this.jsonWarnings(result);
|
|
120
150
|
return {
|
|
121
151
|
result,
|
|
@@ -141,14 +171,14 @@ export class AgentiaCommand extends Command {
|
|
|
141
171
|
}
|
|
142
172
|
return action();
|
|
143
173
|
}
|
|
144
|
-
ux.action.start(message);
|
|
174
|
+
runWithoutCommandOutputCapture(() => ux.action.start(message));
|
|
145
175
|
try {
|
|
146
176
|
const result = await action();
|
|
147
|
-
ux.action.stop();
|
|
177
|
+
runWithoutCommandOutputCapture(() => ux.action.stop());
|
|
148
178
|
return result;
|
|
149
179
|
}
|
|
150
180
|
catch (error) {
|
|
151
|
-
ux.action.stop(ux.colorize('red', 'failed'));
|
|
181
|
+
runWithoutCommandOutputCapture(() => ux.action.stop(ux.colorize('red', 'failed')));
|
|
152
182
|
throw error;
|
|
153
183
|
}
|
|
154
184
|
}
|
|
@@ -162,6 +192,25 @@ export class AgentiaCommand extends Command {
|
|
|
162
192
|
];
|
|
163
193
|
return [...new Set(warnings)];
|
|
164
194
|
}
|
|
195
|
+
async recordCommandHistoryOnce(error) {
|
|
196
|
+
if (this.commandHistoryWritten)
|
|
197
|
+
return;
|
|
198
|
+
this.commandHistoryWritten = true;
|
|
199
|
+
const capture = this.commandHistoryCapture;
|
|
200
|
+
await recordCommandHistory({
|
|
201
|
+
argv: this.argv,
|
|
202
|
+
clientOrigin: this.commandClientOrigin,
|
|
203
|
+
cliVersion: this.config.version,
|
|
204
|
+
commandId: this.id ?? '',
|
|
205
|
+
error,
|
|
206
|
+
executionId: this.commandExecutionId,
|
|
207
|
+
logs: capture?.events,
|
|
208
|
+
result: this.commandHistoryResult,
|
|
209
|
+
startedAtMs: this.commandHistoryStartedAtMs,
|
|
210
|
+
transactionId: this.commandTransactionId,
|
|
211
|
+
truncatedStreams: capture?.truncatedStreams,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
165
214
|
reportHumanErrorTransactionId(error) {
|
|
166
215
|
if (this.jsonEnabled() || this.commandTransactionId === undefined) {
|
|
167
216
|
return;
|
|
@@ -180,5 +229,19 @@ export class AgentiaCommand extends Command {
|
|
|
180
229
|
const { warnings } = result;
|
|
181
230
|
return Array.isArray(warnings) ? warnings.filter((warning) => typeof warning === 'string') : [];
|
|
182
231
|
}
|
|
232
|
+
async runWithHistoryCapture(action) {
|
|
233
|
+
const capture = await runWithCommandOutputCapture(action, {
|
|
234
|
+
captureVisibleToCommand: false,
|
|
235
|
+
forwardStderr: true,
|
|
236
|
+
forwardStdout: true,
|
|
237
|
+
maxBytes: COMMAND_HISTORY_TEXT_MAX_BYTES,
|
|
238
|
+
onCapture: (captured) => {
|
|
239
|
+
this.commandHistoryCapture = captured;
|
|
240
|
+
},
|
|
241
|
+
tail: true,
|
|
242
|
+
trackEvents: true,
|
|
243
|
+
});
|
|
244
|
+
return capture.result;
|
|
245
|
+
}
|
|
183
246
|
}
|
|
184
247
|
//# sourceMappingURL=agentia-command.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {modules} from './runtime.js';
|
|
2
|
+
const CICD_ALLOW_PRODUCTION_ENV = modules["cicd-connection.js"]["CICD_ALLOW_PRODUCTION_ENV"]
|
|
3
|
+
const CICD_CONNECTION_ENV = modules["cicd-connection.js"]["CICD_CONNECTION_ENV"]
|
|
4
|
+
const CICD_CONNECTION_NAME_REGEX = modules["cicd-connection.js"]["CICD_CONNECTION_NAME_REGEX"]
|
|
5
|
+
const activeCicdConnectionOverrideName = modules["cicd-connection.js"]["activeCicdConnectionOverrideName"]
|
|
6
|
+
const assertProductionConnectionAllowed = modules["cicd-connection.js"]["assertProductionConnectionAllowed"]
|
|
7
|
+
const assertValidCicdConnectionKind = modules["cicd-connection.js"]["assertValidCicdConnectionKind"]
|
|
8
|
+
const assertValidCicdConnectionName = modules["cicd-connection.js"]["assertValidCicdConnectionName"]
|
|
9
|
+
const clearProcessCicdConnectionOverride = modules["cicd-connection.js"]["clearProcessCicdConnectionOverride"]
|
|
10
|
+
const deleteCicdNamedConnection = modules["cicd-connection.js"]["deleteCicdNamedConnection"]
|
|
11
|
+
const formatCicdConnectionLabel = modules["cicd-connection.js"]["formatCicdConnectionLabel"]
|
|
12
|
+
const getCicdNamedConnection = modules["cicd-connection.js"]["getCicdNamedConnection"]
|
|
13
|
+
const listCicdNamedConnections = modules["cicd-connection.js"]["listCicdNamedConnections"]
|
|
14
|
+
const parseCicdConnectionFromArgv = modules["cicd-connection.js"]["parseCicdConnectionFromArgv"]
|
|
15
|
+
const productionWritesAllowed = modules["cicd-connection.js"]["productionWritesAllowed"]
|
|
16
|
+
const resolveNamedCicdConnectionCredentials = modules["cicd-connection.js"]["resolveNamedCicdConnectionCredentials"]
|
|
17
|
+
const runWithCicdConnectionOverride = modules["cicd-connection.js"]["runWithCicdConnectionOverride"]
|
|
18
|
+
const setProcessCicdConnectionOverride = modules["cicd-connection.js"]["setProcessCicdConnectionOverride"]
|
|
19
|
+
const setProcessProductionConnectionConfirmed = modules["cicd-connection.js"]["setProcessProductionConnectionConfirmed"]
|
|
20
|
+
const summarizeCicdNamedConnection = modules["cicd-connection.js"]["summarizeCicdNamedConnection"]
|
|
21
|
+
const upsertCicdNamedConnection = modules["cicd-connection.js"]["upsertCicdNamedConnection"]
|
|
22
|
+
export {CICD_ALLOW_PRODUCTION_ENV, CICD_CONNECTION_ENV, CICD_CONNECTION_NAME_REGEX, activeCicdConnectionOverrideName, assertProductionConnectionAllowed, assertValidCicdConnectionKind, assertValidCicdConnectionName, clearProcessCicdConnectionOverride, deleteCicdNamedConnection, formatCicdConnectionLabel, getCicdNamedConnection, listCicdNamedConnections, parseCicdConnectionFromArgv, productionWritesAllowed, resolveNamedCicdConnectionCredentials, runWithCicdConnectionOverride, setProcessCicdConnectionOverride, setProcessProductionConnectionConfirmed, summarizeCicdNamedConnection, upsertCicdNamedConnection};
|
package/dist/lib/cicd-gateway.js
CHANGED
|
@@ -25,6 +25,7 @@ const getActiveHttpRequestOptionsForTests = modules["cicd-gateway.js"]["getActiv
|
|
|
25
25
|
const getGatewayClientOrigin = modules["cicd-gateway.js"]["getGatewayClientOrigin"]
|
|
26
26
|
const getGatewayReferer = modules["cicd-gateway.js"]["getGatewayReferer"]
|
|
27
27
|
const getGatewayTransactionId = modules["cicd-gateway.js"]["getGatewayTransactionId"]
|
|
28
|
+
const getGatewayTransactionOrigin = modules["cicd-gateway.js"]["getGatewayTransactionOrigin"]
|
|
28
29
|
const isCicdWarningResponseBody = modules["cicd-gateway.js"]["isCicdWarningResponseBody"]
|
|
29
30
|
const isCicdWarningStatus = modules["cicd-gateway.js"]["isCicdWarningStatus"]
|
|
30
31
|
const maskUrlSecrets = modules["cicd-gateway.js"]["maskUrlSecrets"]
|
|
@@ -42,4 +43,4 @@ const scheduleGatewayEventLog = modules["cicd-gateway.js"]["scheduleGatewayEvent
|
|
|
42
43
|
const setGatewayEventLogSenderForTests = modules["cicd-gateway.js"]["setGatewayEventLogSenderForTests"]
|
|
43
44
|
const setHttpRequestForTests = modules["cicd-gateway.js"]["setHttpRequestForTests"]
|
|
44
45
|
const tryResolveCicdCredentials = modules["cicd-gateway.js"]["tryResolveCicdCredentials"]
|
|
45
|
-
export {ADV_GATEWAY_EVENT_SERVICE, AGENTIA_CLIENT_ORIGIN_ENV, AGENTIA_IDE_VERSION_ENV, AI_GATEWAY_EVENT_SERVICE, CICD_ENV, CRT_GATEWAY_EVENT_SERVICE, CicdGateway, CicdGatewayError, GATEWAY_EVENT_API_CALL, GATEWAY_EVENT_UNKNOWN, MCP_CICD_DEFAULT_REQUEST_TIMEOUT_MS, PLUGIN_GATEWAY_EVENT_SERVICE, buildGatewayEventLogPayload, cicdApiUrl, createTransactionId, discoverCicdBaseUrl, flushGatewayEventLogsForTests, formatCicdGatewayError, formatGatewayEventTimestamp, gatewayEventSource, gatewayRefererHeaders, gatewayUserAgent, getActiveHttpRequestOptionsForTests, getGatewayClientOrigin, getGatewayReferer, getGatewayTransactionId, isCicdWarningResponseBody, isCicdWarningStatus, maskUrlSecrets, maskedCicdApiUrl, normalizeCicdBaseUrl, parseRetryAfterHeader, resetGatewayEventLogSenderForTests, resetHttpRequestForTests, resolveAndValidateCicdEndpoint, resolveCicdCredentials, resolveCicdRequestTimeoutMs, resolveConfiguredCicdBaseUrl, runWithGatewayTransactionContext, scheduleGatewayEventLog, setGatewayEventLogSenderForTests, setHttpRequestForTests, tryResolveCicdCredentials};
|
|
46
|
+
export {ADV_GATEWAY_EVENT_SERVICE, AGENTIA_CLIENT_ORIGIN_ENV, AGENTIA_IDE_VERSION_ENV, AI_GATEWAY_EVENT_SERVICE, CICD_ENV, CRT_GATEWAY_EVENT_SERVICE, CicdGateway, CicdGatewayError, GATEWAY_EVENT_API_CALL, GATEWAY_EVENT_UNKNOWN, MCP_CICD_DEFAULT_REQUEST_TIMEOUT_MS, PLUGIN_GATEWAY_EVENT_SERVICE, buildGatewayEventLogPayload, cicdApiUrl, createTransactionId, discoverCicdBaseUrl, flushGatewayEventLogsForTests, formatCicdGatewayError, formatGatewayEventTimestamp, gatewayEventSource, gatewayRefererHeaders, gatewayUserAgent, getActiveHttpRequestOptionsForTests, getGatewayClientOrigin, getGatewayReferer, getGatewayTransactionId, getGatewayTransactionOrigin, isCicdWarningResponseBody, isCicdWarningStatus, maskUrlSecrets, maskedCicdApiUrl, normalizeCicdBaseUrl, parseRetryAfterHeader, resetGatewayEventLogSenderForTests, resetHttpRequestForTests, resolveAndValidateCicdEndpoint, resolveCicdCredentials, resolveCicdRequestTimeoutMs, resolveConfiguredCicdBaseUrl, runWithGatewayTransactionContext, scheduleGatewayEventLog, setGatewayEventLogSenderForTests, setHttpRequestForTests, tryResolveCicdCredentials};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {modules} from './runtime.js';
|
|
2
|
+
const COMMAND_HISTORY_RESULT_MAX_BYTES = modules["command-history-sanitization.js"]["COMMAND_HISTORY_RESULT_MAX_BYTES"]
|
|
3
|
+
const COMMAND_HISTORY_TEXT_MAX_BYTES = modules["command-history-sanitization.js"]["COMMAND_HISTORY_TEXT_MAX_BYTES"]
|
|
4
|
+
const commandHistoryLogsText = modules["command-history-sanitization.js"]["commandHistoryLogsText"]
|
|
5
|
+
const sanitizeCommandHistoryLogs = modules["command-history-sanitization.js"]["sanitizeCommandHistoryLogs"]
|
|
6
|
+
const sanitizeCommandHistoryParameters = modules["command-history-sanitization.js"]["sanitizeCommandHistoryParameters"]
|
|
7
|
+
const sanitizeCommandHistoryResult = modules["command-history-sanitization.js"]["sanitizeCommandHistoryResult"]
|
|
8
|
+
const sanitizeCommandHistoryText = modules["command-history-sanitization.js"]["sanitizeCommandHistoryText"]
|
|
9
|
+
export {COMMAND_HISTORY_RESULT_MAX_BYTES, COMMAND_HISTORY_TEXT_MAX_BYTES, commandHistoryLogsText, sanitizeCommandHistoryLogs, sanitizeCommandHistoryParameters, sanitizeCommandHistoryResult, sanitizeCommandHistoryText};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {modules} from './runtime.js';
|
|
2
|
+
const COMMAND_HISTORY_DEFAULT_LIST_LIMIT = modules["command-history.js"]["COMMAND_HISTORY_DEFAULT_LIST_LIMIT"]
|
|
3
|
+
const COMMAND_HISTORY_LIMIT = modules["command-history.js"]["COMMAND_HISTORY_LIMIT"]
|
|
4
|
+
const clearCommandHistory = modules["command-history.js"]["clearCommandHistory"]
|
|
5
|
+
const commandHistoryPath = modules["command-history.js"]["commandHistoryPath"]
|
|
6
|
+
const readCommandHistory = modules["command-history.js"]["readCommandHistory"]
|
|
7
|
+
const recordCommandHistory = modules["command-history.js"]["recordCommandHistory"]
|
|
8
|
+
const recordMcpToolHistory = modules["command-history.js"]["recordMcpToolHistory"]
|
|
9
|
+
const setCommandHistoryRootForTests = modules["command-history.js"]["setCommandHistoryRootForTests"]
|
|
10
|
+
const shouldRecordCommandHistory = modules["command-history.js"]["shouldRecordCommandHistory"]
|
|
11
|
+
export {COMMAND_HISTORY_DEFAULT_LIST_LIMIT, COMMAND_HISTORY_LIMIT, clearCommandHistory, commandHistoryPath, readCommandHistory, recordCommandHistory, recordMcpToolHistory, setCommandHistoryRootForTests, shouldRecordCommandHistory};
|
|
@@ -6,10 +6,15 @@ const appendCommandOutputLine = modules["command-output-buffer.js"]["appendComma
|
|
|
6
6
|
const attachCapturedLogs = modules["command-output-buffer.js"]["attachCapturedLogs"]
|
|
7
7
|
const attachCapturedOutputLogs = modules["command-output-buffer.js"]["attachCapturedOutputLogs"]
|
|
8
8
|
const commandStdioCaptureOptions = modules["command-output-buffer.js"]["commandStdioCaptureOptions"]
|
|
9
|
+
const isAnyCommandOutputCaptureActive = modules["command-output-buffer.js"]["isAnyCommandOutputCaptureActive"]
|
|
9
10
|
const isCommandOutputCaptureActive = modules["command-output-buffer.js"]["isCommandOutputCaptureActive"]
|
|
11
|
+
const readCapturedCommandOutputSnapshot = modules["command-output-buffer.js"]["readCapturedCommandOutputSnapshot"]
|
|
10
12
|
const readCapturedCommandOutputText = modules["command-output-buffer.js"]["readCapturedCommandOutputText"]
|
|
11
13
|
const redactCommandOutput = modules["command-output-buffer.js"]["redactCommandOutput"]
|
|
12
14
|
const runWithCommandOutputCapture = modules["command-output-buffer.js"]["runWithCommandOutputCapture"]
|
|
15
|
+
const runWithoutCommandOutputCapture = modules["command-output-buffer.js"]["runWithoutCommandOutputCapture"]
|
|
13
16
|
const splitCommandOutputLines = modules["command-output-buffer.js"]["splitCommandOutputLines"]
|
|
17
|
+
const tailUtf8 = modules["command-output-buffer.js"]["tailUtf8"]
|
|
18
|
+
const truncateUtf8 = modules["command-output-buffer.js"]["truncateUtf8"]
|
|
14
19
|
const withCapturedCommandOutput = modules["command-output-buffer.js"]["withCapturedCommandOutput"]
|
|
15
|
-
export {COMMAND_OUTPUT_MAX_BYTES, MCP_STDIO_CAPTURE_OPTIONS, appendCommandOutput, appendCommandOutputLine, attachCapturedLogs, attachCapturedOutputLogs, commandStdioCaptureOptions, isCommandOutputCaptureActive, readCapturedCommandOutputText, redactCommandOutput, runWithCommandOutputCapture, splitCommandOutputLines, withCapturedCommandOutput};
|
|
20
|
+
export {COMMAND_OUTPUT_MAX_BYTES, MCP_STDIO_CAPTURE_OPTIONS, appendCommandOutput, appendCommandOutputLine, attachCapturedLogs, attachCapturedOutputLogs, commandStdioCaptureOptions, isAnyCommandOutputCaptureActive, isCommandOutputCaptureActive, readCapturedCommandOutputSnapshot, readCapturedCommandOutputText, redactCommandOutput, runWithCommandOutputCapture, runWithoutCommandOutputCapture, splitCommandOutputLines, tailUtf8, truncateUtf8, withCapturedCommandOutput};
|
|
@@ -10,6 +10,7 @@ const migrateUserSettingsFromProjectConfig = modules["defaults-store.js"]["migra
|
|
|
10
10
|
const readCredentialSyncReceipt = modules["defaults-store.js"]["readCredentialSyncReceipt"]
|
|
11
11
|
const readDefaults = modules["defaults-store.js"]["readDefaults"]
|
|
12
12
|
const readEnableLocalPromote = modules["defaults-store.js"]["readEnableLocalPromote"]
|
|
13
|
+
const readGlobalConfigDocument = modules["defaults-store.js"]["readGlobalConfigDocument"]
|
|
13
14
|
const readLastApexTestClassesSelected = modules["defaults-store.js"]["readLastApexTestClassesSelected"]
|
|
14
15
|
const readLastBaseBranch = modules["defaults-store.js"]["readLastBaseBranch"]
|
|
15
16
|
const readLastDevOrgBranch = modules["defaults-store.js"]["readLastDevOrgBranch"]
|
|
@@ -30,6 +31,7 @@ const resolveDefaults = modules["defaults-store.js"]["resolveDefaults"]
|
|
|
30
31
|
const setDefaultsStorePathsForTests = modules["defaults-store.js"]["setDefaultsStorePathsForTests"]
|
|
31
32
|
const setDefaultsStoreProjectRoot = modules["defaults-store.js"]["setDefaultsStoreProjectRoot"]
|
|
32
33
|
const unsetDefaults = modules["defaults-store.js"]["unsetDefaults"]
|
|
34
|
+
const updateGlobalConfigDocument = modules["defaults-store.js"]["updateGlobalConfigDocument"]
|
|
33
35
|
const writeCredentialSyncReceipt = modules["defaults-store.js"]["writeCredentialSyncReceipt"]
|
|
34
36
|
const writeDefaults = modules["defaults-store.js"]["writeDefaults"]
|
|
35
37
|
const writeLastCommitSelections = modules["defaults-store.js"]["writeLastCommitSelections"]
|
|
@@ -37,4 +39,4 @@ const writeLastEnvironmentSyncName = modules["defaults-store.js"]["writeLastEnvi
|
|
|
37
39
|
const writeLastWorkSelection = modules["defaults-store.js"]["writeLastWorkSelection"]
|
|
38
40
|
const writeUpdateChannel = modules["defaults-store.js"]["writeUpdateChannel"]
|
|
39
41
|
const writeUserContext = modules["defaults-store.js"]["writeUserContext"]
|
|
40
|
-
export {DEFAULT_WORK_PUSH_RETRY_TIMEOUT_SECONDS, clearCredentialSyncReceipt, clearLastEnvironmentSyncName, clearLastKeysFromUserConfig, clearUserContext, getDefaultsStorePaths, isValidUserContext, migrateUserSettingsFromProjectConfig, readCredentialSyncReceipt, readDefaults, readEnableLocalPromote, readLastApexTestClassesSelected, readLastBaseBranch, readLastDevOrgBranch, readLastEnvironmentSyncName, readLastFullMetadataSelected, readLastPermissionSelected, readLastPullRequestBaseUrl, readLastWorkItem, readLastWorkItemId, readLastWorkItemTitle, readSkipNestedMetadataDetection, readSkipPullRequest, readUpdateChannel, readUserContext, readWorkPushRetryTimeoutSeconds, resetDefaultsStorePathsForTests, resolveDefaults, setDefaultsStorePathsForTests, setDefaultsStoreProjectRoot, unsetDefaults, writeCredentialSyncReceipt, writeDefaults, writeLastCommitSelections, writeLastEnvironmentSyncName, writeLastWorkSelection, writeUpdateChannel, writeUserContext};
|
|
42
|
+
export {DEFAULT_WORK_PUSH_RETRY_TIMEOUT_SECONDS, clearCredentialSyncReceipt, clearLastEnvironmentSyncName, clearLastKeysFromUserConfig, clearUserContext, getDefaultsStorePaths, isValidUserContext, migrateUserSettingsFromProjectConfig, readCredentialSyncReceipt, readDefaults, readEnableLocalPromote, readGlobalConfigDocument, readLastApexTestClassesSelected, readLastBaseBranch, readLastDevOrgBranch, readLastEnvironmentSyncName, readLastFullMetadataSelected, readLastPermissionSelected, readLastPullRequestBaseUrl, readLastWorkItem, readLastWorkItemId, readLastWorkItemTitle, readSkipNestedMetadataDetection, readSkipPullRequest, readUpdateChannel, readUserContext, readWorkPushRetryTimeoutSeconds, resetDefaultsStorePathsForTests, resolveDefaults, setDefaultsStorePathsForTests, setDefaultsStoreProjectRoot, unsetDefaults, updateGlobalConfigDocument, writeCredentialSyncReceipt, writeDefaults, writeLastCommitSelections, writeLastEnvironmentSyncName, writeLastWorkSelection, writeUpdateChannel, writeUserContext};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {modules} from './runtime.js';
|
|
2
|
+
const normalizeDependencyInputPath = modules["dependency-from-changes.js"]["normalizeDependencyInputPath"]
|
|
2
3
|
const resetGitChangedFilesForTests = modules["dependency-from-changes.js"]["resetGitChangedFilesForTests"]
|
|
3
4
|
const resolveChangedPath = modules["dependency-from-changes.js"]["resolveChangedPath"]
|
|
4
5
|
const resolvedSelectionsFromChangedFiles = modules["dependency-from-changes.js"]["resolvedSelectionsFromChangedFiles"]
|
|
6
|
+
const resolvedSelectionsFromPaths = modules["dependency-from-changes.js"]["resolvedSelectionsFromPaths"]
|
|
5
7
|
const selectionsFromChangedFiles = modules["dependency-from-changes.js"]["selectionsFromChangedFiles"]
|
|
6
8
|
const setGitChangedFilesForTests = modules["dependency-from-changes.js"]["setGitChangedFilesForTests"]
|
|
7
|
-
export {resetGitChangedFilesForTests, resolveChangedPath, resolvedSelectionsFromChangedFiles, selectionsFromChangedFiles, setGitChangedFilesForTests};
|
|
9
|
+
export {normalizeDependencyInputPath, resetGitChangedFilesForTests, resolveChangedPath, resolvedSelectionsFromChangedFiles, resolvedSelectionsFromPaths, selectionsFromChangedFiles, setGitChangedFilesForTests};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {modules} from './runtime.js';
|
|
2
|
+
const HELP_AGENT_INTERACTION_LIMIT = modules["help-agent-interaction-history.js"]["HELP_AGENT_INTERACTION_LIMIT"]
|
|
3
|
+
const HELP_AGENT_INTERACTION_TEXT_MAX_BYTES = modules["help-agent-interaction-history.js"]["HELP_AGENT_INTERACTION_TEXT_MAX_BYTES"]
|
|
4
|
+
const HELP_AGENT_INTERACTION_TTL_MS = modules["help-agent-interaction-history.js"]["HELP_AGENT_INTERACTION_TTL_MS"]
|
|
5
|
+
const clearHelpAgentInteractions = modules["help-agent-interaction-history.js"]["clearHelpAgentInteractions"]
|
|
6
|
+
const helpAgentInteractionHistoryPath = modules["help-agent-interaction-history.js"]["helpAgentInteractionHistoryPath"]
|
|
7
|
+
const readHelpAgentInteractions = modules["help-agent-interaction-history.js"]["readHelpAgentInteractions"]
|
|
8
|
+
const recordHelpAgentInteraction = modules["help-agent-interaction-history.js"]["recordHelpAgentInteraction"]
|
|
9
|
+
const setHelpAgentInteractionHistoryRootForTests = modules["help-agent-interaction-history.js"]["setHelpAgentInteractionHistoryRootForTests"]
|
|
10
|
+
export {HELP_AGENT_INTERACTION_LIMIT, HELP_AGENT_INTERACTION_TEXT_MAX_BYTES, HELP_AGENT_INTERACTION_TTL_MS, clearHelpAgentInteractions, helpAgentInteractionHistoryPath, readHelpAgentInteractions, recordHelpAgentInteraction, setHelpAgentInteractionHistoryRootForTests};
|
package/dist/lib/mcp/result.js
CHANGED
|
@@ -1,14 +1,52 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { runWithCicdConnectionOverride } from '../cicd-connection.js';
|
|
1
3
|
import { createTransactionId, runWithGatewayTransactionContext } from '../cicd-gateway.js';
|
|
4
|
+
import { recordMcpToolHistory } from '../command-history.js';
|
|
2
5
|
import { mcpCommandIdFromToolName, mcpToolNameFromHandler } from './command-id.js';
|
|
3
6
|
import { redactErrorMessage, redactSecrets } from './redaction.js';
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const packageJson = require('../../../package.json');
|
|
4
9
|
export { mcpToolNameFromHandler } from './command-id.js';
|
|
5
|
-
export function runWithMcpToolContext(toolName, fn) {
|
|
6
|
-
|
|
10
|
+
export function runWithMcpToolContext(toolName, fn, options = {}) {
|
|
11
|
+
const transactionId = createTransactionId();
|
|
12
|
+
const executionId = createTransactionId();
|
|
13
|
+
const commandId = mcpCommandIdFromToolName(toolName);
|
|
14
|
+
const startedAtMs = Date.now();
|
|
15
|
+
return runWithGatewayTransactionContext({ origin: 'mcp', referer: commandId, transactionId }, async () => {
|
|
16
|
+
let error;
|
|
17
|
+
try {
|
|
18
|
+
return await runWithCicdConnectionOverride(options.cicdConnection, fn);
|
|
19
|
+
}
|
|
20
|
+
catch (error_) {
|
|
21
|
+
error = error_;
|
|
22
|
+
throw error_;
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
await recordMcpToolHistory({
|
|
26
|
+
cliVersion: packageJson.version,
|
|
27
|
+
commandId,
|
|
28
|
+
error,
|
|
29
|
+
executionId,
|
|
30
|
+
startedAtMs,
|
|
31
|
+
transactionId,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export function cicdConnectionFromToolArgs(args) {
|
|
37
|
+
const first = args[0];
|
|
38
|
+
if (first === null || typeof first !== 'object' || Array.isArray(first))
|
|
39
|
+
return undefined;
|
|
40
|
+
const value = first.cicdConnection;
|
|
41
|
+
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
|
|
7
42
|
}
|
|
8
43
|
export function wrapMcpToolHandlers(handlers) {
|
|
9
44
|
return Object.fromEntries(Object.entries(handlers).map(([name, handler]) => [
|
|
10
45
|
name,
|
|
11
|
-
(...args) =>
|
|
46
|
+
(...args) => {
|
|
47
|
+
const cicdConnection = cicdConnectionFromToolArgs(args);
|
|
48
|
+
return runWithMcpToolContext(mcpToolNameFromHandler(name), () => handler(...args), { cicdConnection });
|
|
49
|
+
},
|
|
12
50
|
]));
|
|
13
51
|
}
|
|
14
52
|
export function toolResult(data) {
|
package/dist/lib/mcp/server.js
CHANGED
|
@@ -7,7 +7,7 @@ import { logVerboseDebug } from '../debug.js';
|
|
|
7
7
|
import { migrateUserSettingsFromProjectConfig } from '../defaults-store.js';
|
|
8
8
|
import { applyProjectRoot, hasExplicitProjectRoot } from '../project-root.js';
|
|
9
9
|
import { runWithMcpRequestSignal } from './request-context.js';
|
|
10
|
-
import { runWithMcpToolContext } from './result.js';
|
|
10
|
+
import { cicdConnectionFromToolArgs, runWithMcpToolContext } from './result.js';
|
|
11
11
|
import { withToolAnnotations } from './tool-annotations.js';
|
|
12
12
|
import { registerAgentiaMcpTools } from './tools.js';
|
|
13
13
|
const require = createRequire(import.meta.url);
|
|
@@ -105,10 +105,11 @@ function wrapMcpToolRegistration(server, lifecycleSignal, projectContextReady =
|
|
|
105
105
|
server.registerTool = ((name, config, handler) => registerTool(name, withToolAnnotations(name, config), (...args) => {
|
|
106
106
|
const extra = args.at(-1);
|
|
107
107
|
const { dispose, signal } = combineSignals(extra?.signal, lifecycleSignal);
|
|
108
|
+
const cicdConnection = cicdConnectionFromToolArgs(args);
|
|
108
109
|
return runWithMcpRequestSignal(signal, async () => {
|
|
109
110
|
try {
|
|
110
111
|
await projectContextReady;
|
|
111
|
-
return await runWithMcpToolContext(name, async () => handler(...args));
|
|
112
|
+
return await runWithMcpToolContext(name, async () => handler(...args), { cicdConnection });
|
|
112
113
|
}
|
|
113
114
|
finally {
|
|
114
115
|
dispose();
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { mkdtemp } from 'node:fs/promises';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { executeTestingLive, getTestingLiveHistory, getTestingLiveReports, getTestingLiveStatus, inspectTestingLive, saveTestingLiveScreenshot, setTestingLiveOptions, startTestingLive, stopTestingLive, } from '../testing-browser-operations.js';
|
|
6
|
+
import { assertTestingLiveStopConfirmed, normalizeTestingLiveExecuteSource, normalizeTestingLiveRecorderOptions, normalizeTestingLiveStartScreen, shapeTestingLiveHistoryResult, } from '../testing-browser-requests.js';
|
|
7
|
+
import { TESTING_LIVE_LIBRARIES } from '../testing-browser-types.js';
|
|
8
|
+
import { safelyHandleTool } from './result.js';
|
|
9
|
+
async function testingBrowserStart(args) {
|
|
10
|
+
const screen = normalizeTestingLiveStartScreen(args);
|
|
11
|
+
return {
|
|
12
|
+
result: await startTestingLive({
|
|
13
|
+
japIme: args.japIme,
|
|
14
|
+
jobId: args.job,
|
|
15
|
+
library: args.library,
|
|
16
|
+
noBootstrap: args.noBootstrap,
|
|
17
|
+
noBrowser: args.noBrowser,
|
|
18
|
+
projectId: args.project,
|
|
19
|
+
screen,
|
|
20
|
+
timeoutMs: args.timeoutSeconds === undefined ? undefined : args.timeoutSeconds * 1000,
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
async function testingBrowserStop(args) {
|
|
25
|
+
assertTestingLiveStopConfirmed(args.confirm);
|
|
26
|
+
return { result: await stopTestingLive({ jobId: args.job, projectId: args.project, sessionId: args.sessionId }) };
|
|
27
|
+
}
|
|
28
|
+
async function testingBrowserStatus(args) {
|
|
29
|
+
return { result: await getTestingLiveStatus({ jobId: args.job, projectId: args.project, sessionId: args.sessionId }) };
|
|
30
|
+
}
|
|
31
|
+
async function testingBrowserExecute(args) {
|
|
32
|
+
normalizeTestingLiveExecuteSource({ keyword: args.keyword, lines: args.line }, { keyword: 'keyword', line: 'line' });
|
|
33
|
+
return {
|
|
34
|
+
result: await executeTestingLive({
|
|
35
|
+
args: args.argument,
|
|
36
|
+
jobId: args.job,
|
|
37
|
+
keyword: args.keyword,
|
|
38
|
+
lines: args.line,
|
|
39
|
+
projectId: args.project,
|
|
40
|
+
raw: args.raw,
|
|
41
|
+
sessionId: args.sessionId,
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async function testingBrowserInspect(args) {
|
|
46
|
+
return {
|
|
47
|
+
result: await inspectTestingLive({
|
|
48
|
+
jobId: args.job,
|
|
49
|
+
projectId: args.project,
|
|
50
|
+
sessionId: args.sessionId,
|
|
51
|
+
}),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
async function testingBrowserScreenshot(args) {
|
|
55
|
+
const outputDir = await mkdtemp(join(tmpdir(), 'agentia-mcp-browser-screenshot-'));
|
|
56
|
+
return {
|
|
57
|
+
result: await saveTestingLiveScreenshot({
|
|
58
|
+
jobId: args.job,
|
|
59
|
+
output: join(outputDir, 'screenshot.png'),
|
|
60
|
+
projectId: args.project,
|
|
61
|
+
sessionId: args.sessionId,
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
async function testingBrowserReports(args) {
|
|
66
|
+
return {
|
|
67
|
+
result: await getTestingLiveReports({
|
|
68
|
+
jobId: args.job,
|
|
69
|
+
projectId: args.project,
|
|
70
|
+
sessionId: args.sessionId,
|
|
71
|
+
}),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async function testingBrowserSetOptions(args) {
|
|
75
|
+
return {
|
|
76
|
+
result: await setTestingLiveOptions({
|
|
77
|
+
jobId: args.job,
|
|
78
|
+
projectId: args.project,
|
|
79
|
+
recorder: normalizeTestingLiveRecorderOptions(args.recorder),
|
|
80
|
+
sessionId: args.sessionId,
|
|
81
|
+
}),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async function testingBrowserHistory(args) {
|
|
85
|
+
const result = await getTestingLiveHistory({
|
|
86
|
+
includeFailed: args.includeFailed,
|
|
87
|
+
jobId: args.job,
|
|
88
|
+
keyword: args.keyword,
|
|
89
|
+
limit: args.limit,
|
|
90
|
+
projectId: args.project,
|
|
91
|
+
status: args.status,
|
|
92
|
+
});
|
|
93
|
+
return { result: shapeTestingLiveHistoryResult(result, args.linesOnly === true) };
|
|
94
|
+
}
|
|
95
|
+
export const testingBrowserMcpHandlers = {
|
|
96
|
+
testingBrowserExecute,
|
|
97
|
+
testingBrowserHistory,
|
|
98
|
+
testingBrowserInspect,
|
|
99
|
+
testingBrowserReports,
|
|
100
|
+
testingBrowserScreenshot,
|
|
101
|
+
testingBrowserSetOptions,
|
|
102
|
+
testingBrowserStart,
|
|
103
|
+
testingBrowserStatus,
|
|
104
|
+
testingBrowserStop,
|
|
105
|
+
};
|
|
106
|
+
const liveSessionSchema = {
|
|
107
|
+
job: z.number().int().positive().optional().describe('Optional CRT job ID.'),
|
|
108
|
+
project: z.number().int().positive().describe('CRT project ID.'),
|
|
109
|
+
sessionId: z.number().int().positive().optional().describe('Optional active CRT browser session ID.'),
|
|
110
|
+
};
|
|
111
|
+
const liveRecorderOptionsSchema = z.object({
|
|
112
|
+
enabled: z.boolean(),
|
|
113
|
+
enableHealingContext: z.boolean(),
|
|
114
|
+
enableHoverText: z.boolean(),
|
|
115
|
+
enableScrollText: z.boolean(),
|
|
116
|
+
enableSystemState: z.boolean(),
|
|
117
|
+
enableVerifyText: z.boolean(),
|
|
118
|
+
preferTableKeywords: z.boolean(),
|
|
119
|
+
});
|
|
120
|
+
export function registerTestingLiveMcpTools(server) {
|
|
121
|
+
server.registerTool('agentia_testing_browser_start', {
|
|
122
|
+
description: 'Start and bootstrap a CRT browser session.',
|
|
123
|
+
inputSchema: {
|
|
124
|
+
japIme: z.boolean().optional(),
|
|
125
|
+
job: z.number().int().positive().describe('CRT job ID.'),
|
|
126
|
+
library: z.enum(TESTING_LIVE_LIBRARIES).optional(),
|
|
127
|
+
noBootstrap: z.boolean().optional(),
|
|
128
|
+
noBrowser: z.boolean().optional(),
|
|
129
|
+
project: z.number().int().positive().describe('CRT project ID.'),
|
|
130
|
+
screen: z.string().max(100).optional(),
|
|
131
|
+
screenDepth: z.number().int().min(8).max(32).optional(),
|
|
132
|
+
screenHeight: z.number().int().min(240).max(4320).optional(),
|
|
133
|
+
screenWidth: z.number().int().min(320).max(7680).optional(),
|
|
134
|
+
timeoutSeconds: z.number().int().min(1).max(600).optional(),
|
|
135
|
+
viewport: z.string().max(100).optional(),
|
|
136
|
+
},
|
|
137
|
+
title: 'Agentia Testing Browser Start',
|
|
138
|
+
}, (args) => safelyHandleTool(() => testingBrowserStart(args)));
|
|
139
|
+
server.registerTool('agentia_testing_browser_stop', {
|
|
140
|
+
description: 'Stop the active CRT browser session. Requires explicit confirmation.',
|
|
141
|
+
inputSchema: { confirm: z.boolean().describe('Must be true to stop the session.'), ...liveSessionSchema },
|
|
142
|
+
title: 'Agentia Testing Browser Stop',
|
|
143
|
+
}, (args) => safelyHandleTool(() => testingBrowserStop(args)));
|
|
144
|
+
server.registerTool('agentia_testing_browser_status', {
|
|
145
|
+
description: 'Read status for the active CRT browser session.',
|
|
146
|
+
inputSchema: liveSessionSchema,
|
|
147
|
+
title: 'Agentia Testing Browser Status',
|
|
148
|
+
}, (args) => safelyHandleTool(() => testingBrowserStatus(args)));
|
|
149
|
+
server.registerTool('agentia_testing_browser_execute', {
|
|
150
|
+
description: 'Execute Robot Framework keywords in the active CRT browser session.',
|
|
151
|
+
inputSchema: {
|
|
152
|
+
argument: z.array(z.string().max(16_384)).max(100).optional(),
|
|
153
|
+
keyword: z.string().max(16_384).optional(),
|
|
154
|
+
line: z.array(z.string().max(16_384)).max(500).optional(),
|
|
155
|
+
raw: z.boolean().optional(),
|
|
156
|
+
...liveSessionSchema,
|
|
157
|
+
},
|
|
158
|
+
title: 'Agentia Testing Browser Execute',
|
|
159
|
+
}, (args) => safelyHandleTool(() => testingBrowserExecute(args)));
|
|
160
|
+
server.registerTool('agentia_testing_browser_inspect', {
|
|
161
|
+
description: 'Inspect page state from the active CRT browser session.',
|
|
162
|
+
inputSchema: liveSessionSchema,
|
|
163
|
+
title: 'Agentia Testing Browser Inspect',
|
|
164
|
+
}, (args) => safelyHandleTool(() => testingBrowserInspect(args)));
|
|
165
|
+
server.registerTool('agentia_testing_browser_screenshot', {
|
|
166
|
+
description: 'Save a CRT browser screenshot to a temporary path.',
|
|
167
|
+
inputSchema: liveSessionSchema,
|
|
168
|
+
title: 'Agentia Testing Browser Screenshot',
|
|
169
|
+
}, (args) => safelyHandleTool(() => testingBrowserScreenshot(args)));
|
|
170
|
+
server.registerTool('agentia_testing_browser_reports', {
|
|
171
|
+
description: 'List browser session report metadata.',
|
|
172
|
+
inputSchema: liveSessionSchema,
|
|
173
|
+
title: 'Agentia Testing Browser Reports',
|
|
174
|
+
}, (args) => safelyHandleTool(() => testingBrowserReports(args)));
|
|
175
|
+
server.registerTool('agentia_testing_browser_set_options', {
|
|
176
|
+
description: 'Set CRT browser recorder options.',
|
|
177
|
+
inputSchema: { recorder: liveRecorderOptionsSchema, ...liveSessionSchema },
|
|
178
|
+
title: 'Agentia Testing Browser Set Options',
|
|
179
|
+
}, (args) => safelyHandleTool(() => testingBrowserSetOptions(args)));
|
|
180
|
+
server.registerTool('agentia_testing_browser_history', {
|
|
181
|
+
description: 'Read local CRT browser execution history.',
|
|
182
|
+
inputSchema: {
|
|
183
|
+
includeFailed: z.boolean().optional().describe('Include failed keyword executions.'),
|
|
184
|
+
job: z.number().int().positive().optional().describe('CRT job ID; defaults to the active session.'),
|
|
185
|
+
keyword: z.string().max(200).optional().describe('Filter by Robot Framework keyword name.'),
|
|
186
|
+
limit: z.number().int().min(1).max(500).optional(),
|
|
187
|
+
linesOnly: z.boolean().optional().describe('Flatten history into replayable keyword lines.'),
|
|
188
|
+
project: z.number().int().positive().describe('CRT project ID.'),
|
|
189
|
+
status: z.enum(['completed', 'failed', 'recorded']).optional(),
|
|
190
|
+
},
|
|
191
|
+
title: 'Agentia Testing Browser History',
|
|
192
|
+
}, (args) => safelyHandleTool(() => testingBrowserHistory(args)));
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=testing-browser-tools.js.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/* eslint-disable unicorn/text-encoding-identifier-case -- CRT file APIs require the literal utf-8 enum. */
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { createTestingDataTable, deleteTestingDataTable, getTestingDataTable, listTestingDataTables, TESTING_DATA_MAX_CELL_BYTES, TESTING_DATA_MAX_COLUMNS, TESTING_DATA_MAX_ROWS, updateTestingDataTable, } from '../testing-data-table.js';
|
|
4
|
+
import { abortTestingBuild, countTestingBuilds, executeTestingBuildRun, getTestingBuild, getTestingBuildLogs, listTestingBuilds, searchTestingBuilds, } from '../testing-execution.js';
|
|
4
5
|
import { buildTestingRunOptions } from '../testing-flags.js';
|
|
5
|
-
import {
|
|
6
|
+
import { createTestingJob, createTestingProject, createTestingRobot, createTestingUserParameter, createTestingVariable, deleteTestingJob, deleteTestingProject, deleteTestingRobot, deleteTestingUserParameter, deleteTestingVariable, downloadTestingJobFiles, getTestingJob, getTestingJobRefs, getTestingJobScheduleStatus, getTestingProject, getTestingProjectPermission, getTestingRobot, getTestingUserParameter, getTestingVariable, listTestingJobFiles, listTestingJobs, listTestingProjectPermissions, listTestingProjects, listTestingRobots, listTestingUserParameters, listTestingVariables, removeTestingJobSchedule, setTestingJobSchedule, setTestingProjectPermission, updateTestingJob, updateTestingProject, updateTestingRobot, updateTestingUserParameter, updateTestingVariable, uploadTestingJobFiles, } from '../testing-operations.js';
|
|
6
7
|
import { sanitizeTestingOutput } from '../testing-sanitization.js';
|
|
7
8
|
import { TESTING_BUILD_STATUSES, TESTING_CONSOLE_COLORS, TESTING_JOB_PARALLEL_MODES, TESTING_JOB_SUITE_TYPES, TESTING_RECORD_BUILD_OPTIONS, TESTING_ROBOT_ACCEPTED_RUN_ENVIRONMENTS, TESTING_ROBOT_REPORTING, TESTING_ROBOT_REPORTING_DESCRIPTION, TESTING_ROBOT_RUN_ENVIRONMENT_DESCRIPTION, TESTING_ROBOT_TYPE_DESCRIPTION, TESTING_ROBOT_TYPES, TESTING_RUN_TYPES, TESTING_VARIABLE_TYPES, } from '../testing-types.js';
|
|
8
9
|
import { safelyHandleTool } from './result.js';
|
|
9
|
-
import { registerTestingLiveMcpTools,
|
|
10
|
+
import { registerTestingLiveMcpTools, testingBrowserMcpHandlers } from './testing-browser-tools.js';
|
|
10
11
|
const projectIdSchema = z.number().int().positive().describe('CRT project ID.');
|
|
11
12
|
const jobIdSchema = z.number().int().positive().describe('CRT job ID.');
|
|
12
13
|
const optionalJobIdSchema = z.number().int().positive().optional().describe('CRT job ID.');
|
|
@@ -444,7 +445,7 @@ export const agentiaMcpTestingToolHandlers = {
|
|
|
444
445
|
testingVariableGet,
|
|
445
446
|
testingVariableList,
|
|
446
447
|
testingVariableUpdate,
|
|
447
|
-
...
|
|
448
|
+
...testingBrowserMcpHandlers,
|
|
448
449
|
};
|
|
449
450
|
export function registerAgentiaMcpTestingTools(server) {
|
|
450
451
|
server.registerTool('agentia_testing_project_list', {
|