mulesoft-anypoint-cli-agent-fabric-plugin 1.3.0 → 1.3.1-beta
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 +77 -42
- package/bin/run +6 -0
- package/dist/commands/agent-network/project/agent-console.d.ts +16 -0
- package/dist/commands/agent-network/project/agent-console.js +175 -0
- package/dist/commands/agent-network/project/agent-console.js.map +1 -0
- package/dist/commands/agent-network/project/broker/create.d.ts +10 -0
- package/dist/commands/agent-network/project/broker/create.js +192 -0
- package/dist/commands/agent-network/project/broker/create.js.map +1 -0
- package/dist/commands/agent-network/project/create.d.ts +12 -0
- package/dist/commands/agent-network/project/create.js +48 -11
- package/dist/commands/agent-network/project/create.js.map +1 -1
- package/dist/commands/agent-network/project/deploy.d.ts +24 -14
- package/dist/commands/agent-network/project/deploy.js +230 -178
- package/dist/commands/agent-network/project/deploy.js.map +1 -1
- package/dist/commands/agent-network/project/export-logs.d.ts +11 -0
- package/dist/commands/agent-network/project/export-logs.js +38 -0
- package/dist/commands/agent-network/project/export-logs.js.map +1 -0
- package/dist/commands/agent-network/project/mcp/introspect.js +4 -1
- package/dist/commands/agent-network/project/mcp/introspect.js.map +1 -1
- package/dist/commands/agent-network/project/publish.js +1 -1
- package/dist/commands/agent-network/project/publish.js.map +1 -1
- package/dist/commands/agent-network/project/run-local.d.ts +85 -0
- package/dist/commands/agent-network/project/run-local.js +825 -0
- package/dist/commands/agent-network/project/run-local.js.map +1 -0
- package/dist/commands/agent-network/project/secrets.d.ts +21 -0
- package/dist/commands/agent-network/project/secrets.js +163 -0
- package/dist/commands/agent-network/project/secrets.js.map +1 -0
- package/dist/commands/agent-network/project/stop-local.d.ts +11 -0
- package/dist/commands/agent-network/project/stop-local.js +38 -0
- package/dist/commands/agent-network/project/stop-local.js.map +1 -0
- package/dist/commands/agent-network/project/undeploy.js +15 -10
- package/dist/commands/agent-network/project/undeploy.js.map +1 -1
- package/dist/commands/agent-network/project/unpublish.js +14 -6
- package/dist/commands/agent-network/project/unpublish.js.map +1 -1
- package/dist/commands/agent-network/setup/gateways.d.ts +3 -0
- package/dist/commands/agent-network/setup/gateways.js +66 -3
- package/dist/commands/agent-network/setup/gateways.js.map +1 -1
- package/dist/errors/error-factory.d.ts +51 -6
- package/dist/errors/error-factory.js +246 -15
- package/dist/errors/error-factory.js.map +1 -1
- package/dist/helpers/proxy-agent.d.ts +2 -0
- package/dist/helpers/proxy-agent.js +26 -0
- package/dist/helpers/proxy-agent.js.map +1 -0
- package/dist/helpers/request-utils.d.ts +2 -1
- package/dist/helpers/request-utils.js +2 -2
- package/dist/helpers/request-utils.js.map +1 -1
- package/dist/helpers/utils.d.ts +1 -0
- package/dist/helpers/utils.js +5 -0
- package/dist/helpers/utils.js.map +1 -1
- package/dist/resources/agent-console.html +478 -0
- package/dist/resources/schemas/broker-deployment-settings.schema.json +46 -0
- package/dist/types/agent-network-v2.d.ts +4 -0
- package/dist/types/agent-network-v2.js.map +1 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/utils/builders/network-lock.d.ts +1 -0
- package/dist/utils/builders/network-lock.js +41 -6
- package/dist/utils/builders/network-lock.js.map +1 -1
- package/dist/utils/builders/policies-factory.d.ts +5 -1
- package/dist/utils/builders/policies-factory.js +10 -2
- package/dist/utils/builders/policies-factory.js.map +1 -1
- package/dist/utils/builders/project-builder-impl.d.ts +16 -2
- package/dist/utils/builders/project-builder-impl.js +29 -1
- package/dist/utils/builders/project-builder-impl.js.map +1 -1
- package/dist/utils/builders/project-builder.d.ts +29 -2
- package/dist/utils/builders/project-builder.js +10 -2
- package/dist/utils/builders/project-builder.js.map +1 -1
- package/dist/utils/builders/remote-space-resolver.d.ts +2 -2
- package/dist/utils/builders/remote-space-resolver.js +27 -11
- package/dist/utils/builders/remote-space-resolver.js.map +1 -1
- package/dist/utils/builders/space-serializer.js +3 -1
- package/dist/utils/builders/space-serializer.js.map +1 -1
- package/dist/utils/builders/stage-diagnostics.d.ts +2 -0
- package/dist/utils/builders/stage-diagnostics.js +27 -0
- package/dist/utils/builders/stage-diagnostics.js.map +1 -0
- package/dist/utils/builders/tooling-metadata.d.ts +4 -4
- package/dist/utils/builders/tooling-metadata.js +27 -15
- package/dist/utils/builders/tooling-metadata.js.map +1 -1
- package/dist/utils/builders/v1/network-builder.js +2 -1
- package/dist/utils/builders/v1/network-builder.js.map +1 -1
- package/dist/utils/builders/v2/broker-builder.d.ts +1 -0
- package/dist/utils/builders/v2/broker-builder.js +69 -4
- package/dist/utils/builders/v2/broker-builder.js.map +1 -1
- package/dist/utils/builders/v2/network-builder.js +1 -1
- package/dist/utils/builders/v2/network-builder.js.map +1 -1
- package/dist/utils/constants.d.ts +3 -0
- package/dist/utils/constants.js +8 -3
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/deployment-settings.d.ts +13 -0
- package/dist/utils/deployment-settings.js +97 -0
- package/dist/utils/deployment-settings.js.map +1 -0
- package/dist/utils/facets/abstract-facet.d.ts +1 -0
- package/dist/utils/facets/abstract-facet.js +3 -0
- package/dist/utils/facets/abstract-facet.js.map +1 -1
- package/dist/utils/facets/agent-graph-facet.d.ts +14 -1
- package/dist/utils/facets/agent-graph-facet.js +126 -49
- package/dist/utils/facets/agent-graph-facet.js.map +1 -1
- package/dist/utils/facets/api-instance-facet.d.ts +36 -1
- package/dist/utils/facets/api-instance-facet.js +196 -5
- package/dist/utils/facets/api-instance-facet.js.map +1 -1
- package/dist/utils/facets/connection-facet.d.ts +8 -0
- package/dist/utils/facets/connection-facet.js +65 -1
- package/dist/utils/facets/connection-facet.js.map +1 -1
- package/dist/utils/facets/deployment-helpers.d.ts +18 -1
- package/dist/utils/facets/deployment-helpers.js +53 -0
- package/dist/utils/facets/deployment-helpers.js.map +1 -1
- package/dist/utils/facets/deployment-logs.js +1 -0
- package/dist/utils/facets/deployment-logs.js.map +1 -1
- package/dist/utils/facets/deployment-runner.js +5 -0
- package/dist/utils/facets/deployment-runner.js.map +1 -1
- package/dist/utils/facets/facets.d.ts +2 -0
- package/dist/utils/facets/facets.js +20 -3
- package/dist/utils/facets/facets.js.map +1 -1
- package/dist/utils/facets/mule-application-facet.d.ts +1 -1
- package/dist/utils/facets/mule-application-facet.js +25 -21
- package/dist/utils/facets/mule-application-facet.js.map +1 -1
- package/dist/utils/files.d.ts +25 -0
- package/dist/utils/files.js +62 -0
- package/dist/utils/files.js.map +1 -1
- package/dist/utils/gateway.d.ts +6 -2
- package/dist/utils/gateway.js +37 -33
- package/dist/utils/gateway.js.map +1 -1
- package/dist/utils/keychain.d.ts +56 -0
- package/dist/utils/keychain.js +488 -0
- package/dist/utils/keychain.js.map +1 -0
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.js +3 -0
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/mcp/mcp-metadata-mapper.d.ts +8 -0
- package/dist/utils/mcp/mcp-metadata-mapper.js +7 -1
- package/dist/utils/mcp/mcp-metadata-mapper.js.map +1 -1
- package/dist/utils/mcp/project-registrar.js +2 -26
- package/dist/utils/mcp/project-registrar.js.map +1 -1
- package/dist/utils/naming.d.ts +13 -0
- package/dist/utils/naming.js +36 -4
- package/dist/utils/naming.js.map +1 -1
- package/dist/utils/request-executor.d.ts +5 -5
- package/dist/utils/run-local/agent-console-proxy.d.ts +56 -0
- package/dist/utils/run-local/agent-console-proxy.js +182 -0
- package/dist/utils/run-local/agent-console-proxy.js.map +1 -0
- package/dist/utils/run-local/broker-recreate-selector.d.ts +31 -0
- package/dist/utils/run-local/broker-recreate-selector.js +82 -0
- package/dist/utils/run-local/broker-recreate-selector.js.map +1 -0
- package/dist/utils/run-local/build-status.d.ts +73 -0
- package/dist/utils/run-local/build-status.js +210 -0
- package/dist/utils/run-local/build-status.js.map +1 -0
- package/dist/utils/run-local/constants.d.ts +28 -0
- package/dist/utils/run-local/constants.js +36 -0
- package/dist/utils/run-local/constants.js.map +1 -0
- package/dist/utils/run-local/crd-files.d.ts +2 -0
- package/dist/utils/run-local/crd-files.js +24 -0
- package/dist/utils/run-local/crd-files.js.map +1 -0
- package/dist/utils/run-local/index.d.ts +9 -0
- package/dist/utils/run-local/index.js +42 -0
- package/dist/utils/run-local/index.js.map +1 -0
- package/dist/utils/run-local/local-a2a-upstream.d.ts +9 -0
- package/dist/utils/run-local/local-a2a-upstream.js +55 -0
- package/dist/utils/run-local/local-a2a-upstream.js.map +1 -0
- package/dist/utils/run-local/local-deploy-descriptor.d.ts +36 -0
- package/dist/utils/run-local/local-deploy-descriptor.js +70 -0
- package/dist/utils/run-local/local-deploy-descriptor.js.map +1 -0
- package/dist/utils/run-local/local-run-manager.d.ts +51 -0
- package/dist/utils/run-local/local-run-manager.js +220 -0
- package/dist/utils/run-local/local-run-manager.js.map +1 -0
- package/dist/utils/run-local/policy-resolver.d.ts +69 -0
- package/dist/utils/run-local/policy-resolver.js +461 -0
- package/dist/utils/run-local/policy-resolver.js.map +1 -0
- package/dist/utils/run-local/runtime-environment-manager.d.ts +89 -0
- package/dist/utils/run-local/runtime-environment-manager.js +313 -0
- package/dist/utils/run-local/runtime-environment-manager.js.map +1 -0
- package/dist/utils/run-local/secrets-manager.d.ts +66 -0
- package/dist/utils/run-local/secrets-manager.js +181 -0
- package/dist/utils/run-local/secrets-manager.js.map +1 -0
- package/dist/utils/uris.js +4 -0
- package/dist/utils/uris.js.map +1 -1
- package/dist/utils/variables.d.ts +17 -4
- package/dist/utils/variables.js +52 -7
- package/dist/utils/variables.js.map +1 -1
- package/package.json +3 -1
- package/scripts/check-gus-ticket-format.sh +29 -0
- package/scripts/resolve-version.sh +161 -52
- package/scripts/resolve-version.test.sh +207 -20
- package/templates/agent-network/exchange.json.template +1 -0
- package/templates/agentic-network/brokers/broker1.agent.template +2 -2
- package/templates/agentic-network/exchange.json.template +1 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocalDeploymentStatusWriter = exports.LOCAL_DEPLOYMENT_SESSION_ID_ENV = exports.BUILD_STATUS_SCHEMA_VERSION = void 0;
|
|
4
|
+
exports.isComposeSignalExit = isComposeSignalExit;
|
|
5
|
+
exports.resolveLocalDeploymentSessionId = resolveLocalDeploymentSessionId;
|
|
6
|
+
exports.classifyLocalDeploymentFailure = classifyLocalDeploymentFailure;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const anypoint_cli_command_lib_1 = require("anypoint-cli-command-lib");
|
|
9
|
+
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
10
|
+
const node_crypto_1 = require("node:crypto");
|
|
11
|
+
const node_path_1 = require("node:path");
|
|
12
|
+
const base_error_1 = require("../../errors/base-error");
|
|
13
|
+
const constants_1 = require("./constants");
|
|
14
|
+
/** Bumped only on a breaking change to the shape; consumers must ignore versions they don't know. */
|
|
15
|
+
exports.BUILD_STATUS_SCHEMA_VERSION = 1;
|
|
16
|
+
exports.LOCAL_DEPLOYMENT_SESSION_ID_ENV = 'MULE_LOCAL_DEPLOYMENT_SESSION_ID';
|
|
17
|
+
/** Safe for temp-file names: UUID or a short opaque token — never path separators or `..`. */
|
|
18
|
+
const SESSION_ID_PATTERN = /^[\w-]{1,64}$/;
|
|
19
|
+
const BUILD_ERROR_CODE_MIN = 1000;
|
|
20
|
+
const BUILD_ERROR_CODE_MAX = 1999;
|
|
21
|
+
const DOCKER_PREREQ_RENDER_CODES = new Set([8501, 8502, 8503, 8504]);
|
|
22
|
+
const DOCKER_AGENT_GRAPH_IMAGE_CODE = 8519;
|
|
23
|
+
const POLICY_CODE_MIN = 8507;
|
|
24
|
+
const POLICY_CODE_MAX = 8512;
|
|
25
|
+
const PORT_CODES = new Set([8513, 8514]);
|
|
26
|
+
const SCHEMA_VALIDATION_CODE = 8500;
|
|
27
|
+
const PROJECT_INPUT_CODE = 8505;
|
|
28
|
+
const RUNTIME_CONFIG_CODES = new Set([8506, 8517]);
|
|
29
|
+
const SECRET_VALIDATION_CODES = new Set([8516, 8521, 8522, 8523]);
|
|
30
|
+
const VARIABLE_VALIDATION_CODE = 8518;
|
|
31
|
+
const UNEXPECTED_CODE = 9001;
|
|
32
|
+
/** True when `docker compose` was killed by a process signal (Ctrl+C / SIGTERM). */
|
|
33
|
+
function isComposeSignalExit(error) {
|
|
34
|
+
return error instanceof Error && /killed by signal \w+/.test(error.message);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Resolves a session id from an explicit value or `MULE_LOCAL_DEPLOYMENT_SESSION_ID`.
|
|
38
|
+
* Rejects path traversal and other unsafe temp-name characters.
|
|
39
|
+
*/
|
|
40
|
+
function resolveLocalDeploymentSessionId(explicit) {
|
|
41
|
+
const candidate = explicit !== null && explicit !== void 0 ? explicit : process.env[exports.LOCAL_DEPLOYMENT_SESSION_ID_ENV];
|
|
42
|
+
if (candidate !== undefined && SESSION_ID_PATTERN.test(candidate)) {
|
|
43
|
+
return candidate;
|
|
44
|
+
}
|
|
45
|
+
return (0, node_crypto_1.randomUUID)();
|
|
46
|
+
}
|
|
47
|
+
const BASE_ERROR_CLASSIFIERS = [
|
|
48
|
+
{ test: code => PORT_CODES.has(code), kind: 'port', phase: 'initializing' },
|
|
49
|
+
{ test: code => code >= BUILD_ERROR_CODE_MIN && code <= BUILD_ERROR_CODE_MAX, kind: 'build', phase: 'current' },
|
|
50
|
+
{ test: code => code === DOCKER_AGENT_GRAPH_IMAGE_CODE, kind: 'docker_prerequisite', phase: 'current' },
|
|
51
|
+
{ test: code => DOCKER_PREREQ_RENDER_CODES.has(code), kind: 'docker_prerequisite', phase: 'rendering' },
|
|
52
|
+
{ test: code => code === SCHEMA_VALIDATION_CODE, kind: 'schema_validation', phase: 'current' },
|
|
53
|
+
{ test: code => code === PROJECT_INPUT_CODE, kind: 'project_input', phase: 'current' },
|
|
54
|
+
{ test: code => RUNTIME_CONFIG_CODES.has(code), kind: 'runtime_config', phase: 'current' },
|
|
55
|
+
{ test: code => code >= POLICY_CODE_MIN && code <= POLICY_CODE_MAX, kind: 'policy', phase: 'current' },
|
|
56
|
+
{ test: code => SECRET_VALIDATION_CODES.has(code), kind: 'secret_validation', phase: 'current' },
|
|
57
|
+
{ test: code => code === VARIABLE_VALIDATION_CODE, kind: 'variable_validation', phase: 'current' },
|
|
58
|
+
{ test: code => code === UNEXPECTED_CODE, kind: 'unexpected', phase: 'current' },
|
|
59
|
+
];
|
|
60
|
+
function classifyBaseError(code, currentPhase) {
|
|
61
|
+
for (const rule of BASE_ERROR_CLASSIFIERS) {
|
|
62
|
+
if (rule.test(code)) {
|
|
63
|
+
return { phase: rule.phase === 'current' ? currentPhase : rule.phase, kind: rule.kind, code };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return { phase: currentPhase, kind: 'unexpected', code };
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Maps a thrown value to the machine-readable failure shape. Never copies messages, paths, or
|
|
70
|
+
* secrets — only phase/kind and an optional numeric BaseError.errorCode.
|
|
71
|
+
*/
|
|
72
|
+
function classifyLocalDeploymentFailure(error, currentPhase) {
|
|
73
|
+
if (error instanceof base_error_1.BaseError) {
|
|
74
|
+
return classifyBaseError(error.errorCode, currentPhase);
|
|
75
|
+
}
|
|
76
|
+
if (currentPhase === 'runtime') {
|
|
77
|
+
return { phase: 'runtime', kind: 'runtime_exit' };
|
|
78
|
+
}
|
|
79
|
+
if (currentPhase === 'deploying') {
|
|
80
|
+
return { phase: 'deploying', kind: 'compose_command' };
|
|
81
|
+
}
|
|
82
|
+
return { phase: currentPhase, kind: 'unexpected' };
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Owns `.deployment/local/build-status.json`. Writes are advisory: I/O failures warn and never throw.
|
|
86
|
+
* Call sites live in RunLocal / WatchSession only — not in RuntimeEnvironmentManager.
|
|
87
|
+
*
|
|
88
|
+
* After `seal()` or a terminal write (`completed` / `failed` / `cancelled`), further non-cancel
|
|
89
|
+
* writes are dropped so an in-flight rebuild cannot overwrite Ctrl+C. `beginWatchGeneration`
|
|
90
|
+
* clears the latch so the next watch generation can publish again after a non-fatal failure.
|
|
91
|
+
*/
|
|
92
|
+
class LocalDeploymentStatusWriter {
|
|
93
|
+
constructor(localRunDir, options = {}) {
|
|
94
|
+
this.localRunDir = localRunDir;
|
|
95
|
+
this.sequence = 0;
|
|
96
|
+
this.generation = 0;
|
|
97
|
+
this.trigger = 'initial';
|
|
98
|
+
this.currentPhase = 'initializing';
|
|
99
|
+
this.sealed = false;
|
|
100
|
+
this.cancelledEmitted = false;
|
|
101
|
+
this.sessionId = resolveLocalDeploymentSessionId(options.sessionId);
|
|
102
|
+
}
|
|
103
|
+
/** Drop subsequent non-cancel writes; call at shutdown start before teardown I/O. */
|
|
104
|
+
seal() {
|
|
105
|
+
this.sealed = true;
|
|
106
|
+
}
|
|
107
|
+
/** Call once at the start of each watch rebuild — not on debounce or queue coalescing. */
|
|
108
|
+
beginWatchGeneration() {
|
|
109
|
+
this.sealed = false;
|
|
110
|
+
this.generation += 1;
|
|
111
|
+
this.trigger = 'watch';
|
|
112
|
+
}
|
|
113
|
+
writeRunning(task) {
|
|
114
|
+
if (this.sealed) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (task === undefined) {
|
|
118
|
+
this.writeAtomic({
|
|
119
|
+
schemaVersion: exports.BUILD_STATUS_SCHEMA_VERSION,
|
|
120
|
+
sessionId: this.sessionId,
|
|
121
|
+
sequence: this.nextSequence(),
|
|
122
|
+
generation: this.generation,
|
|
123
|
+
trigger: this.trigger,
|
|
124
|
+
state: 'running',
|
|
125
|
+
});
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.currentPhase = task;
|
|
129
|
+
this.writeAtomic({
|
|
130
|
+
schemaVersion: exports.BUILD_STATUS_SCHEMA_VERSION,
|
|
131
|
+
sessionId: this.sessionId,
|
|
132
|
+
sequence: this.nextSequence(),
|
|
133
|
+
generation: this.generation,
|
|
134
|
+
trigger: this.trigger,
|
|
135
|
+
state: 'running',
|
|
136
|
+
task,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
writeCompleted() {
|
|
140
|
+
if (this.sealed) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
this.sealed = true;
|
|
144
|
+
this.writeAtomic({
|
|
145
|
+
schemaVersion: exports.BUILD_STATUS_SCHEMA_VERSION,
|
|
146
|
+
sessionId: this.sessionId,
|
|
147
|
+
sequence: this.nextSequence(),
|
|
148
|
+
generation: this.generation,
|
|
149
|
+
trigger: this.trigger,
|
|
150
|
+
state: 'completed',
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
writeFailed(error, phase) {
|
|
154
|
+
if (this.sealed) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (phase !== undefined) {
|
|
158
|
+
this.currentPhase = phase;
|
|
159
|
+
}
|
|
160
|
+
this.sealed = true;
|
|
161
|
+
this.writeAtomic({
|
|
162
|
+
schemaVersion: exports.BUILD_STATUS_SCHEMA_VERSION,
|
|
163
|
+
sessionId: this.sessionId,
|
|
164
|
+
sequence: this.nextSequence(),
|
|
165
|
+
generation: this.generation,
|
|
166
|
+
trigger: this.trigger,
|
|
167
|
+
state: 'failed',
|
|
168
|
+
failure: classifyLocalDeploymentFailure(error, this.currentPhase),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
writeCancelled() {
|
|
172
|
+
if (this.cancelledEmitted) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
this.cancelledEmitted = true;
|
|
176
|
+
this.sealed = true;
|
|
177
|
+
this.writeAtomic({
|
|
178
|
+
schemaVersion: exports.BUILD_STATUS_SCHEMA_VERSION,
|
|
179
|
+
sessionId: this.sessionId,
|
|
180
|
+
sequence: this.nextSequence(),
|
|
181
|
+
generation: this.generation,
|
|
182
|
+
trigger: this.trigger,
|
|
183
|
+
state: 'cancelled',
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
nextSequence() {
|
|
187
|
+
this.sequence += 1;
|
|
188
|
+
return this.sequence;
|
|
189
|
+
}
|
|
190
|
+
writeAtomic(status) {
|
|
191
|
+
const target = (0, node_path_1.join)(this.localRunDir, constants_1.BUILD_STATUS_FILE);
|
|
192
|
+
const tmp = (0, node_path_1.join)(this.localRunDir, `${constants_1.BUILD_STATUS_FILE}.tmp-${this.sessionId}-${status.sequence}`);
|
|
193
|
+
try {
|
|
194
|
+
fs.mkdirpSync(this.localRunDir);
|
|
195
|
+
try {
|
|
196
|
+
fs.writeFileSync(tmp, JSON.stringify(status, null, 2));
|
|
197
|
+
fs.renameSync(tmp, target);
|
|
198
|
+
}
|
|
199
|
+
finally {
|
|
200
|
+
fs.removeSync(tmp);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
205
|
+
anypoint_cli_command_lib_1.Logger.warn(`Could not write the local deployment build status: ${detail}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
exports.LocalDeploymentStatusWriter = LocalDeploymentStatusWriter;
|
|
210
|
+
//# sourceMappingURL=build-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-status.js","sourceRoot":"","sources":["../../../src/utils/run-local/build-status.ts"],"names":[],"mappings":";;;AAiFA,kDAEC;AAMD,0EAOC;AAoCD,wEAiBC;;AArJD,uEAA+C;AAC/C,qDAA8B;AAC9B,6CAAsC;AACtC,yCAA8B;AAC9B,wDAAiD;AACjD,2CAA6C;AAE7C,qGAAqG;AACxF,QAAA,2BAA2B,GAAG,CAAU,CAAA;AAExC,QAAA,+BAA+B,GAAG,kCAAkC,CAAA;AAEjF,8FAA8F;AAC9F,MAAM,kBAAkB,GAAG,eAAe,CAAA;AAqD1C,MAAM,oBAAoB,GAAG,IAAI,CAAA;AACjC,MAAM,oBAAoB,GAAG,IAAI,CAAA;AACjC,MAAM,0BAA0B,GAAG,IAAI,GAAG,CA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export declare const DEFAULT_INGRESS_PORT = 8081;
|
|
2
|
+
/** Parent of local compose output and (later) remote deploy descriptors. Must stay dotted. */
|
|
3
|
+
export declare const CHAT_ROOT_DIR = ".deployment";
|
|
4
|
+
export declare const CHAT_LOCAL_SUBDIR = "local";
|
|
5
|
+
export declare const CHAT_REMOTE_SUBDIR = "remote";
|
|
6
|
+
/** Compose/render cwd: `.deployment/local`. */
|
|
7
|
+
export declare const LOCAL_RUN_DIR: string;
|
|
8
|
+
/**
|
|
9
|
+
* Passed as `docker compose -p` so the project name stays `local-run` after the
|
|
10
|
+
* render cwd moved to `.deployment/local` (basename would otherwise become `local`,
|
|
11
|
+
* which collides with unrelated compose stacks and makes `--remove-orphans` unsafe).
|
|
12
|
+
*/
|
|
13
|
+
export declare const COMPOSE_PROJECT_NAME = "local-run";
|
|
14
|
+
export declare function chatRemoteDir(projectPath: string): string;
|
|
15
|
+
export declare const LOCAL_COMPOSE_FILE = "docker-compose.yaml";
|
|
16
|
+
/** Render output describing the running brokers/endpoints, consumed by the VS Code local-deploy view. */
|
|
17
|
+
export declare const LOCAL_DEPLOY_DESCRIPTOR_FILE = "local-deploy.json";
|
|
18
|
+
/** Machine-readable local deployment lifecycle, consumed by the VS Code local-deploy view. */
|
|
19
|
+
export declare const BUILD_STATUS_FILE = "build-status.json";
|
|
20
|
+
/** In-container listen port of every agent-graph service. */
|
|
21
|
+
export declare const AGENT_GRAPH_PORT = 8001;
|
|
22
|
+
/** Compose service names of the two Flex Gateways. */
|
|
23
|
+
export declare const FLEX_INGRESS_SERVICE = "flex-ingress";
|
|
24
|
+
export declare const FLEX_EGRESS_SERVICE = "flex-egress";
|
|
25
|
+
/** Compose service name of the local Exchange static file server. */
|
|
26
|
+
export declare const EXCHANGE_SERVICE = "exchange";
|
|
27
|
+
/** Published Agent Graph image (Docker Hub `latest`, same untagged form as Flex). Pulled on first compose-up if missing locally. */
|
|
28
|
+
export declare const AGENT_GRAPH_IMAGE = "mulesoft/agent-graph-module";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AGENT_GRAPH_IMAGE = exports.EXCHANGE_SERVICE = exports.FLEX_EGRESS_SERVICE = exports.FLEX_INGRESS_SERVICE = exports.AGENT_GRAPH_PORT = exports.BUILD_STATUS_FILE = exports.LOCAL_DEPLOY_DESCRIPTOR_FILE = exports.LOCAL_COMPOSE_FILE = exports.COMPOSE_PROJECT_NAME = exports.LOCAL_RUN_DIR = exports.CHAT_REMOTE_SUBDIR = exports.CHAT_LOCAL_SUBDIR = exports.CHAT_ROOT_DIR = exports.DEFAULT_INGRESS_PORT = void 0;
|
|
4
|
+
exports.chatRemoteDir = chatRemoteDir;
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
exports.DEFAULT_INGRESS_PORT = 8081;
|
|
7
|
+
/** Parent of local compose output and (later) remote deploy descriptors. Must stay dotted. */
|
|
8
|
+
exports.CHAT_ROOT_DIR = '.deployment';
|
|
9
|
+
exports.CHAT_LOCAL_SUBDIR = 'local';
|
|
10
|
+
exports.CHAT_REMOTE_SUBDIR = 'remote';
|
|
11
|
+
/** Compose/render cwd: `.deployment/local`. */
|
|
12
|
+
exports.LOCAL_RUN_DIR = (0, node_path_1.join)(exports.CHAT_ROOT_DIR, exports.CHAT_LOCAL_SUBDIR);
|
|
13
|
+
/**
|
|
14
|
+
* Passed as `docker compose -p` so the project name stays `local-run` after the
|
|
15
|
+
* render cwd moved to `.deployment/local` (basename would otherwise become `local`,
|
|
16
|
+
* which collides with unrelated compose stacks and makes `--remove-orphans` unsafe).
|
|
17
|
+
*/
|
|
18
|
+
exports.COMPOSE_PROJECT_NAME = 'local-run';
|
|
19
|
+
function chatRemoteDir(projectPath) {
|
|
20
|
+
return (0, node_path_1.join)(projectPath, exports.CHAT_ROOT_DIR, exports.CHAT_REMOTE_SUBDIR);
|
|
21
|
+
}
|
|
22
|
+
exports.LOCAL_COMPOSE_FILE = 'docker-compose.yaml';
|
|
23
|
+
/** Render output describing the running brokers/endpoints, consumed by the VS Code local-deploy view. */
|
|
24
|
+
exports.LOCAL_DEPLOY_DESCRIPTOR_FILE = 'local-deploy.json';
|
|
25
|
+
/** Machine-readable local deployment lifecycle, consumed by the VS Code local-deploy view. */
|
|
26
|
+
exports.BUILD_STATUS_FILE = 'build-status.json';
|
|
27
|
+
/** In-container listen port of every agent-graph service. */
|
|
28
|
+
exports.AGENT_GRAPH_PORT = 8001;
|
|
29
|
+
/** Compose service names of the two Flex Gateways. */
|
|
30
|
+
exports.FLEX_INGRESS_SERVICE = 'flex-ingress';
|
|
31
|
+
exports.FLEX_EGRESS_SERVICE = 'flex-egress';
|
|
32
|
+
/** Compose service name of the local Exchange static file server. */
|
|
33
|
+
exports.EXCHANGE_SERVICE = 'exchange';
|
|
34
|
+
/** Published Agent Graph image (Docker Hub `latest`, same untagged form as Flex). Pulled on first compose-up if missing locally. */
|
|
35
|
+
exports.AGENT_GRAPH_IMAGE = 'mulesoft/agent-graph-module';
|
|
36
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/run-local/constants.ts"],"names":[],"mappings":";;;AAgBA,sCAEC;AAlBD,yCAA8B;AAEjB,QAAA,oBAAoB,GAAG,IAAI,CAAA;AACxC,8FAA8F;AACjF,QAAA,aAAa,GAAG,aAAa,CAAA;AAC7B,QAAA,iBAAiB,GAAG,OAAO,CAAA;AAC3B,QAAA,kBAAkB,GAAG,QAAQ,CAAA;AAC1C,+CAA+C;AAClC,QAAA,aAAa,GAAG,IAAA,gBAAI,EAAC,qBAAa,EAAE,yBAAiB,CAAC,CAAA;AACnE;;;;GAIG;AACU,QAAA,oBAAoB,GAAG,WAAW,CAAA;AAE/C,SAAgB,aAAa,CAAC,WAAmB;IAC/C,OAAO,IAAA,gBAAI,EAAC,WAAW,EAAE,qBAAa,EAAE,0BAAkB,CAAC,CAAA;AAC7D,CAAC;AAEY,QAAA,kBAAkB,GAAG,qBAAqB,CAAA;AACvD,yGAAyG;AAC5F,QAAA,4BAA4B,GAAG,mBAAmB,CAAA;AAC/D,8FAA8F;AACjF,QAAA,iBAAiB,GAAG,mBAAmB,CAAA;AACpD,6DAA6D;AAChD,QAAA,gBAAgB,GAAG,IAAI,CAAA;AACpC,sDAAsD;AACzC,QAAA,oBAAoB,GAAG,cAAc,CAAA;AACrC,QAAA,mBAAmB,GAAG,aAAa,CAAA;AAChD,qEAAqE;AACxD,QAAA,gBAAgB,GAAG,UAAU,CAAA;AAC1C,oIAAoI;AACvH,QAAA,iBAAiB,GAAG,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.writeExclusiveCrd = writeExclusiveCrd;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) 2026, Salesforce, Inc.
|
|
7
|
+
* All rights reserved.
|
|
8
|
+
* For full license text, see the LICENSE.txt file
|
|
9
|
+
*/
|
|
10
|
+
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
11
|
+
const error_factory_1 = require("../../errors/error-factory");
|
|
12
|
+
/** Write a Flex CRD file only if it does not already exist (`wx`). Colliding Flex names fail loud. */
|
|
13
|
+
function writeExclusiveCrd(filePath, contents, resourceId) {
|
|
14
|
+
try {
|
|
15
|
+
fs.writeFileSync(filePath, contents, { flag: 'wx' });
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if ((error === null || error === void 0 ? void 0 : error.code) === 'EEXIST') {
|
|
19
|
+
throw error_factory_1.ErrorFactory.flexCrdNameCollision(resourceId, filePath);
|
|
20
|
+
}
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=crd-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crd-files.js","sourceRoot":"","sources":["../../../src/utils/run-local/crd-files.ts"],"names":[],"mappings":";;AASA,8CAUC;;AAnBD;;;;GAIG;AACH,qDAA8B;AAC9B,8DAAuD;AAEvD,sGAAsG;AACtG,SAAgB,iBAAiB,CAAC,QAAgB,EAAE,QAAgB,EAAE,UAAkB;IACtF,IAAI,CAAC;QACH,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC,CAAA;IACpD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,4BAAY,CAAC,oBAAoB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAC/D,CAAC;QAED,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { SecretsManager, SecretsReadOptions, KeychainSecretsManager, FileSystemSecretsManager, createSecretsManager, } from './secrets-manager';
|
|
2
|
+
export { SecretsListUnsupportedError, SecretsManagementReadError, SECRETS_LIST_UNSUPPORTED_WARNING_CODE, } from '../keychain';
|
|
3
|
+
export { LocalRunManager, LocalRunSetupOptions, DefaultLocalRunManager } from './local-run-manager';
|
|
4
|
+
export { RuntimeEnvironmentManager, GatewayConfig, AgentGraphConfig, StaticServerConfig, LogFollower, DockerComposeEnvironmentManager, } from './runtime-environment-manager';
|
|
5
|
+
export { PolicyResolver, PolicyResolverOptions, ExchangePolicyResolver } from './policy-resolver';
|
|
6
|
+
export { RecreateFingerprints, BrokerRecreateSelection, agentGraphServiceIds, computeRecreateFingerprints, selectBrokersToRecreate, } from './broker-recreate-selector';
|
|
7
|
+
export { writeLocalDeployDescriptor } from './local-deploy-descriptor';
|
|
8
|
+
export { LocalDeploymentStatusWriter, LocalDeploymentStatusWriterOptions, LocalDeploymentOperationStatus, LocalDeploymentTask, LocalDeploymentFailurePhase, LocalDeploymentFailureKind, LocalDeploymentTrigger, LocalDeploymentFailure, BUILD_STATUS_SCHEMA_VERSION, LOCAL_DEPLOYMENT_SESSION_ID_ENV, classifyLocalDeploymentFailure, resolveLocalDeploymentSessionId, isComposeSignalExit, } from './build-status';
|
|
9
|
+
export { DEFAULT_INGRESS_PORT, CHAT_ROOT_DIR, CHAT_LOCAL_SUBDIR, CHAT_REMOTE_SUBDIR, LOCAL_RUN_DIR, COMPOSE_PROJECT_NAME, chatRemoteDir, LOCAL_COMPOSE_FILE, LOCAL_DEPLOY_DESCRIPTOR_FILE, BUILD_STATUS_FILE, } from './constants';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BUILD_STATUS_FILE = exports.LOCAL_DEPLOY_DESCRIPTOR_FILE = exports.LOCAL_COMPOSE_FILE = exports.chatRemoteDir = exports.COMPOSE_PROJECT_NAME = exports.LOCAL_RUN_DIR = exports.CHAT_REMOTE_SUBDIR = exports.CHAT_LOCAL_SUBDIR = exports.CHAT_ROOT_DIR = exports.DEFAULT_INGRESS_PORT = exports.isComposeSignalExit = exports.resolveLocalDeploymentSessionId = exports.classifyLocalDeploymentFailure = exports.LOCAL_DEPLOYMENT_SESSION_ID_ENV = exports.BUILD_STATUS_SCHEMA_VERSION = exports.LocalDeploymentStatusWriter = exports.writeLocalDeployDescriptor = exports.selectBrokersToRecreate = exports.computeRecreateFingerprints = exports.agentGraphServiceIds = exports.ExchangePolicyResolver = exports.DockerComposeEnvironmentManager = exports.DefaultLocalRunManager = exports.SECRETS_LIST_UNSUPPORTED_WARNING_CODE = exports.SecretsManagementReadError = exports.SecretsListUnsupportedError = exports.createSecretsManager = exports.FileSystemSecretsManager = exports.KeychainSecretsManager = void 0;
|
|
4
|
+
var secrets_manager_1 = require("./secrets-manager");
|
|
5
|
+
Object.defineProperty(exports, "KeychainSecretsManager", { enumerable: true, get: function () { return secrets_manager_1.KeychainSecretsManager; } });
|
|
6
|
+
Object.defineProperty(exports, "FileSystemSecretsManager", { enumerable: true, get: function () { return secrets_manager_1.FileSystemSecretsManager; } });
|
|
7
|
+
Object.defineProperty(exports, "createSecretsManager", { enumerable: true, get: function () { return secrets_manager_1.createSecretsManager; } });
|
|
8
|
+
var keychain_1 = require("../keychain");
|
|
9
|
+
Object.defineProperty(exports, "SecretsListUnsupportedError", { enumerable: true, get: function () { return keychain_1.SecretsListUnsupportedError; } });
|
|
10
|
+
Object.defineProperty(exports, "SecretsManagementReadError", { enumerable: true, get: function () { return keychain_1.SecretsManagementReadError; } });
|
|
11
|
+
Object.defineProperty(exports, "SECRETS_LIST_UNSUPPORTED_WARNING_CODE", { enumerable: true, get: function () { return keychain_1.SECRETS_LIST_UNSUPPORTED_WARNING_CODE; } });
|
|
12
|
+
var local_run_manager_1 = require("./local-run-manager");
|
|
13
|
+
Object.defineProperty(exports, "DefaultLocalRunManager", { enumerable: true, get: function () { return local_run_manager_1.DefaultLocalRunManager; } });
|
|
14
|
+
var runtime_environment_manager_1 = require("./runtime-environment-manager");
|
|
15
|
+
Object.defineProperty(exports, "DockerComposeEnvironmentManager", { enumerable: true, get: function () { return runtime_environment_manager_1.DockerComposeEnvironmentManager; } });
|
|
16
|
+
var policy_resolver_1 = require("./policy-resolver");
|
|
17
|
+
Object.defineProperty(exports, "ExchangePolicyResolver", { enumerable: true, get: function () { return policy_resolver_1.ExchangePolicyResolver; } });
|
|
18
|
+
var broker_recreate_selector_1 = require("./broker-recreate-selector");
|
|
19
|
+
Object.defineProperty(exports, "agentGraphServiceIds", { enumerable: true, get: function () { return broker_recreate_selector_1.agentGraphServiceIds; } });
|
|
20
|
+
Object.defineProperty(exports, "computeRecreateFingerprints", { enumerable: true, get: function () { return broker_recreate_selector_1.computeRecreateFingerprints; } });
|
|
21
|
+
Object.defineProperty(exports, "selectBrokersToRecreate", { enumerable: true, get: function () { return broker_recreate_selector_1.selectBrokersToRecreate; } });
|
|
22
|
+
var local_deploy_descriptor_1 = require("./local-deploy-descriptor");
|
|
23
|
+
Object.defineProperty(exports, "writeLocalDeployDescriptor", { enumerable: true, get: function () { return local_deploy_descriptor_1.writeLocalDeployDescriptor; } });
|
|
24
|
+
var build_status_1 = require("./build-status");
|
|
25
|
+
Object.defineProperty(exports, "LocalDeploymentStatusWriter", { enumerable: true, get: function () { return build_status_1.LocalDeploymentStatusWriter; } });
|
|
26
|
+
Object.defineProperty(exports, "BUILD_STATUS_SCHEMA_VERSION", { enumerable: true, get: function () { return build_status_1.BUILD_STATUS_SCHEMA_VERSION; } });
|
|
27
|
+
Object.defineProperty(exports, "LOCAL_DEPLOYMENT_SESSION_ID_ENV", { enumerable: true, get: function () { return build_status_1.LOCAL_DEPLOYMENT_SESSION_ID_ENV; } });
|
|
28
|
+
Object.defineProperty(exports, "classifyLocalDeploymentFailure", { enumerable: true, get: function () { return build_status_1.classifyLocalDeploymentFailure; } });
|
|
29
|
+
Object.defineProperty(exports, "resolveLocalDeploymentSessionId", { enumerable: true, get: function () { return build_status_1.resolveLocalDeploymentSessionId; } });
|
|
30
|
+
Object.defineProperty(exports, "isComposeSignalExit", { enumerable: true, get: function () { return build_status_1.isComposeSignalExit; } });
|
|
31
|
+
var constants_1 = require("./constants");
|
|
32
|
+
Object.defineProperty(exports, "DEFAULT_INGRESS_PORT", { enumerable: true, get: function () { return constants_1.DEFAULT_INGRESS_PORT; } });
|
|
33
|
+
Object.defineProperty(exports, "CHAT_ROOT_DIR", { enumerable: true, get: function () { return constants_1.CHAT_ROOT_DIR; } });
|
|
34
|
+
Object.defineProperty(exports, "CHAT_LOCAL_SUBDIR", { enumerable: true, get: function () { return constants_1.CHAT_LOCAL_SUBDIR; } });
|
|
35
|
+
Object.defineProperty(exports, "CHAT_REMOTE_SUBDIR", { enumerable: true, get: function () { return constants_1.CHAT_REMOTE_SUBDIR; } });
|
|
36
|
+
Object.defineProperty(exports, "LOCAL_RUN_DIR", { enumerable: true, get: function () { return constants_1.LOCAL_RUN_DIR; } });
|
|
37
|
+
Object.defineProperty(exports, "COMPOSE_PROJECT_NAME", { enumerable: true, get: function () { return constants_1.COMPOSE_PROJECT_NAME; } });
|
|
38
|
+
Object.defineProperty(exports, "chatRemoteDir", { enumerable: true, get: function () { return constants_1.chatRemoteDir; } });
|
|
39
|
+
Object.defineProperty(exports, "LOCAL_COMPOSE_FILE", { enumerable: true, get: function () { return constants_1.LOCAL_COMPOSE_FILE; } });
|
|
40
|
+
Object.defineProperty(exports, "LOCAL_DEPLOY_DESCRIPTOR_FILE", { enumerable: true, get: function () { return constants_1.LOCAL_DEPLOY_DESCRIPTOR_FILE; } });
|
|
41
|
+
Object.defineProperty(exports, "BUILD_STATUS_FILE", { enumerable: true, get: function () { return constants_1.BUILD_STATUS_FILE; } });
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/run-local/index.ts"],"names":[],"mappings":";;;AAAA,qDAM0B;AAHxB,yHAAA,sBAAsB,OAAA;AACtB,2HAAA,wBAAwB,OAAA;AACxB,uHAAA,oBAAoB,OAAA;AAEtB,wCAIoB;AAHlB,uHAAA,2BAA2B,OAAA;AAC3B,sHAAA,0BAA0B,OAAA;AAC1B,iIAAA,qCAAqC,OAAA;AAEvC,yDAAiG;AAAlD,2HAAA,sBAAsB,OAAA;AACrE,6EAOsC;AADpC,8IAAA,+BAA+B,OAAA;AAEjC,qDAA+F;AAAhD,yHAAA,sBAAsB,OAAA;AACrE,uEAMmC;AAHjC,gIAAA,oBAAoB,OAAA;AACpB,uIAAA,2BAA2B,OAAA;AAC3B,mIAAA,uBAAuB,OAAA;AAEzB,qEAAoE;AAA5D,qIAAA,0BAA0B,OAAA;AAClC,+CAcuB;AAbrB,2HAAA,2BAA2B,OAAA;AAQ3B,2HAAA,2BAA2B,OAAA;AAC3B,+HAAA,+BAA+B,OAAA;AAC/B,8HAAA,8BAA8B,OAAA;AAC9B,+HAAA,+BAA+B,OAAA;AAC/B,mHAAA,mBAAmB,OAAA;AAErB,yCAWoB;AAVlB,iHAAA,oBAAoB,OAAA;AACpB,0GAAA,aAAa,OAAA;AACb,8GAAA,iBAAiB,OAAA;AACjB,+GAAA,kBAAkB,OAAA;AAClB,0GAAA,aAAa,OAAA;AACb,iHAAA,oBAAoB,OAAA;AACpB,0GAAA,aAAa,OAAA;AACb,+GAAA,kBAAkB,OAAA;AAClB,yHAAA,4BAA4B,OAAA;AAC5B,8GAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Connection, Space } from '../builders/project-builder';
|
|
2
|
+
export declare function isA2AConnectionType(type: string | undefined): boolean;
|
|
3
|
+
export declare function normalizeIngressPath(path: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Same-network A2A: rewrite the egress Service upstream through local flex-ingress
|
|
6
|
+
* so the target agent's inbound policies apply. Uses `dockerPort` (not hardcoded 8081).
|
|
7
|
+
* Returns undefined for LLM/MCP/remote A2A — caller keeps YAML `upstreamUrl`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveLocalA2AUpstream(connection: Connection, space: Space, dockerPort: number): string | undefined;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isA2AConnectionType = isA2AConnectionType;
|
|
4
|
+
exports.normalizeIngressPath = normalizeIngressPath;
|
|
5
|
+
exports.resolveLocalA2AUpstream = resolveLocalA2AUpstream;
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (c) 2026, Salesforce, Inc.
|
|
8
|
+
* All rights reserved.
|
|
9
|
+
* For full license text, see the LICENSE.txt file
|
|
10
|
+
*/
|
|
11
|
+
const constants_1 = require("../constants");
|
|
12
|
+
const constants_2 = require("./constants");
|
|
13
|
+
const A2A_TYPES = new Set([constants_1.A2A, constants_1.A2AV1, constants_1.A2A_V1]);
|
|
14
|
+
function isA2AConnectionType(type) {
|
|
15
|
+
return typeof type === 'string' && A2A_TYPES.has(type);
|
|
16
|
+
}
|
|
17
|
+
function normalizeIngressPath(path) {
|
|
18
|
+
const withSlash = path.startsWith('/') ? path : `/${path}`;
|
|
19
|
+
return withSlash.endsWith('/') ? withSlash : `${withSlash}/`;
|
|
20
|
+
}
|
|
21
|
+
function hasGavIdentity(asset) {
|
|
22
|
+
return Boolean((asset === null || asset === void 0 ? void 0 : asset.groupId) && (asset === null || asset === void 0 ? void 0 : asset.assetId));
|
|
23
|
+
}
|
|
24
|
+
function matchingLocalApiInstance(connection, space) {
|
|
25
|
+
if (!hasGavIdentity(connection.asset)) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
for (const component of Object.values(space.components)) {
|
|
29
|
+
for (const instance of Object.values(component.apiInstances)) {
|
|
30
|
+
if (!isA2AConnectionType(instance.type) || !hasGavIdentity(instance.asset)) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (instance.asset.groupId === connection.asset.groupId && instance.asset.assetId === connection.asset.assetId) {
|
|
34
|
+
return instance;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Same-network A2A: rewrite the egress Service upstream through local flex-ingress
|
|
42
|
+
* so the target agent's inbound policies apply. Uses `dockerPort` (not hardcoded 8081).
|
|
43
|
+
* Returns undefined for LLM/MCP/remote A2A — caller keeps YAML `upstreamUrl`.
|
|
44
|
+
*/
|
|
45
|
+
function resolveLocalA2AUpstream(connection, space, dockerPort) {
|
|
46
|
+
if (!isA2AConnectionType(connection.type)) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const instance = matchingLocalApiInstance(connection, space);
|
|
50
|
+
if (!instance) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
return `http://${constants_2.FLEX_INGRESS_SERVICE}:${dockerPort}${normalizeIngressPath(instance.path)}`;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=local-a2a-upstream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-a2a-upstream.js","sourceRoot":"","sources":["../../../src/utils/run-local/local-a2a-upstream.ts"],"names":[],"mappings":";;AAWA,kDAEC;AAED,oDAGC;AA+BD,0DAeC;AAhED;;;;GAIG;AACH,4CAA+C;AAE/C,2CAAgD;AAEhD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,eAAG,EAAE,iBAAK,EAAE,kBAAM,CAAC,CAAC,CAAA;AAE/C,SAAgB,mBAAmB,CAAC,IAAwB;IAC1D,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACxD,CAAC;AAED,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAA;IAC1D,OAAO,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAA;AAC9D,CAAC;AAED,SAAS,cAAc,CAAC,KAAuD;IAC7E,OAAO,OAAO,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,MAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CAAA,CAAC,CAAA;AAClD,CAAC;AAED,SAAS,wBAAwB,CAAC,UAAsB,EAAE,KAAY;IACpE,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QACxD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3E,SAAQ;YACV,CAAC;YAED,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,KAAK,UAAU,CAAC,KAAK,CAAC,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,KAAK,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBAC/G,OAAO,QAAQ,CAAA;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CACrC,UAAsB,EACtB,KAAY,EACZ,UAAkB;IAElB,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,QAAQ,GAAG,wBAAwB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAC5D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO,UAAU,gCAAoB,IAAI,UAAU,GAAG,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAA;AAC7F,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Space } from '../builders/project-builder';
|
|
2
|
+
import { GAV } from '../../types/types';
|
|
3
|
+
/** Bumped only on a breaking change to the shape; consumers must ignore versions they don't know. */
|
|
4
|
+
export declare const LOCAL_DEPLOY_DESCRIPTOR_SCHEMA_VERSION = 1;
|
|
5
|
+
/**
|
|
6
|
+
* One callable broker endpoint. `id` (assetId), `name` (`info.label`) and `path` are distinct
|
|
7
|
+
* on purpose: reusing one for another mislabels the broker or calls the wrong URL.
|
|
8
|
+
*/
|
|
9
|
+
export type LocalDeployBroker = {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
path: string;
|
|
13
|
+
url: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
};
|
|
16
|
+
/** Identifiers, labels, paths and ports only — never variable values, which stay in compose env. */
|
|
17
|
+
export type LocalDeployDescriptor = {
|
|
18
|
+
schemaVersion: number;
|
|
19
|
+
generatedAt: string;
|
|
20
|
+
gav: GAV;
|
|
21
|
+
ingress: {
|
|
22
|
+
port: number;
|
|
23
|
+
baseUrl: string;
|
|
24
|
+
};
|
|
25
|
+
brokers: LocalDeployBroker[];
|
|
26
|
+
};
|
|
27
|
+
export type LocalDeployDescriptorOptions = {
|
|
28
|
+
localRenderDir: string;
|
|
29
|
+
space: Space;
|
|
30
|
+
dockerPort: number;
|
|
31
|
+
/** The map the gateway CRDs were rendered against, secrets already replaced by an inert token. */
|
|
32
|
+
variables: Record<string, string>;
|
|
33
|
+
};
|
|
34
|
+
export declare function buildLocalDeployDescriptor(space: Space, dockerPort: number, variables: Record<string, string>): LocalDeployDescriptor;
|
|
35
|
+
/** Writes via tmp-file + rename so a watching consumer never observes a partial JSON document. */
|
|
36
|
+
export declare function writeLocalDeployDescriptor(options: LocalDeployDescriptorOptions): void;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LOCAL_DEPLOY_DESCRIPTOR_SCHEMA_VERSION = void 0;
|
|
4
|
+
exports.buildLocalDeployDescriptor = buildLocalDeployDescriptor;
|
|
5
|
+
exports.writeLocalDeployDescriptor = writeLocalDeployDescriptor;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
const variables_1 = require("../variables");
|
|
11
|
+
const constants_2 = require("./constants");
|
|
12
|
+
/** Bumped only on a breaking change to the shape; consumers must ignore versions they don't know. */
|
|
13
|
+
exports.LOCAL_DEPLOY_DESCRIPTOR_SCHEMA_VERSION = 1;
|
|
14
|
+
const TMP_SUFFIX = '.tmp';
|
|
15
|
+
const LOCAL_HOST = 'localhost';
|
|
16
|
+
function buildLocalDeployDescriptor(space, dockerPort, variables) {
|
|
17
|
+
const baseUrl = `http://${LOCAL_HOST}:${dockerPort}`;
|
|
18
|
+
const brokers = [];
|
|
19
|
+
for (const component of Object.values(space.components)) {
|
|
20
|
+
for (const instance of Object.values(component.apiInstances)) {
|
|
21
|
+
if (instance.type !== constants_1.A2AV1) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
brokers.push(toBroker(instance, baseUrl, variables));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
brokers.sort((a, b) => a.id.localeCompare(b.id));
|
|
28
|
+
return {
|
|
29
|
+
schemaVersion: exports.LOCAL_DEPLOY_DESCRIPTOR_SCHEMA_VERSION,
|
|
30
|
+
generatedAt: new Date().toISOString(),
|
|
31
|
+
gav: space.gav,
|
|
32
|
+
ingress: { port: dockerPort, baseUrl },
|
|
33
|
+
brokers,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function toBroker(instance, baseUrl, variables) {
|
|
37
|
+
// Same map and helper as the ingress CRD, so the advertised URL and the live route cannot diverge.
|
|
38
|
+
const path = normalizePath(variables_1.VariablesHelper.recursivelyReplacePlaceholders(instance.path, variables));
|
|
39
|
+
// Defensive: every broker reaching here sets environmentInstanceId; fall back to the raw
|
|
40
|
+
// (unresolved) path for a stable id if that ever changes — a resolved path would move with a
|
|
41
|
+
// variable value and lose the consumer's per-broker state on the next render.
|
|
42
|
+
const id = instance.environmentInstanceId || normalizePath(instance.path);
|
|
43
|
+
const name = variables_1.VariablesHelper.recursivelyReplacePlaceholders(instance.id, variables);
|
|
44
|
+
const description = instance.description && variables_1.VariablesHelper.recursivelyReplacePlaceholders(instance.description, variables);
|
|
45
|
+
return {
|
|
46
|
+
id,
|
|
47
|
+
name,
|
|
48
|
+
path,
|
|
49
|
+
url: `${baseUrl}/${path}/`,
|
|
50
|
+
...(description ? { description } : {}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function normalizePath(path) {
|
|
54
|
+
return path.replace(/^\/+/, '').replace(/\/+$/, '');
|
|
55
|
+
}
|
|
56
|
+
/** Writes via tmp-file + rename so a watching consumer never observes a partial JSON document. */
|
|
57
|
+
function writeLocalDeployDescriptor(options) {
|
|
58
|
+
const { localRenderDir, space, dockerPort, variables } = options;
|
|
59
|
+
const target = (0, node_path_1.join)(localRenderDir, constants_2.LOCAL_DEPLOY_DESCRIPTOR_FILE);
|
|
60
|
+
const tmp = `${target}${TMP_SUFFIX}`;
|
|
61
|
+
try {
|
|
62
|
+
fs.writeFileSync(tmp, JSON.stringify(buildLocalDeployDescriptor(space, dockerPort, variables), null, 2));
|
|
63
|
+
fs.renameSync(tmp, target);
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
// The render dir is watched, so a half-written tmp left by a failed rename must not survive.
|
|
67
|
+
fs.removeSync(tmp);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=local-deploy-descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-deploy-descriptor.js","sourceRoot":"","sources":["../../../src/utils/run-local/local-deploy-descriptor.ts"],"names":[],"mappings":";;;AA8CA,gEAuBC;AA0BD,gEAYC;;AA3GD,qDAA8B;AAC9B,yCAA8B;AAG9B,4CAAkC;AAClC,4CAA4C;AAC5C,2CAAwD;AAExD,qGAAqG;AACxF,QAAA,sCAAsC,GAAG,CAAC,CAAA;AAEvD,MAAM,UAA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CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Dependency, Space } from '../builders/project-builder';
|
|
2
|
+
export type LocalRunSetupOptions = {
|
|
3
|
+
projectPath: string;
|
|
4
|
+
targetDir: string;
|
|
5
|
+
localRenderDir: string;
|
|
6
|
+
space: Space;
|
|
7
|
+
dockerPort: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Manages the .deployment/local/ directory structure that serves as the self-contained
|
|
11
|
+
* runtime environment for local execution.
|
|
12
|
+
*
|
|
13
|
+
* Responsibilities include creating gateway config directories, generating Flex
|
|
14
|
+
* Gateway registration files, copying project sources, writing static CRDs
|
|
15
|
+
* (logging, exchange service), and preparing Exchange assets for the local
|
|
16
|
+
* static file server.
|
|
17
|
+
*/
|
|
18
|
+
export interface LocalRunManager {
|
|
19
|
+
/**
|
|
20
|
+
* Validates the Exchange assets that local run will copy before any render side effects.
|
|
21
|
+
*/
|
|
22
|
+
validateExchangeAssets(space: Space, targetDir: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Creates or refreshes the .deployment/local/ directory with all static artifacts
|
|
25
|
+
* needed before facet rendering and runtime configuration.
|
|
26
|
+
*/
|
|
27
|
+
setup(options: LocalRunSetupOptions): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Default implementation that produces a Docker Compose-compatible directory layout.
|
|
31
|
+
* Generates Flex Gateway disconnected-mode registration via Docker, copies project
|
|
32
|
+
* sources, and writes Flex CRDs for logging and the exchange service.
|
|
33
|
+
*/
|
|
34
|
+
export declare class DefaultLocalRunManager implements LocalRunManager {
|
|
35
|
+
validateExchangeAssets(space: Space, targetDir: string): void;
|
|
36
|
+
setup(options: LocalRunSetupOptions): void;
|
|
37
|
+
static validateExchangeAssets(space: Space, targetDir: string, exchangeModuleDir?: string): void;
|
|
38
|
+
static cleanVolatileArtifacts(localRenderDir: string): void;
|
|
39
|
+
static ensureFlexRegistration(localRenderDir: string, side: 'ingress' | 'egress'): boolean;
|
|
40
|
+
static copyProjectSources(projectPath: string, destDir: string): void;
|
|
41
|
+
static writeLoggingConfig(localRenderDir: string, side: 'ingress' | 'egress'): void;
|
|
42
|
+
static writeExchangeServiceCRD(localRenderDir: string, side: 'ingress' | 'egress'): void;
|
|
43
|
+
static copyExchangeAssets(space: Space, targetDir: string, localRenderDir: string, exchangeModuleDir?: string): void;
|
|
44
|
+
static copyDependencyAsset(dep: Dependency, exchangeDir: string, depCacheDir?: string): void;
|
|
45
|
+
private static collectOwnedCandidate;
|
|
46
|
+
private static collectDependencyCandidate;
|
|
47
|
+
private static exchangeAssetCandidates;
|
|
48
|
+
private static validateCandidateDestinations;
|
|
49
|
+
private static candidateLabel;
|
|
50
|
+
private static writePortConfig;
|
|
51
|
+
}
|