@credibledata/cred-cli 0.0.105 → 0.0.106
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 +12 -4
- package/dist/agent-contract.spec.js +21 -6
- package/dist/agent-contract.spec.js.map +1 -1
- package/dist/client/api.js +454 -66
- package/dist/client/api.js.map +1 -1
- package/dist/client-codeassist/api.js.map +1 -1
- package/dist/commands/misc/mcp.boot.harness.js +14 -0
- package/dist/commands/misc/mcp.boot.harness.js.map +1 -0
- package/dist/commands/misc/mcp.harness.js +9 -0
- package/dist/commands/misc/mcp.harness.js.map +1 -0
- package/dist/commands/misc/mcp.js +258 -0
- package/dist/commands/misc/mcp.js.map +1 -0
- package/dist/commands/misc/mcp.spec.js +213 -0
- package/dist/commands/misc/mcp.spec.js.map +1 -0
- package/dist/commands/misc/setup.js +72 -3
- package/dist/commands/misc/setup.js.map +1 -1
- package/dist/commands/misc/setup.spec.js +51 -6
- package/dist/commands/misc/setup.spec.js.map +1 -1
- package/dist/commands/misc/status.js +7 -1
- package/dist/commands/misc/status.js.map +1 -1
- package/dist/commands/misc/status.spec.js +34 -0
- package/dist/commands/misc/status.spec.js.map +1 -1
- package/dist/index.js +52 -11
- package/dist/index.js.map +1 -1
- package/dist/setup-core/briefing.d.ts +68 -0
- package/dist/setup-core/briefing.js +20 -11
- package/dist/setup-core/briefing.js.map +1 -1
- package/dist/setup-core/credstore.d.ts +229 -0
- package/dist/setup-core/environments.d.ts +112 -0
- package/dist/setup-core/flow.d.ts +171 -0
- package/dist/setup-core/flow.js +54 -28
- package/dist/setup-core/flow.js.map +1 -1
- package/dist/setup-core/flow.spec.js +135 -54
- package/dist/setup-core/flow.spec.js.map +1 -1
- package/dist/setup-core/folderconfig.d.ts +184 -0
- package/dist/setup-core/folderconfig.js +82 -21
- package/dist/setup-core/folderconfig.js.map +1 -1
- package/dist/setup-core/git.d.ts +57 -0
- package/dist/setup-core/git.js +37 -0
- package/dist/setup-core/git.js.map +1 -1
- package/dist/setup-core/host.d.ts +121 -0
- package/dist/setup-core/importconnections.d.ts +171 -0
- package/dist/setup-core/liveness.d.ts +17 -0
- package/dist/setup-core/localpublisherconfig.d.ts +10 -0
- package/dist/setup-core/mcpconfig.d.ts +132 -0
- package/dist/setup-core/mcpconfig.js +41 -17
- package/dist/setup-core/mcpconfig.js.map +1 -1
- package/dist/setup-core/mcpconfig.spec.js +17 -6
- package/dist/setup-core/mcpconfig.spec.js.map +1 -1
- package/dist/setup-core/packagemanifest.d.ts +28 -0
- package/dist/setup-core/ports.d.ts +95 -0
- package/dist/setup-core/ports.js +6 -5
- package/dist/setup-core/ports.js.map +1 -1
- package/dist/setup-core/publisherconfig.d.ts +163 -0
- package/dist/setup-core/publisherversion.d.ts +22 -0
- package/dist/setup-core/publisherversion.js +1 -1
- package/dist/setup-core/readylines.d.ts +109 -0
- package/dist/setup-core/refresh.d.ts +80 -0
- package/dist/setup-core/skills.d.ts +114 -0
- package/dist/setup-core/skills.js +34 -11
- package/dist/setup-core/skills.js.map +1 -1
- package/dist/setup-core/skills.spec.js +20 -0
- package/dist/setup-core/skills.spec.js.map +1 -1
- package/dist/setup-core/staleservers.d.ts +27 -0
- package/dist/setup-core/staleservers.js +97 -0
- package/dist/setup-core/staleservers.js.map +1 -0
- package/dist/setup-core/staleservers.spec.js +63 -0
- package/dist/setup-core/staleservers.spec.js.map +1 -0
- package/dist/setup-core/supervisor.d.ts +187 -0
- package/dist/setup-core/supervisor.js +1 -0
- package/dist/setup-core/supervisor.js.map +1 -1
- package/dist/setup-core/writefile.d.ts +27 -0
- package/package.json +4 -3
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RETIRED_SERVER_NAMES = exports.OWNED_SERVER_NAMES = exports.REMOTE_SERVER_NAME = exports.LOCAL_SERVER_NAME = exports.MCP_CONFIG_FILENAME = void 0;
|
|
7
7
|
exports.localPublisherUrl = localPublisherUrl;
|
|
8
|
+
exports.localServerEntry = localServerEntry;
|
|
8
9
|
exports.remoteCredibleUrl = remoteCredibleUrl;
|
|
9
10
|
exports.writeMcpConfig = writeMcpConfig;
|
|
10
11
|
exports.detectIndent = detectIndent;
|
|
@@ -23,15 +24,14 @@ const writefile_1 = require("./writefile");
|
|
|
23
24
|
* anyone is under version control. So the skip is the normal case, not the edge
|
|
24
25
|
* case, and setup owns the file.
|
|
25
26
|
*
|
|
26
|
-
* ## Why the local
|
|
27
|
+
* ## Why the local entry is a command and not a URL
|
|
27
28
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* copies, and bookmarks, and browsers already fall back across families.
|
|
29
|
+
* The local entry runs `cred mcp`, which finds this directory's Publisher,
|
|
30
|
+
* starts it with `cred dev` when it is not running, and forwards over stdio
|
|
31
|
+
* (`docs/cred-mcp-stdio-design.md`). It used to be the Publisher's URL. That
|
|
32
|
+
* port was open only while `cred dev` ran, so an agent started first had no
|
|
33
|
+
* `malloy` tools for its whole session, and the file kept pointing at the
|
|
34
|
+
* port after the server stopped.
|
|
35
35
|
*/
|
|
36
36
|
exports.MCP_CONFIG_FILENAME = ".mcp.json";
|
|
37
37
|
/** The name of the local Publisher entry. Matches what upstream writes. */
|
|
@@ -90,9 +90,28 @@ const MCP_HOSTS = {
|
|
|
90
90
|
"aws-affinity": (org) => `https://${org}.aws-affinity-mcp.credibledata.com`,
|
|
91
91
|
"e2e-test": (org) => `http://${org}.mcp.credibledata.localhost:8000`,
|
|
92
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* The local Publisher's MCP URL, for `cred status` and `cred mcp`.
|
|
95
|
+
*
|
|
96
|
+
* `127.0.0.1`, never `localhost`: `localhost` resolves to both loopback
|
|
97
|
+
* families while the server binds only one, so another local process can hold
|
|
98
|
+
* the same port on the other family and receive the traffic instead.
|
|
99
|
+
*/
|
|
93
100
|
function localPublisherUrl(mcpPort) {
|
|
94
101
|
return `http://127.0.0.1:${mcpPort}/mcp`;
|
|
95
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* The `.mcp.json` entry for the local Publisher.
|
|
105
|
+
*
|
|
106
|
+
* On native Windows an npm-installed `cred` is a `cred.cmd` shim, which an
|
|
107
|
+
* MCP client spawning without a shell cannot launch. `cmd /c` is the wrapper
|
|
108
|
+
* Claude Code's docs give for the same problem with `npx`.
|
|
109
|
+
*/
|
|
110
|
+
function localServerEntry(platform = process.platform) {
|
|
111
|
+
return platform === "win32"
|
|
112
|
+
? { type: "stdio", command: "cmd", args: ["/c", "cred", "mcp"] }
|
|
113
|
+
: { type: "stdio", command: "cred", args: ["mcp"] };
|
|
114
|
+
}
|
|
96
115
|
/**
|
|
97
116
|
* The org-scoped remote MCP URL.
|
|
98
117
|
*
|
|
@@ -114,9 +133,8 @@ function remoteCredibleUrl(deployment, organization) {
|
|
|
114
133
|
*
|
|
115
134
|
* - a user's own MCP servers in this file must survive `cred init`, so we only
|
|
116
135
|
* ever touch the keys we own, plus the ones we used to own and now remove;
|
|
117
|
-
* - our own entries must be *overwritten*, not preserved,
|
|
118
|
-
*
|
|
119
|
-
* failure this whole file exists to avoid.
|
|
136
|
+
* - our own entries must be *overwritten*, not preserved, so a file an older
|
|
137
|
+
* build wrote (with the local entry as a URL) moves to the current shape.
|
|
120
138
|
*
|
|
121
139
|
* No token is ever written. The local server needs none, and the remote one is
|
|
122
140
|
* reached with the client's own OAuth.
|
|
@@ -171,10 +189,7 @@ function writeMcpConfig(options) {
|
|
|
171
189
|
for (const name of retired) {
|
|
172
190
|
delete servers[name];
|
|
173
191
|
}
|
|
174
|
-
servers[exports.LOCAL_SERVER_NAME] =
|
|
175
|
-
type: "http",
|
|
176
|
-
url: localPublisherUrl(options.mcpPort),
|
|
177
|
-
};
|
|
192
|
+
servers[exports.LOCAL_SERVER_NAME] = localServerEntry(options.platform);
|
|
178
193
|
servers[exports.REMOTE_SERVER_NAME] = {
|
|
179
194
|
type: "http",
|
|
180
195
|
url: remoteCredibleUrl(options.deployment, options.organization),
|
|
@@ -184,11 +199,20 @@ function writeMcpConfig(options) {
|
|
|
184
199
|
// changes the lines that changed rather than every line. Two spaces for a
|
|
185
200
|
// new file, as Claude Code writes it.
|
|
186
201
|
const content = `${JSON.stringify(merged, null, detectIndent(existingRaw))}\n`;
|
|
202
|
+
const onlyOurs = preserved.length === 0 &&
|
|
203
|
+
Object.keys(merged).every((key) => key === "mcpServers");
|
|
187
204
|
if (existingRaw === content) {
|
|
188
|
-
return {
|
|
205
|
+
return {
|
|
206
|
+
filePath,
|
|
207
|
+
changed: false,
|
|
208
|
+
preserved,
|
|
209
|
+
retired,
|
|
210
|
+
displaced,
|
|
211
|
+
onlyOurs,
|
|
212
|
+
};
|
|
189
213
|
}
|
|
190
214
|
(0, writefile_1.writeFileAtomic)(filePath, content);
|
|
191
|
-
return { filePath, changed: true, preserved, retired, displaced };
|
|
215
|
+
return { filePath, changed: true, preserved, retired, displaced, onlyOurs };
|
|
192
216
|
}
|
|
193
217
|
/** The indentation of the first indented line, or two spaces. */
|
|
194
218
|
function detectIndent(text) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpconfig.js","sourceRoot":"","sources":["../../src/setup-core/mcpconfig.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"mcpconfig.js","sourceRoot":"","sources":["../../src/setup-core/mcpconfig.ts"],"names":[],"mappings":";;;;;;AAkHA,8CAEC;AASD,4CAMC;AAYD,8CAKC;AA4CD,wCA2FC;AAGD,oCAGC;AAjSD,4CAAoB;AACpB,gDAAwB;AAExB,2CAA8C;AAE9C;;;;;;;;;;;;;;;;;;;;GAoBG;AAEU,QAAA,mBAAmB,GAAG,WAAW,CAAC;AAE/C,2EAA2E;AAC9D,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAC1C,yFAAyF;AAC5E,QAA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AS,EAAE,QAAQ,EAAE,CAAC;AAC/E,CAAC;AAED,iEAAiE;AACjE,SAAgB,YAAY,CAAC,IAAwB;IAClD,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAClC,CAAC"}
|
|
@@ -17,7 +17,6 @@ describe("writeMcpConfig", () => {
|
|
|
17
17
|
fs_1.default.rmSync(directory, { recursive: true, force: true });
|
|
18
18
|
});
|
|
19
19
|
const options = {
|
|
20
|
-
mcpPort: 4040,
|
|
21
20
|
deployment: "production",
|
|
22
21
|
organization: "acme",
|
|
23
22
|
};
|
|
@@ -40,7 +39,7 @@ describe("writeMcpConfig", () => {
|
|
|
40
39
|
(0, chai_1.expect)(result.changed).to.equal(true);
|
|
41
40
|
const config = read();
|
|
42
41
|
(0, chai_1.expect)(config.mcpServers).to.eql({
|
|
43
|
-
malloy: { type: "
|
|
42
|
+
malloy: { type: "stdio", command: "cred", args: ["mcp"] },
|
|
44
43
|
credible: {
|
|
45
44
|
type: "http",
|
|
46
45
|
url: "https://acme.mcp.credibledata.com/mcp",
|
|
@@ -114,16 +113,28 @@ describe("writeMcpConfig", () => {
|
|
|
114
113
|
(0, mcpconfig_1.writeMcpConfig)(Object.assign({ directory }, options));
|
|
115
114
|
(0, chai_1.expect)(read().someOtherSetting).to.equal(true);
|
|
116
115
|
});
|
|
117
|
-
it("
|
|
118
|
-
// The opposite of preserving:
|
|
119
|
-
//
|
|
116
|
+
it("replaces an older build's local URL with the cred mcp command", () => {
|
|
117
|
+
// The opposite of preserving: our own entries are always rewritten, and
|
|
118
|
+
// a local URL outlives the server it names.
|
|
120
119
|
fs_1.default.writeFileSync((0, path_1.join)(directory, ".mcp.json"), JSON.stringify({
|
|
121
120
|
mcpServers: {
|
|
122
121
|
malloy: { type: "http", url: "http://127.0.0.1:9999/mcp" },
|
|
123
122
|
},
|
|
124
123
|
}));
|
|
125
124
|
(0, mcpconfig_1.writeMcpConfig)(Object.assign({ directory }, options));
|
|
126
|
-
(0, chai_1.expect)(read().mcpServers.malloy
|
|
125
|
+
(0, chai_1.expect)(read().mcpServers.malloy).to.eql({
|
|
126
|
+
type: "stdio",
|
|
127
|
+
command: "cred",
|
|
128
|
+
args: ["mcp"],
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
it("wraps cred in cmd /c on Windows, where it is a .cmd shim", () => {
|
|
132
|
+
(0, mcpconfig_1.writeMcpConfig)(Object.assign(Object.assign({ directory }, options), { platform: "win32" }));
|
|
133
|
+
(0, chai_1.expect)(read().mcpServers.malloy).to.eql({
|
|
134
|
+
type: "stdio",
|
|
135
|
+
command: "cmd",
|
|
136
|
+
args: ["/c", "cred", "mcp"],
|
|
137
|
+
});
|
|
127
138
|
});
|
|
128
139
|
it("reports no change when the file already says exactly this", () => {
|
|
129
140
|
(0, mcpconfig_1.writeMcpConfig)(Object.assign({ directory }, options));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpconfig.spec.js","sourceRoot":"","sources":["../../src/setup-core/mcpconfig.spec.ts"],"names":[],"mappings":";;;;;AAAA,+BAA8B;AAC9B,4CAAoB;AACpB,4CAAoB;AACpB,+BAA4B;AAC5B,2CAIqB;AAErB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC7B,IAAI,SAAiB,CAAC;IAEtB,UAAU,CAAC,GAAG,EAAE;QACb,SAAS,GAAG,YAAE,CAAC,WAAW,CAAC,IAAA,WAAI,EAAC,YAAE,CAAC,MAAM,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACZ,YAAE,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,I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IAAA,aAAM,EAAC,IAAA,6BAAiB,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAC9C,2CAA2C,CAC7C,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;YACrE,wEAAwE;YACxE,0EAA0E;YAC1E,yEAAyE;YACzE,yEAAyE;YACzE,IAAA,aAAM,EAAC,IAAA,6BAAiB,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CACnD,8DAA8D,CAChE,CAAC;YACF,IAAA,aAAM,EAAC,IAAA,6BAAiB,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CACvD,IAAA,6BAAiB,EAAC,YAAY,EAAE,MAAM,CAAC,CACzC,CAAC;QACL,CAAC,CAAC,CAAC;IACN,CAAC,CAAC,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `publisher.json` — the file that makes a directory a *package* rather than a
|
|
3
|
+
* folder that happens to contain `.malloy` files.
|
|
4
|
+
*
|
|
5
|
+
* Without it the server loads the environment, finds the mounted directory, and
|
|
6
|
+
* then fails the package with *"Package manifest for … does not exist"* — which
|
|
7
|
+
* it reports as a load error while still binding both ports. So adopting an
|
|
8
|
+
* existing checkout (plan §5.4 source B) needs this written, and the plan did
|
|
9
|
+
* not say so: it assumed a directory a user points at is already a package,
|
|
10
|
+
* which is true for a clone of a published package and false for the loose
|
|
11
|
+
* folder of models that "use this directory" is mostly aimed at.
|
|
12
|
+
*
|
|
13
|
+
* Written only when absent. A package that already has a manifest keeps its own
|
|
14
|
+
* name, version, and description — those are the author's, not ours.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PACKAGE_MANIFEST_FILE = "publisher.json";
|
|
17
|
+
export interface ManifestResult {
|
|
18
|
+
filePath: string;
|
|
19
|
+
action: "created" | "kept";
|
|
20
|
+
/** The package name now in effect — the existing one wins when there is one. */
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* A kept manifest with no `version`. Left alone — it is the author's — but
|
|
24
|
+
* `cred publish` will refuse it, so the caller says so now rather than then.
|
|
25
|
+
*/
|
|
26
|
+
missingVersion?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare function ensurePackageManifest(directory: string, fallbackName: string): ManifestResult;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Choosing the port pair a local Publisher session listens on.
|
|
3
|
+
*
|
|
4
|
+
* ## Why not just ask for an ephemeral port
|
|
5
|
+
*
|
|
6
|
+
* The server accepts `--port 0 --mcp_port 0` and reports what it bound, which
|
|
7
|
+
* looks like the easy answer to two sessions colliding. It is the wrong answer,
|
|
8
|
+
* and the server itself says so: with an ephemeral MCP port it refuses to write
|
|
9
|
+
* `.mcp.json` at all, because "the port changes from run to run and a saved
|
|
10
|
+
* config would be wrong next boot".
|
|
11
|
+
*
|
|
12
|
+
* Our own `.mcp.json` no longer names a port: it runs `cred mcp`, which reads
|
|
13
|
+
* this directory's remembered pair. Stable ports still matter for anything that
|
|
14
|
+
* saved an address: the Publisher UI open in a browser, and an MCP config
|
|
15
|
+
* written by an older `cred` or by the editor extension, which still names a
|
|
16
|
+
* URL. A port that moves every run turns those into addresses that silently
|
|
17
|
+
* point at nothing.
|
|
18
|
+
*
|
|
19
|
+
* So ports must be *stable for a directory*: the same working directory gets the
|
|
20
|
+
* same pair every run, while two different directories get different pairs.
|
|
21
|
+
*/
|
|
22
|
+
/** The ports a user recognises, and what we try first. */
|
|
23
|
+
export declare const DEFAULT_UI_PORT = 4000;
|
|
24
|
+
export declare const DEFAULT_MCP_PORT = 4040;
|
|
25
|
+
/** MCP sits this far above the UI port, mirroring the 4000/4040 default. */
|
|
26
|
+
export declare const MCP_OFFSET = 40;
|
|
27
|
+
export interface PortPair {
|
|
28
|
+
uiPort: number;
|
|
29
|
+
mcpPort: number;
|
|
30
|
+
}
|
|
31
|
+
export interface PortAllocation extends PortPair {
|
|
32
|
+
/** True when the pair is not the recognisable 4000/4040. */
|
|
33
|
+
derived: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** Is `port` free to bind on `host`? */
|
|
36
|
+
export declare function isPortFree(port: number, host?: string): Promise<boolean>;
|
|
37
|
+
export declare function pairIsFree(pair: PortPair, host?: string): Promise<boolean>;
|
|
38
|
+
/** The pair `--port` names: the UI port, and MCP the usual distance above it. */
|
|
39
|
+
export declare function pairForUiPort(uiPort: number): PortPair;
|
|
40
|
+
/** The highest UI port `--port` accepts, so the MCP port above it is valid. */
|
|
41
|
+
export declare const MAX_UI_PORT: number;
|
|
42
|
+
/** The lowest UI port `--port` accepts: above the privileged range. */
|
|
43
|
+
export declare const MIN_UI_PORT = 1024;
|
|
44
|
+
/**
|
|
45
|
+
* A free pair to offer in a port-conflict error, so the fix names a number
|
|
46
|
+
* rather than telling the reader to go find one. The directory's own derived
|
|
47
|
+
* pairs, the ones `cred` would have picked itself; undefined when none in the
|
|
48
|
+
* first few is free.
|
|
49
|
+
*/
|
|
50
|
+
export declare function suggestFreePair(directory: string, host?: string): Promise<PortPair | undefined>;
|
|
51
|
+
/**
|
|
52
|
+
* The pair a given directory prefers, derived from its path.
|
|
53
|
+
*
|
|
54
|
+
* Deterministic so the same directory lands on the same pair every run, and
|
|
55
|
+
* spread out so two directories are unlikely to collide. Exported for tests and
|
|
56
|
+
* for the caller that wants to report the pair before binding it.
|
|
57
|
+
*/
|
|
58
|
+
export declare function derivePairForDirectory(directory: string): PortPair;
|
|
59
|
+
/**
|
|
60
|
+
* The pairs to try for a directory, in order, starting at its derived pair.
|
|
61
|
+
*
|
|
62
|
+
* Separate from the probing loop because it is the part with the arithmetic in
|
|
63
|
+
* it, and the part worth asserting directly: the sequence wraps to the bottom of
|
|
64
|
+
* the range rather than stopping at the top, so every directory gets the whole
|
|
65
|
+
* budget. The previous loop walked forward and broke at the range end, which
|
|
66
|
+
* gave a directory whose hash landed near 65500 one or two probes and then said
|
|
67
|
+
* "after 32 attempts".
|
|
68
|
+
*
|
|
69
|
+
* Never longer than the range holds, so `attempts` cannot make it repeat a pair
|
|
70
|
+
* and then report having tried more than it did.
|
|
71
|
+
*/
|
|
72
|
+
export declare function derivedCandidates(directory: string, attempts: number): PortPair[];
|
|
73
|
+
/** The top and bottom of the derived range, for tests that assert the wrap. */
|
|
74
|
+
export declare const DERIVED_RANGE: {
|
|
75
|
+
start: number;
|
|
76
|
+
end: number;
|
|
77
|
+
stride: number;
|
|
78
|
+
slots: number;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Pick the pair this session should bind.
|
|
82
|
+
*
|
|
83
|
+
* Precedence, so a returning user keeps the URL they bookmarked:
|
|
84
|
+
* 1. `preferred` — the pair this directory used last, from `.credible/config.json`.
|
|
85
|
+
* 2. 4000/4040, the memorable default.
|
|
86
|
+
* 3. The pair derived from the directory path, then successive strides from it.
|
|
87
|
+
*
|
|
88
|
+
* @throws SetupError-worthy Error when nothing in the search window is free,
|
|
89
|
+
* which in practice means something is very wrong rather than busy.
|
|
90
|
+
*/
|
|
91
|
+
export declare function allocatePortPair(directory: string, options?: {
|
|
92
|
+
preferred?: PortPair;
|
|
93
|
+
host?: string;
|
|
94
|
+
attempts?: number;
|
|
95
|
+
}): Promise<PortAllocation>;
|
package/dist/setup-core/ports.js
CHANGED
|
@@ -33,11 +33,12 @@ const net_1 = __importDefault(require("net"));
|
|
|
33
33
|
* `.mcp.json` at all, because "the port changes from run to run and a saved
|
|
34
34
|
* config would be wrong next boot".
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* Our own `.mcp.json` no longer names a port: it runs `cred mcp`, which reads
|
|
37
|
+
* this directory's remembered pair. Stable ports still matter for anything that
|
|
38
|
+
* saved an address: the Publisher UI open in a browser, and an MCP config
|
|
39
|
+
* written by an older `cred` or by the editor extension, which still names a
|
|
40
|
+
* URL. A port that moves every run turns those into addresses that silently
|
|
41
|
+
* point at nothing.
|
|
41
42
|
*
|
|
42
43
|
* So ports must be *stable for a directory*: the same working directory gets the
|
|
43
44
|
* same pair every run, while two different directories get different pairs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../src/setup-core/ports.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../src/setup-core/ports.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AA0DA,gCASC;AAED,gCAUC;AAGD,sCAEC;AAcD,0CAQC;AASD,wDAIC;AAeD,8CAiBC;AAqBD,4CAgCC;AA5MD,oDAA4B;AAC5B,8CAAsB;AAEtB;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,0DAA0D;AAC7C,QAAA,eAAe,GAAG,IAAI,CAAC;AACvB,QAAA,gBAAgB,GAAG,IAAI,CAAC;AAErC;;;GAGG;AACH,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAClC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAChC,4EAA4E;AAC/D,QAAA,UAAU,GAAG,EAAE,CAAC;AAC7B,0EAA0E;AAC1E,MAAM,cAAc,GAAG,kBAAU,GAAG,CAAC,CAAC;AACtC;;;GAGG;AACH,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAC7B,CAAC,iBAAiB,GAAG,kBAAU,GAAG,mBAAmB,CAAC,GAAG,cAAc,CACzE,CAAC;AAYF,wCAAwC;AACxC,SAAgB,UAAU,CAAC,IAAY,EAAE,IAAI,GAAG,WAAW;IACxD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC5B,MAAM,KAAK,GAAG,aAAG,CAAC,YAAY,EAAE,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GA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,MAAA,OAAO,CAAC,QAAQ,mCAAI,EAAE,CAAC;QAExC,IAAI,OAAO,CAAC,SAAS,IAAI,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;YACpE,uCACM,OAAO,CAAC,SAAS,KACpB,OAAO,EACJ,OAAO,CAAC,SAAS,CAAC,MAAM,KAAK,uBAAe;oBAC5C,OAAO,CAAC,SAAS,CAAC,OAAO,KAAK,wBAAgB,IAClD;QACL,CAAC;QAED,MAAM,QAAQ,GAAG,EAAE,MAAM,EAAE,uBAAe,EAAE,OAAO,EAAE,wBAAgB,EAAE,CAAC;QACxE,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC;YACpC,uCAAY,QAAQ,KAAE,OAAO,EAAE,KAAK,IAAG;QAC1C,CAAC;QAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC1D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YAClC,IAAI,MAAM,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC;gBACrC,uCAAY,SAAS,KAAE,OAAO,EAAE,IAAI,IAAG;YAC1C,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,KAAK,CACZ,uCAAuC,SAAS,UAAU,UAAU,CAAC,MAAM,aAAa;YACrF,8CAA8C,MAAA,UAAU,CAAC,CAAC,CAAC,0CAAE,MAAM,aAAa,uBAAe,QAAQ,wBAAgB,GAAG,CAC/H,CAAC;IACL,CAAC;CAAA"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Environment } from "./environments";
|
|
2
|
+
/**
|
|
3
|
+
* Generating `publisher.config.json` — the file that tells a local Publisher
|
|
4
|
+
* which directory to serve and how to reach the warehouse.
|
|
5
|
+
*
|
|
6
|
+
* ## The shape trap
|
|
7
|
+
*
|
|
8
|
+
* The VS Code extension already builds "publisher connections", so its
|
|
9
|
+
* `convertToPublisherConnection` looks like the thing to reuse. It is not: it
|
|
10
|
+
* writes the *Malloy VS Code extension's* flat shape,
|
|
11
|
+
*
|
|
12
|
+
* { "is": "publisher", "connectionUri": "...", "accessToken": "...", "readOnly": true }
|
|
13
|
+
*
|
|
14
|
+
* into `malloy-config.json`, while the Publisher *server* requires its own
|
|
15
|
+
* nested shape,
|
|
16
|
+
*
|
|
17
|
+
* { "name": "...", "type": "publisher", "publisherConnection": { "connectionUri": "...", "accessToken": "..." } }
|
|
18
|
+
*
|
|
19
|
+
* (see the server's `connection_config.ts`, which rejects a missing
|
|
20
|
+
* `connectionUri` at config-load with exactly that Fix line). Two files, two
|
|
21
|
+
* consumers, two schemas for one concept. Port the logic, never the literal.
|
|
22
|
+
*
|
|
23
|
+
* ## Why no token is written here
|
|
24
|
+
*
|
|
25
|
+
* A `publisher` connection's `accessToken` is a short-lived JWT and the server
|
|
26
|
+
* has no refresh hook yet, so a token written at setup time is stale by the time
|
|
27
|
+
* anyone uses it. The supervisor stamps it at spawn, every spawn. Setup writing
|
|
28
|
+
* one would also mean a credential sitting in a file that setup tells the user
|
|
29
|
+
* to commit.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Connection names a local Publisher will not accept at environment level.
|
|
33
|
+
*
|
|
34
|
+
* `duckdb` is reserved for the per-package sandbox each package gets. Using it
|
|
35
|
+
* makes the server skip the entire environment — while still binding both ports
|
|
36
|
+
* and printing both listening lines, so nothing about the startup output says
|
|
37
|
+
* anything is wrong.
|
|
38
|
+
*/
|
|
39
|
+
export declare const RESERVED_CONNECTION_NAMES: Set<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Turn a directory name into something Publisher will accept as a package name.
|
|
42
|
+
*
|
|
43
|
+
* Substitution rather than rejection: the user did not choose this string as a
|
|
44
|
+
* package name — we derived it from where they happened to be standing — so
|
|
45
|
+
* failing setup over a space in a folder name would be punishing them for our
|
|
46
|
+
* choice of default.
|
|
47
|
+
*/
|
|
48
|
+
export declare function packageNameFromDirectory(directoryName: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* The environment the local publisher serves the package under: the Credible
|
|
51
|
+
* environment's name with `-local`, so the agent and the user see which remote
|
|
52
|
+
* environment it proxies to, and cannot mistake one name for the other. A
|
|
53
|
+
* Credible name may hold spaces; the publisher's names may not, so it is
|
|
54
|
+
* cleaned by the same rule as a package name.
|
|
55
|
+
*/
|
|
56
|
+
export declare function localEnvironmentName(credibleEnvironment: string): string;
|
|
57
|
+
/** A connection as the control plane lists it. Only the name is load-bearing here. */
|
|
58
|
+
export interface CredibleConnection {
|
|
59
|
+
name?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface PublisherPackageEntry {
|
|
62
|
+
name: string;
|
|
63
|
+
location: string;
|
|
64
|
+
}
|
|
65
|
+
export interface PublisherConnectionEntry {
|
|
66
|
+
name: string;
|
|
67
|
+
type: "publisher" | "duckdb";
|
|
68
|
+
publisherConnection?: {
|
|
69
|
+
connectionUri: string;
|
|
70
|
+
/** Stamped by the supervisor at spawn, absent on disk between runs. */
|
|
71
|
+
accessToken?: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export interface PublisherEnvironmentEntry {
|
|
75
|
+
name: string;
|
|
76
|
+
packages: PublisherPackageEntry[];
|
|
77
|
+
connections: PublisherConnectionEntry[];
|
|
78
|
+
}
|
|
79
|
+
export interface PublisherConfig {
|
|
80
|
+
frozenConfig: boolean;
|
|
81
|
+
environments: PublisherEnvironmentEntry[];
|
|
82
|
+
/**
|
|
83
|
+
* The server's `get_context` retrieval settings (`retrieval.llm`,
|
|
84
|
+
* `retrieval.embedding`, ...), copied as written from the directory's own
|
|
85
|
+
* `publisher.config.json`. See {@link readLocalRetrieval}.
|
|
86
|
+
*/
|
|
87
|
+
retrieval?: Record<string, unknown>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The URL a local Publisher proxies SQL to.
|
|
91
|
+
*
|
|
92
|
+
* Note the form: `@malloydata/db-publisher` parses this positionally and issues
|
|
93
|
+
* its own requests against the legacy `/api/v0/projects/{env}/…` facade, while
|
|
94
|
+
* publisher-server's introspection appends paths verbatim to this
|
|
95
|
+
* `/environments/…` form. The router serves both, which is why a locally-spawned
|
|
96
|
+
* Publisher daisy-chaining to Credible needs no server-side change — but it
|
|
97
|
+
* means this string is load-bearing for two different request generations.
|
|
98
|
+
*/
|
|
99
|
+
export declare function connectionUriFor(deployment: Environment, organization: string, credibleEnvironment: string, connectionName: string): string;
|
|
100
|
+
export interface BuildPublisherConfigOptions {
|
|
101
|
+
deployment: Environment;
|
|
102
|
+
organization: string;
|
|
103
|
+
/** The Credible environment whose connections are proxied. */
|
|
104
|
+
credibleEnvironment: string;
|
|
105
|
+
connections: CredibleConnection[];
|
|
106
|
+
/**
|
|
107
|
+
* The package's `location`, as an ABSOLUTE path.
|
|
108
|
+
*
|
|
109
|
+
* Not `"."`, and not a bare name: the server rejects both with *"Invalid
|
|
110
|
+
* package path … Must be an absolute mounted path or a GCS/S3/GitHub URI"*,
|
|
111
|
+
* then skips the environment while still reporting both ports listening.
|
|
112
|
+
* Absolute sidesteps the resolution rules entirely — a relative location
|
|
113
|
+
* resolves against the config file's directory, which is a second thing to
|
|
114
|
+
* get right for no benefit.
|
|
115
|
+
*/
|
|
116
|
+
packageLocation: string;
|
|
117
|
+
packageName?: string;
|
|
118
|
+
/** The watch environment's name inside publisher.config.json. */
|
|
119
|
+
environmentName?: string;
|
|
120
|
+
/** The `retrieval` block to pass through. See {@link readLocalRetrieval}. */
|
|
121
|
+
retrieval?: Record<string, unknown>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Build the config, or explain exactly why the inputs cannot produce one.
|
|
125
|
+
*
|
|
126
|
+
* Validation happens here rather than being left to the server because a config
|
|
127
|
+
* the server rejects at boot fails *after* setup has claimed success, and the
|
|
128
|
+
* server's error lands in a log the user is not reading yet.
|
|
129
|
+
*/
|
|
130
|
+
export declare function buildPublisherConfig(options: BuildPublisherConfigOptions): PublisherConfig;
|
|
131
|
+
/**
|
|
132
|
+
* The `retrieval` block of the user's own `publisher.config.json` in this
|
|
133
|
+
* directory, if it has one.
|
|
134
|
+
*
|
|
135
|
+
* The config the server runs on is ours, rebuilt at every start (see
|
|
136
|
+
* `sessionConfigPath`), so a setting written there is lost. The retrieval block
|
|
137
|
+
* is the part of a Publisher operator's config that still means something under
|
|
138
|
+
* `cred dev`: it picks the LLM and embedding models `get_context` ranks with.
|
|
139
|
+
* So it is read from the file a Publisher user already keeps it in, and copied
|
|
140
|
+
* unchanged. Its contents are the server's to validate: an unknown key or a bad
|
|
141
|
+
* value fails its startup (`PUBLISHER_INIT_FAILED`, naming the key and the
|
|
142
|
+
* valid ones), and `cred dev` exits with that message. That beats a second
|
|
143
|
+
* schema here that drifts from the server's. The API keys are environment
|
|
144
|
+
* variables (`LLM_API_KEY`, `EMBEDDING_API_KEY`), which the server inherits from
|
|
145
|
+
* the shell that ran `cred dev`.
|
|
146
|
+
*
|
|
147
|
+
* No file, an unreadable one, no `retrieval` key, or `"retrieval": null`:
|
|
148
|
+
* nothing to carry, and not an error. A `retrieval` that is not an object is reported and left out rather
|
|
149
|
+
* than handed to the server.
|
|
150
|
+
*/
|
|
151
|
+
export declare function readLocalRetrieval(directory: string): {
|
|
152
|
+
settings: Record<string, unknown>;
|
|
153
|
+
} | {
|
|
154
|
+
problem: string;
|
|
155
|
+
} | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* Return a copy of `config` with `accessToken` set on every `publisher`
|
|
158
|
+
* connection. Called by the supervisor at spawn and on every refresh.
|
|
159
|
+
*
|
|
160
|
+
* A copy rather than a mutation so the token-free config is what stays on disk
|
|
161
|
+
* between runs, and so a caller cannot accidentally serialize the stamped one.
|
|
162
|
+
*/
|
|
163
|
+
export declare function stampAccessToken(config: PublisherConfig, accessToken: string): PublisherConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Publisher release `cred init` and `cred dev` run.
|
|
3
|
+
*
|
|
4
|
+
* DO NOT EDIT BY HAND. This is a derived value: the repo's one human-authored
|
|
5
|
+
* Publisher version is `publisher_version` in
|
|
6
|
+
* `infrastructure/malloy-versions.json`, and `npm run sync-malloy-versions`
|
|
7
|
+
* writes this constant from it. `npm run check-malloy-versions` (CI job
|
|
8
|
+
* `validate-malloy-versions`) fails if the two disagree. To bump the publisher,
|
|
9
|
+
* edit the manifest and run sync — see
|
|
10
|
+
* `docs/practices/malloy-version-lockstep.md`.
|
|
11
|
+
*
|
|
12
|
+
* It is a checked-in constant rather than a read of the manifest at runtime
|
|
13
|
+
* because the CLI ships to npm as `@credibledata/cred-cli`, without the repo
|
|
14
|
+
* around it. Pinning rather than taking `@latest` also means a session is
|
|
15
|
+
* reproducible and a publisher bump is a deliberate, reviewable change.
|
|
16
|
+
*
|
|
17
|
+
* It lives in `setup-core/` rather than next to the command because the two
|
|
18
|
+
* real-publisher harnesses (`publisherconfig.oracle.ts`, `flow.e2e.ts`) need it
|
|
19
|
+
* too, and the setup-core boundary bans them from importing up into
|
|
20
|
+
* `../commands/`. One definition, imported by all three.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PUBLISHER_VERSION = "0.12.6";
|
|
@@ -22,5 +22,5 @@ exports.PUBLISHER_VERSION = void 0;
|
|
|
22
22
|
* too, and the setup-core boundary bans them from importing up into
|
|
23
23
|
* `../commands/`. One definition, imported by all three.
|
|
24
24
|
*/
|
|
25
|
-
exports.PUBLISHER_VERSION = "0.
|
|
25
|
+
exports.PUBLISHER_VERSION = "0.12.6";
|
|
26
26
|
//# sourceMappingURL=publisherversion.js.map
|