@opengeni/ogtool 0.2.2 → 0.3.5

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 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` and the bearer path in
19
- `OPENGENI_CODEMODE_TOKEN_FILE`. The token remains in the protected file and is read anew for
20
- each CLI process, so worker-side token renewal does not require reinstalling or restarting the
21
- CLI. `ogtool doctor` checks local availability without printing the token.
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
 
@@ -15316,7 +15316,7 @@ async function abortableDelay(delayMs, signal) {
15316
15316
  // package.json
15317
15317
  var package_default = {
15318
15318
  name: "@opengeni/ogtool",
15319
- version: "0.2.2",
15319
+ version: "0.3.5",
15320
15320
  description: "Codemode CLI and typed client entrypoint for an OpenGeni execution attempt.",
15321
15321
  license: "Apache-2.0",
15322
15322
  repository: {
@@ -15376,7 +15376,7 @@ function usage(exitCode = 1) {
15376
15376
  " ogtool doctor",
15377
15377
  " ogtool --version",
15378
15378
  "",
15379
- "requires OPENGENI_CODEMODE_TOKEN_FILE and OPENGENI_CODEMODE_URL"
15379
+ "requires OPENGENI_CODEMODE_URL and OPENGENI_CODEMODE_TOKEN or OPENGENI_CODEMODE_TOKEN_FILE"
15380
15380
  ].join("\n");
15381
15381
  (exitCode === 0 ? process.stdout : process.stderr).write(`${output}
15382
15382
  `);
@@ -15384,14 +15384,22 @@ function usage(exitCode = 1) {
15384
15384
  }
15385
15385
  function configuredClient() {
15386
15386
  const baseUrl = process.env.OPENGENI_CODEMODE_URL?.trim();
15387
+ const directTokenConfigured = process.env.OPENGENI_CODEMODE_TOKEN !== void 0;
15387
15388
  const tokenFile = process.env.OPENGENI_CODEMODE_TOKEN_FILE?.trim();
15388
15389
  if (!baseUrl) throw new Error("OPENGENI_CODEMODE_URL is required");
15389
- if (!tokenFile) throw new Error("OPENGENI_CODEMODE_TOKEN_FILE is required");
15390
+ if (!directTokenConfigured && !tokenFile) {
15391
+ throw new Error("OPENGENI_CODEMODE_TOKEN or OPENGENI_CODEMODE_TOKEN_FILE is required");
15392
+ }
15390
15393
  return new CodemodeClient({
15391
15394
  baseUrl,
15392
- token: async () => readToken(tokenFile)
15395
+ token: directTokenConfigured ? async () => requiredDirectToken() : async () => readToken(tokenFile)
15393
15396
  });
15394
15397
  }
15398
+ function requiredDirectToken() {
15399
+ const token = process.env.OPENGENI_CODEMODE_TOKEN?.trim();
15400
+ if (!token) throw new Error("OPENGENI_CODEMODE_TOKEN is empty");
15401
+ return token;
15402
+ }
15395
15403
  function readToken(tokenFile) {
15396
15404
  let token;
15397
15405
  try {
@@ -15403,6 +15411,9 @@ function readToken(tokenFile) {
15403
15411
  return token;
15404
15412
  }
15405
15413
  function doctor() {
15414
+ const directTokenRaw = process.env.OPENGENI_CODEMODE_TOKEN;
15415
+ const directTokenConfigured = directTokenRaw !== void 0;
15416
+ const directTokenNonempty = Boolean(directTokenRaw?.trim().length);
15406
15417
  const tokenFile = process.env.OPENGENI_CODEMODE_TOKEN_FILE ?? null;
15407
15418
  const rawUrl = process.env.OPENGENI_CODEMODE_URL ?? null;
15408
15419
  let urlValid = false;
@@ -15426,7 +15437,9 @@ function doctor() {
15426
15437
  tokenFileReadable = false;
15427
15438
  }
15428
15439
  }
15429
- const ok = urlValid && tokenFileReadable && tokenFileNonempty;
15440
+ const tokenMode = directTokenConfigured ? "environment" : tokenFile ? "file" : null;
15441
+ const tokenReady = directTokenConfigured ? directTokenNonempty : tokenFileNonempty;
15442
+ const ok = urlValid && tokenReady;
15430
15443
  process.stdout.write(
15431
15444
  `${JSON.stringify(
15432
15445
  {
@@ -15437,6 +15450,9 @@ function doctor() {
15437
15450
  urlConfigured: rawUrl !== null,
15438
15451
  urlValid,
15439
15452
  protocol,
15453
+ tokenMode,
15454
+ directTokenConfigured,
15455
+ directTokenNonempty,
15440
15456
  tokenFileConfigured: tokenFile !== null,
15441
15457
  tokenFileReadable,
15442
15458
  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":";AAUA,cAAc;AATP,IAAM,sBAAsB;AAG5B,IAAM,qBAAqB;AAAA,EAChC,KAAK;AAAA,EACL,WAAW;AAAA,EACX,aAAa;AACf;","names":[]}
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.2.2",
3
+ "version": "0.3.5",
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.2.2"
40
+ "@opengeni/codemode": "^0.4.1"
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 OPENGENI_CODEMODE_TOKEN_FILE and OPENGENI_CODEMODE_URL",
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) throw new Error("OPENGENI_CODEMODE_TOKEN_FILE is required");
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: async () => readToken(tokenFile),
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 ok = urlValid && tokenFileReadable && tokenFileNonempty;
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;