@experiture/xyra-cli 0.6.1 → 0.6.2

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.
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runChatAttention = runChatAttention;
4
3
  exports.runChatStart = runChatStart;
5
4
  exports.runChatSend = runChatSend;
6
5
  const crypto_1 = require("crypto");
@@ -24,7 +23,7 @@ async function createClient(config) {
24
23
  throw new CliError_1.CliError(CliError_1.CliErrorCodes.InsufficientScope, 'Administration is metadata maintenance, not runtime chat or paid execution.');
25
24
  const token = await (0, latency_1.measureLatencyPhase)('auth.token_load', async () => {
26
25
  const store = await (0, tokenStore_1.createTokenStore)();
27
- return (0, session_1.getValidToken)(env, store);
26
+ return (0, session_1.getValidToken)(env, store, config.getSessionName());
28
27
  });
29
28
  return new runtimeChatClient_1.XyraRuntimeChatClient(env, token.accessToken);
30
29
  }
@@ -49,14 +48,6 @@ function formatChatResult(result) {
49
48
  if (approvalReference(result))
50
49
  return formatPendingApproval(result);
51
50
  const lines = [];
52
- if (result.waiting) {
53
- lines.push(result.message || 'The same work is still running. Read its status instead of sending it again.');
54
- lines.push(`Conversation: ${result.conversationId}`);
55
- lines.push(`Request: ${result.clientRequestId}`);
56
- lines.push(`Turn: ${result.executionId}`);
57
- lines.push('Choices: xyra chat attention <keep_waiting|show_ready|see_other_options|stop_waiting|cancel_operation> --conversation <id> --request <clientRequestId> --turn <runtimeTurnId> --epoch <epoch>');
58
- return lines.join('\n');
59
- }
60
51
  if (result.message)
61
52
  lines.push(result.message);
62
53
  else if (result.error !== undefined)
@@ -68,8 +59,6 @@ function formatChatResult(result) {
68
59
  function chatExitCode(result) {
69
60
  if (approvalReference(result))
70
61
  return 2;
71
- if (result.waiting || result.outcome === 'waiting')
72
- return 0;
73
62
  return result.outcome === 'completed' ? 0 : 1;
74
63
  }
75
64
  /** A finished 4xx answer is a refusal. Unresolved is only for uncertain delivery. */
@@ -99,23 +88,6 @@ async function createOwnedConversation(client, title) {
99
88
  throw new CliError_1.CliError(CliError_1.CliErrorCodes.ChatRequestFailed, `Conversation creation is unresolved (${clientRequestId}). Another conversation was not created.`, `Check request ${clientRequestId} before trying again. Do not start a replacement conversation while it is unresolved.`);
100
89
  }
101
90
  }
102
- async function runChatAttention(config, writer, action, options = {}) {
103
- const allowed = ['keep_waiting', 'show_ready', 'see_other_options', 'stop_waiting', 'cancel_operation'];
104
- if (!allowed.includes(action) || !options.conversation || !options.request || !options.turn || !options.epoch) {
105
- throw new CliError_1.CliError(CliError_1.CliErrorCodes.InvalidArguments, 'An attention choice needs the action, conversation, original request, runtime turn, and epoch.', 'Use: xyra chat attention <action> --conversation <id> --request <clientRequestId> --turn <runtimeTurnId> --epoch <epoch>');
106
- }
107
- const client = await createClient(config);
108
- const result = await client.decideAttention({
109
- conversationId: options.conversation,
110
- clientRequestId: options.request,
111
- runtimeTurnId: options.turn,
112
- epoch: Number(options.epoch),
113
- action: action,
114
- locale: (0, runtimeChatClient_1.parseRuntimeLocale)(options.locale),
115
- });
116
- writer.out(options.json ? (0, formatters_1.toJson)(result) : 'The choice was sent. Read the turn status before sending the original request again.');
117
- return 0;
118
- }
119
91
  async function runChatStart(config, writer, options = {}) {
120
92
  const client = await createClient(config);
121
93
  const conversation = await (0, latency_1.measureLatencyPhase)('chat.conversation_create', () => createOwnedConversation(client, options.title));
@@ -1 +1 @@
1
- {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":";;AAyHA,4CAgCC;AAED,oCAcC;AAED,kCAkDC;AA7ND,mCAAoC;AAGpC,mDAAsD;AACtD,6CAAgD;AAChD,oDAA6D;AAC7D,iDAA6D;AAC7D,qDAA8C;AAC9C,iEAImC;AAenC,SAAS,eAAe,CAAC,KAAwB;IAC/C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC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M,CAAC,OAAO,KAAK,WAAW,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;gBAAE,MAAM,CAAC,GAAG,CAAC,IAAA,mBAAM,EAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrG,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC"}
@@ -35,10 +35,18 @@ var require_xyra_administration = __commonJS({
35
35
  "../../libs/xyra-types/dist/xyra-administration.js"(exports2) {
36
36
  "use strict";
37
37
  Object.defineProperty(exports2, "__esModule", { value: true });
38
+ exports2.runtimeAdministrationTarget = runtimeAdministrationTarget;
38
39
  exports2.parseXyraAdministrationTargetV1 = parseXyraAdministrationTargetV12;
39
40
  exports2.xyraAdministrationTargetKeyV1 = xyraAdministrationTargetKeyV1;
40
41
  exports2.parseXyraAdministrationResolvedTargetV1 = parseXyraAdministrationResolvedTargetV1;
41
42
  exports2.parseXyraAdministrationDecisionV1 = parseXyraAdministrationDecisionV1;
43
+ function runtimeAdministrationTarget(identity) {
44
+ return identity.licenseSourceProductId !== identity.licensedProductId && identity.tenantId === identity.licenseOwnerTenantId ? {
45
+ targetKind: "configuration-owner",
46
+ configurationTenantId: identity.licenseOwnerTenantId,
47
+ managedProductId: identity.licenseSourceProductId
48
+ } : { targetKind: "customer-resource", targetTenantId: identity.tenantId, activeProductId: identity.productId };
49
+ }
42
50
  var identifier = (value) => typeof value === "string" && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,49}$/.test(value);
43
51
  var guid = (value) => typeof value === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(value) && value !== "00000000-0000-0000-0000-000000000000";
44
52
  var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
@@ -76,7 +84,7 @@ var require_xyra_administration = __commonJS({
76
84
  const base = ["targetKind", "managedProductId", "relationshipKind", "activeProductId", "actualTenantId", "licensedProductId", "commercialState"];
77
85
  const embedded = ["licenseSourceProductId", "licenseOwnerTenantId", "bindingId", "entitlementId", "sourceEntitlementId"];
78
86
  const isNative = value.relationshipKind === "native-product-tenant";
79
- if (!isNative && value.relationshipKind !== "embedded-product-entitlement" || !exact(value, isNative ? base : [...base, ...embedded]) || value.licensedProductId !== "xyra-ai" || !base.filter((key) => !["targetKind", "relationshipKind"].includes(key)).every((key) => identifier(value[key])) || (isNative ? value.activeProductId !== "xyra-ai" : !embedded.every((key) => identifier(value[key]))) || value.actualTenantId !== (target.targetKind === "customer-resource" ? target.targetTenantId : target.configurationTenantId) || target.targetKind === "customer-resource" && value.activeProductId !== target.activeProductId || target.targetKind === "configuration-owner" && value.activeProductId !== target.managedProductId || !isNative && (value.licenseSourceProductId !== value.activeProductId || !["bindingId", "entitlementId", "sourceEntitlementId"].every((key) => guid(value[key])) || target.targetKind === "configuration-owner" && value.licenseOwnerTenantId !== target.configurationTenantId))
87
+ if (!isNative && value.relationshipKind !== "embedded-product-entitlement" || !exact(value, isNative ? base : [...base, ...embedded]) || value.licensedProductId !== "xyra-ai" || !base.filter((key) => !["targetKind", "relationshipKind"].includes(key)).every((key) => identifier(value[key])) || (isNative ? value.activeProductId !== "xyra-ai" : !embedded.every((key) => identifier(value[key]))) || value.actualTenantId !== (target.targetKind === "customer-resource" ? target.targetTenantId : target.configurationTenantId) || target.targetKind === "customer-resource" && value.activeProductId !== target.activeProductId || target.targetKind === "configuration-owner" && value.activeProductId !== target.managedProductId || !isNative && (value.activeProductId !== value.licenseSourceProductId && value.activeProductId !== value.licensedProductId || !["bindingId", "entitlementId", "sourceEntitlementId"].every((key) => guid(value[key])) || target.targetKind === "configuration-owner" && (value.licenseOwnerTenantId !== target.configurationTenantId || value.licenseSourceProductId !== target.managedProductId)))
80
88
  return null;
81
89
  return { ...value };
82
90
  }
@@ -92,17 +100,23 @@ var require_xyra_administration = __commonJS({
92
100
  "targetTenantId",
93
101
  "grantId",
94
102
  "target",
95
- "resolvedTarget"
96
- ]) || value.operationId !== request.operationId || value.purpose !== purpose || value.accessPurpose !== "administration" || value.productId !== "xyra-ai" || typeof value.allowed !== "boolean" || typeof value.code !== "string" || !/^[A-Z0-9_.]{1,160}$/.test(value.code) || !(value.operatorTenantId === null || identifier(value.operatorTenantId)) || !(value.grantId === null || guid(value.grantId)))
103
+ "resolvedTarget",
104
+ ...Object.prototype.hasOwnProperty.call(value, "configurationAccess") ? ["configurationAccess"] : []
105
+ ]) || value.configurationAccess !== void 0 && !["read", "manage", "manage_selection"].includes(String(value.configurationAccess)) || value.operationId !== request.operationId || value.purpose !== purpose || value.accessPurpose !== "administration" || value.productId !== "xyra-ai" || typeof value.allowed !== "boolean" || typeof value.code !== "string" || !/^[A-Z0-9_.]{1,160}$/.test(value.code) || !(value.operatorTenantId === null || identifier(value.operatorTenantId)) || !(value.grantId === null || guid(value.grantId)))
97
106
  return null;
98
107
  const target = parseXyraAdministrationTargetV12(value.target);
99
108
  if (!target || xyraAdministrationTargetKeyV1(target) !== xyraAdministrationTargetKeyV1(request.target) || value.targetTenantId !== (target.targetKind === "global-resource" ? null : target.targetKind === "configuration-owner" ? target.configurationTenantId : target.targetTenantId))
100
109
  return null;
101
110
  const resolvedTarget = parseXyraAdministrationResolvedTargetV1(value.resolvedTarget, target);
102
111
  if (value.allowed) {
103
- if (!resolvedTarget || (value.code === "AUTHORIZATION.ALLOWED.SUPER_USER" ? value.operatorTenantId !== null || value.grantId !== null : !["AUTHORIZATION.ALLOWED", "AUTHORIZATION.ALLOWED.LICENSEE"].includes(value.code) || value.operatorTenantId === null || value.grantId === null))
112
+ if (!resolvedTarget)
113
+ return null;
114
+ if (value.code === "AUTHORIZATION.ALLOWED.SAME_TENANT") {
115
+ if (target.targetKind !== "customer-resource" || value.operatorTenantId !== target.targetTenantId || value.grantId !== null)
116
+ return null;
117
+ } else if (value.code === "AUTHORIZATION.ALLOWED.SUPER_USER" ? value.operatorTenantId !== null || value.grantId !== null : !["AUTHORIZATION.ALLOWED", "AUTHORIZATION.ALLOWED.LICENSEE"].includes(value.code) || value.operatorTenantId === null || value.grantId === null)
104
118
  return null;
105
- if (value.code === "AUTHORIZATION.ALLOWED.LICENSEE" && (target.targetKind === "global-resource" || resolvedTarget.relationshipKind !== "embedded-product-entitlement" || resolvedTarget.licenseOwnerTenantId !== value.operatorTenantId || resolvedTarget.activeProductId === "xyra-ai"))
119
+ if (value.code === "AUTHORIZATION.ALLOWED.LICENSEE" && (target.targetKind === "global-resource" || resolvedTarget.relationshipKind !== "embedded-product-entitlement" || resolvedTarget.licenseOwnerTenantId !== value.operatorTenantId))
106
120
  return null;
107
121
  } else if (value.code.startsWith("AUTHORIZATION.ALLOWED") || value.resolvedTarget !== null)
108
122
  return null;
@@ -455,38 +469,7 @@ module.exports = __toCommonJS(configStore_exports);
455
469
  var import_node_fs = require("node:fs");
456
470
  var import_node_os = require("node:os");
457
471
  var import_node_path = require("node:path");
458
-
459
- // src/errors/CliError.ts
460
- var CliError = class extends Error {
461
- code;
462
- hint;
463
- httpStatus;
464
- constructor(code, message, hint, httpStatus) {
465
- super(message);
466
- this.name = "CliError";
467
- this.code = code;
468
- this.hint = hint;
469
- this.httpStatus = httpStatus;
470
- }
471
- };
472
- var CliErrorCodes = {
473
- ConfigInvalid: "XYRA.CLI.CONFIG_INVALID",
474
- EnvironmentNotFound: "XYRA.CLI.ENVIRONMENT_NOT_FOUND",
475
- NotAuthenticated: "XYRA.CLI.NOT_AUTHENTICATED",
476
- OAuthStateMismatch: "XYRA.CLI.OAUTH_STATE_MISMATCH",
477
- OAuthCallbackError: "XYRA.CLI.OAUTH_CALLBACK_ERROR",
478
- TokenStoreUnavailable: "XYRA.CLI.TOKEN_STORE_UNAVAILABLE",
479
- TokenExchangeFailed: "XYRA.CLI.TOKEN_EXCHANGE_FAILED",
480
- InsufficientScope: "XYRA.CLI.INSUFFICIENT_SCOPE",
481
- McpProtocolError: "XYRA.CLI.MCP_PROTOCOL_ERROR",
482
- ToolCallFailed: "XYRA.CLI.TOOL_CALL_FAILED",
483
- ChatRequestFailed: "XYRA.CLI.CHAT_REQUEST_FAILED",
484
- InvalidArguments: "XYRA.CLI.INVALID_ARGUMENTS",
485
- ConfirmationRequired: "XYRA.CLI.CONFIRMATION_REQUIRED",
486
- AmbiguousAlias: "XYRA.CLI.AMBIGUOUS_ALIAS"
487
- };
488
-
489
- // src/config/configStore.ts
472
+ var import_CliError = require("../errors/CliError");
490
473
  var import_xyra_administration = __toESM(require_xyra_administration());
491
474
  var import_canonical_runtime_json = __toESM(require_canonical_runtime_json());
492
475
 
@@ -536,12 +519,12 @@ function requireHttpsOrTest(name, url) {
536
519
  try {
537
520
  parsed = new URL(url);
538
521
  } catch {
539
- throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${name}' has an invalid URL: ${url}`);
522
+ throw new import_CliError.CliError(import_CliError.CliErrorCodes.ConfigInvalid, `Environment '${name}' has an invalid URL: ${url}`);
540
523
  }
541
524
  const isTestDomain = parsed.hostname.endsWith(".test");
542
525
  if (parsed.protocol !== "https:" && !isTestDomain) {
543
- throw new CliError(
544
- CliErrorCodes.ConfigInvalid,
526
+ throw new import_CliError.CliError(
527
+ import_CliError.CliErrorCodes.ConfigInvalid,
545
528
  `Environment '${name}' must use https (got ${parsed.protocol}//${parsed.host}).`
546
529
  );
547
530
  }
@@ -551,14 +534,14 @@ function requireHttpOrigin(name, url) {
551
534
  try {
552
535
  parsed = new URL(url);
553
536
  } catch {
554
- throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${name}' has an invalid URL: ${url}`);
537
+ throw new import_CliError.CliError(import_CliError.CliErrorCodes.ConfigInvalid, `Environment '${name}' has an invalid URL: ${url}`);
555
538
  }
556
539
  const isLocalhost = parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1";
557
540
  const isTestDomain = parsed.hostname.endsWith(".test");
558
541
  const allowedProtocol = parsed.protocol === "https:" || parsed.protocol === "http:" && (isLocalhost || isTestDomain);
559
542
  if (!allowedProtocol || parsed.username || parsed.password || parsed.search || parsed.hash || parsed.pathname !== "/" && parsed.pathname !== "") {
560
- throw new CliError(
561
- CliErrorCodes.ConfigInvalid,
543
+ throw new import_CliError.CliError(
544
+ import_CliError.CliErrorCodes.ConfigInvalid,
562
545
  `Environment '${name}' must be an HTTP(S) origin without credentials, path, query, or fragment.`
563
546
  );
564
547
  }
@@ -570,19 +553,19 @@ function validateEnvironment(env) {
570
553
  ["tokenEndpoint", env.tokenEndpoint]
571
554
  ]) {
572
555
  if (!url) {
573
- throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing ${field}.`);
556
+ throw new import_CliError.CliError(import_CliError.CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing ${field}.`);
574
557
  }
575
558
  requireHttpsOrTest(`${env.name}.${field}`, url);
576
559
  }
577
560
  if (!env.orchestratorUrl) {
578
- throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing orchestratorUrl.`);
561
+ throw new import_CliError.CliError(import_CliError.CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing orchestratorUrl.`);
579
562
  }
580
563
  requireHttpOrigin(`${env.name}.orchestratorUrl`, env.orchestratorUrl);
581
564
  if (!env.clientId) {
582
- throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing clientId.`);
565
+ throw new import_CliError.CliError(import_CliError.CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing clientId.`);
583
566
  }
584
567
  if (!env.redirectPath.startsWith("/")) {
585
- throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' redirectPath must start with '/'.`);
568
+ throw new import_CliError.CliError(import_CliError.CliErrorCodes.ConfigInvalid, `Environment '${env.name}' redirectPath must start with '/'.`);
586
569
  }
587
570
  }
588
571
  var ConfigStore = class {
@@ -607,7 +590,7 @@ var ConfigStore = class {
607
590
  try {
608
591
  raw = JSON.parse((0, import_node_fs.readFileSync)(this.path, "utf8"));
609
592
  } catch {
610
- throw new CliError(CliErrorCodes.ConfigInvalid, `Config file at ${this.path} is not valid JSON.`);
593
+ throw new import_CliError.CliError(import_CliError.CliErrorCodes.ConfigInvalid, `Config file at ${this.path} is not valid JSON.`);
611
594
  }
612
595
  const environments = Object.fromEntries(
613
596
  Object.entries({ ...DEFAULT_ENVIRONMENTS, ...raw.environments ?? {} }).map(([name, env]) => [
@@ -631,24 +614,24 @@ var ConfigStore = class {
631
614
  const config = this.load();
632
615
  const env = config.environments[config.activeEnvironment];
633
616
  if (!env) {
634
- throw new CliError(
635
- CliErrorCodes.EnvironmentNotFound,
617
+ throw new import_CliError.CliError(
618
+ import_CliError.CliErrorCodes.EnvironmentNotFound,
636
619
  `Active environment '${config.activeEnvironment}' is not defined. Run 'xyra env use <name>'.`
637
620
  );
638
621
  }
639
622
  validateEnvironment(env);
640
- if (env.accessPurpose !== void 0 || env.administrationTarget !== void 0) throw new CliError(
641
- CliErrorCodes.ConfigInvalid,
623
+ if (env.accessPurpose !== void 0 || env.administrationTarget !== void 0) throw new import_CliError.CliError(
624
+ import_CliError.CliErrorCodes.ConfigInvalid,
642
625
  "Purpose and selected administration target are invocation-only, not stored environment or actor fields."
643
626
  );
644
627
  const purpose = this.accessPurposeOverride ?? "runtime";
645
628
  if (!["runtime", "administration"].includes(purpose) || purpose === "runtime" && this.administrationTargetOverride !== void 0)
646
- throw new CliError(CliErrorCodes.InvalidArguments, "Select runtime or administration; a maintenance target requires administration purpose.");
629
+ throw new import_CliError.CliError(import_CliError.CliErrorCodes.InvalidArguments, "Select runtime or administration; a maintenance target requires administration purpose.");
647
630
  if (purpose === "runtime") return env;
648
631
  const profile = env.administrationOAuth;
649
632
  if (!profile || !profile.clientId || !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,99}$/.test(profile.clientId) || profile.clientId === env.clientId || env.mcpUrl !== env.oauthResource || !Array.isArray(profile.scopes) || profile.scopes.length > 100 || !profile.scopes.includes("openid") || !profile.scopes.includes("offline_access") || profile.scopes.some((scope) => typeof scope !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(scope)) || !profile.redirectPath || !/^\/callback\/[A-Za-z0-9_-]+$/.test(profile.redirectPath))
650
- throw new CliError(
651
- CliErrorCodes.ConfigInvalid,
633
+ throw new import_CliError.CliError(
634
+ import_CliError.CliErrorCodes.ConfigInvalid,
652
635
  `Environment '${env.name}' needs its registered Xyra-owned public administration CLI profile.`,
653
636
  "Configure administrationOAuth with its separate native client, approved loopback callback path and delegated scopes; do not reuse the runtime or HTTPS connector client."
654
637
  );
@@ -656,18 +639,18 @@ var ConfigStore = class {
656
639
  try {
657
640
  selected = this.administrationTargetOverride === void 0 ? { targetKind: "global-resource", managedProductId: "xyra-ai" } : (0, import_canonical_runtime_json.parseBoundedRuntimeJsonV1)(this.administrationTargetOverride, { maximumBytes: 8192, maximumDepth: 4 });
658
641
  } catch {
659
- throw new CliError(CliErrorCodes.InvalidArguments, "The administration target must be one bounded JSON object without repeated fields.");
642
+ throw new import_CliError.CliError(import_CliError.CliErrorCodes.InvalidArguments, "The administration target must be one bounded JSON object without repeated fields.");
660
643
  }
661
644
  const target = (0, import_xyra_administration.parseXyraAdministrationTargetV1)(selected);
662
- if (!target) throw new CliError(CliErrorCodes.InvalidArguments, "Select one complete global, configuration-owner or customer administration target.");
645
+ if (!target) throw new import_CliError.CliError(import_CliError.CliErrorCodes.InvalidArguments, "Select one complete global, configuration-owner or customer administration target.");
663
646
  return { ...env, clientId: profile.clientId, redirectPath: profile.redirectPath, scopes: [...profile.scopes], accessPurpose: "administration", administrationTarget: target };
664
647
  }
665
648
  useEnvironment(name) {
666
649
  const config = this.load();
667
650
  const env = config.environments[name];
668
651
  if (!env) {
669
- throw new CliError(
670
- CliErrorCodes.EnvironmentNotFound,
652
+ throw new import_CliError.CliError(
653
+ import_CliError.CliErrorCodes.EnvironmentNotFound,
671
654
  `Environment '${name}' is not defined. Known: ${Object.keys(config.environments).join(", ")}.`
672
655
  );
673
656
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../libs/xyra-types/src/xyra-administration.ts", "../../../../libs/xyra-types/src/canonical-runtime-json.ts", "../../src/config/configStore.ts", "../../src/errors/CliError.ts", "../../src/config/environments.ts"],
4
- "sourcesContent": ["/** A requested maintenance target. It is never a runtime identity or an authorization decision. */\nexport type XyraAdministrationTargetV1 =\n | Readonly<{ targetKind: 'global-resource'; managedProductId: 'xyra-ai' }>\n | Readonly<{ targetKind: 'configuration-owner'; configurationTenantId: string; managedProductId: string }>\n | Readonly<{ targetKind: 'customer-resource'; targetTenantId: string; activeProductId: string }>;\n\nexport type XyraAccessPurposeV1 = 'runtime' | 'administration';\nexport type XyraAuthorityDecisionPhaseV1 = 'discovery' | 'execution';\n\nexport type XyraAdministrationRequestV1 = Readonly<{\n operationId: string;\n target: XyraAdministrationTargetV1;\n}>;\n\n/** Auth-resolved relationship facts, without a permission snapshot or runtime licence grant. */\nexport type XyraAdministrationResolvedTargetV1 =\n | Readonly<{ targetKind: 'global-resource'; managedProductId: 'xyra-ai'; relationshipKind: 'global-resource' }>\n | Readonly<{ targetKind: 'configuration-owner' | 'customer-resource'; managedProductId: string;\n relationshipKind: 'native-product-tenant'; activeProductId: 'xyra-ai'; actualTenantId: string;\n licensedProductId: 'xyra-ai'; commercialState: string }>\n | Readonly<{ targetKind: 'configuration-owner' | 'customer-resource'; managedProductId: string;\n relationshipKind: 'embedded-product-entitlement'; activeProductId: string; actualTenantId: string;\n licenseSourceProductId: string; licensedProductId: 'xyra-ai'; licenseOwnerTenantId: string;\n bindingId: string; entitlementId: string; sourceEntitlementId: string; commercialState: string }>;\n\nexport type XyraAdministrationDecisionV1 = Readonly<{\n operationId: string;\n purpose: XyraAuthorityDecisionPhaseV1;\n accessPurpose: 'administration';\n allowed: boolean;\n code: string;\n productId: 'xyra-ai';\n operatorTenantId: string | null;\n targetTenantId: string | null;\n grantId: string | null;\n target: XyraAdministrationTargetV1;\n resolvedTarget: XyraAdministrationResolvedTargetV1 | null;\n}>;\n\n/** Protected execution/approval scope, not a permission grant and never a public argument. */\nexport type XyraAdministrationExecutionScopeV1 = Readonly<{\n accessPurpose: 'administration';\n resourceAudience: string;\n administrationTransport: 'native-http' | 'delegated-oauth';\n actorOperatorTenantId: string | null;\n targetHash: string;\n target: XyraAdministrationTargetV1;\n resolvedTarget: XyraAdministrationResolvedTargetV1;\n}>;\n\nconst identifier = (value: unknown): value is string => typeof value === 'string'\n && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,49}$/.test(value);\nconst guid = (value: unknown): value is string => typeof value === 'string'\n && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(value)\n && value !== '00000000-0000-0000-0000-000000000000';\nconst record = (value: unknown): value is Record<string, unknown> => value !== null\n && typeof value === 'object' && !Array.isArray(value);\nconst exact = (value: Record<string, unknown>, keys: readonly string[]): boolean =>\n Object.keys(value).length === keys.length && keys.every(key => Object.prototype.hasOwnProperty.call(value, key));\n\n/** Strictly parse the closed object shape; raw duplicate JSON keys belong to the transport parser. */\nexport function parseXyraAdministrationTargetV1(value: unknown): XyraAdministrationTargetV1 | null {\n if (!record(value)) return null;\n if (value.targetKind === 'global-resource' && exact(value, ['targetKind', 'managedProductId'])\n && value.managedProductId === 'xyra-ai') {\n return { targetKind: 'global-resource', managedProductId: 'xyra-ai' };\n }\n if (value.targetKind === 'configuration-owner'\n && exact(value, ['targetKind', 'configurationTenantId', 'managedProductId'])\n && identifier(value.configurationTenantId) && identifier(value.managedProductId)) {\n return { targetKind: 'configuration-owner', configurationTenantId: value.configurationTenantId,\n managedProductId: value.managedProductId };\n }\n if (value.targetKind === 'customer-resource'\n && exact(value, ['targetKind', 'targetTenantId', 'activeProductId'])\n && identifier(value.targetTenantId) && identifier(value.activeProductId)) {\n return { targetKind: 'customer-resource', targetTenantId: value.targetTenantId, activeProductId: value.activeProductId };\n }\n return null;\n}\n\n/** Stable exact tuple for cache/request binding, excluding display text and mutable capabilities. */\nexport function xyraAdministrationTargetKeyV1(target: XyraAdministrationTargetV1): string {\n return JSON.stringify(target.targetKind === 'global-resource'\n ? [target.targetKind, target.managedProductId]\n : target.targetKind === 'configuration-owner'\n ? [target.targetKind, target.configurationTenantId, target.managedProductId]\n : [target.targetKind, target.targetTenantId, target.activeProductId]);\n}\n\n/** Validate independent Auth facts against the exact request, never infer a missing relationship. */\nexport function parseXyraAdministrationResolvedTargetV1(\n value: unknown, target: XyraAdministrationTargetV1,\n): XyraAdministrationResolvedTargetV1 | null {\n if (!record(value) || value.targetKind !== target.targetKind) return null;\n const managedProductId = target.targetKind === 'customer-resource' ? 'xyra-ai' : target.managedProductId;\n if (value.managedProductId !== managedProductId) return null;\n if (target.targetKind === 'global-resource') {\n return exact(value, ['targetKind', 'managedProductId', 'relationshipKind']) && value.relationshipKind === 'global-resource'\n ? { targetKind: 'global-resource', managedProductId: 'xyra-ai', relationshipKind: 'global-resource' } : null;\n }\n const base = ['targetKind', 'managedProductId', 'relationshipKind', 'activeProductId', 'actualTenantId', 'licensedProductId', 'commercialState'];\n const embedded = ['licenseSourceProductId', 'licenseOwnerTenantId', 'bindingId', 'entitlementId', 'sourceEntitlementId'];\n const isNative = value.relationshipKind === 'native-product-tenant';\n if ((!isNative && value.relationshipKind !== 'embedded-product-entitlement')\n || !exact(value, isNative ? base : [...base, ...embedded]) || value.licensedProductId !== 'xyra-ai'\n || !base.filter(key => !['targetKind', 'relationshipKind'].includes(key)).every(key => identifier(value[key]))\n || (isNative ? value.activeProductId !== 'xyra-ai' : !embedded.every(key => identifier(value[key])))\n || value.actualTenantId !== (target.targetKind === 'customer-resource' ? target.targetTenantId : target.configurationTenantId)\n || (target.targetKind === 'customer-resource' && value.activeProductId !== target.activeProductId)\n || (target.targetKind === 'configuration-owner' && value.activeProductId !== target.managedProductId)\n || (!isNative && (value.licenseSourceProductId !== value.activeProductId\n || !['bindingId', 'entitlementId', 'sourceEntitlementId'].every(key => guid(value[key]))\n || (target.targetKind === 'configuration-owner' && value.licenseOwnerTenantId !== target.configurationTenantId)))) return null;\n return { ...value } as XyraAdministrationResolvedTargetV1;\n}\n\n/** Parse a decision only for the operation, phase and target that were actually requested. */\nexport function parseXyraAdministrationDecisionV1(value: unknown,\n request: XyraAdministrationRequestV1, purpose: XyraAuthorityDecisionPhaseV1,\n): XyraAdministrationDecisionV1 | null {\n if (!record(value) || !exact(value, ['operationId', 'purpose', 'accessPurpose', 'allowed', 'code', 'productId',\n 'operatorTenantId', 'targetTenantId', 'grantId', 'target', 'resolvedTarget'])\n || value.operationId !== request.operationId || value.purpose !== purpose || value.accessPurpose !== 'administration'\n || value.productId !== 'xyra-ai' || typeof value.allowed !== 'boolean' || typeof value.code !== 'string'\n || !/^[A-Z0-9_.]{1,160}$/.test(value.code)\n || !(value.operatorTenantId === null || identifier(value.operatorTenantId))\n || !(value.grantId === null || guid(value.grantId))) return null;\n const target = parseXyraAdministrationTargetV1(value.target);\n if (!target || xyraAdministrationTargetKeyV1(target) !== xyraAdministrationTargetKeyV1(request.target)\n || value.targetTenantId !== (target.targetKind === 'global-resource' ? null\n : target.targetKind === 'configuration-owner' ? target.configurationTenantId : target.targetTenantId)) return null;\n const resolvedTarget = parseXyraAdministrationResolvedTargetV1(value.resolvedTarget, target);\n if (value.allowed) {\n if (!resolvedTarget || (value.code === 'AUTHORIZATION.ALLOWED.SUPER_USER'\n ? value.operatorTenantId !== null || value.grantId !== null\n : !['AUTHORIZATION.ALLOWED', 'AUTHORIZATION.ALLOWED.LICENSEE'].includes(value.code) || value.operatorTenantId === null || value.grantId === null)) return null;\n if (value.code === 'AUTHORIZATION.ALLOWED.LICENSEE'\n && (target.targetKind === 'global-resource' || resolvedTarget.relationshipKind !== 'embedded-product-entitlement'\n || resolvedTarget.licenseOwnerTenantId !== value.operatorTenantId || resolvedTarget.activeProductId === 'xyra-ai')) return null;\n } else if (value.code.startsWith('AUTHORIZATION.ALLOWED') || value.resolvedTarget !== null) return null;\n return { ...value, target, resolvedTarget } as XyraAdministrationDecisionV1;\n}\n", "export type CanonicalRuntimeJsonFailureReasonV1 =\n | 'cyclic_value'\n | 'non_finite_number'\n | 'non_plain_object'\n | 'sparse_array'\n | 'unsupported_value'\n | 'invalid_unicode'\n | 'symbol_key'\n | 'accessor_property';\n\nexport class CanonicalRuntimeJsonErrorV1 extends TypeError {\n readonly code = 'XYRA.RUNTIME.CANONICAL_JSON_INVALID' as const;\n\n constructor(\n readonly reason: CanonicalRuntimeJsonFailureReasonV1,\n readonly path: string,\n ) {\n super(`Canonical runtime JSON rejected ${reason} at ${path}.`);\n this.name = 'CanonicalRuntimeJsonErrorV1';\n }\n}\n\nfunction invalid(reason: CanonicalRuntimeJsonFailureReasonV1, path: string): never {\n throw new CanonicalRuntimeJsonErrorV1(reason, path);\n}\n\nfunction compareOrdinal(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nfunction objectPath(parent: string, key: string): string {\n return `${parent}[${JSON.stringify(key)}]`;\n}\n\nfunction assertCanonicalString(value: string, path: string): void {\n for (let index = 0; index < value.length; index += 1) {\n const codeUnit = value.charCodeAt(index);\n if (codeUnit === 0) invalid('invalid_unicode', path);\n if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {\n const next = value.charCodeAt(index + 1);\n if (!(next >= 0xdc00 && next <= 0xdfff)) invalid('invalid_unicode', path);\n index += 1;\n } else if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {\n invalid('invalid_unicode', path);\n }\n }\n}\n\nfunction isPlainJsonObject(value: object): value is Record<string, unknown> {\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction canonicalize(\n value: unknown,\n path: string,\n ancestors: Set<object>,\n): null | boolean | number | string | readonly unknown[] | Readonly<Record<string, unknown>> {\n if (value === null || typeof value === 'boolean') return value;\n if (typeof value === 'string') {\n assertCanonicalString(value, path);\n return value;\n }\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) invalid('non_finite_number', path);\n return value;\n }\n if (typeof value !== 'object') invalid('unsupported_value', path);\n if (ancestors.has(value)) invalid('cyclic_value', path);\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n if (Object.getOwnPropertySymbols(value).length > 0) invalid('symbol_key', path);\n const ownKeys = Object.keys(value);\n if (ownKeys.length !== value.length) invalid('sparse_array', path);\n const result: unknown[] = [];\n for (let index = 0; index < value.length; index += 1) {\n if (!Object.prototype.hasOwnProperty.call(value, index)) invalid('sparse_array', `${path}[${index}]`);\n const descriptor = Object.getOwnPropertyDescriptor(value, String(index));\n if (!descriptor || descriptor.get || descriptor.set) invalid('accessor_property', `${path}[${index}]`);\n result.push(canonicalize(descriptor.value, `${path}[${index}]`, ancestors));\n }\n return result;\n }\n if (!isPlainJsonObject(value)) invalid('non_plain_object', path);\n if (Object.getOwnPropertySymbols(value).length > 0) invalid('symbol_key', path);\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(value).sort(compareOrdinal)) {\n assertCanonicalString(key, objectPath(path, key));\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (!descriptor || descriptor.get || descriptor.set) {\n invalid('accessor_property', objectPath(path, key));\n }\n result[key] = canonicalize(descriptor.value, objectPath(path, key), ancestors);\n }\n return result;\n } finally {\n ancestors.delete(value);\n }\n}\n\n/**\n * Canonical compact JSON for executable runtime contracts.\n *\n * This is intentionally different from pretty, newline-terminated signed\n * inventory artifacts. It accepts only ordinary JSON values and preserves\n * array order while sorting object keys by locale-independent ordinal order.\n */\nexport function canonicalRuntimeJsonV1(value: unknown): string {\n return JSON.stringify(canonicalize(value, '$', new Set<object>()));\n}\n\n/** Browser-safe exact UTF-8 bytes for the canonical representation. */\nexport function canonicalRuntimeUtf8BytesV1(value: unknown): Uint8Array {\n return new TextEncoder().encode(canonicalRuntimeJsonV1(value));\n}\n\n/** Browser-safe exact UTF-8 byte length for a string already validated here. */\nexport function canonicalRuntimeUtf8ByteLengthV1(value: unknown): number {\n return canonicalRuntimeUtf8BytesV1(value).byteLength;\n}\n\nexport interface BoundedRuntimeJsonLimitsV1 {\n readonly maximumBytes?: number;\n readonly maximumDepth?: number;\n}\n\nexport class BoundedRuntimeJsonErrorV1 extends SyntaxError {\n constructor(readonly reason: string) {\n super(`Bounded runtime JSON rejected ${reason}.`);\n this.name = 'BoundedRuntimeJsonErrorV1';\n }\n}\n\nconst boundedInvalid = (reason: string): never => { throw new BoundedRuntimeJsonErrorV1(reason); };\n/**\n * Reviewed ceiling for bounded runtime JSON. The default stays one mebibyte so\n * existing callers are unchanged; callers that own a larger reviewed artifact\n * may request up to this ceiling. The measured worst-case evaluation turn\n * evidence is about 1.14 MiB, because a frozen turn carries the exact model\n * input for every stage, including the router's context evidence.\n */\nexport const MAXIMUM_BOUNDED_RUNTIME_JSON_BYTES_V1 = 2_097_152;\nfunction boundedLimits(limits: BoundedRuntimeJsonLimitsV1) {\n const maximumBytes = limits.maximumBytes ?? 1048576;\n const maximumDepth = limits.maximumDepth ?? 16;\n if (!Number.isSafeInteger(maximumBytes) || maximumBytes < 1 || maximumBytes > MAXIMUM_BOUNDED_RUNTIME_JSON_BYTES_V1\n || !Number.isSafeInteger(maximumDepth) || maximumDepth < 1 || maximumDepth > 24) boundedInvalid('limits');\n return { maximumBytes, maximumDepth };\n}\nfunction boundedUnicode(value: string): boolean {\n for (let index = 0; index < value.length; index += 1) {\n const unit = value.charCodeAt(index);\n if (unit >= 0xd800 && unit <= 0xdbff) {\n const next = value.charCodeAt(++index);\n if (!(next >= 0xdc00 && next <= 0xdfff)) return false;\n } else if (unit >= 0xdc00 && unit <= 0xdfff) return false;\n }\n return true;\n}\n\n// One descriptor-based copy owner serves wire JSON and ordinary in-process data.\n// The latter preserves optional undefined values and the evaluation observation\n// limits; it is never used by the wire JSON parser or as canonical JSON evidence.\nfunction copyBoundedRuntimeData(input: unknown, maximumBytes: number, maximumDepth: number, jsonOnly: boolean, preserveKeyOrder = false): unknown {\n let nodes = 0; let characters = 0; const ancestors = new Set<object>();\n function copy(value: unknown, depth: number): unknown {\n if (++nodes > (jsonOnly ? 200000 : 100000) || depth > maximumDepth) boundedInvalid('shape');\n if (value === null || typeof value === 'boolean' || (!jsonOnly && value === undefined)) return value;\n if (typeof value === 'number' && Number.isFinite(value)) return value;\n if (typeof value === 'string') {\n characters += value.length;\n if (jsonOnly ? characters > maximumBytes || !boundedUnicode(value)\n : value.length > 1048576 || characters > 16777216) boundedInvalid('text');\n return value;\n }\n if (!value || typeof value !== 'object' || ancestors.has(value)) boundedInvalid('shape');\n const objectValue = value as object;\n const array = Array.isArray(objectValue); const prototype = Object.getPrototypeOf(objectValue);\n const arrayLength = array ? (objectValue as unknown[]).length : 0;\n if (array ? prototype !== Array.prototype && (jsonOnly || prototype !== null)\n : prototype !== Object.prototype && prototype !== null) boundedInvalid('shape');\n const keys = Reflect.ownKeys(objectValue);\n if (keys.length > 10001 || keys.some(key => typeof key !== 'string')) boundedInvalid('shape');\n if (array && keys.length !== arrayLength + 1) boundedInvalid('array');\n const seen = new Set<string>(); const result: Record<string, unknown> | unknown[] = array ? [] : {};\n ancestors.add(objectValue);\n try {\n for (const key of (jsonOnly || array || preserveKeyOrder ? keys : keys.sort()) as string[]) {\n if (array && key === 'length') continue;\n const descriptor = Object.getOwnPropertyDescriptor(objectValue, key)!;\n if (!descriptor.enumerable || !('value' in descriptor) || key.length > (jsonOnly ? 160 : 256)\n || (jsonOnly && seen.has(key.toLowerCase()))\n || (array && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= arrayLength))) boundedInvalid('shape');\n seen.add(key.toLowerCase());\n Object.defineProperty(result, key, { enumerable: true, writable: true, configurable: true, value: copy(descriptor.value, depth + 1) });\n }\n } finally { ancestors.delete(objectValue); }\n return result;\n }\n return copy(input, 0);\n}\n\n/** Detached in-process values; source order can be retained for existing definition fingerprints. */\nexport function boundedRuntimeDataV1<T>(input: T, preserveKeyOrder = false): T {\n return copyBoundedRuntimeData(input, 16777216, 24, false, preserveKeyOrder) as T;\n}\n\n/** Detached, closed-over-data JSON value with bounded depth, nodes, keys and canonical UTF-8 size. */\nexport function boundedRuntimeJsonDataV1(input: unknown, limits: BoundedRuntimeJsonLimitsV1 = {}): unknown {\n const { maximumBytes, maximumDepth } = boundedLimits(limits);\n const value = copyBoundedRuntimeData(input, maximumBytes, maximumDepth, true);\n if (canonicalRuntimeUtf8ByteLengthV1(value) > maximumBytes) boundedInvalid('bytes');\n return value;\n}\n\n/** Parses already fatal-UTF-8-decoded JSON without duplicate keys or lossy integer conversion. */\nexport function parseBoundedRuntimeJsonV1(source: string, limits: BoundedRuntimeJsonLimitsV1 = {}): unknown {\n const { maximumBytes, maximumDepth } = boundedLimits(limits);\n if (typeof source !== 'string' || source.length > maximumBytes || !boundedUnicode(source)\n || new TextEncoder().encode(source).byteLength > maximumBytes) boundedInvalid('bytes');\n let index = 0; let nodes = 0;\n const whitespace = () => { while (/[\\x20\\t\\r\\n]/.test(source[index] ?? '\\0')) index += 1; };\n function string(): string {\n const start = index;\n if (source[index++] !== '\"') boundedInvalid('string');\n while (index < source.length) {\n const char = source[index++];\n if (char === '\\\\') { index += 1; continue; }\n if (char === '\"') {\n try {\n const parsed = JSON.parse(source.slice(start, index));\n if (!boundedUnicode(parsed)) boundedInvalid('unicode');\n return parsed;\n } catch (error) {\n if (error instanceof BoundedRuntimeJsonErrorV1) throw error;\n boundedInvalid('string');\n }\n }\n }\n return boundedInvalid('string');\n }\n function value(depth: number): void {\n if (++nodes > 200000 || depth > maximumDepth) boundedInvalid('shape');\n whitespace(); const char = source[index];\n if (char === '\"') { string(); return; }\n if (char === '{') {\n index += 1; whitespace(); const seen = new Set<string>();\n if (source[index] === '}') { index += 1; return; }\n for (;;) {\n const item = string().toLowerCase();\n if (seen.has(item)) boundedInvalid('duplicate_key');\n seen.add(item); whitespace();\n if (source[index++] !== ':') boundedInvalid('object');\n value(depth + 1); whitespace();\n const end = source[index++];\n if (end === '}') return;\n if (end !== ',') boundedInvalid('object');\n whitespace();\n }\n }\n if (char === '[') {\n index += 1; whitespace();\n if (source[index] === ']') { index += 1; return; }\n let count = 0;\n for (;;) {\n if (++count > 10000) boundedInvalid('array');\n value(depth + 1); whitespace();\n const end = source[index++];\n if (end === ']') return;\n if (end !== ',') boundedInvalid('array');\n whitespace();\n }\n }\n const token = /^(?:true|false|null|-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)/.exec(source.slice(index));\n if (!token) boundedInvalid('value');\n const tokenText = token![0];\n if (/^-?\\d/.test(tokenText)) {\n const numeric = Number(tokenText);\n if (!Number.isFinite(numeric)) boundedInvalid('number');\n if (Number.isInteger(numeric)) {\n if (!Number.isSafeInteger(numeric)) boundedInvalid('number');\n const parts = /^(-?)(\\d+)(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/.exec(tokenText)!;\n let digits = (parts[2] + (parts[3] ?? '')).replace(/^0+/, '');\n let power = Number(parts[4] ?? 0) - (parts[3]?.length ?? 0);\n if (digits) {\n const trimmed = digits.replace(/0+$/, ''); power += digits.length - trimmed.length; digits = trimmed;\n if (power < 0 || digits.length + power > 16 || Number(digits + '0'.repeat(power)) !== Math.abs(numeric)) boundedInvalid('number');\n }\n }\n }\n index += tokenText.length;\n }\n value(0); whitespace();\n if (index !== source.length) boundedInvalid('trailing');\n try { return boundedRuntimeJsonDataV1(JSON.parse(source), limits); }\n catch (error) {\n if (error instanceof BoundedRuntimeJsonErrorV1) throw error;\n return boundedInvalid('json');\n }\n}\n", "import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport { CliError, CliErrorCodes } from '../errors/CliError';\nimport {parseXyraAdministrationTargetV1} from '@xyra/types/xyra-administration';\nimport {parseBoundedRuntimeJsonV1} from '@xyra/types/canonical-runtime-json';\nimport {\n DEFAULT_ENVIRONMENTS,\n DEFAULT_ENVIRONMENT_NAME,\n XyraEnvironment,\n} from './environments';\n\n/** Non-secret CLI config persisted to disk. Never holds tokens. */\nexport interface CliConfig {\n activeEnvironment: string;\n environments: Record<string, XyraEnvironment>;\n}\n\nconst CONFIG_DIR =\n process.env.XYRA_CLI_CONFIG_DIR ?? join(homedir(), '.config', 'xyra');\nconst CONFIG_PATH = join(CONFIG_DIR, 'config.json');\n\nfunction requireHttpsOrTest(name: string, url: string): void {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${name}' has an invalid URL: ${url}`);\n }\n const isTestDomain = parsed.hostname.endsWith('.test');\n if (parsed.protocol !== 'https:' && !isTestDomain) {\n throw new CliError(\n CliErrorCodes.ConfigInvalid,\n `Environment '${name}' must use https (got ${parsed.protocol}//${parsed.host}).`,\n );\n }\n}\n\nfunction requireHttpOrigin(name: string, url: string): void {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${name}' has an invalid URL: ${url}`);\n }\n const isLocalhost = parsed.hostname === 'localhost' || parsed.hostname === '127.0.0.1';\n const isTestDomain = parsed.hostname.endsWith('.test');\n const allowedProtocol = parsed.protocol === 'https:' || (parsed.protocol === 'http:' && (isLocalhost || isTestDomain));\n if (!allowedProtocol || parsed.username || parsed.password || parsed.search || parsed.hash\n || (parsed.pathname !== '/' && parsed.pathname !== '')) {\n throw new CliError(\n CliErrorCodes.ConfigInvalid,\n `Environment '${name}' must be an HTTP(S) origin without credentials, path, query, or fragment.`,\n );\n }\n}\n\nexport function validateEnvironment(env: XyraEnvironment): void {\n for (const [field, url] of [\n ['mcpUrl', env.mcpUrl],\n ['authorizationEndpoint', env.authorizationEndpoint],\n ['tokenEndpoint', env.tokenEndpoint],\n ] as const) {\n if (!url) {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing ${field}.`);\n }\n requireHttpsOrTest(`${env.name}.${field}`, url);\n }\n if (!env.orchestratorUrl) {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing orchestratorUrl.`);\n }\n requireHttpOrigin(`${env.name}.orchestratorUrl`, env.orchestratorUrl);\n if (!env.clientId) {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing clientId.`);\n }\n if (!env.redirectPath.startsWith('/')) {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' redirectPath must start with '/'.`);\n }\n}\n\nexport class ConfigStore {\n constructor(\n private readonly path: string = CONFIG_PATH,\n private readonly activeEnvironmentOverride?: string,\n private readonly accessPurposeOverride?:string,\n private readonly administrationTargetOverride?:string,\n private readonly sessionNameOverride?:string,\n ) {}\n getSessionName():string|undefined{return this.sessionNameOverride;}\n\n load(): CliConfig {\n if (!existsSync(this.path)) {\n return {\n activeEnvironment: this.activeEnvironmentOverride ?? DEFAULT_ENVIRONMENT_NAME,\n environments: { ...DEFAULT_ENVIRONMENTS },\n };\n }\n let raw: CliConfig;\n try {\n raw = JSON.parse(readFileSync(this.path, 'utf8')) as CliConfig;\n } catch {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Config file at ${this.path} is not valid JSON.`);\n }\n // Merge built-in defaults so new default envs appear without a rewrite,\n // but user-defined overrides win.\n const environments = Object.fromEntries(\n Object.entries({ ...DEFAULT_ENVIRONMENTS, ...(raw.environments ?? {}) })\n .map(([name, env]) => [\n name,\n DEFAULT_ENVIRONMENTS[name] ? { ...DEFAULT_ENVIRONMENTS[name], ...env } : env,\n ]),\n );\n const activeEnvironment = this.activeEnvironmentOverride ?? raw.activeEnvironment ?? DEFAULT_ENVIRONMENT_NAME;\n return { activeEnvironment, environments };\n }\n\n save(config: CliConfig): void {\n mkdirSync(dirname(this.path), { recursive: true });\n writeFileSync(this.path, `${JSON.stringify(config, null, 2)}\\n`, { mode: 0o600 });\n }\n\n listEnvironments(): { name: string; active: boolean }[] {\n const config = this.load();\n return Object.keys(config.environments)\n .sort()\n .map((name) => ({ name, active: name === config.activeEnvironment }));\n }\n\n getActiveEnvironment(): XyraEnvironment {\n const config = this.load();\n const env = config.environments[config.activeEnvironment];\n if (!env) {\n throw new CliError(\n CliErrorCodes.EnvironmentNotFound,\n `Active environment '${config.activeEnvironment}' is not defined. Run 'xyra env use <name>'.`,\n );\n }\n validateEnvironment(env);\n if(env.accessPurpose!==undefined||env.administrationTarget!==undefined)throw new CliError(CliErrorCodes.ConfigInvalid,\n 'Purpose and selected administration target are invocation-only, not stored environment or actor fields.');\n const purpose=this.accessPurposeOverride??'runtime';\n if(!['runtime','administration'].includes(purpose)||(purpose==='runtime'&&this.administrationTargetOverride!==undefined))\n throw new CliError(CliErrorCodes.InvalidArguments,'Select runtime or administration; a maintenance target requires administration purpose.');\n if(purpose==='runtime')return env;\n const profile=env.administrationOAuth;\n if(!profile||!profile.clientId||!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,99}$/.test(profile.clientId)||profile.clientId===env.clientId\n ||env.mcpUrl!==env.oauthResource||!Array.isArray(profile.scopes)||profile.scopes.length>100\n ||!profile.scopes.includes('openid')||!profile.scopes.includes('offline_access')\n ||profile.scopes.some(scope=>typeof scope!=='string'||!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(scope))\n ||!profile.redirectPath||!/^\\/callback\\/[A-Za-z0-9_-]+$/.test(profile.redirectPath))\n throw new CliError(CliErrorCodes.ConfigInvalid,`Environment '${env.name}' needs its registered Xyra-owned public administration CLI profile.`,\n 'Configure administrationOAuth with its separate native client, approved loopback callback path and delegated scopes; do not reuse the runtime or HTTPS connector client.');\n let selected:unknown;\n try{selected=this.administrationTargetOverride===undefined?{targetKind:'global-resource',managedProductId:'xyra-ai'}\n :parseBoundedRuntimeJsonV1(this.administrationTargetOverride,{maximumBytes:8192,maximumDepth:4});}\n catch{throw new CliError(CliErrorCodes.InvalidArguments,'The administration target must be one bounded JSON object without repeated fields.');}\n const target=parseXyraAdministrationTargetV1(selected);\n if(!target)throw new CliError(CliErrorCodes.InvalidArguments,'Select one complete global, configuration-owner or customer administration target.');\n return {...env,clientId:profile.clientId,redirectPath:profile.redirectPath,scopes:[...profile.scopes],accessPurpose:'administration',administrationTarget:target};\n }\n\n useEnvironment(name: string): XyraEnvironment {\n const config = this.load();\n const env = config.environments[name];\n if (!env) {\n throw new CliError(\n CliErrorCodes.EnvironmentNotFound,\n `Environment '${name}' is not defined. Known: ${Object.keys(config.environments).join(', ')}.`,\n );\n }\n validateEnvironment(env);\n config.activeEnvironment = name;\n this.save({ ...config, activeEnvironment: name });\n return env;\n }\n}\n", "/**\n * CliError - explicit, fail-loud CLI error with a stable local code.\n * Local codes are prefixed XYRA.CLI.* so they never collide with canonical\n * server-side Xyra codes (which are preserved verbatim from MCP results).\n */\nexport class CliError extends Error {\n readonly code: string;\n readonly hint?: string;\n readonly httpStatus?: number;\n\n constructor(code: string, message: string, hint?: string, httpStatus?: number) {\n super(message);\n this.name = 'CliError';\n this.code = code;\n this.hint = hint;\n this.httpStatus = httpStatus;\n }\n}\n\nexport const CliErrorCodes = {\n ConfigInvalid: 'XYRA.CLI.CONFIG_INVALID',\n EnvironmentNotFound: 'XYRA.CLI.ENVIRONMENT_NOT_FOUND',\n NotAuthenticated: 'XYRA.CLI.NOT_AUTHENTICATED',\n OAuthStateMismatch: 'XYRA.CLI.OAUTH_STATE_MISMATCH',\n OAuthCallbackError: 'XYRA.CLI.OAUTH_CALLBACK_ERROR',\n TokenStoreUnavailable: 'XYRA.CLI.TOKEN_STORE_UNAVAILABLE',\n TokenExchangeFailed: 'XYRA.CLI.TOKEN_EXCHANGE_FAILED',\n InsufficientScope: 'XYRA.CLI.INSUFFICIENT_SCOPE',\n McpProtocolError: 'XYRA.CLI.MCP_PROTOCOL_ERROR',\n ToolCallFailed: 'XYRA.CLI.TOOL_CALL_FAILED',\n ChatRequestFailed: 'XYRA.CLI.CHAT_REQUEST_FAILED',\n InvalidArguments: 'XYRA.CLI.INVALID_ARGUMENTS',\n ConfirmationRequired: 'XYRA.CLI.CONFIRMATION_REQUIRED',\n AmbiguousAlias: 'XYRA.CLI.AMBIGUOUS_ALIAS',\n} as const;\n", "/**\n * Environment definitions. These are NON-SECRET connection profiles only.\n * Tokens are never stored here (see auth/tokenStore.ts).\n *\n * Defaults are grounded in the CLI spec (verified against Auth/MCP code\n * 2026-07-07): delegated public PKCE client `experiture-xyra-mcp-delegated`,\n * offline_access enabled (migration 20260707013000). Tool access is resolved\n * from the delegated user's real permissions, not a CLI-specific mode scope.\n */\nexport interface XyraEnvironment {\n name: string;\n mcpUrl: string;\n orchestratorUrl: string;\n oauthResource: string;\n authorizationEndpoint: string;\n tokenEndpoint: string;\n clientId: string;\n /** Exact registered loopback callback path (gate G1). Port is dynamic. */\n redirectPath: string;\n /** OIDC/delegated-login scopes. offline_access is required for refresh. */\n scopes: string[];\n /** Separate Xyra-owned public native CLI registration; never the connector or runtime client. */\n administrationOAuth?: {clientId:string;redirectPath:string;scopes:string[]};\n /** Transient purpose and selected resource, never persisted as actor/runtime identity. */\n accessPurpose?:'runtime'|'administration';\n administrationTarget?:import('@xyra/types/xyra-administration').XyraAdministrationTargetV1;\n}\n\nexport const DEFAULT_ENVIRONMENTS: Record<string, XyraEnvironment> = {\n dev: {\n name: 'dev',\n mcpUrl: 'https://mcp.dev.experiture.ai/mcp',\n orchestratorUrl: 'https://orchestrator.dev.experiture.ai',\n oauthResource: 'https://mcp.dev.experiture.ai/mcp',\n authorizationEndpoint: 'https://dev.app.experiture.ai/api/auth/oauth/authorize',\n tokenEndpoint: 'https://dev.app.experiture.ai/api/auth/oauth/token',\n clientId: 'experiture-xyra-mcp-delegated',\n redirectPath: '/callback/QYfSVwRg9okE',\n scopes: ['openid', 'profile', 'email', 'offline_access'],\n },\n staging: {\n name: 'staging',\n mcpUrl: 'https://mcp.staging.experiture.ai/mcp',\n orchestratorUrl: 'https://app.experiture.ai',\n oauthResource: 'https://mcp.staging.experiture.ai/mcp',\n authorizationEndpoint: 'https://app.experiture.ai/api/auth/oauth/authorize',\n tokenEndpoint: 'https://app.experiture.ai/api/auth/oauth/token',\n clientId: 'experiture-xyra-mcp-delegated',\n redirectPath: '/callback/QYfSVwRg9okE',\n scopes: ['openid', 'profile', 'email', 'offline_access'],\n },\n local: {\n name: 'local',\n mcpUrl: 'https://app.experiture.test/mcp',\n orchestratorUrl: 'http://localhost:8000',\n oauthResource: 'https://mcp.dev.experiture.ai/mcp',\n authorizationEndpoint: 'https://app.experiture.test/api/auth/oauth/authorize',\n tokenEndpoint: 'https://app.experiture.test/api/auth/oauth/token',\n clientId: 'experiture-xyra-mcp-delegated',\n redirectPath: '/callback/QYfSVwRg9okE',\n scopes: ['openid', 'profile', 'email', 'offline_access'],\n },\n};\n\nexport const DEFAULT_ENVIRONMENT_NAME = 'dev';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,IAAAA,SAAA,kCAAAC;AAqBA,IAAAD,SAAA,gCAAA;AASA,IAAAA,SAAA,0CAAA;AA2BA,IAAAA,SAAA,oCAAA;AApEA,QAAM,aAAa,CAAC,UAAoC,OAAO,UAAU,YACpE,qCAAqC,KAAK,KAAK;AACpD,QAAM,OAAO,CAAC,UAAoC,OAAO,UAAU,YAC9D,kEAAkE,KAAK,KAAK,KAC5E,UAAU;AACf,QAAM,SAAS,CAAC,UAAqD,UAAU,QAC1E,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACtD,QAAM,QAAQ,CAAC,OAAgC,SAC7C,OAAO,KAAK,KAAK,EAAE,WAAW,KAAK,UAAU,KAAK,MAAM,SAAO,OAAO,UAAU,eAAe,KAAK,OAAO,GAAG,CAAC;AAGjH,aAAgBC,iCAAgC,OAAc;AAC5D,UAAI,CAAC,OAAO,KAAK;AAAG,eAAO;AAC3B,UAAI,MAAM,eAAe,qBAAqB,MAAM,OAAO,CAAC,cAAc,kBAAkB,CAAC,K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O,oBAAoB;AAC3B,SAAK,KAAK,EAAE,GAAG,QAAQ,mBAAmB,KAAK,CAAC;AAChD,WAAO;AAAA,EACT;AACF;",
3
+ "sources": ["../../../../libs/xyra-types/src/xyra-administration.ts", "../../../../libs/xyra-types/src/canonical-runtime-json.ts", "../../src/config/configStore.ts", "../../src/config/environments.ts"],
4
+ "sourcesContent": ["import type { XyraRuntimeIdentityV2 } from './context';\n\n/** A requested maintenance target. It is never a runtime identity or an authorization decision. */\nexport type XyraAdministrationTargetV1 =\n | Readonly<{ targetKind: 'global-resource'; managedProductId: 'xyra-ai' }>\n | Readonly<{ targetKind: 'configuration-owner'; configurationTenantId: string; managedProductId: string }>\n | Readonly<{ targetKind: 'customer-resource'; targetTenantId: string; activeProductId: string }>;\n\n/** Selects a candidate from verified runtime facts. Auth must still admit the exact action. */\nexport function runtimeAdministrationTarget(identity: XyraRuntimeIdentityV2): XyraAdministrationTargetV1 {\n return identity.licenseSourceProductId !== identity.licensedProductId\n && identity.tenantId === identity.licenseOwnerTenantId\n ? { targetKind: 'configuration-owner', configurationTenantId: identity.licenseOwnerTenantId,\n managedProductId: identity.licenseSourceProductId }\n : { targetKind: 'customer-resource', targetTenantId: identity.tenantId, activeProductId: identity.productId };\n}\n\nexport type XyraAccessPurposeV1 = 'runtime' | 'administration';\nexport type XyraAuthorityDecisionPhaseV1 = 'discovery' | 'execution';\nexport type XyraConfigurationAccess = 'read' | 'manage' | 'manage_selection';\n\nexport type XyraAdministrationRequestV1 = Readonly<{\n operationId: string;\n target: XyraAdministrationTargetV1;\n}>;\n\n/** Auth-resolved relationship facts, without a permission snapshot or runtime licence grant. */\nexport type XyraAdministrationResolvedTargetV1 =\n | Readonly<{ targetKind: 'global-resource'; managedProductId: 'xyra-ai'; relationshipKind: 'global-resource' }>\n | Readonly<{ targetKind: 'configuration-owner' | 'customer-resource'; managedProductId: string;\n relationshipKind: 'native-product-tenant'; activeProductId: 'xyra-ai'; actualTenantId: string;\n licensedProductId: 'xyra-ai'; commercialState: string }>\n | Readonly<{ targetKind: 'configuration-owner' | 'customer-resource'; managedProductId: string;\n relationshipKind: 'embedded-product-entitlement'; activeProductId: string; actualTenantId: string;\n licenseSourceProductId: string; licensedProductId: 'xyra-ai'; licenseOwnerTenantId: string;\n bindingId: string; entitlementId: string; sourceEntitlementId: string; commercialState: string }>;\n\nexport type XyraAdministrationDecisionV1 = Readonly<{\n operationId: string;\n purpose: XyraAuthorityDecisionPhaseV1;\n accessPurpose: 'administration';\n allowed: boolean;\n code: string;\n productId: 'xyra-ai';\n operatorTenantId: string | null;\n targetTenantId: string | null;\n grantId: string | null;\n target: XyraAdministrationTargetV1;\n resolvedTarget: XyraAdministrationResolvedTargetV1 | null;\n /** Optional Auth-owned projection requested during a rolling service release. */\n configurationAccess?: XyraConfigurationAccess;\n}>;\n\n/** Protected execution/approval scope, not a permission grant and never a public argument. */\nexport type XyraAdministrationExecutionScopeV1 = Readonly<{\n accessPurpose: 'administration';\n resourceAudience: string;\n administrationTransport: 'native-http' | 'delegated-oauth';\n actorOperatorTenantId: string | null;\n targetHash: string;\n target: XyraAdministrationTargetV1;\n resolvedTarget: XyraAdministrationResolvedTargetV1;\n}>;\n\nconst identifier = (value: unknown): value is string => typeof value === 'string'\n && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,49}$/.test(value);\nconst guid = (value: unknown): value is string => typeof value === 'string'\n && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(value)\n && value !== '00000000-0000-0000-0000-000000000000';\nconst record = (value: unknown): value is Record<string, unknown> => value !== null\n && typeof value === 'object' && !Array.isArray(value);\nconst exact = (value: Record<string, unknown>, keys: readonly string[]): boolean =>\n Object.keys(value).length === keys.length && keys.every(key => Object.prototype.hasOwnProperty.call(value, key));\n\n/** Strictly parse the closed object shape; raw duplicate JSON keys belong to the transport parser. */\nexport function parseXyraAdministrationTargetV1(value: unknown): XyraAdministrationTargetV1 | null {\n if (!record(value)) return null;\n if (value.targetKind === 'global-resource' && exact(value, ['targetKind', 'managedProductId'])\n && value.managedProductId === 'xyra-ai') {\n return { targetKind: 'global-resource', managedProductId: 'xyra-ai' };\n }\n if (value.targetKind === 'configuration-owner'\n && exact(value, ['targetKind', 'configurationTenantId', 'managedProductId'])\n && identifier(value.configurationTenantId) && identifier(value.managedProductId)) {\n return { targetKind: 'configuration-owner', configurationTenantId: value.configurationTenantId,\n managedProductId: value.managedProductId };\n }\n if (value.targetKind === 'customer-resource'\n && exact(value, ['targetKind', 'targetTenantId', 'activeProductId'])\n && identifier(value.targetTenantId) && identifier(value.activeProductId)) {\n return { targetKind: 'customer-resource', targetTenantId: value.targetTenantId, activeProductId: value.activeProductId };\n }\n return null;\n}\n\n/** Stable exact tuple for cache/request binding, excluding display text and mutable capabilities. */\nexport function xyraAdministrationTargetKeyV1(target: XyraAdministrationTargetV1): string {\n return JSON.stringify(target.targetKind === 'global-resource'\n ? [target.targetKind, target.managedProductId]\n : target.targetKind === 'configuration-owner'\n ? [target.targetKind, target.configurationTenantId, target.managedProductId]\n : [target.targetKind, target.targetTenantId, target.activeProductId]);\n}\n\n/** Validate independent Auth facts against the exact request, never infer a missing relationship. */\nexport function parseXyraAdministrationResolvedTargetV1(\n value: unknown, target: XyraAdministrationTargetV1,\n): XyraAdministrationResolvedTargetV1 | null {\n if (!record(value) || value.targetKind !== target.targetKind) return null;\n const managedProductId = target.targetKind === 'customer-resource' ? 'xyra-ai' : target.managedProductId;\n if (value.managedProductId !== managedProductId) return null;\n if (target.targetKind === 'global-resource') {\n return exact(value, ['targetKind', 'managedProductId', 'relationshipKind']) && value.relationshipKind === 'global-resource'\n ? { targetKind: 'global-resource', managedProductId: 'xyra-ai', relationshipKind: 'global-resource' } : null;\n }\n const base = ['targetKind', 'managedProductId', 'relationshipKind', 'activeProductId', 'actualTenantId', 'licensedProductId', 'commercialState'];\n const embedded = ['licenseSourceProductId', 'licenseOwnerTenantId', 'bindingId', 'entitlementId', 'sourceEntitlementId'];\n const isNative = value.relationshipKind === 'native-product-tenant';\n if ((!isNative && value.relationshipKind !== 'embedded-product-entitlement')\n || !exact(value, isNative ? base : [...base, ...embedded]) || value.licensedProductId !== 'xyra-ai'\n || !base.filter(key => !['targetKind', 'relationshipKind'].includes(key)).every(key => identifier(value[key]))\n || (isNative ? value.activeProductId !== 'xyra-ai' : !embedded.every(key => identifier(value[key])))\n || value.actualTenantId !== (target.targetKind === 'customer-resource' ? target.targetTenantId : target.configurationTenantId)\n || (target.targetKind === 'customer-resource' && value.activeProductId !== target.activeProductId)\n || (target.targetKind === 'configuration-owner' && value.activeProductId !== target.managedProductId)\n || (!isNative && (value.activeProductId !== value.licenseSourceProductId && value.activeProductId !== value.licensedProductId\n || !['bindingId', 'entitlementId', 'sourceEntitlementId'].every(key => guid(value[key]))\n || (target.targetKind === 'configuration-owner' && (value.licenseOwnerTenantId !== target.configurationTenantId\n || value.licenseSourceProductId !== target.managedProductId))))) return null;\n return { ...value } as XyraAdministrationResolvedTargetV1;\n}\n\n/** Parse a decision only for the operation, phase and target that were actually requested. */\nexport function parseXyraAdministrationDecisionV1(value: unknown,\n request: XyraAdministrationRequestV1, purpose: XyraAuthorityDecisionPhaseV1,\n): XyraAdministrationDecisionV1 | null {\n if (!record(value) || !exact(value, ['operationId', 'purpose', 'accessPurpose', 'allowed', 'code', 'productId',\n 'operatorTenantId', 'targetTenantId', 'grantId', 'target', 'resolvedTarget',\n ...(Object.prototype.hasOwnProperty.call(value, 'configurationAccess') ? ['configurationAccess'] : [])])\n || (value.configurationAccess !== undefined && !['read', 'manage', 'manage_selection'].includes(String(value.configurationAccess)))\n || value.operationId !== request.operationId || value.purpose !== purpose || value.accessPurpose !== 'administration'\n || value.productId !== 'xyra-ai' || typeof value.allowed !== 'boolean' || typeof value.code !== 'string'\n || !/^[A-Z0-9_.]{1,160}$/.test(value.code)\n || !(value.operatorTenantId === null || identifier(value.operatorTenantId))\n || !(value.grantId === null || guid(value.grantId))) return null;\n const target = parseXyraAdministrationTargetV1(value.target);\n if (!target || xyraAdministrationTargetKeyV1(target) !== xyraAdministrationTargetKeyV1(request.target)\n || value.targetTenantId !== (target.targetKind === 'global-resource' ? null\n : target.targetKind === 'configuration-owner' ? target.configurationTenantId : target.targetTenantId)) return null;\n const resolvedTarget = parseXyraAdministrationResolvedTargetV1(value.resolvedTarget, target);\n if (value.allowed) {\n if (!resolvedTarget) return null;\n if (value.code === 'AUTHORIZATION.ALLOWED.SAME_TENANT') {\n if (target.targetKind !== 'customer-resource' || value.operatorTenantId !== target.targetTenantId\n || value.grantId !== null) return null;\n } else if (value.code === 'AUTHORIZATION.ALLOWED.SUPER_USER'\n ? value.operatorTenantId !== null || value.grantId !== null\n : !['AUTHORIZATION.ALLOWED', 'AUTHORIZATION.ALLOWED.LICENSEE'].includes(value.code) || value.operatorTenantId === null || value.grantId === null) return null;\n if (value.code === 'AUTHORIZATION.ALLOWED.LICENSEE'\n && (target.targetKind === 'global-resource' || resolvedTarget.relationshipKind !== 'embedded-product-entitlement'\n || resolvedTarget.licenseOwnerTenantId !== value.operatorTenantId)) return null;\n } else if (value.code.startsWith('AUTHORIZATION.ALLOWED') || value.resolvedTarget !== null) return null;\n return { ...value, target, resolvedTarget } as XyraAdministrationDecisionV1;\n}\n", "export type CanonicalRuntimeJsonFailureReasonV1 =\n | 'cyclic_value'\n | 'non_finite_number'\n | 'non_plain_object'\n | 'sparse_array'\n | 'unsupported_value'\n | 'invalid_unicode'\n | 'symbol_key'\n | 'accessor_property';\n\nexport class CanonicalRuntimeJsonErrorV1 extends TypeError {\n readonly code = 'XYRA.RUNTIME.CANONICAL_JSON_INVALID' as const;\n\n constructor(\n readonly reason: CanonicalRuntimeJsonFailureReasonV1,\n readonly path: string,\n ) {\n super(`Canonical runtime JSON rejected ${reason} at ${path}.`);\n this.name = 'CanonicalRuntimeJsonErrorV1';\n }\n}\n\nfunction invalid(reason: CanonicalRuntimeJsonFailureReasonV1, path: string): never {\n throw new CanonicalRuntimeJsonErrorV1(reason, path);\n}\n\nfunction compareOrdinal(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nfunction objectPath(parent: string, key: string): string {\n return `${parent}[${JSON.stringify(key)}]`;\n}\n\nfunction assertCanonicalString(value: string, path: string): void {\n for (let index = 0; index < value.length; index += 1) {\n const codeUnit = value.charCodeAt(index);\n if (codeUnit === 0) invalid('invalid_unicode', path);\n if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {\n const next = value.charCodeAt(index + 1);\n if (!(next >= 0xdc00 && next <= 0xdfff)) invalid('invalid_unicode', path);\n index += 1;\n } else if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {\n invalid('invalid_unicode', path);\n }\n }\n}\n\nfunction isPlainJsonObject(value: object): value is Record<string, unknown> {\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction canonicalize(\n value: unknown,\n path: string,\n ancestors: Set<object>,\n): null | boolean | number | string | readonly unknown[] | Readonly<Record<string, unknown>> {\n if (value === null || typeof value === 'boolean') return value;\n if (typeof value === 'string') {\n assertCanonicalString(value, path);\n return value;\n }\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) invalid('non_finite_number', path);\n return value;\n }\n if (typeof value !== 'object') invalid('unsupported_value', path);\n if (ancestors.has(value)) invalid('cyclic_value', path);\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n if (Object.getOwnPropertySymbols(value).length > 0) invalid('symbol_key', path);\n const ownKeys = Object.keys(value);\n if (ownKeys.length !== value.length) invalid('sparse_array', path);\n const result: unknown[] = [];\n for (let index = 0; index < value.length; index += 1) {\n if (!Object.prototype.hasOwnProperty.call(value, index)) invalid('sparse_array', `${path}[${index}]`);\n const descriptor = Object.getOwnPropertyDescriptor(value, String(index));\n if (!descriptor || descriptor.get || descriptor.set) invalid('accessor_property', `${path}[${index}]`);\n result.push(canonicalize(descriptor.value, `${path}[${index}]`, ancestors));\n }\n return result;\n }\n if (!isPlainJsonObject(value)) invalid('non_plain_object', path);\n if (Object.getOwnPropertySymbols(value).length > 0) invalid('symbol_key', path);\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(value).sort(compareOrdinal)) {\n assertCanonicalString(key, objectPath(path, key));\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (!descriptor || descriptor.get || descriptor.set) {\n invalid('accessor_property', objectPath(path, key));\n }\n result[key] = canonicalize(descriptor.value, objectPath(path, key), ancestors);\n }\n return result;\n } finally {\n ancestors.delete(value);\n }\n}\n\n/**\n * Canonical compact JSON for executable runtime contracts.\n *\n * This is intentionally different from pretty, newline-terminated signed\n * inventory artifacts. It accepts only ordinary JSON values and preserves\n * array order while sorting object keys by locale-independent ordinal order.\n */\nexport function canonicalRuntimeJsonV1(value: unknown): string {\n return JSON.stringify(canonicalize(value, '$', new Set<object>()));\n}\n\n/** Browser-safe exact UTF-8 bytes for the canonical representation. */\nexport function canonicalRuntimeUtf8BytesV1(value: unknown): Uint8Array {\n return new TextEncoder().encode(canonicalRuntimeJsonV1(value));\n}\n\n/** Browser-safe exact UTF-8 byte length for a string already validated here. */\nexport function canonicalRuntimeUtf8ByteLengthV1(value: unknown): number {\n return canonicalRuntimeUtf8BytesV1(value).byteLength;\n}\n\nexport interface BoundedRuntimeJsonLimitsV1 {\n readonly maximumBytes?: number;\n readonly maximumDepth?: number;\n}\n\nexport class BoundedRuntimeJsonErrorV1 extends SyntaxError {\n constructor(readonly reason: string) {\n super(`Bounded runtime JSON rejected ${reason}.`);\n this.name = 'BoundedRuntimeJsonErrorV1';\n }\n}\n\nconst boundedInvalid = (reason: string): never => { throw new BoundedRuntimeJsonErrorV1(reason); };\n/**\n * Reviewed ceiling for bounded runtime JSON. The default stays one mebibyte so\n * existing callers are unchanged; callers that own a larger reviewed artifact\n * may request up to this ceiling. The measured worst-case evaluation turn\n * evidence is about 1.14 MiB, because a frozen turn carries the exact model\n * input for every stage, including the router's context evidence.\n */\nexport const MAXIMUM_BOUNDED_RUNTIME_JSON_BYTES_V1 = 2_097_152;\nfunction boundedLimits(limits: BoundedRuntimeJsonLimitsV1) {\n const maximumBytes = limits.maximumBytes ?? 1048576;\n const maximumDepth = limits.maximumDepth ?? 16;\n if (!Number.isSafeInteger(maximumBytes) || maximumBytes < 1 || maximumBytes > MAXIMUM_BOUNDED_RUNTIME_JSON_BYTES_V1\n || !Number.isSafeInteger(maximumDepth) || maximumDepth < 1 || maximumDepth > 24) boundedInvalid('limits');\n return { maximumBytes, maximumDepth };\n}\nfunction boundedUnicode(value: string): boolean {\n for (let index = 0; index < value.length; index += 1) {\n const unit = value.charCodeAt(index);\n if (unit >= 0xd800 && unit <= 0xdbff) {\n const next = value.charCodeAt(++index);\n if (!(next >= 0xdc00 && next <= 0xdfff)) return false;\n } else if (unit >= 0xdc00 && unit <= 0xdfff) return false;\n }\n return true;\n}\n\n// One descriptor-based copy owner serves wire JSON and ordinary in-process data.\n// The latter preserves optional undefined values and the evaluation observation\n// limits; it is never used by the wire JSON parser or as canonical JSON evidence.\nfunction copyBoundedRuntimeData(input: unknown, maximumBytes: number, maximumDepth: number, jsonOnly: boolean, preserveKeyOrder = false): unknown {\n let nodes = 0; let characters = 0; const ancestors = new Set<object>();\n function copy(value: unknown, depth: number): unknown {\n if (++nodes > (jsonOnly ? 200000 : 100000) || depth > maximumDepth) boundedInvalid('shape');\n if (value === null || typeof value === 'boolean' || (!jsonOnly && value === undefined)) return value;\n if (typeof value === 'number' && Number.isFinite(value)) return value;\n if (typeof value === 'string') {\n characters += value.length;\n if (jsonOnly ? characters > maximumBytes || !boundedUnicode(value)\n : value.length > 1048576 || characters > 16777216) boundedInvalid('text');\n return value;\n }\n if (!value || typeof value !== 'object' || ancestors.has(value)) boundedInvalid('shape');\n const objectValue = value as object;\n const array = Array.isArray(objectValue); const prototype = Object.getPrototypeOf(objectValue);\n const arrayLength = array ? (objectValue as unknown[]).length : 0;\n if (array ? prototype !== Array.prototype && (jsonOnly || prototype !== null)\n : prototype !== Object.prototype && prototype !== null) boundedInvalid('shape');\n const keys = Reflect.ownKeys(objectValue);\n if (keys.length > 10001 || keys.some(key => typeof key !== 'string')) boundedInvalid('shape');\n if (array && keys.length !== arrayLength + 1) boundedInvalid('array');\n const seen = new Set<string>(); const result: Record<string, unknown> | unknown[] = array ? [] : {};\n ancestors.add(objectValue);\n try {\n for (const key of (jsonOnly || array || preserveKeyOrder ? keys : keys.sort()) as string[]) {\n if (array && key === 'length') continue;\n const descriptor = Object.getOwnPropertyDescriptor(objectValue, key)!;\n if (!descriptor.enumerable || !('value' in descriptor) || key.length > (jsonOnly ? 160 : 256)\n || (jsonOnly && seen.has(key.toLowerCase()))\n || (array && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= arrayLength))) boundedInvalid('shape');\n seen.add(key.toLowerCase());\n Object.defineProperty(result, key, { enumerable: true, writable: true, configurable: true, value: copy(descriptor.value, depth + 1) });\n }\n } finally { ancestors.delete(objectValue); }\n return result;\n }\n return copy(input, 0);\n}\n\n/** Detached in-process values; source order can be retained for existing definition fingerprints. */\nexport function boundedRuntimeDataV1<T>(input: T, preserveKeyOrder = false): T {\n return copyBoundedRuntimeData(input, 16777216, 24, false, preserveKeyOrder) as T;\n}\n\n/** Detached, closed-over-data JSON value with bounded depth, nodes, keys and canonical UTF-8 size. */\nexport function boundedRuntimeJsonDataV1(input: unknown, limits: BoundedRuntimeJsonLimitsV1 = {}): unknown {\n const { maximumBytes, maximumDepth } = boundedLimits(limits);\n const value = copyBoundedRuntimeData(input, maximumBytes, maximumDepth, true);\n if (canonicalRuntimeUtf8ByteLengthV1(value) > maximumBytes) boundedInvalid('bytes');\n return value;\n}\n\n/** Parses already fatal-UTF-8-decoded JSON without duplicate keys or lossy integer conversion. */\nexport function parseBoundedRuntimeJsonV1(source: string, limits: BoundedRuntimeJsonLimitsV1 = {}): unknown {\n const { maximumBytes, maximumDepth } = boundedLimits(limits);\n if (typeof source !== 'string' || source.length > maximumBytes || !boundedUnicode(source)\n || new TextEncoder().encode(source).byteLength > maximumBytes) boundedInvalid('bytes');\n let index = 0; let nodes = 0;\n const whitespace = () => { while (/[\\x20\\t\\r\\n]/.test(source[index] ?? '\\0')) index += 1; };\n function string(): string {\n const start = index;\n if (source[index++] !== '\"') boundedInvalid('string');\n while (index < source.length) {\n const char = source[index++];\n if (char === '\\\\') { index += 1; continue; }\n if (char === '\"') {\n try {\n const parsed = JSON.parse(source.slice(start, index));\n if (!boundedUnicode(parsed)) boundedInvalid('unicode');\n return parsed;\n } catch (error) {\n if (error instanceof BoundedRuntimeJsonErrorV1) throw error;\n boundedInvalid('string');\n }\n }\n }\n return boundedInvalid('string');\n }\n function value(depth: number): void {\n if (++nodes > 200000 || depth > maximumDepth) boundedInvalid('shape');\n whitespace(); const char = source[index];\n if (char === '\"') { string(); return; }\n if (char === '{') {\n index += 1; whitespace(); const seen = new Set<string>();\n if (source[index] === '}') { index += 1; return; }\n for (;;) {\n const item = string().toLowerCase();\n if (seen.has(item)) boundedInvalid('duplicate_key');\n seen.add(item); whitespace();\n if (source[index++] !== ':') boundedInvalid('object');\n value(depth + 1); whitespace();\n const end = source[index++];\n if (end === '}') return;\n if (end !== ',') boundedInvalid('object');\n whitespace();\n }\n }\n if (char === '[') {\n index += 1; whitespace();\n if (source[index] === ']') { index += 1; return; }\n let count = 0;\n for (;;) {\n if (++count > 10000) boundedInvalid('array');\n value(depth + 1); whitespace();\n const end = source[index++];\n if (end === ']') return;\n if (end !== ',') boundedInvalid('array');\n whitespace();\n }\n }\n const token = /^(?:true|false|null|-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)/.exec(source.slice(index));\n if (!token) boundedInvalid('value');\n const tokenText = token![0];\n if (/^-?\\d/.test(tokenText)) {\n const numeric = Number(tokenText);\n if (!Number.isFinite(numeric)) boundedInvalid('number');\n if (Number.isInteger(numeric)) {\n if (!Number.isSafeInteger(numeric)) boundedInvalid('number');\n const parts = /^(-?)(\\d+)(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/.exec(tokenText)!;\n let digits = (parts[2] + (parts[3] ?? '')).replace(/^0+/, '');\n let power = Number(parts[4] ?? 0) - (parts[3]?.length ?? 0);\n if (digits) {\n const trimmed = digits.replace(/0+$/, ''); power += digits.length - trimmed.length; digits = trimmed;\n if (power < 0 || digits.length + power > 16 || Number(digits + '0'.repeat(power)) !== Math.abs(numeric)) boundedInvalid('number');\n }\n }\n }\n index += tokenText.length;\n }\n value(0); whitespace();\n if (index !== source.length) boundedInvalid('trailing');\n try { return boundedRuntimeJsonDataV1(JSON.parse(source), limits); }\n catch (error) {\n if (error instanceof BoundedRuntimeJsonErrorV1) throw error;\n return boundedInvalid('json');\n }\n}\n", "import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport { CliError, CliErrorCodes } from '../errors/CliError';\nimport {parseXyraAdministrationTargetV1} from '@xyra/types/xyra-administration';\nimport {parseBoundedRuntimeJsonV1} from '@xyra/types/canonical-runtime-json';\nimport {\n DEFAULT_ENVIRONMENTS,\n DEFAULT_ENVIRONMENT_NAME,\n XyraEnvironment,\n} from './environments';\n\n/** Non-secret CLI config persisted to disk. Never holds tokens. */\nexport interface CliConfig {\n activeEnvironment: string;\n environments: Record<string, XyraEnvironment>;\n}\n\nconst CONFIG_DIR =\n process.env.XYRA_CLI_CONFIG_DIR ?? join(homedir(), '.config', 'xyra');\nconst CONFIG_PATH = join(CONFIG_DIR, 'config.json');\n\nfunction requireHttpsOrTest(name: string, url: string): void {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${name}' has an invalid URL: ${url}`);\n }\n const isTestDomain = parsed.hostname.endsWith('.test');\n if (parsed.protocol !== 'https:' && !isTestDomain) {\n throw new CliError(\n CliErrorCodes.ConfigInvalid,\n `Environment '${name}' must use https (got ${parsed.protocol}//${parsed.host}).`,\n );\n }\n}\n\nfunction requireHttpOrigin(name: string, url: string): void {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${name}' has an invalid URL: ${url}`);\n }\n const isLocalhost = parsed.hostname === 'localhost' || parsed.hostname === '127.0.0.1';\n const isTestDomain = parsed.hostname.endsWith('.test');\n const allowedProtocol = parsed.protocol === 'https:' || (parsed.protocol === 'http:' && (isLocalhost || isTestDomain));\n if (!allowedProtocol || parsed.username || parsed.password || parsed.search || parsed.hash\n || (parsed.pathname !== '/' && parsed.pathname !== '')) {\n throw new CliError(\n CliErrorCodes.ConfigInvalid,\n `Environment '${name}' must be an HTTP(S) origin without credentials, path, query, or fragment.`,\n );\n }\n}\n\nexport function validateEnvironment(env: XyraEnvironment): void {\n for (const [field, url] of [\n ['mcpUrl', env.mcpUrl],\n ['authorizationEndpoint', env.authorizationEndpoint],\n ['tokenEndpoint', env.tokenEndpoint],\n ] as const) {\n if (!url) {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing ${field}.`);\n }\n requireHttpsOrTest(`${env.name}.${field}`, url);\n }\n if (!env.orchestratorUrl) {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing orchestratorUrl.`);\n }\n requireHttpOrigin(`${env.name}.orchestratorUrl`, env.orchestratorUrl);\n if (!env.clientId) {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' is missing clientId.`);\n }\n if (!env.redirectPath.startsWith('/')) {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Environment '${env.name}' redirectPath must start with '/'.`);\n }\n}\n\nexport class ConfigStore {\n constructor(\n private readonly path: string = CONFIG_PATH,\n private readonly activeEnvironmentOverride?: string,\n private readonly accessPurposeOverride?:string,\n private readonly administrationTargetOverride?:string,\n private readonly sessionNameOverride?:string,\n ) {}\n getSessionName():string|undefined{return this.sessionNameOverride;}\n\n load(): CliConfig {\n if (!existsSync(this.path)) {\n return {\n activeEnvironment: this.activeEnvironmentOverride ?? DEFAULT_ENVIRONMENT_NAME,\n environments: { ...DEFAULT_ENVIRONMENTS },\n };\n }\n let raw: CliConfig;\n try {\n raw = JSON.parse(readFileSync(this.path, 'utf8')) as CliConfig;\n } catch {\n throw new CliError(CliErrorCodes.ConfigInvalid, `Config file at ${this.path} is not valid JSON.`);\n }\n // Merge built-in defaults so new default envs appear without a rewrite,\n // but user-defined overrides win.\n const environments = Object.fromEntries(\n Object.entries({ ...DEFAULT_ENVIRONMENTS, ...(raw.environments ?? {}) })\n .map(([name, env]) => [\n name,\n DEFAULT_ENVIRONMENTS[name] ? { ...DEFAULT_ENVIRONMENTS[name], ...env } : env,\n ]),\n );\n const activeEnvironment = this.activeEnvironmentOverride ?? raw.activeEnvironment ?? DEFAULT_ENVIRONMENT_NAME;\n return { activeEnvironment, environments };\n }\n\n save(config: CliConfig): void {\n mkdirSync(dirname(this.path), { recursive: true });\n writeFileSync(this.path, `${JSON.stringify(config, null, 2)}\\n`, { mode: 0o600 });\n }\n\n listEnvironments(): { name: string; active: boolean }[] {\n const config = this.load();\n return Object.keys(config.environments)\n .sort()\n .map((name) => ({ name, active: name === config.activeEnvironment }));\n }\n\n getActiveEnvironment(): XyraEnvironment {\n const config = this.load();\n const env = config.environments[config.activeEnvironment];\n if (!env) {\n throw new CliError(\n CliErrorCodes.EnvironmentNotFound,\n `Active environment '${config.activeEnvironment}' is not defined. Run 'xyra env use <name>'.`,\n );\n }\n validateEnvironment(env);\n if(env.accessPurpose!==undefined||env.administrationTarget!==undefined)throw new CliError(CliErrorCodes.ConfigInvalid,\n 'Purpose and selected administration target are invocation-only, not stored environment or actor fields.');\n const purpose=this.accessPurposeOverride??'runtime';\n if(!['runtime','administration'].includes(purpose)||(purpose==='runtime'&&this.administrationTargetOverride!==undefined))\n throw new CliError(CliErrorCodes.InvalidArguments,'Select runtime or administration; a maintenance target requires administration purpose.');\n if(purpose==='runtime')return env;\n const profile=env.administrationOAuth;\n if(!profile||!profile.clientId||!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,99}$/.test(profile.clientId)||profile.clientId===env.clientId\n ||env.mcpUrl!==env.oauthResource||!Array.isArray(profile.scopes)||profile.scopes.length>100\n ||!profile.scopes.includes('openid')||!profile.scopes.includes('offline_access')\n ||profile.scopes.some(scope=>typeof scope!=='string'||!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(scope))\n ||!profile.redirectPath||!/^\\/callback\\/[A-Za-z0-9_-]+$/.test(profile.redirectPath))\n throw new CliError(CliErrorCodes.ConfigInvalid,`Environment '${env.name}' needs its registered Xyra-owned public administration CLI profile.`,\n 'Configure administrationOAuth with its separate native client, approved loopback callback path and delegated scopes; do not reuse the runtime or HTTPS connector client.');\n let selected:unknown;\n try{selected=this.administrationTargetOverride===undefined?{targetKind:'global-resource',managedProductId:'xyra-ai'}\n :parseBoundedRuntimeJsonV1(this.administrationTargetOverride,{maximumBytes:8192,maximumDepth:4});}\n catch{throw new CliError(CliErrorCodes.InvalidArguments,'The administration target must be one bounded JSON object without repeated fields.');}\n const target=parseXyraAdministrationTargetV1(selected);\n if(!target)throw new CliError(CliErrorCodes.InvalidArguments,'Select one complete global, configuration-owner or customer administration target.');\n return {...env,clientId:profile.clientId,redirectPath:profile.redirectPath,scopes:[...profile.scopes],accessPurpose:'administration',administrationTarget:target};\n }\n\n useEnvironment(name: string): XyraEnvironment {\n const config = this.load();\n const env = config.environments[name];\n if (!env) {\n throw new CliError(\n CliErrorCodes.EnvironmentNotFound,\n `Environment '${name}' is not defined. Known: ${Object.keys(config.environments).join(', ')}.`,\n );\n }\n validateEnvironment(env);\n config.activeEnvironment = name;\n this.save({ ...config, activeEnvironment: name });\n return env;\n }\n}\n", "/**\n * Environment definitions. These are NON-SECRET connection profiles only.\n * Tokens are never stored here (see auth/tokenStore.ts).\n *\n * Defaults are grounded in the CLI spec (verified against Auth/MCP code\n * 2026-07-07): delegated public PKCE client `experiture-xyra-mcp-delegated`,\n * offline_access enabled (migration 20260707013000). Tool access is resolved\n * from the delegated user's real permissions, not a CLI-specific mode scope.\n */\nexport interface XyraEnvironment {\n name: string;\n mcpUrl: string;\n orchestratorUrl: string;\n oauthResource: string;\n authorizationEndpoint: string;\n tokenEndpoint: string;\n clientId: string;\n /** Exact registered loopback callback path (gate G1). Port is dynamic. */\n redirectPath: string;\n /** OIDC/delegated-login scopes. offline_access is required for refresh. */\n scopes: string[];\n /** Separate Xyra-owned public native CLI registration; never the connector or runtime client. */\n administrationOAuth?: {clientId:string;redirectPath:string;scopes:string[]};\n /** Transient purpose and selected resource, never persisted as actor/runtime identity. */\n accessPurpose?:'runtime'|'administration';\n administrationTarget?:import('@xyra/types/xyra-administration').XyraAdministrationTargetV1;\n}\n\nexport const DEFAULT_ENVIRONMENTS: Record<string, XyraEnvironment> = {\n dev: {\n name: 'dev',\n mcpUrl: 'https://mcp.dev.experiture.ai/mcp',\n orchestratorUrl: 'https://orchestrator.dev.experiture.ai',\n oauthResource: 'https://mcp.dev.experiture.ai/mcp',\n authorizationEndpoint: 'https://dev.app.experiture.ai/api/auth/oauth/authorize',\n tokenEndpoint: 'https://dev.app.experiture.ai/api/auth/oauth/token',\n clientId: 'experiture-xyra-mcp-delegated',\n redirectPath: '/callback/QYfSVwRg9okE',\n scopes: ['openid', 'profile', 'email', 'offline_access'],\n },\n staging: {\n name: 'staging',\n mcpUrl: 'https://mcp.staging.experiture.ai/mcp',\n orchestratorUrl: 'https://app.experiture.ai',\n oauthResource: 'https://mcp.staging.experiture.ai/mcp',\n authorizationEndpoint: 'https://app.experiture.ai/api/auth/oauth/authorize',\n tokenEndpoint: 'https://app.experiture.ai/api/auth/oauth/token',\n clientId: 'experiture-xyra-mcp-delegated',\n redirectPath: '/callback/QYfSVwRg9okE',\n scopes: ['openid', 'profile', 'email', 'offline_access'],\n },\n local: {\n name: 'local',\n mcpUrl: 'https://app.experiture.test/mcp',\n orchestratorUrl: 'http://localhost:8000',\n oauthResource: 'https://mcp.dev.experiture.ai/mcp',\n authorizationEndpoint: 'https://app.experiture.test/api/auth/oauth/authorize',\n tokenEndpoint: 'https://app.experiture.test/api/auth/oauth/token',\n clientId: 'experiture-xyra-mcp-delegated',\n redirectPath: '/callback/QYfSVwRg9okE',\n scopes: ['openid', 'profile', 'email', 'offline_access'],\n },\n};\n\nexport const DEFAULT_ENVIRONMENT_NAME = 'dev';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAAA,SAAA,8BAAA;AAkEA,IAAAA,SAAA,kCAAAC;AAqBA,IAAAD,SAAA,gCAAA;AASA,IAAAA,SAAA,0CAAA;AA4BA,IAAAA,SAAA,oCAAA;AA5HA,aAAgB,4BAA4B,UAA+B;AACzE,aAAO,SAAS,2BAA2B,SAAS,qBAC/C,SAAS,aAAa,SAAS,uBAChC;QAAE,YAAY;QAAuB,uBAAuB,SAAS;QACnE,kBAAkB,SAAS;MAAsB,IACnD,EAAE,YAAY,qBAAqB,gBAAgB,SAAS,UAAU,iBAAiB,SAAS,UAAS;IAC/G;AAiDA,QAAM,aAAa,CAAC,UAAoC,OAAO,UAAU,YACpE,qCAAqC,KAAK,KAAK;AACpD,QAAM,OAAO,CAAC,UAAoC,OAAO,UAAU,YAC9D,kEAAkE,KAAK,KAAK,KAC5E,UAAU;AACf,QAAM,SAAS,CAAC,UAAqD,UAAU,QAC1E,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACtD,QAAM,QAAQ,CAAC,OAAgC,SAC7C,OAAO,KAAK,KAAK,EAAE,WAAW,KAAK,UAAU,KAAK,MAAM,SAAO,OAAO,UAAU,eAAe,KAAK,OAAO,GAAG,CAAC;AAGjH,aAAgBC,iCAAgC,OAAc;AAC5D,UAAI,CAAC,OAAO,KAAK;AAAG,eAAO;AAC3B,UAAI,MAAM,eAAe,qBAAqB,MAAM,OAAO,CAAC,cAAc,kBAAkB,CAAC,KACxF,MAAM,qBAAqB,WAAW;AACzC,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1", "result"]
7
7
  }
package/dist/index.js CHANGED
@@ -113,16 +113,6 @@ function buildProgram(baseWriter = console_1.defaultWriter) {
113
113
  .option('--locale <locale>', 'Runtime locale: en, fr, or zh-Hans.', 'en')
114
114
  .option('--json', 'Emit JSON.')
115
115
  .action((message, opts) => run(writer, () => (0, chat_1.runChatSend)(selectedConfig(), writer, message, opts)));
116
- chat
117
- .command('attention <action>')
118
- .description('Continue, inspect, or stop a turn that is waiting.')
119
- .option('--conversation <id>', 'Conversation id.')
120
- .option('--request <id>', 'Original client request id.')
121
- .option('--turn <id>', 'Runtime turn id.')
122
- .option('--epoch <epoch>', 'Attention epoch from the waiting status.')
123
- .option('--locale <locale>', 'Runtime locale: en, fr, or zh-Hans.', 'en')
124
- .option('--json', 'Emit JSON.')
125
- .action((action, opts) => run(writer, () => (0, chat_1.runChatAttention)(selectedConfig(), writer, action, opts)));
126
116
  // ---- mcp ----
127
117
  const mcp = program.command('mcp').description('Low-level MCP operations.');
128
118
  mcp