@opengeni/ogtool 0.2.2 → 0.3.6
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 +5 -4
- package/dist/bin/ogtool.cjs +27 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/cli.ts +23 -4
- package/src/index.ts +1 -0
package/README.md
CHANGED
|
@@ -15,10 +15,11 @@ Always replace `<version>` with the exact version in the deployment BOM; do not
|
|
|
15
15
|
`latest` in a production image. An embedding host may expose that pinned spec through
|
|
16
16
|
`OPENGENI_OGTOOL_PACKAGE_SPEC`.
|
|
17
17
|
|
|
18
|
-
The CLI reads `OPENGENI_CODEMODE_URL`
|
|
19
|
-
`
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
The CLI reads `OPENGENI_CODEMODE_URL` plus either the bearer in
|
|
19
|
+
`OPENGENI_CODEMODE_TOKEN` or its path in `OPENGENI_CODEMODE_TOKEN_FILE`. Managed sandboxes use
|
|
20
|
+
the protected file and reread it for every request. Connected Machines receive the direct bearer
|
|
21
|
+
only in the exact agent command's child environment; it is not installed machine-wide or written
|
|
22
|
+
to disk. `ogtool doctor` reports the selected delivery mode without printing the token.
|
|
22
23
|
|
|
23
24
|
Commands:
|
|
24
25
|
|
package/dist/bin/ogtool.cjs
CHANGED
|
@@ -15195,7 +15195,12 @@ var CodemodeClient = class {
|
|
|
15195
15195
|
method: "POST",
|
|
15196
15196
|
...signal ? { signal } : {},
|
|
15197
15197
|
headers: { "content-type": "application/json" },
|
|
15198
|
-
body: JSON.stringify({
|
|
15198
|
+
body: JSON.stringify({
|
|
15199
|
+
operationId,
|
|
15200
|
+
catalogDigest,
|
|
15201
|
+
identity,
|
|
15202
|
+
arguments: argumentsValue
|
|
15203
|
+
})
|
|
15199
15204
|
});
|
|
15200
15205
|
return CodemodeCallSubmission.parse(await response.json()).operation;
|
|
15201
15206
|
}
|
|
@@ -15316,7 +15321,7 @@ async function abortableDelay(delayMs, signal) {
|
|
|
15316
15321
|
// package.json
|
|
15317
15322
|
var package_default = {
|
|
15318
15323
|
name: "@opengeni/ogtool",
|
|
15319
|
-
version: "0.
|
|
15324
|
+
version: "0.3.6",
|
|
15320
15325
|
description: "Codemode CLI and typed client entrypoint for an OpenGeni execution attempt.",
|
|
15321
15326
|
license: "Apache-2.0",
|
|
15322
15327
|
repository: {
|
|
@@ -15376,7 +15381,7 @@ function usage(exitCode = 1) {
|
|
|
15376
15381
|
" ogtool doctor",
|
|
15377
15382
|
" ogtool --version",
|
|
15378
15383
|
"",
|
|
15379
|
-
"requires
|
|
15384
|
+
"requires OPENGENI_CODEMODE_URL and OPENGENI_CODEMODE_TOKEN or OPENGENI_CODEMODE_TOKEN_FILE"
|
|
15380
15385
|
].join("\n");
|
|
15381
15386
|
(exitCode === 0 ? process.stdout : process.stderr).write(`${output}
|
|
15382
15387
|
`);
|
|
@@ -15384,14 +15389,22 @@ function usage(exitCode = 1) {
|
|
|
15384
15389
|
}
|
|
15385
15390
|
function configuredClient() {
|
|
15386
15391
|
const baseUrl = process.env.OPENGENI_CODEMODE_URL?.trim();
|
|
15392
|
+
const directTokenConfigured = process.env.OPENGENI_CODEMODE_TOKEN !== void 0;
|
|
15387
15393
|
const tokenFile = process.env.OPENGENI_CODEMODE_TOKEN_FILE?.trim();
|
|
15388
15394
|
if (!baseUrl) throw new Error("OPENGENI_CODEMODE_URL is required");
|
|
15389
|
-
if (!tokenFile)
|
|
15395
|
+
if (!directTokenConfigured && !tokenFile) {
|
|
15396
|
+
throw new Error("OPENGENI_CODEMODE_TOKEN or OPENGENI_CODEMODE_TOKEN_FILE is required");
|
|
15397
|
+
}
|
|
15390
15398
|
return new CodemodeClient({
|
|
15391
15399
|
baseUrl,
|
|
15392
|
-
token: async () => readToken(tokenFile)
|
|
15400
|
+
token: directTokenConfigured ? async () => requiredDirectToken() : async () => readToken(tokenFile)
|
|
15393
15401
|
});
|
|
15394
15402
|
}
|
|
15403
|
+
function requiredDirectToken() {
|
|
15404
|
+
const token = process.env.OPENGENI_CODEMODE_TOKEN?.trim();
|
|
15405
|
+
if (!token) throw new Error("OPENGENI_CODEMODE_TOKEN is empty");
|
|
15406
|
+
return token;
|
|
15407
|
+
}
|
|
15395
15408
|
function readToken(tokenFile) {
|
|
15396
15409
|
let token;
|
|
15397
15410
|
try {
|
|
@@ -15403,6 +15416,9 @@ function readToken(tokenFile) {
|
|
|
15403
15416
|
return token;
|
|
15404
15417
|
}
|
|
15405
15418
|
function doctor() {
|
|
15419
|
+
const directTokenRaw = process.env.OPENGENI_CODEMODE_TOKEN;
|
|
15420
|
+
const directTokenConfigured = directTokenRaw !== void 0;
|
|
15421
|
+
const directTokenNonempty = Boolean(directTokenRaw?.trim().length);
|
|
15406
15422
|
const tokenFile = process.env.OPENGENI_CODEMODE_TOKEN_FILE ?? null;
|
|
15407
15423
|
const rawUrl = process.env.OPENGENI_CODEMODE_URL ?? null;
|
|
15408
15424
|
let urlValid = false;
|
|
@@ -15426,7 +15442,9 @@ function doctor() {
|
|
|
15426
15442
|
tokenFileReadable = false;
|
|
15427
15443
|
}
|
|
15428
15444
|
}
|
|
15429
|
-
const
|
|
15445
|
+
const tokenMode = directTokenConfigured ? "environment" : tokenFile ? "file" : null;
|
|
15446
|
+
const tokenReady = directTokenConfigured ? directTokenNonempty : tokenFileNonempty;
|
|
15447
|
+
const ok = urlValid && tokenReady;
|
|
15430
15448
|
process.stdout.write(
|
|
15431
15449
|
`${JSON.stringify(
|
|
15432
15450
|
{
|
|
@@ -15437,6 +15455,9 @@ function doctor() {
|
|
|
15437
15455
|
urlConfigured: rawUrl !== null,
|
|
15438
15456
|
urlValid,
|
|
15439
15457
|
protocol,
|
|
15458
|
+
tokenMode,
|
|
15459
|
+
directTokenConfigured,
|
|
15460
|
+
directTokenNonempty,
|
|
15440
15461
|
tokenFileConfigured: tokenFile !== null,
|
|
15441
15462
|
tokenFileReadable,
|
|
15442
15463
|
tokenFileNonempty,
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare const OGTOOL_PACKAGE_NAME: "@opengeni/ogtool";
|
|
|
3
3
|
/** Environment variables consumed by the standalone bundled CLI. */
|
|
4
4
|
export declare const OGTOOL_ENVIRONMENT: {
|
|
5
5
|
readonly url: "OPENGENI_CODEMODE_URL";
|
|
6
|
+
readonly token: "OPENGENI_CODEMODE_TOKEN";
|
|
6
7
|
readonly tokenFile: "OPENGENI_CODEMODE_TOKEN_FILE";
|
|
7
8
|
readonly packageSpec: "OPENGENI_OGTOOL_PACKAGE_SPEC";
|
|
8
9
|
};
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from "@opengeni/codemode";
|
|
|
3
3
|
var OGTOOL_PACKAGE_NAME = "@opengeni/ogtool";
|
|
4
4
|
var OGTOOL_ENVIRONMENT = {
|
|
5
5
|
url: "OPENGENI_CODEMODE_URL",
|
|
6
|
+
token: "OPENGENI_CODEMODE_TOKEN",
|
|
6
7
|
tokenFile: "OPENGENI_CODEMODE_TOKEN_FILE",
|
|
7
8
|
packageSpec: "OPENGENI_OGTOOL_PACKAGE_SPEC"
|
|
8
9
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/** npm package name used by deployment BOMs and custom-rig bootstrap hints. */\nexport const OGTOOL_PACKAGE_NAME = \"@opengeni/ogtool\" as const;\n\n/** Environment variables consumed by the standalone bundled CLI. */\nexport const OGTOOL_ENVIRONMENT = {\n url: \"OPENGENI_CODEMODE_URL\",\n tokenFile: \"OPENGENI_CODEMODE_TOKEN_FILE\",\n packageSpec: \"OPENGENI_OGTOOL_PACKAGE_SPEC\",\n} as const;\n\nexport * from \"@opengeni/codemode\";\n"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/** npm package name used by deployment BOMs and custom-rig bootstrap hints. */\nexport const OGTOOL_PACKAGE_NAME = \"@opengeni/ogtool\" as const;\n\n/** Environment variables consumed by the standalone bundled CLI. */\nexport const OGTOOL_ENVIRONMENT = {\n url: \"OPENGENI_CODEMODE_URL\",\n token: \"OPENGENI_CODEMODE_TOKEN\",\n tokenFile: \"OPENGENI_CODEMODE_TOKEN_FILE\",\n packageSpec: \"OPENGENI_OGTOOL_PACKAGE_SPEC\",\n} as const;\n\nexport * from \"@opengeni/codemode\";\n"],"mappings":";AAWA,cAAc;AAVP,IAAM,sBAAsB;AAG5B,IAAM,qBAAqB;AAAA,EAChC,KAAK;AAAA,EACL,OAAO;AAAA,EACP,WAAW;AAAA,EACX,aAAa;AACf;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/ogtool",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Codemode CLI and typed client entrypoint for an OpenGeni execution attempt.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@opengeni/codemode": "^0.
|
|
40
|
+
"@opengeni/codemode": "^0.4.2"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=18"
|
package/src/cli.ts
CHANGED
|
@@ -20,7 +20,7 @@ function usage(exitCode = 1): void {
|
|
|
20
20
|
" ogtool doctor",
|
|
21
21
|
" ogtool --version",
|
|
22
22
|
"",
|
|
23
|
-
"requires
|
|
23
|
+
"requires OPENGENI_CODEMODE_URL and OPENGENI_CODEMODE_TOKEN or OPENGENI_CODEMODE_TOKEN_FILE",
|
|
24
24
|
].join("\n");
|
|
25
25
|
(exitCode === 0 ? process.stdout : process.stderr).write(`${output}\n`);
|
|
26
26
|
process.exitCode = exitCode;
|
|
@@ -28,15 +28,26 @@ function usage(exitCode = 1): void {
|
|
|
28
28
|
|
|
29
29
|
function configuredClient(): CodemodeClient {
|
|
30
30
|
const baseUrl = process.env.OPENGENI_CODEMODE_URL?.trim();
|
|
31
|
+
const directTokenConfigured = process.env.OPENGENI_CODEMODE_TOKEN !== undefined;
|
|
31
32
|
const tokenFile = process.env.OPENGENI_CODEMODE_TOKEN_FILE?.trim();
|
|
32
33
|
if (!baseUrl) throw new Error("OPENGENI_CODEMODE_URL is required");
|
|
33
|
-
if (!tokenFile)
|
|
34
|
+
if (!directTokenConfigured && !tokenFile) {
|
|
35
|
+
throw new Error("OPENGENI_CODEMODE_TOKEN or OPENGENI_CODEMODE_TOKEN_FILE is required");
|
|
36
|
+
}
|
|
34
37
|
return new CodemodeClient({
|
|
35
38
|
baseUrl,
|
|
36
|
-
token:
|
|
39
|
+
token: directTokenConfigured
|
|
40
|
+
? async () => requiredDirectToken()
|
|
41
|
+
: async () => readToken(tokenFile!),
|
|
37
42
|
});
|
|
38
43
|
}
|
|
39
44
|
|
|
45
|
+
function requiredDirectToken(): string {
|
|
46
|
+
const token = process.env.OPENGENI_CODEMODE_TOKEN?.trim();
|
|
47
|
+
if (!token) throw new Error("OPENGENI_CODEMODE_TOKEN is empty");
|
|
48
|
+
return token;
|
|
49
|
+
}
|
|
50
|
+
|
|
40
51
|
function readToken(tokenFile: string): string {
|
|
41
52
|
let token: string;
|
|
42
53
|
try {
|
|
@@ -49,6 +60,9 @@ function readToken(tokenFile: string): string {
|
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
function doctor(): void {
|
|
63
|
+
const directTokenRaw = process.env.OPENGENI_CODEMODE_TOKEN;
|
|
64
|
+
const directTokenConfigured = directTokenRaw !== undefined;
|
|
65
|
+
const directTokenNonempty = Boolean(directTokenRaw?.trim().length);
|
|
52
66
|
const tokenFile = process.env.OPENGENI_CODEMODE_TOKEN_FILE ?? null;
|
|
53
67
|
const rawUrl = process.env.OPENGENI_CODEMODE_URL ?? null;
|
|
54
68
|
let urlValid = false;
|
|
@@ -72,7 +86,9 @@ function doctor(): void {
|
|
|
72
86
|
tokenFileReadable = false;
|
|
73
87
|
}
|
|
74
88
|
}
|
|
75
|
-
const
|
|
89
|
+
const tokenMode = directTokenConfigured ? "environment" : tokenFile ? "file" : null;
|
|
90
|
+
const tokenReady = directTokenConfigured ? directTokenNonempty : tokenFileNonempty;
|
|
91
|
+
const ok = urlValid && tokenReady;
|
|
76
92
|
process.stdout.write(
|
|
77
93
|
`${JSON.stringify(
|
|
78
94
|
{
|
|
@@ -83,6 +99,9 @@ function doctor(): void {
|
|
|
83
99
|
urlConfigured: rawUrl !== null,
|
|
84
100
|
urlValid,
|
|
85
101
|
protocol,
|
|
102
|
+
tokenMode,
|
|
103
|
+
directTokenConfigured,
|
|
104
|
+
directTokenNonempty,
|
|
86
105
|
tokenFileConfigured: tokenFile !== null,
|
|
87
106
|
tokenFileReadable,
|
|
88
107
|
tokenFileNonempty,
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export const OGTOOL_PACKAGE_NAME = "@opengeni/ogtool" as const;
|
|
|
4
4
|
/** Environment variables consumed by the standalone bundled CLI. */
|
|
5
5
|
export const OGTOOL_ENVIRONMENT = {
|
|
6
6
|
url: "OPENGENI_CODEMODE_URL",
|
|
7
|
+
token: "OPENGENI_CODEMODE_TOKEN",
|
|
7
8
|
tokenFile: "OPENGENI_CODEMODE_TOKEN_FILE",
|
|
8
9
|
packageSpec: "OPENGENI_OGTOOL_PACKAGE_SPEC",
|
|
9
10
|
} as const;
|