@useorgx/wizard 0.1.59 → 0.1.61

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/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/cli.ts
4
4
 
5
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="38a8c165-aa33-5892-9af0-25fee0a694c7")}catch(e){}}();
5
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="25afe0bb-abb4-54b0-9963-05fbafee7372")}catch(e){}}();
6
6
  import * as clack from "@clack/prompts";
7
7
  import { spawnSync as spawnSync5 } from "child_process";
8
8
  import { readFileSync as readFileSync10 } from "fs";
@@ -32,7 +32,9 @@ import { join } from "path";
32
32
  var ORGX_HOSTED_MCP_KEY = "orgx";
33
33
  var ORGX_LOCAL_MCP_KEY = "orgx-openclaw";
34
34
  var ORGX_HOSTED_MCP_URL = "https://mcp.useorgx.com/mcp";
35
- var ORGX_CODEX_MCP_URL = `${ORGX_HOSTED_MCP_URL}?profile=commander`;
35
+ var ORGX_CODEX_MCP_URL = ORGX_HOSTED_MCP_URL;
36
+ var ORGX_CODEX_TOOL_PROFILE_HEADER = "x-orgx-tool-profile";
37
+ var ORGX_CODEX_TOOL_PROFILE = "commander";
36
38
  var ORGX_HOSTED_MCP_HEALTH_URL = "https://mcp.useorgx.com/health";
37
39
  var ORGX_HOSTED_OAUTH_BASE_URL = "https://mcp.useorgx.com";
38
40
  var ORGX_HOSTED_OAUTH_AUTHORIZE_URL = `${ORGX_HOSTED_OAUTH_BASE_URL}/authorize`;
@@ -2179,6 +2181,7 @@ import { dirname as dirname4, join as join4 } from "path";
2179
2181
 
2180
2182
  // src/surfaces/mcp-config.ts
2181
2183
  import * as TOML from "@iarna/toml";
2184
+ var ORGX_LEGACY_CODEX_MCP_URL = `${ORGX_HOSTED_MCP_URL}?profile=commander`;
2182
2185
  function cloneConfigCollection(config, key) {
2183
2186
  return { ...readObject(config[key]) };
2184
2187
  }
@@ -2441,7 +2444,7 @@ function stringifyTomlDocument(document) {
2441
2444
  return rendered.endsWith("\n") ? rendered : `${rendered}
2442
2445
  `;
2443
2446
  }
