@executioncontrolprotocol/cli 0.12.0 → 0.13.1
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/LICENSE +202 -0
- package/README.md +1 -1
- package/dist/commands/init.d.ts +14 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +91 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/up.d.ts +1 -0
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +10 -3
- package/dist/commands/up.js.map +1 -1
- package/dist/lib/http/create-serve-handler.d.ts.map +1 -1
- package/dist/lib/http/create-serve-handler.js +6 -0
- package/dist/lib/http/create-serve-handler.js.map +1 -1
- package/dist/lib/http/handle-artifact.d.ts +14 -0
- package/dist/lib/http/handle-artifact.d.ts.map +1 -0
- package/dist/lib/http/handle-artifact.js +40 -0
- package/dist/lib/http/handle-artifact.js.map +1 -0
- package/dist/lib/http/handle-invoke.d.ts +28 -11
- package/dist/lib/http/handle-invoke.d.ts.map +1 -1
- package/dist/lib/http/handle-invoke.js +43 -1
- package/dist/lib/http/handle-invoke.js.map +1 -1
- package/dist/lib/init/collect-env-packages.d.ts +14 -0
- package/dist/lib/init/collect-env-packages.d.ts.map +1 -0
- package/dist/lib/init/collect-env-packages.js +36 -0
- package/dist/lib/init/collect-env-packages.js.map +1 -0
- package/dist/lib/init/merge-package-json.d.ts +29 -0
- package/dist/lib/init/merge-package-json.d.ts.map +1 -0
- package/dist/lib/init/merge-package-json.js +56 -0
- package/dist/lib/init/merge-package-json.js.map +1 -0
- package/dist/lib/up/constants.d.ts +1 -1
- package/dist/lib/up/constants.d.ts.map +1 -1
- package/dist/lib/up/constants.js +2 -2
- package/dist/lib/up/constants.js.map +1 -1
- package/dist/lib/up/create-daemon.d.ts +16 -0
- package/dist/lib/up/create-daemon.d.ts.map +1 -1
- package/dist/lib/up/create-daemon.js +29 -7
- package/dist/lib/up/create-daemon.js.map +1 -1
- package/dist/lib/up/handle-request.d.ts.map +1 -1
- package/dist/lib/up/handle-request.js +15 -2
- package/dist/lib/up/handle-request.js.map +1 -1
- package/package.json +16 -16
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Rockbound Digital Inc.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -124,7 +124,7 @@ Ollama/PNA **demo bridge** (fixed local env, not arbitrary `--env`). Prefer `ecp
|
|
|
124
124
|
|
|
125
125
|
```sh
|
|
126
126
|
ecp up
|
|
127
|
-
# Opens https://executioncontrolprotocol.
|
|
127
|
+
# Opens https://demo.executioncontrolprotocol.io/?token=<uuid>&bridge=http://127.0.0.1:3090
|
|
128
128
|
|
|
129
129
|
ecp up --open-url http://localhost:5173/
|
|
130
130
|
ecp up --no-open
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
/** Create or merge package.json from an environment module's imports. */
|
|
3
|
+
export default class Init extends Command {
|
|
4
|
+
static summary: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static flags: {
|
|
8
|
+
from: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
install: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
"dry-run": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAgC5C,yEAAyE;AACzE,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACvC,MAAM,CAAC,OAAO,SAA4D;IAE1E,MAAM,CAAC,WAAW,SAE4D;IAE9E,MAAM,CAAC,QAAQ,WAGd;IAED,MAAM,CAAC,KAAK;;;;MAcX;IAEK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAmC3B"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { readFile, writeFile, access } from "node:fs/promises";
|
|
2
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { Command, Flags } from "@oclif/core";
|
|
5
|
+
import { collectPackagesFromEnvironmentSource } from "../lib/init/collect-env-packages.js";
|
|
6
|
+
import { createPackageJson, mergeMissingDependencies, } from "../lib/init/merge-package-json.js";
|
|
7
|
+
async function pathExists(path) {
|
|
8
|
+
try {
|
|
9
|
+
await access(path);
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function runNpmInstall(cwd, extra) {
|
|
17
|
+
return new Promise((resolveInstall, reject) => {
|
|
18
|
+
const child = spawn("npm", ["install", ...extra], {
|
|
19
|
+
cwd,
|
|
20
|
+
stdio: "inherit",
|
|
21
|
+
shell: true,
|
|
22
|
+
});
|
|
23
|
+
child.on("error", reject);
|
|
24
|
+
child.on("exit", (code) => {
|
|
25
|
+
if (code === 0)
|
|
26
|
+
resolveInstall();
|
|
27
|
+
else
|
|
28
|
+
reject(new Error(`npm install exited with code ${code ?? "null"}`));
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** Create or merge package.json from an environment module's imports. */
|
|
33
|
+
export default class Init extends Command {
|
|
34
|
+
static summary = "Create or merge package.json from an environment module";
|
|
35
|
+
static description = "Collect npm packages from environment.ts side-effect imports, write or merge " +
|
|
36
|
+
"package.json (never bump existing ranges), and optionally run npm install.";
|
|
37
|
+
static examples = [
|
|
38
|
+
"<%= config.bin %> <%= command.id %> --from environment.ts --install",
|
|
39
|
+
"<%= config.bin %> <%= command.id %> --from examples/01-echo/environment.ts --no-install",
|
|
40
|
+
];
|
|
41
|
+
static flags = {
|
|
42
|
+
from: Flags.string({
|
|
43
|
+
required: true,
|
|
44
|
+
description: "Path to environment module (.ts or .js)",
|
|
45
|
+
}),
|
|
46
|
+
install: Flags.boolean({
|
|
47
|
+
description: "Run npm install after writing package.json",
|
|
48
|
+
allowNo: true,
|
|
49
|
+
default: true,
|
|
50
|
+
}),
|
|
51
|
+
"dry-run": Flags.boolean({
|
|
52
|
+
description: "Print planned packages without writing files",
|
|
53
|
+
default: false,
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
async run() {
|
|
57
|
+
const { flags } = await this.parse(Init);
|
|
58
|
+
const envPath = resolve(flags.from);
|
|
59
|
+
const source = await readFile(envPath, "utf8");
|
|
60
|
+
const packages = collectPackagesFromEnvironmentSource(source);
|
|
61
|
+
const dir = dirname(envPath);
|
|
62
|
+
const pkgPath = join(dir, "package.json");
|
|
63
|
+
const exists = await pathExists(pkgPath);
|
|
64
|
+
if (flags["dry-run"]) {
|
|
65
|
+
this.log(JSON.stringify({ packages, packageJson: pkgPath, exists }, null, 2));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
let added = packages;
|
|
69
|
+
if (!exists) {
|
|
70
|
+
const created = createPackageJson(basename(dir) || "ecp-env", packages);
|
|
71
|
+
await writeFile(pkgPath, `${JSON.stringify(created, null, 2)}\n`, "utf8");
|
|
72
|
+
this.log(`Created ${pkgPath}`);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
const existing = JSON.parse(await readFile(pkgPath, "utf8"));
|
|
76
|
+
const merged = mergeMissingDependencies(existing, packages);
|
|
77
|
+
added = merged.added;
|
|
78
|
+
await writeFile(pkgPath, `${JSON.stringify(merged.next, null, 2)}\n`, "utf8");
|
|
79
|
+
if (added.length === 0) {
|
|
80
|
+
this.log(`No missing packages in ${pkgPath}`);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this.log(`Added ${added.join(", ")} to ${pkgPath}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (flags.install) {
|
|
87
|
+
await runNpmInstall(dir, []);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,oCAAoC,EAAE,MAAM,qCAAqC,CAAA;AAC1F,OAAO,EACL,iBAAiB,EACjB,wBAAwB,GAEzB,MAAM,mCAAmC,CAAA;AAE1C,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAA;QAClB,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,GAAW,EAAE,KAAe;IACjD,OAAO,IAAI,OAAO,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE;QAC5C,MAAM,KAA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AAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;YAC7E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvB,IAAI,CAAC,GAAG,CAAC,0BAA0B,OAAO,EAAE,CAAC,CAAA;YAC/C,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,OAAO,EAAE,CAAC,CAAA;YACrD,CAAC;QACH,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,aAAa,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;QAC9B,CAAC;IACH,CAAC"}
|
package/dist/commands/up.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export default class Up extends Command {
|
|
|
9
9
|
host: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
"ollama-url": import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
"cors-origin": import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
env: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
14
|
"open-url": import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
15
|
open: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../../src/commands/up.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAU5C,wEAAwE;AACxE,MAAM,CAAC,OAAO,OAAO,EAAG,SAAQ,OAAO;IACrC,MAAM,CAAC,OAAO,SAA+B;IAE7C,MAAM,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../../src/commands/up.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAU5C,wEAAwE;AACxE,MAAM,CAAC,OAAO,OAAO,EAAG,SAAQ,OAAO;IACrC,MAAM,CAAC,OAAO,SAA+B;IAE7C,MAAM,CAAC,WAAW,SAIkC;IAEpD,MAAM,CAAC,QAAQ,WAKd;IAED,MAAM,CAAC,KAAK;;;;;;;;;MAkCX;IAEK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAoD3B"}
|
package/dist/commands/up.js
CHANGED
|
@@ -6,10 +6,13 @@ import { buildDemoOpenUrl, openBrowserUrl, originFromUrl } from "../lib/up/open-
|
|
|
6
6
|
/** Start the local ECP daemon (bridges Ollama for the browser demo). */
|
|
7
7
|
export default class Up extends Command {
|
|
8
8
|
static summary = "Start the local ECP daemon";
|
|
9
|
-
static description = "Run a loopback HTTP daemon that exposes ECP invoke for local
|
|
10
|
-
"(CORS + Private Network Access).
|
|
9
|
+
static description = "Run a loopback HTTP daemon that exposes ECP invoke for a local environment " +
|
|
10
|
+
"(CORS + Private Network Access). Always hosts Ollama for the browser demo; " +
|
|
11
|
+
"optional --env adds that project's host extensions alongside Ollama. " +
|
|
12
|
+
"Opens the browser demo with ?token= for pairing.";
|
|
11
13
|
static examples = [
|
|
12
14
|
"<%= config.bin %> <%= command.id %>",
|
|
15
|
+
"<%= config.bin %> <%= command.id %> --env environment.ts",
|
|
13
16
|
"<%= config.bin %> <%= command.id %> --open-url http://localhost:5173/",
|
|
14
17
|
"<%= config.bin %> <%= command.id %> --no-open",
|
|
15
18
|
];
|
|
@@ -31,6 +34,9 @@ export default class Up extends Command {
|
|
|
31
34
|
multiple: true,
|
|
32
35
|
default: [],
|
|
33
36
|
}),
|
|
37
|
+
env: Flags.string({
|
|
38
|
+
description: "Path to environment module (.ts or .js). Merged with Ollama (always hosted for the demo bridge).",
|
|
39
|
+
}),
|
|
34
40
|
token: Flags.string({
|
|
35
41
|
description: "Pairing token for /v1/invoke (auto-generated if omitted)",
|
|
36
42
|
}),
|
|
@@ -59,6 +65,7 @@ export default class Up extends Command {
|
|
|
59
65
|
ollamaUrl: flags["ollama-url"],
|
|
60
66
|
corsOrigins,
|
|
61
67
|
token,
|
|
68
|
+
envPath: flags.env,
|
|
62
69
|
});
|
|
63
70
|
const bridgeBaseURL = `http://${daemon.host}:${daemon.port}`;
|
|
64
71
|
const demoUrl = buildDemoOpenUrl(openUrl, {
|
|
@@ -67,7 +74,7 @@ export default class Up extends Command {
|
|
|
67
74
|
});
|
|
68
75
|
this.log(`ECP daemon on ${bridgeBaseURL}`);
|
|
69
76
|
this.log(`Pairing token: ${daemon.token}`);
|
|
70
|
-
this.log("GET /health (no auth) · POST /v1/invoke (Bearer token)");
|
|
77
|
+
this.log("GET /health (no auth) · POST /v1/invoke · GET /v1/artifacts (Bearer or ?token=)");
|
|
71
78
|
if (flags.open) {
|
|
72
79
|
this.log(`Opening ${demoUrl}`);
|
|
73
80
|
try {
|
package/dist/commands/up.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"up.js","sourceRoot":"","sources":["../../src/commands/up.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE3F,wEAAwE;AACxE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,SAAS,EAAE,QAAQ,CAAC,CAAA;QACnC,CAAC,CAAC,CAAA;IACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-serve-handler.d.ts","sourceRoot":"","sources":["../../../src/lib/http/create-serve-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"create-serve-handler.d.ts","sourceRoot":"","sources":["../../../src/lib/http/create-serve-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;AAQzD,wEAAwE;AACxE,MAAM,WAAW,0BAA0B;IACzC,gCAAgC;IAChC,GAAG,EAAE,GAAG,CAAA;IACR,6DAA6D;IAC7D,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAClC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,IAIzE,KAAK,eAAe,EACpB,KAAK,cAAc,KAClB,OAAO,CAAC,IAAI,CAAC,CAgCjB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isArtifactFetchPathname } from "@executioncontrolprotocol/core";
|
|
2
|
+
import { handleArtifactGet } from "./handle-artifact.js";
|
|
1
3
|
import { handleInvokePost } from "./handle-invoke.js";
|
|
2
4
|
import { writeJson } from "./write-json.js";
|
|
3
5
|
import { ECP_UP_VERSION } from "../up/constants.js";
|
|
@@ -24,6 +26,10 @@ export function createServeRequestHandler(options) {
|
|
|
24
26
|
});
|
|
25
27
|
return;
|
|
26
28
|
}
|
|
29
|
+
if (req.method === "GET" && isArtifactFetchPathname(pathname)) {
|
|
30
|
+
await handleArtifactGet(ecp, req, res);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
27
33
|
if (req.method === "POST" && pathname === "/v1/invoke") {
|
|
28
34
|
await handleInvokePost(ecp, req, res);
|
|
29
35
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-serve-handler.js","sourceRoot":"","sources":["../../../src/lib/http/create-serve-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAU7C;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAmC;IAC3E,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,OAAO,CAAA;IAErC,OAAO,KAAK,UAAU,kBAAkB,CACtC,GAAoB,EACpB,GAAmB;QAEnB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,CAAA;QAErC,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC7B,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;YAClB,GAAG,CAAC,GAAG,EAAE,CAAA;YACT,OAAM;QACR,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,EAAE,UAAU,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,WAAW,EAAE,CAAC,CAAA;QAChF,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAA;QAE7B,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YACnD,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE;gBAClB,EAAE,EAAE,IAAI;gBACR,OAAO,EAAE,cAAc;aACxB,CAAC,CAAA;YACF,OAAM;QACR,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QAChF,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAA;QAE7B,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YACnD,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE;gBAClB,EAAE,EAAE,IAAI;gBACR,OAAO,EAAE,cAAc;aACxB,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,uBAAuB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9D,MAAM,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;YACtC,OAAM;QACR,CAAC;QAED,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;YACvD,MAAM,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;YACrC,OAAM;QACR,CAAC;QAED,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAA;IAC7C,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import { type Ecp } from "@executioncontrolprotocol/core";
|
|
3
|
+
/**
|
|
4
|
+
* Sanitize a filename for Content-Disposition (strip quotes / path separators).
|
|
5
|
+
* @category CLI
|
|
6
|
+
*/
|
|
7
|
+
export declare function sanitizeArtifactFilename(name: string | undefined, uri: string, mediaType?: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Handle `GET /v1/artifacts` or `GET /v1/artifacts/<filename>?uri=…` — serve host artifact bytes.
|
|
10
|
+
* Caller is responsible for authentication.
|
|
11
|
+
* @category CLI
|
|
12
|
+
*/
|
|
13
|
+
export declare function handleArtifactGet(ecp: Ecp, req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=handle-artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-artifact.d.ts","sourceRoot":"","sources":["../../../src/lib/http/handle-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,EAAuD,KAAK,GAAG,EAAE,MAAM,gCAAgC,CAAA;AAG9G;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,IAAI,CAAC,CA8Bf"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { resolveArtifactFilename, parseArtifactFetchPathname } from "@executioncontrolprotocol/core";
|
|
2
|
+
import { writeJson } from "./write-json.js";
|
|
3
|
+
/**
|
|
4
|
+
* Sanitize a filename for Content-Disposition (strip quotes / path separators).
|
|
5
|
+
* @category CLI
|
|
6
|
+
*/
|
|
7
|
+
export function sanitizeArtifactFilename(name, uri, mediaType) {
|
|
8
|
+
return resolveArtifactFilename(name, uri, mediaType);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Handle `GET /v1/artifacts` or `GET /v1/artifacts/<filename>?uri=…` — serve host artifact bytes.
|
|
12
|
+
* Caller is responsible for authentication.
|
|
13
|
+
* @category CLI
|
|
14
|
+
*/
|
|
15
|
+
export async function handleArtifactGet(ecp, req, res) {
|
|
16
|
+
const host = req.headers.host ?? "127.0.0.1";
|
|
17
|
+
const url = new URL(req.url ?? "/", `http://${host}`);
|
|
18
|
+
const uri = url.searchParams.get("uri")?.trim() ?? "";
|
|
19
|
+
if (!uri || !uri.startsWith("ecp://")) {
|
|
20
|
+
writeJson(res, 400, { error: "uri query parameter is required (ecp://…)" });
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const store = typeof ecp.getArtifactStore === "function" ? ecp.getArtifactStore() : undefined;
|
|
24
|
+
const artifact = store?.get(uri);
|
|
25
|
+
if (!artifact) {
|
|
26
|
+
writeJson(res, 404, { error: `Artifact not found: ${uri}` });
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const pathHint = parseArtifactFetchPathname(url.pathname);
|
|
30
|
+
const filename = sanitizeArtifactFilename(artifact.name ?? pathHint, uri, artifact.mediaType);
|
|
31
|
+
const body = Buffer.from(artifact.bytes);
|
|
32
|
+
res.writeHead(200, {
|
|
33
|
+
"Content-Type": artifact.mediaType || "application/octet-stream",
|
|
34
|
+
"Content-Length": body.length,
|
|
35
|
+
"Content-Disposition": `inline; filename="${filename}"`,
|
|
36
|
+
"Cache-Control": "no-store",
|
|
37
|
+
});
|
|
38
|
+
res.end(body);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=handle-artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-artifact.js","sourceRoot":"","sources":["../../../src/lib/http/handle-artifact.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAY,MAAM,gCAAgC,CAAA;AAC9G,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAwB,EACxB,GAAW,EACX,SAAkB;IAElB,OAAO,uBAAuB,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,CAAC,CAAA;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,GAAQ,EACR,GAAoB,EACpB,GAAmB;IAEnB,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,WAAW,CAAA;IAC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AE,UAAU;KAC5B,CAAC,CAAA;IACF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACf,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
-
import type
|
|
2
|
+
import { type CapabilityBlobStore, type Ecp, type SerializedCapabilityBlob } from "@executioncontrolprotocol/core";
|
|
3
|
+
import { type InvokeResult } from "@executioncontrolprotocol/types";
|
|
3
4
|
/** JSON body for `POST /v1/invoke`. @category CLI */
|
|
4
5
|
export interface InvokeHttpBody {
|
|
5
6
|
/** Capability id to invoke. */
|
|
@@ -8,6 +9,19 @@ export interface InvokeHttpBody {
|
|
|
8
9
|
input?: unknown;
|
|
9
10
|
/** Optional provider capability override (harness `.uses`). */
|
|
10
11
|
provider?: string;
|
|
12
|
+
/** Browser file blobs hopped with locator refs (transport only). */
|
|
13
|
+
blobs?: Record<string, SerializedCapabilityBlob>;
|
|
14
|
+
}
|
|
15
|
+
/** Parsed invoke body. @category CLI */
|
|
16
|
+
export interface ParsedInvokeBody {
|
|
17
|
+
/** Capability id. */
|
|
18
|
+
capability: string;
|
|
19
|
+
/** Input payload. */
|
|
20
|
+
input: unknown;
|
|
21
|
+
/** Optional provider override. */
|
|
22
|
+
provider?: string;
|
|
23
|
+
/** Optional hopped blobs. */
|
|
24
|
+
blobs?: Record<string, SerializedCapabilityBlob>;
|
|
11
25
|
}
|
|
12
26
|
/**
|
|
13
27
|
* Parse and validate a `/v1/invoke` request body.
|
|
@@ -15,24 +29,27 @@ export interface InvokeHttpBody {
|
|
|
15
29
|
*/
|
|
16
30
|
export declare function parseInvokeBody(raw: string): {
|
|
17
31
|
ok: true;
|
|
18
|
-
body:
|
|
19
|
-
capability: string;
|
|
20
|
-
input: unknown;
|
|
21
|
-
provider?: string;
|
|
22
|
-
};
|
|
32
|
+
body: ParsedInvokeBody;
|
|
23
33
|
} | {
|
|
24
34
|
ok: false;
|
|
25
35
|
error: string;
|
|
26
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Resolve the host blob store when the operational ECP supports hop hydration.
|
|
39
|
+
* Older `@executioncontrolprotocol/core` builds (no {@link Ecp.getBlobStore}) return undefined.
|
|
40
|
+
* @category CLI
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveInvokeBlobStore(ecp: Ecp): CapabilityBlobStore | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Failed invoke result when the host cannot accept hopped browser blobs.
|
|
45
|
+
* @category CLI
|
|
46
|
+
*/
|
|
47
|
+
export declare function blobHopUnsupportedResult(capabilityId: string): InvokeResult;
|
|
27
48
|
/**
|
|
28
49
|
* Run `ecp.invoke` for a parsed invoke body and return the result.
|
|
29
50
|
* @category CLI
|
|
30
51
|
*/
|
|
31
|
-
export declare function runHttpInvoke(ecp: Ecp, body:
|
|
32
|
-
capability: string;
|
|
33
|
-
input: unknown;
|
|
34
|
-
provider?: string;
|
|
35
|
-
}): Promise<import("@executioncontrolprotocol/core").InvokeResult<unknown>>;
|
|
52
|
+
export declare function runHttpInvoke(ecp: Ecp, body: ParsedInvokeBody): Promise<InvokeResult<unknown>>;
|
|
36
53
|
/**
|
|
37
54
|
* Handle `POST /v1/invoke`: read body, invoke, write JSON result.
|
|
38
55
|
* Does not perform authentication.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-invoke.d.ts","sourceRoot":"","sources":["../../../src/lib/http/handle-invoke.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"handle-invoke.d.ts","sourceRoot":"","sources":["../../../src/lib/http/handle-invoke.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,GAAG,EACR,KAAK,wBAAwB,E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CAAC,IAAI,CAAC,CAuBf"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { hydrateCapabilityBlobs, } from "@executioncontrolprotocol/core";
|
|
1
2
|
import { readRequestBody } from "./read-body.js";
|
|
2
3
|
import { writeJson } from "./write-json.js";
|
|
4
|
+
import { ECP_INVOKE_ERROR_CODES, LATEST_ECP_VERSION, httpStatusForInvokeResult, } from "@executioncontrolprotocol/types";
|
|
3
5
|
/**
|
|
4
6
|
* Parse and validate a `/v1/invoke` request body.
|
|
5
7
|
* @category CLI
|
|
@@ -15,6 +17,9 @@ export function parseInvokeBody(raw) {
|
|
|
15
17
|
if (typeof parsed.capability !== "string" || !parsed.capability.trim()) {
|
|
16
18
|
return { ok: false, error: "capability is required" };
|
|
17
19
|
}
|
|
20
|
+
const blobs = parsed.blobs && typeof parsed.blobs === "object" && !Array.isArray(parsed.blobs)
|
|
21
|
+
? parsed.blobs
|
|
22
|
+
: undefined;
|
|
18
23
|
return {
|
|
19
24
|
ok: true,
|
|
20
25
|
body: {
|
|
@@ -23,14 +28,51 @@ export function parseInvokeBody(raw) {
|
|
|
23
28
|
...(typeof parsed.provider === "string" && parsed.provider.trim()
|
|
24
29
|
? { provider: parsed.provider }
|
|
25
30
|
: {}),
|
|
31
|
+
...(blobs ? { blobs } : {}),
|
|
26
32
|
},
|
|
27
33
|
};
|
|
28
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Resolve the host blob store when the operational ECP supports hop hydration.
|
|
37
|
+
* Older `@executioncontrolprotocol/core` builds (no {@link Ecp.getBlobStore}) return undefined.
|
|
38
|
+
* @category CLI
|
|
39
|
+
*/
|
|
40
|
+
export function resolveInvokeBlobStore(ecp) {
|
|
41
|
+
if (typeof ecp.getBlobStore !== "function")
|
|
42
|
+
return undefined;
|
|
43
|
+
return ecp.getBlobStore();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Failed invoke result when the host cannot accept hopped browser blobs.
|
|
47
|
+
* @category CLI
|
|
48
|
+
*/
|
|
49
|
+
export function blobHopUnsupportedResult(capabilityId) {
|
|
50
|
+
return {
|
|
51
|
+
schema: "@executioncontrolprotocol.invoke.result",
|
|
52
|
+
version: LATEST_ECP_VERSION,
|
|
53
|
+
success: false,
|
|
54
|
+
capabilityId: capabilityId,
|
|
55
|
+
diagnostics: [
|
|
56
|
+
{
|
|
57
|
+
severity: "error",
|
|
58
|
+
code: ECP_INVOKE_ERROR_CODES.INVOKE_FAILED,
|
|
59
|
+
message: "Host environment does not support browser blob hop (upgrade @executioncontrolprotocol/core / node used by --env).",
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
29
64
|
/**
|
|
30
65
|
* Run `ecp.invoke` for a parsed invoke body and return the result.
|
|
31
66
|
* @category CLI
|
|
32
67
|
*/
|
|
33
68
|
export async function runHttpInvoke(ecp, body) {
|
|
69
|
+
if (body.blobs) {
|
|
70
|
+
const store = resolveInvokeBlobStore(ecp);
|
|
71
|
+
if (!store) {
|
|
72
|
+
return blobHopUnsupportedResult(body.capability);
|
|
73
|
+
}
|
|
74
|
+
hydrateCapabilityBlobs(store, body.blobs);
|
|
75
|
+
}
|
|
34
76
|
const builder = ecp.invoke(body.capability).with(body.input);
|
|
35
77
|
return (body.provider ? builder.uses(body.provider) : builder).process();
|
|
36
78
|
}
|
|
@@ -56,7 +98,7 @@ export async function handleInvokePost(ecp, req, res) {
|
|
|
56
98
|
}
|
|
57
99
|
try {
|
|
58
100
|
const result = await runHttpInvoke(ecp, parsed.body);
|
|
59
|
-
writeJson(res,
|
|
101
|
+
writeJson(res, httpStatusForInvokeResult(result), result);
|
|
60
102
|
}
|
|
61
103
|
catch (err) {
|
|
62
104
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-invoke.js","sourceRoot":"","sources":["../../../src/lib/http/handle-invoke.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handle-inv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EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;IACzC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map an import specifier to its npm package name.
|
|
3
|
+
* Subpaths resolve to the owning package (`@scope/name/sub` → `@scope/name`).
|
|
4
|
+
* @category CLI
|
|
5
|
+
*/
|
|
6
|
+
export declare function npmPackageFromSpecifier(specifier: string): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Collect npm package names from environment module source (side-effect and named imports).
|
|
9
|
+
* @category CLI
|
|
10
|
+
*/
|
|
11
|
+
export declare function collectPackagesFromEnvironmentSource(source: string): string[];
|
|
12
|
+
/** Dev-only packages added by `ecp init`. @category CLI */
|
|
13
|
+
export declare const INIT_DEV_DEPENDENCIES: readonly ["@executioncontrolprotocol/cli"];
|
|
14
|
+
//# sourceMappingURL=collect-env-packages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-env-packages.d.ts","sourceRoot":"","sources":["../../../src/lib/init/collect-env-packages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAW7E;AAID;;;GAGG;AACH,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ7E;AAED,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB,4CAA6C,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map an import specifier to its npm package name.
|
|
3
|
+
* Subpaths resolve to the owning package (`@scope/name/sub` → `@scope/name`).
|
|
4
|
+
* @category CLI
|
|
5
|
+
*/
|
|
6
|
+
export function npmPackageFromSpecifier(specifier) {
|
|
7
|
+
const trimmed = specifier.trim();
|
|
8
|
+
if (!trimmed || trimmed.startsWith(".") || trimmed.startsWith("/") || trimmed.startsWith("node:")) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
if (trimmed.startsWith("@")) {
|
|
12
|
+
const parts = trimmed.split("/");
|
|
13
|
+
if (parts.length < 2 || !parts[0] || !parts[1])
|
|
14
|
+
return undefined;
|
|
15
|
+
return `${parts[0]}/${parts[1]}`;
|
|
16
|
+
}
|
|
17
|
+
return trimmed.split("/")[0];
|
|
18
|
+
}
|
|
19
|
+
const IMPORT_FROM_RE = /(?:from|import)\s+["']([^"']+)["']/g;
|
|
20
|
+
/**
|
|
21
|
+
* Collect npm package names from environment module source (side-effect and named imports).
|
|
22
|
+
* @category CLI
|
|
23
|
+
*/
|
|
24
|
+
export function collectPackagesFromEnvironmentSource(source) {
|
|
25
|
+
const names = new Set();
|
|
26
|
+
for (const match of source.matchAll(IMPORT_FROM_RE)) {
|
|
27
|
+
const pkg = npmPackageFromSpecifier(match[1] ?? "");
|
|
28
|
+
if (pkg)
|
|
29
|
+
names.add(pkg);
|
|
30
|
+
}
|
|
31
|
+
names.add("@executioncontrolprotocol/node");
|
|
32
|
+
return [...names].sort();
|
|
33
|
+
}
|
|
34
|
+
/** Dev-only packages added by `ecp init`. @category CLI */
|
|
35
|
+
export const INIT_DEV_DEPENDENCIES = ["@executioncontrolprotocol/cli"];
|
|
36
|
+
//# sourceMappingURL=collect-env-packages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-env-packages.js","sourceRoot":"","sources":["../../../src/lib/init/collect-env-packages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAAiB;IACvD,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAA;IAChC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAClG,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAChC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAAE,OAAO,SAAS,CAAA;QAChE,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAClC,CAAC;IACD,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;AAC9B,CAAC;AAED,MAAM,cAAc,GAAG,qCAAqC,CAAA;AAE5D;;;GAGG;AACH,MAAM,UAAU,oCAAoC,CAAC,MAAc;IACjE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAC/B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACpD,MAAM,GAAG,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;QACnD,IAAI,GAAG;YAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACzB,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;IAC3C,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;AAC1B,CAAC;AAED,2DAA2D;AAC3D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,+BAA+B,CAAU,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** package.json shape used by `ecp init`. @category CLI */
|
|
2
|
+
export interface InitPackageJson {
|
|
3
|
+
/** Package name. */
|
|
4
|
+
name?: string;
|
|
5
|
+
/** Private package flag. */
|
|
6
|
+
private?: boolean;
|
|
7
|
+
/** Module type. */
|
|
8
|
+
type?: string;
|
|
9
|
+
/** Production dependencies. */
|
|
10
|
+
dependencies?: Record<string, string>;
|
|
11
|
+
/** Development dependencies. */
|
|
12
|
+
devDependencies?: Record<string, string>;
|
|
13
|
+
/** Additional package.json fields. */
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Create a greenfield package.json (latest-compatible ranges via `*`).
|
|
18
|
+
* @category CLI
|
|
19
|
+
*/
|
|
20
|
+
export declare function createPackageJson(name: string, packages: string[], devPackages?: readonly string[]): InitPackageJson;
|
|
21
|
+
/**
|
|
22
|
+
* Add missing packages without rewriting existing version ranges.
|
|
23
|
+
* @category CLI
|
|
24
|
+
*/
|
|
25
|
+
export declare function mergeMissingDependencies(existing: InitPackageJson, packages: string[], devPackages?: readonly string[]): {
|
|
26
|
+
next: InitPackageJson;
|
|
27
|
+
added: string[];
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=merge-package-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-package-json.d.ts","sourceRoot":"","sources":["../../../src/lib/init/merge-package-json.ts"],"names":[],"mappings":"AAEA,2DAA2D;AAC3D,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4BAA4B;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,mBAAmB;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,+BAA+B;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,sCAAsC;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAAE,EAClB,WAAW,GAAE,SAAS,MAAM,EAA0B,GACrD,eAAe,CAiBjB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,EAAE,EAClB,WAAW,GAAE,SAAS,MAAM,EAA0B,GACrD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAwB5C"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { INIT_DEV_DEPENDENCIES } from "./collect-env-packages.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create a greenfield package.json (latest-compatible ranges via `*`).
|
|
4
|
+
* @category CLI
|
|
5
|
+
*/
|
|
6
|
+
export function createPackageJson(name, packages, devPackages = INIT_DEV_DEPENDENCIES) {
|
|
7
|
+
const dependencies = {};
|
|
8
|
+
for (const pkg of packages) {
|
|
9
|
+
if (devPackages.includes(pkg))
|
|
10
|
+
continue;
|
|
11
|
+
dependencies[pkg] = "*";
|
|
12
|
+
}
|
|
13
|
+
const devDependencies = {};
|
|
14
|
+
for (const pkg of devPackages) {
|
|
15
|
+
devDependencies[pkg] = "*";
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
name,
|
|
19
|
+
private: true,
|
|
20
|
+
type: "module",
|
|
21
|
+
dependencies,
|
|
22
|
+
devDependencies,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Add missing packages without rewriting existing version ranges.
|
|
27
|
+
* @category CLI
|
|
28
|
+
*/
|
|
29
|
+
export function mergeMissingDependencies(existing, packages, devPackages = INIT_DEV_DEPENDENCIES) {
|
|
30
|
+
const next = {
|
|
31
|
+
...existing,
|
|
32
|
+
dependencies: { ...existing.dependencies },
|
|
33
|
+
devDependencies: { ...existing.devDependencies },
|
|
34
|
+
};
|
|
35
|
+
const added = [];
|
|
36
|
+
const deps = next.dependencies ?? {};
|
|
37
|
+
const dev = next.devDependencies ?? {};
|
|
38
|
+
next.dependencies = deps;
|
|
39
|
+
next.devDependencies = dev;
|
|
40
|
+
for (const pkg of packages) {
|
|
41
|
+
if (devPackages.includes(pkg))
|
|
42
|
+
continue;
|
|
43
|
+
if (deps[pkg] || dev[pkg])
|
|
44
|
+
continue;
|
|
45
|
+
deps[pkg] = "*";
|
|
46
|
+
added.push(pkg);
|
|
47
|
+
}
|
|
48
|
+
for (const pkg of devPackages) {
|
|
49
|
+
if (deps[pkg] || dev[pkg])
|
|
50
|
+
continue;
|
|
51
|
+
dev[pkg] = "*";
|
|
52
|
+
added.push(pkg);
|
|
53
|
+
}
|
|
54
|
+
return { next, added };
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=merge-package-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-package-json.js","sourceRoot":"","sources":["../../../src/lib/init/merge-package-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAkBjE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAY,EACZ,QAAkB,EAClB,cAAiC,qBAAqB;IAEtD,MAAM,YAAY,GAA2B,EAAE,CAAA;IAC/C,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAmC,CAAC;YAAE,SAAQ;QACvE,YAAY,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;IACzB,CAAC;IACD,MAAM,eAAe,GAA2B,EAAE,CAAA;IAClD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,eAAe,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;IAC5B,CAAC;IACD,OAAO;QACL,IAAI;QACJ,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,QAAQ;QACd,YAAY;QACZ,eAAe;KAChB,CAAA;AACH,CAAC;AAED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L = "http://127.0.0.1:11434";
|
|
7
7
|
/** Default browser demo URL opened by `ecp up`. @category CLI */
|
|
8
|
-
export declare const DEFAULT_DEMO_OPEN_URL = "https://executioncontrolprotocol.
|
|
8
|
+
export declare const DEFAULT_DEMO_OPEN_URL = "https://demo.executioncontrolprotocol.io/";
|
|
9
9
|
/** Built-in CORS origins for local Vite + hosted demo. @category CLI */
|
|
10
10
|
export declare const DEFAULT_CORS_ORIGINS: readonly string[];
|
|
11
11
|
/** JSON MIME type for daemon responses. @category CLI */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/up/constants.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,OAAO,CAAA;AAEvC,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,cAAc,CAAA;AAE9C,sDAAsD;AACtD,eAAO,MAAM,kBAAkB,2BAA2B,CAAA;AAE1D,iEAAiE;AACjE,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/up/constants.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,OAAO,CAAA;AAEvC,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,cAAc,CAAA;AAE9C,sDAAsD;AACtD,eAAO,MAAM,kBAAkB,2BAA2B,CAAA;AAE1D,iEAAiE;AACjE,eAAO,MAAM,qBAAqB,8CAA8C,CAAA;AAEhF,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAIjD,CAAA;AAED,yDAAyD;AACzD,eAAO,MAAM,SAAS,qBAAqB,CAAA;AAI3C,mHAAmH;AACnH,eAAO,MAAM,cAAc,QAAoE,CAAA"}
|
package/dist/lib/up/constants.js
CHANGED
|
@@ -6,12 +6,12 @@ export const DEFAULT_ECP_UP_HOST = "127.0.0.1";
|
|
|
6
6
|
/** Default Ollama HTTP API base URL. @category CLI */
|
|
7
7
|
export const DEFAULT_OLLAMA_URL = "http://127.0.0.1:11434";
|
|
8
8
|
/** Default browser demo URL opened by `ecp up`. @category CLI */
|
|
9
|
-
export const DEFAULT_DEMO_OPEN_URL = "https://executioncontrolprotocol.
|
|
9
|
+
export const DEFAULT_DEMO_OPEN_URL = "https://demo.executioncontrolprotocol.io/";
|
|
10
10
|
/** Built-in CORS origins for local Vite + hosted demo. @category CLI */
|
|
11
11
|
export const DEFAULT_CORS_ORIGINS = [
|
|
12
12
|
"http://localhost:5173",
|
|
13
13
|
"http://127.0.0.1:5173",
|
|
14
|
-
"https://executioncontrolprotocol.
|
|
14
|
+
"https://demo.executioncontrolprotocol.io",
|
|
15
15
|
];
|
|
16
16
|
/** JSON MIME type for daemon responses. @category CLI */
|
|
17
17
|
export const JSON_MIME = "application/json";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/up/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,kFAAkF;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAA;AAEvC,uDAAuD;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAA;AAE9C,sDAAsD;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAA;AAE1D,iEAAiE;AACjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/up/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,kFAAkF;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAA;AAEvC,uDAAuD;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAA;AAE9C,sDAAsD;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAA;AAE1D,iEAAiE;AACjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,2CAA2C,CAAA;AAEhF,wEAAwE;AACxE,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACrD,uBAAuB;IACvB,uBAAuB;IACvB,0CAA0C;CAC3C,CAAA;AAED,yDAAyD;AACzD,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAA;AAE3C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C,mHAAmH;AACnH,MAAM,CAAC,MAAM,cAAc,GAAI,OAAO,CAAC,uBAAuB,CAAyB,CAAC,OAAO,CAAA"}
|
|
@@ -13,6 +13,8 @@ export interface StartEcpUpDaemonOptions {
|
|
|
13
13
|
corsOrigins?: string[];
|
|
14
14
|
/** Pairing token for `/v1/invoke`. */
|
|
15
15
|
token: string;
|
|
16
|
+
/** Optional environment module path (`ecp up --env`). */
|
|
17
|
+
envPath?: string;
|
|
16
18
|
}
|
|
17
19
|
/** Result of starting the daemon. @category CLI */
|
|
18
20
|
export interface EcpUpDaemon {
|
|
@@ -29,6 +31,20 @@ export interface EcpUpDaemon {
|
|
|
29
31
|
/** Close the server and terminate ECP. */
|
|
30
32
|
close: () => Promise<void>;
|
|
31
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Load the operational ECP instance for `ecp up`.
|
|
36
|
+
* Always hosts Ollama (browser demo model picker / coding harness).
|
|
37
|
+
* With `--env`, that project's Node environment is loaded and Ollama is added
|
|
38
|
+
* so host packages (e.g. image-sharp) and Ollama coexist.
|
|
39
|
+
* Without `--env`, the daemon hosts Ollama only.
|
|
40
|
+
* @category CLI
|
|
41
|
+
*/
|
|
42
|
+
export declare function loadUpDaemonEcp(options: {
|
|
43
|
+
/** Optional environment module path. */
|
|
44
|
+
envPath?: string;
|
|
45
|
+
/** Ollama API base URL for the default daemon env. */
|
|
46
|
+
ollamaUrl: string;
|
|
47
|
+
}): Promise<Ecp>;
|
|
32
48
|
/**
|
|
33
49
|
* Start the local ECP daemon (`ecp up`).
|
|
34
50
|
* @category CLI
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-daemon.d.ts","sourceRoot":"","sources":["../../../src/lib/up/create-daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAErD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"create-daemon.d.ts","sourceRoot":"","sources":["../../../src/lib/up/create-daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAErD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;AAEzD,OAAO,4CAA4C,CAAA;AAUnD,0DAA0D;AAC1D,MAAM,WAAW,uBAAuB;IACtC,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,mDAAmD;AACnD,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,gCAAgC;IAChC,GAAG,EAAE,GAAG,CAAA;IACR,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,0CAA0C;IAC1C,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAC7C,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,OAAO,CAAC,GAAG,CAAC,CAef;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,WAAW,CAAC,CAsDtB"}
|
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
import { createServer } from "node:http";
|
|
2
2
|
import { environment, extension } from "@executioncontrolprotocol/node";
|
|
3
|
+
import { loadEnvironmentModule } from "@executioncontrolprotocol/core/loaders";
|
|
3
4
|
import "@executioncontrolprotocol/extension-ollama";
|
|
4
5
|
import { registerOllamaExtension } from "@executioncontrolprotocol/extension-ollama";
|
|
5
6
|
import { DEFAULT_CORS_ORIGINS, DEFAULT_ECP_UP_HOST, DEFAULT_ECP_UP_PORT, DEFAULT_OLLAMA_URL, } from "./constants.js";
|
|
6
7
|
import { createUpRequestHandler } from "./handle-request.js";
|
|
8
|
+
/**
|
|
9
|
+
* Load the operational ECP instance for `ecp up`.
|
|
10
|
+
* Always hosts Ollama (browser demo model picker / coding harness).
|
|
11
|
+
* With `--env`, that project's Node environment is loaded and Ollama is added
|
|
12
|
+
* so host packages (e.g. image-sharp) and Ollama coexist.
|
|
13
|
+
* Without `--env`, the daemon hosts Ollama only.
|
|
14
|
+
* @category CLI
|
|
15
|
+
*/
|
|
16
|
+
export async function loadUpDaemonEcp(options) {
|
|
17
|
+
await registerOllamaExtension();
|
|
18
|
+
const ollamaConfig = { baseURL: options.ollamaUrl };
|
|
19
|
+
if (options.envPath) {
|
|
20
|
+
const loaded = await loadEnvironmentModule(options.envPath);
|
|
21
|
+
// Project envs use their own registry instance after module load — register Ollama there.
|
|
22
|
+
await registerOllamaExtension(loaded.getRegistry());
|
|
23
|
+
// Project envs (e.g. image-prep) omit Ollama; the demo bridge still needs listModels/generate.
|
|
24
|
+
loaded.addExtensionBinding("@executioncontrolprotocol/ollama", ollamaConfig);
|
|
25
|
+
return loaded.init();
|
|
26
|
+
}
|
|
27
|
+
const env = (await environment("ecp-up")).withExtensions([
|
|
28
|
+
extension("@executioncontrolprotocol/ollama").with(ollamaConfig),
|
|
29
|
+
]);
|
|
30
|
+
return env.init();
|
|
31
|
+
}
|
|
7
32
|
/**
|
|
8
33
|
* Start the local ECP daemon (`ecp up`).
|
|
9
34
|
* @category CLI
|
|
@@ -13,13 +38,10 @@ export async function startEcpUpDaemon(options) {
|
|
|
13
38
|
const host = options.host ?? DEFAULT_ECP_UP_HOST;
|
|
14
39
|
const ollamaUrl = options.ollamaUrl ?? DEFAULT_OLLAMA_URL;
|
|
15
40
|
const token = options.token;
|
|
16
|
-
await
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}),
|
|
21
|
-
]);
|
|
22
|
-
const ecp = await env.init();
|
|
41
|
+
const ecp = await loadUpDaemonEcp({
|
|
42
|
+
envPath: options.envPath,
|
|
43
|
+
ollamaUrl,
|
|
44
|
+
});
|
|
23
45
|
const allowOrigins = new Set([
|
|
24
46
|
...DEFAULT_CORS_ORIGINS,
|
|
25
47
|
...(options.corsOrigins ?? []),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-daemon.js","sourceRoot":"","sources":["../../../src/lib/up/create-daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,4CAA4C,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAA;AACpF,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,sBAAsB,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A;IAEF,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC5B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;YAC7B,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;YAC3B,OAAO,EAAE,CAAA;QACX,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,MAAM;QACN,GAAG;QACH,IAAI;QACJ,IAAI;QACJ,KAAK;QACL,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC1C,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;YACxD,CAAC,CAAC,CAAA;YACF,MAAM,GAAG,CAAC,SAAS,EAAE,CAAA;QACvB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-request.d.ts","sourceRoot":"","sources":["../../../src/lib/up/handle-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"handle-request.d.ts","sourceRoot":"","sources":["../../../src/lib/up/handle-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;AASzD,qEAAqE;AACrE,MAAM,WAAW,uBAAuB;IACtC,gCAAgC;IAChC,GAAG,EAAE,GAAG,CAAA;IACR,gCAAgC;IAChC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACjC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAA;CAClB;AAWD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,IAInE,KAAK,eAAe,EACpB,KAAK,cAAc,KAClB,OAAO,CAAC,IAAI,CAAC,CAgDjB"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { isArtifactFetchPathname } from "@executioncontrolprotocol/core";
|
|
1
2
|
import { listOllamaModels } from "@executioncontrolprotocol/extension-ollama";
|
|
3
|
+
import { handleArtifactGet } from "../http/handle-artifact.js";
|
|
2
4
|
import { handleInvokePost } from "../http/handle-invoke.js";
|
|
3
5
|
import { writeJson } from "../http/write-json.js";
|
|
4
6
|
import { ECP_UP_VERSION } from "./constants.js";
|
|
5
7
|
import { readBearerToken, setCorsAndPna } from "./cors.js";
|
|
8
|
+
function authorizeUpRequest(req, url, token) {
|
|
9
|
+
const presented = readBearerToken(req) ?? url.searchParams.get("token")?.trim() ?? "";
|
|
10
|
+
return Boolean(presented) && presented === token;
|
|
11
|
+
}
|
|
6
12
|
/**
|
|
7
13
|
* Create the HTTP request handler for `ecp up`.
|
|
8
14
|
* @category CLI
|
|
@@ -34,9 +40,16 @@ export function createUpRequestHandler(options) {
|
|
|
34
40
|
});
|
|
35
41
|
return;
|
|
36
42
|
}
|
|
43
|
+
if (req.method === "GET" && isArtifactFetchPathname(pathname)) {
|
|
44
|
+
if (!authorizeUpRequest(req, url, token)) {
|
|
45
|
+
writeJson(res, 401, { error: "Unauthorized" });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
await handleArtifactGet(ecp, req, res);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
37
51
|
if (req.method === "POST" && pathname === "/v1/invoke") {
|
|
38
|
-
|
|
39
|
-
if (!presented || presented !== token) {
|
|
52
|
+
if (!authorizeUpRequest(req, url, token)) {
|
|
40
53
|
writeJson(res, 401, { error: "Unauthorized" });
|
|
41
54
|
return;
|
|
42
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-request.js","sourceRoot":"","sources":["../../../src/lib/up/handle-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAc1D;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAgC;IACrE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;IAEvD,OAAO,KAAK,UAAU,eAAe,CACnC,GAAoB,EACpB,GAAmB;QAEnB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,CAAA;QAErC,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC7B,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;YAClB,GAAG,CAAC,GAAG,EAAE,CAAA;YACT,OAAM;QACR,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,EAAE,UAAU,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,WAAW,EAAE,CAAC,CAAA;QAChF,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAA;QAE7B,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,QAAQ,KAAK,SAAS,EA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AC;gBACzC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAA;gBAC9C,OAAM;YACR,CAAC;YACD,MAAM,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;YACtC,OAAM;QACR,CAAC;QAED,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;YACvD,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC;gBACzC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAA;gBAC9C,OAAM;YACR,CAAC;YACD,MAAM,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;YACrC,OAAM;QACR,CAAC;QAED,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAA;IAC7C,CAAC,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@executioncontrolprotocol/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "ECP command-line interface",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -14,31 +14,31 @@
|
|
|
14
14
|
"bin/dev.js",
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "tsc -b",
|
|
19
|
-
"start": "node ./bin/dev.js"
|
|
20
|
-
},
|
|
21
17
|
"peerDependencies": {
|
|
22
|
-
"
|
|
23
|
-
"@executioncontrolprotocol/
|
|
24
|
-
"
|
|
18
|
+
"zod": "^3.24.0",
|
|
19
|
+
"@executioncontrolprotocol/core": "^0.13.1",
|
|
20
|
+
"@executioncontrolprotocol/types": "^0.13.1"
|
|
25
21
|
},
|
|
26
22
|
"dependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@executioncontrolprotocol/
|
|
29
|
-
"@executioncontrolprotocol/
|
|
30
|
-
"@
|
|
23
|
+
"@oclif/core": "^4.10.0",
|
|
24
|
+
"@executioncontrolprotocol/node": "^0.13.1",
|
|
25
|
+
"@executioncontrolprotocol/secrets": "^0.13.1",
|
|
26
|
+
"@executioncontrolprotocol/extension-ollama": "^0.13.1"
|
|
31
27
|
},
|
|
32
28
|
"devDependencies": {
|
|
33
|
-
"@executioncontrolprotocol/core": "0.12.0",
|
|
34
|
-
"@executioncontrolprotocol/types": "0.12.0",
|
|
35
29
|
"typescript": "^5.7.0",
|
|
36
|
-
"zod": "^3.24.0"
|
|
30
|
+
"zod": "^3.24.0",
|
|
31
|
+
"@executioncontrolprotocol/core": "^0.13.1",
|
|
32
|
+
"@executioncontrolprotocol/types": "^0.13.1"
|
|
37
33
|
},
|
|
38
34
|
"oclif": {
|
|
39
35
|
"bin": "ecp",
|
|
40
36
|
"commands": "./dist/commands",
|
|
41
37
|
"dirname": "ecp",
|
|
42
38
|
"topicSeparator": " "
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc -b",
|
|
42
|
+
"start": "node ./bin/dev.js"
|
|
43
43
|
}
|
|
44
|
-
}
|
|
44
|
+
}
|