2444
- function upsertCodexEntry(servers, key, url, oauthResource) {
2447
+ function upsertCodexEntry(servers, key, url, oauthResource, toolProfile) {
2445
2448
  const current = readObject(servers[key]);
2446
2449
  const next = {
2447
2450
  ...current,
@@ -2450,6 +2453,11 @@ function upsertCodexEntry(servers, key, url, oauthResource) {
2450
2453
  if (oauthResource) {
2451
2454
  next.oauth_resource = oauthResource;
2452
2455
  }
2456
+ if (toolProfile) {
2457
+ const httpHeaders = readObject(next.http_headers);
2458
+ httpHeaders[ORGX_CODEX_TOOL_PROFILE_HEADER] = toolProfile;
2459
+ next.http_headers = httpHeaders;
2460
+ }
2453
2461
  delete next.command;
2454
2462
  delete next.args;
2455
2463
  delete next.startup_timeout_sec;
@@ -2473,7 +2481,8 @@ function patchCodexConfigToml(input, localMcpUrl) {
2473
2481
  servers,
2474
2482
  ORGX_HOSTED_MCP_KEY,
2475
2483
  ORGX_CODEX_MCP_URL,
2476
- ORGX_HOSTED_MCP_URL
2484
+ ORGX_HOSTED_MCP_URL,
2485
+ ORGX_CODEX_TOOL_PROFILE
2477
2486
  );
2478
2487
  if (localMcpUrl) {
2479
2488
  upsertCodexEntry(servers, ORGX_LOCAL_MCP_KEY, localMcpUrl);
@@ -2487,21 +2496,43 @@ function migrateCodexHostedMcpConnection(input) {
2487
2496
  const current = parseTomlDocument(input);
2488
2497
  const servers = readObject(current.mcp_servers);
2489
2498
  const hosted = readObject(servers[ORGX_HOSTED_MCP_KEY]);
2490
- if (hosted.url !== ORGX_HOSTED_MCP_URL && hosted.url !== ORGX_CODEX_MCP_URL) {
2499
+ if (hosted.url !== ORGX_HOSTED_MCP_URL && hosted.url !== ORGX_LEGACY_CODEX_MCP_URL) {
2491
2500
  return input;
2492
2501
  }
2493
2502
  const lines = input.match(/.*(?:\r\n|\n|$)/g)?.filter((line) => line.length > 0) ?? [];
2494
- let inOrgxSection = false;
2503
+ let activeSection = "other";
2504
+ let orgxSectionEnd = lines.length;
2505
+ let headersSectionStart = -1;
2506
+ let headersSectionEnd = lines.length;
2495
2507
  let urlIndex = -1;
2496
2508
  let oauthResourceIndex = -1;
2509
+ let inlineHeadersIndex = -1;
2510
+ let profileHeaderIndex = -1;
2497
2511
  for (const [index, line] of lines.entries()) {
2498
2512
  if (/^\s*\[/.test(line)) {
2499
- inOrgxSection = /^\s*\[mcp_servers\.(?:orgx|"orgx")\]\s*(?:#.*)?(?:\r?\n)?$/.test(line);
2513
+ if (activeSection === "orgx" && orgxSectionEnd === lines.length) {
2514
+ orgxSectionEnd = index;
2515
+ }
2516
+ if (activeSection === "headers" && headersSectionEnd === lines.length) {
2517
+ headersSectionEnd = index;
2518
+ }
2519
+ if (/^\s*\[mcp_servers\.(?:orgx|"orgx")\]\s*(?:#.*)?(?:\r?\n)?$/.test(line)) {
2520
+ activeSection = "orgx";
2521
+ } else if (/^\s*\[mcp_servers\.(?:orgx|"orgx")\.http_headers\]\s*(?:#.*)?(?:\r?\n)?$/.test(line)) {
2522
+ activeSection = "headers";
2523
+ headersSectionStart = index;
2524
+ } else {
2525
+ activeSection = "other";
2526
+ }
2500
2527
  continue;
2501
2528
  }
2502
- if (!inOrgxSection) continue;
2503
- if (/^\s*url\s*=/.test(line)) urlIndex = index;
2504
- if (/^\s*oauth_resource\s*=/.test(line)) oauthResourceIndex = index;
2529
+ if (activeSection === "orgx") {
2530
+ if (/^\s*url\s*=/.test(line)) urlIndex = index;
2531
+ if (/^\s*oauth_resource\s*=/.test(line)) oauthResourceIndex = index;
2532
+ if (/^\s*http_headers\s*=/.test(line)) inlineHeadersIndex = index;
2533
+ } else if (activeSection === "headers" && /^\s*(?:"x-orgx-tool-profile"|x-orgx-tool-profile)\s*=/.test(line)) {
2534
+ profileHeaderIndex = index;
2535
+ }
2505
2536
  }
2506
2537
  if (urlIndex < 0) return input;
2507
2538
  const urlMatch = lines[urlIndex]?.match(
@@ -2513,6 +2544,11 @@ function migrateCodexHostedMcpConnection(input) {
2513
2544
  lines[urlIndex] = `${urlMatch[1]}${urlMatch[2]}${ORGX_CODEX_MCP_URL}${urlMatch[2]}${urlMatch[4]}${urlMatch[5] ?? ""}`;
2514
2545
  changed = true;
2515
2546
  }
2547
+ const httpHeaders = readObject(hosted.http_headers);
2548
+ const configuredProfile = httpHeaders[ORGX_CODEX_TOOL_PROFILE_HEADER];
2549
+ if (inlineHeadersIndex >= 0 && configuredProfile !== ORGX_CODEX_TOOL_PROFILE) {
2550
+ return input;
2551
+ }
2516
2552
  if (oauthResourceIndex >= 0) {
2517
2553
  const oauthResourceMatch = lines[oauthResourceIndex]?.match(
2518
2554
  /^(\s*oauth_resource\s*=\s*)(["'])([^"']*)\2([ \t]*(?:#.*)?)(\r?\n)?$/
@@ -2531,10 +2567,38 @@ function migrateCodexHostedMcpConnection(input) {
2531
2567
  lines.splice(
2532
2568
  urlIndex + 1,
2533
2569
  0,
2534
- `${indent}oauth_resource = "${ORGX_HOSTED_MCP_URL}"${urlMatch[5] ? lineEnding : ""}`
2570
+ `${indent}oauth_resource = "${ORGX_HOSTED_MCP_URL}"${lineEnding}`
2535
2571
  );
2536
2572
  changed = true;
2537
2573
  }
2574
+ const oauthInsertionShift = oauthResourceIndex < 0 ? 1 : 0;
2575
+ if (configuredProfile !== ORGX_CODEX_TOOL_PROFILE) {
2576
+ if (profileHeaderIndex >= 0) {
2577
+ const currentIndex = profileHeaderIndex + oauthInsertionShift;
2578
+ const profileHeaderMatch = lines[currentIndex]?.match(
2579
+ /^(\s*(?:"x-orgx-tool-profile"|x-orgx-tool-profile)\s*=\s*)(["'])([^"']*)\2([ \t]*(?:#.*)?)(\r?\n)?$/
2580
+ );
2581
+ if (!profileHeaderMatch) return input;
2582
+ lines[currentIndex] = `${profileHeaderMatch[1]}${profileHeaderMatch[2]}${ORGX_CODEX_TOOL_PROFILE}${profileHeaderMatch[2]}${profileHeaderMatch[4]}${profileHeaderMatch[5] ?? ""}`;
2583
+ } else if (headersSectionStart >= 0) {
2584
+ lines.splice(
2585
+ headersSectionEnd + oauthInsertionShift,
2586
+ 0,
2587
+ `${ORGX_CODEX_TOOL_PROFILE_HEADER} = "${ORGX_CODEX_TOOL_PROFILE}"${urlMatch[5] ?? "\n"}`
2588
+ );
2589
+ } else if (readObject(hosted.http_headers)[ORGX_CODEX_TOOL_PROFILE_HEADER] === void 0) {
2590
+ const lineEnding = urlMatch[5] ?? (input.includes("\r\n") ? "\r\n" : "\n");
2591
+ const insertionIndex = orgxSectionEnd + oauthInsertionShift;
2592
+ lines.splice(
2593
+ insertionIndex,
2594
+ 0,
2595
+ `[mcp_servers.orgx.http_headers]${lineEnding}`,
2596
+ `${ORGX_CODEX_TOOL_PROFILE_HEADER} = "${ORGX_CODEX_TOOL_PROFILE}"${lineEnding}`,
2597
+ lineEnding
2598
+ );
2599
+ }
2600
+ changed = true;
2601
+ }
2538
2602
  return changed ? lines.join("") : input;
2539
2603
  }
2540
2604
  function removeCodexConfigToml(input) {
@@ -2544,7 +2608,7 @@ function removeCodexConfigToml(input) {
2544
2608
  if (isRecord(servers[ORGX_LOCAL_MCP_KEY])) {
2545
2609
  delete servers[ORGX_LOCAL_MCP_KEY];
2546
2610
  }
2547
- if (hosted.url === ORGX_HOSTED_MCP_URL || hosted.url === ORGX_CODEX_MCP_URL) {
2611
+ if (hosted.url === ORGX_HOSTED_MCP_URL || hosted.url === ORGX_LEGACY_CODEX_MCP_URL) {
2548
2612
  delete servers[ORGX_HOSTED_MCP_KEY];
2549
2613
  }
2550
2614
  removeLegacyCodexEntries(servers);
@@ -2556,7 +2620,7 @@ function inspectCodexConfigToml(input) {
2556
2620
  const servers = readObject(current.mcp_servers);
2557
2621
  const hosted = readObject(servers[ORGX_HOSTED_MCP_KEY]);
2558
2622
  const local = readObject(servers[ORGX_LOCAL_MCP_KEY]);
2559
- const hostedConfigured = hosted.url === ORGX_CODEX_MCP_URL && hosted.oauth_resource === ORGX_HOSTED_MCP_URL;
2623
+ const hostedConfigured = hosted.url === ORGX_CODEX_MCP_URL && hosted.oauth_resource === ORGX_HOSTED_MCP_URL && readObject(hosted.http_headers)[ORGX_CODEX_TOOL_PROFILE_HEADER] === ORGX_CODEX_TOOL_PROFILE;
2560
2624
  const localConfigured = typeof local.url === "string";
2561
2625
  return {
2562
2626
  configured: hostedConfigured && localConfigured,
@@ -4302,7 +4366,7 @@ async function installCodexPlugin(paths, fetchImpl, runner) {
4302
4366
  const changes = [
4303
4367
  ...syncResult.changed ? [`Synced ${syncResult.fileCount} Codex plugin files.`] : [],
4304
4368
  ...marketplaceChanged ? ["Updated the Codex marketplace entry."] : [],
4305
- ...configChanged ? ["Updated the existing OrgX MCP connection for the commander profile and OAuth."] : []
4369
+ ...configChanged ? ["Updated the existing OrgX MCP connection to the canonical OAuth resource and commander profile."] : []
4306
4370
  ];
4307
4371
  return {
4308
4372
  target: "codex",
@@ -6290,7 +6354,7 @@ function initializeWizardSentry() {
6290
6354
  Sentry.init({
6291
6355
  dsn,
6292
6356
  environment: process.env.ORGX_SENTRY_ENVIRONMENT || "production",
6293
- release: "useorgx-wizard@0.1.59",
6357
+ release: "useorgx-wizard@0.1.61",
6294
6358
  tracesSampleRate: sampleRate(process.env.ORGX_SENTRY_TRACES_SAMPLE_RATE),
6295
6359
  enableLogs: true,
6296
6360
  sendDefaultPii: false,
@@ -13710,7 +13774,7 @@ import { dirname as dirname5, join as join8, resolve as resolve2 } from "path";
13710
13774
  var SESSION_SUMMARY_HOOK_MARKER = "orgx-session-summary.mjs";
13711
13775
  var SESSION_SUMMARY_ENDPOINT_PATH = "/api/v1/sessions/summary";
13712
13776
  var SESSION_SUMMARY_FALLBACK_ENDPOINT_PATH = "/api/v1/work-graph/reports";
13713
- var SESSION_SUMMARY_SCHEMA_VERSION = "2026-08-07";
13777
+ var SESSION_SUMMARY_SCHEMA_VERSION = "1.0.0";
13714
13778
  var HOOK_OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
13715
13779
  function buildSessionSummaryHookScriptContent() {
13716
13780
  return `#!/usr/bin/env node
@@ -18321,7 +18385,7 @@ async function main() {
18321
18385
  initializeWizardSentry();
18322
18386
  const program = new Command();
18323
18387
  program.name("orgx-wizard").description("Add OrgX MCP configs, skills/rules, and companion plugins to your local AI tools.").showHelpAfterError();
18324
- const pkgVersion = true ? "0.1.59" : void 0;
18388
+ const pkgVersion = true ? "0.1.61" : void 0;
18325
18389
  program.version(pkgVersion ?? "unknown", "-V, --version");
18326
18390
  program.hook("preAction", (_thisCommand, actionCommand) => {
18327
18391
  if (Boolean(actionCommand.optsWithGlobals().json)) return;
@@ -19365,4 +19429,4 @@ main().catch(async (error) => {
19365
19429
  process.exitCode = 1;
19366
19430
  });
19367
19431
  //# sourceMappingURL=cli.js.map
19368
- //# debugId=38a8c165-aa33-5892-9af0-25fee0a694c7
19432
+ //# debugId=25afe0bb-abb4-54b0-9963-05fbafee7372