@preplabsai/rovara-code 0.5.12 → 0.5.14

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.
Files changed (2) hide show
  1. package/bin/agentx-cli.mjs +103 -15
  2. package/package.json +1 -1
@@ -25924,6 +25924,9 @@ var init_routes = __esm({
25924
25924
  // DEC 254zzz63: the company's own lessons learning model (read: any member; change: live owner/admin, a Claude model the gateway offers the company now).
25925
25925
  { method: "GET", path: "/v1/dev/company/learning-model", requires: "full" },
25926
25926
  { method: "PUT", path: "/v1/dev/company/learning-model", requires: "full" },
25927
+ // #1613: the caller's own company (read: any member; rename: live owner/admin, written by the sign-in service).
25928
+ { method: "GET", path: "/v1/dev/company/details", requires: "full" },
25929
+ { method: "PUT", path: "/v1/dev/company/details", requires: "full" },
25927
25930
  // L4-EGR: Rovara's fixed outbound addresses (read only; a live owner or admin of the company).
25928
25931
  { method: "GET", path: "/v1/dev/company/egress-addresses", requires: "full" },
25929
25932
  // The CLI's own routes, which no named scope opens.
@@ -77856,6 +77859,26 @@ var init_company_learning_model = __esm({
77856
77859
  }
77857
77860
  });
77858
77861
 
77862
+ // packages/contracts/dist/company-details.js
77863
+ var COMPANY_DETAILS_PATH, CompanyRenameBodySchema, CompanyDetailsViewSchema;
77864
+ var init_company_details = __esm({
77865
+ "packages/contracts/dist/company-details.js"() {
77866
+ "use strict";
77867
+ init_zod();
77868
+ init_company_scope2();
77869
+ init_company_invites();
77870
+ COMPANY_DETAILS_PATH = "/v1/dev/company/details";
77871
+ CompanyRenameBodySchema = external_exports.object({ name: CompanySelfServeNameSchema }).strict();
77872
+ CompanyDetailsViewSchema = external_exports.object({
77873
+ companyId: OrgIdSchema,
77874
+ name: external_exports.string().min(1).max(80).nullable(),
77875
+ role: OrgRoleSchema,
77876
+ members: external_exports.number().int().min(0),
77877
+ membersAtLeast: external_exports.literal(true).optional()
77878
+ }).strict();
77879
+ }
77880
+ });
77881
+
77859
77882
  // packages/contracts/dist/report-keys.js
77860
77883
  function reportPartition(orgId) {
77861
77884
  return orgScoped(OrgIdSchema.parse(orgId), "REPORT");
@@ -78549,6 +78572,7 @@ var init_dist2 = __esm({
78549
78572
  init_agent_model_choice();
78550
78573
  init_company_engine_model();
78551
78574
  init_company_learning_model();
78575
+ init_company_details();
78552
78576
  init_report_keys();
78553
78577
  init_cost_report();
78554
78578
  init_upkeep();
@@ -376659,7 +376683,7 @@ async function readDeveloperConfig(home) {
376659
376683
  }
376660
376684
  const parsed = ConfigSchema.safeParse(document);
376661
376685
  if (!parsed.success) throw agentXError("CONFIG_INVALID", `${developerConfigPath(home)} is invalid; delete it and run agentx login <url> again`);
376662
- return { ...parsed.data.default === void 0 ? {} : { default: parsed.data.default }, environments: parsed.data.environments };
376686
+ return { environments: parsed.data.environments };
376663
376687
  }
376664
376688
  async function write(home, config5) {
376665
376689
  const path6 = developerConfigPath(home);
@@ -376681,27 +376705,29 @@ async function write(home, config5) {
376681
376705
  }
376682
376706
  async function saveDeveloperEnvironment(home, env3, entry) {
376683
376707
  const config5 = await readDeveloperConfig(home);
376684
- await write(home, { default: env3, environments: { ...config5.environments, [env3]: EntrySchema.parse(entry) } });
376708
+ await write(home, { environments: { ...config5.environments, [env3]: EntrySchema.parse(entry) } });
376685
376709
  }
376686
376710
  async function removeDeveloperEnvironment(home, env3) {
376687
376711
  const config5 = await readDeveloperConfig(home);
376688
376712
  const { [env3]: _removed, ...rest } = config5.environments;
376689
- const nextDefault = config5.default === env3 ? Object.keys(rest).sort()[0] : config5.default;
376690
- await write(home, { ...nextDefault === void 0 ? {} : { default: nextDefault }, environments: rest });
376691
- return nextDefault;
376713
+ await write(home, { environments: rest });
376692
376714
  }
376693
376715
  async function forgetDeveloperSignIn(home, env3, tokenStore) {
376694
376716
  const entry = (await readDeveloperConfig(home)).environments[env3];
376695
- if (entry === void 0) return void 0;
376717
+ if (entry === void 0) return false;
376696
376718
  await tokenStore.delete(developerTokenKey(entry.issuer));
376697
- return { default: await removeDeveloperEnvironment(home, env3) };
376719
+ await removeDeveloperEnvironment(home, env3);
376720
+ return true;
376698
376721
  }
376699
376722
  async function resolveDeveloperEnvironment(home, env3) {
376700
376723
  const config5 = await readDeveloperConfig(home);
376701
- const name3 = env3 ?? config5.default;
376702
- const entry = name3 === void 0 ? void 0 : config5.environments[name3];
376703
- if (name3 === void 0 || entry === void 0) {
376704
- throw agentXError("AUTH_REQUIRED", `this computer is not signed in to AgentX${name3 === void 0 ? "" : ` environment ${name3}`}; run npx ${CLI_PACKAGE_NAME} login <your AgentX URL>`);
376724
+ const name3 = env3 ?? DEFAULT_ENVIRONMENT;
376725
+ const entry = config5.environments[name3];
376726
+ if (entry === void 0) {
376727
+ const others = Object.keys(config5.environments).sort();
376728
+ const signIn = `run npx ${CLI_PACKAGE_NAME} login <your AgentX URL>`;
376729
+ const next = others.length === 0 ? signIn : `it is signed in to ${others.join(", ")}: add --env ${others.length === 1 ? others[0] : "<name>"}, or ${signIn}`;
376730
+ throw agentXError("AUTH_REQUIRED", `this computer is not signed in to AgentX environment ${name3}; ${next}`);
376705
376731
  }
376706
376732
  return { env: name3, entry };
376707
376733
  }
@@ -378709,6 +378735,38 @@ function registerSessionCommands(program2, context) {
378709
378735
  session.command("share").description("share a session with a person, a project or the company").argument("<session-id>", "the session's ID").option("--with <who>", "a person's developer ID, project:<name>, or company").option("--level <level>", "view, use or edit").action(async (id12, options, command5) => printResult(command5, await sessionShare(developerSession(), developerEnv(command5), id12, { ...options.with === void 0 ? {} : { with: options.with }, ...options.level === void 0 ? {} : { level: options.level } })));
378710
378736
  }
378711
378737
 
378738
+ // packages/cli/src/company/commands.ts
378739
+ init_dist2();
378740
+ var ROLE_WORDS = { owner: "owner", admin: "administrator", member: "member" };
378741
+ function detailsText(body, renamed) {
378742
+ const members2 = typeof body.members === "number" ? body.members : 0;
378743
+ const count9 = `${members2.toLocaleString("en-US")}${body.membersAtLeast === true ? "+" : ""} ${members2 === 1 && body.membersAtLeast !== true ? "member" : "members"}`;
378744
+ const name3 = body.name === null || body.name === void 0 ? "(no name)" : str(body.name);
378745
+ return [
378746
+ ...renamed ? [`Renamed your company to ${name3}.`] : [],
378747
+ `Company: ${name3}`,
378748
+ ` ID: ${str(body.companyId)}`,
378749
+ ` Your role: ${ROLE_WORDS[String(body.role)] ?? str(body.role)}`,
378750
+ ` Members: ${count9}`
378751
+ ].join("\n") + "\n";
378752
+ }
378753
+ async function companyShow(deps, env3) {
378754
+ const answer2 = await appRequest(deps, env3, COMPANY_DETAILS_PATH);
378755
+ return result(answer2, answer2.body, detailsText(answer2.body, false));
378756
+ }
378757
+ async function companyRename(deps, env3, name3) {
378758
+ const body = CompanyRenameBodySchema.safeParse({ name: name3 });
378759
+ if (!body.success) throw agentXError("CONFIG_INVALID", "give the company's new name: 1 to 80 characters, with no control characters");
378760
+ const answer2 = await appRequest(deps, env3, COMPANY_DETAILS_PATH, { method: "PUT", body: body.data });
378761
+ return result(answer2, answer2.body, detailsText(answer2.body, true));
378762
+ }
378763
+ function registerCompanyCommands(program2, context) {
378764
+ const print = (command5, answer2) => context.write(context.globalOptions(command5).json ? formatSuccess({ env: answer2.env, url: answer2.url, ...answer2.data }, true) : answer2.text);
378765
+ const company = program2.command("company").description("your company on this Rovara: its name, ID, your role and how many members it has");
378766
+ company.command("show").description("show your company's name, ID, your role in it and how many members it has").action(async (_options, command5) => print(command5, await companyShow(context.developerSession(), context.developerEnv(command5))));
378767
+ company.command("rename").description("give your company a new name (a company owner or administrator only)").argument("<name>", "the new name, 1 to 80 characters").action(async (name3, _options, command5) => print(command5, await companyRename(context.developerSession(), context.developerEnv(command5), name3)));
378768
+ }
378769
+
378712
378770
  // packages/cli/src/admin/workspaces.ts
378713
378771
  init_dist2();
378714
378772
  async function listAdminWorkspaces(input2, fetchImplementation = fetch) {
@@ -384966,7 +385024,7 @@ init_dist2();
384966
385024
  import { realpathSync } from "node:fs";
384967
385025
 
384968
385026
  // packages/cli/src/version.ts
384969
- var RELEASE_VERSION = true ? "0.5.12" : void 0;
385027
+ var RELEASE_VERSION = true ? "0.5.14" : void 0;
384970
385028
  var CLI_VERSION = RELEASE_VERSION ?? "0.1.0";
384971
385029
  function isPrereleaseVersion(version3) {
384972
385030
  return /^\d+\.\d+\.\d+-/.test(version3);
@@ -391529,6 +391587,32 @@ var CompanySignInStore = class {
391529
391587
  { Put: { TableName: this.input.tableName, Item: { ...preapprovalKey(companyId, email4), ...approval }, ConditionExpression: "attribute_not_exists(pk)" } }
391530
391588
  ]);
391531
391589
  }
391590
+ /**
391591
+ * #1613: the company's new name. The actor (the broker pins the caller's live membership) is checked now and again inside the write (a live owner or admin of this company);
391592
+ * the record changes only while it is still the active company with the name read here. The company log row names the actor, never the names. A direct operator invoke names no actor.
391593
+ */
391594
+ async rename(companyId, name3, createdBy) {
391595
+ if (!OrgIdSchema.safeParse(companyId).success || companyId === IMPLICIT_COMPANY_ID)
391596
+ return "not_found";
391597
+ const found = CompanyRecord.safeParse(await this.read(companyKey(companyId)));
391598
+ if (!found.success || found.data.companyId !== companyId)
391599
+ return "not_found";
391600
+ await this.checkActor(companyId, createdBy);
391601
+ if (found.data.name === name3)
391602
+ return "unchanged";
391603
+ await this.operatorWrite(companyId, "company-rename", [
391604
+ { Update: {
391605
+ TableName: this.input.tableName,
391606
+ Key: companyKey(companyId),
391607
+ UpdateExpression: "SET #name = :name",
391608
+ ConditionExpression: "#entity = :entity AND companyId = :company AND #status = :active AND #name = :previous",
391609
+ ExpressionAttributeNames: { "#name": "name", "#entity": "entityType", "#status": "status" },
391610
+ ExpressionAttributeValues: { ":name": name3, ":previous": found.data.name, ":entity": "COMPANY", ":company": companyId, ":active": "active" }
391611
+ } },
391612
+ ...createdBy === void 0 ? [] : [this.liveMemberCheck(companyId, createdBy, false)]
391613
+ ], createdBy);
391614
+ return "changed";
391615
+ }
391532
391616
  approval(role, hours, createdBy) {
391533
391617
  return CompanyPreapproval.parse({ entityType: "COMPANY_PREAPPROVAL", role, status: "live", expiresAt: this.seconds() + CompanyExpiryHours.parse(hours) * 3600, createdAt: this.iso(), createdBy });
391534
391618
  }
@@ -408565,9 +408649,8 @@ async function runDestroy(options, deps) {
408565
408649
  if (settings !== void 0) await deps.tokenStore.delete(tokenStoreKey({ issuer: settings.identity.issuer, clientId: settings.identity.clientId, audience: settings.identity.audience }));
408566
408650
  result4.localFiles = localFiles;
408567
408651
  try {
408568
- const forgotten = await forgetDeveloperSignIn(deps.home, env3, deps.tokenStore);
408569
- if (forgotten !== void 0) {
408570
- deps.write(`Removed this computer's developer sign-in for ${env3}; ${forgotten.default === void 0 ? "no developer environment is the default now" : `the default developer environment is now ${forgotten.default}`}.`);
408652
+ if (await forgetDeveloperSignIn(deps.home, env3, deps.tokenStore)) {
408653
+ deps.write(`Removed this computer's developer sign-in for ${env3}.`);
408571
408654
  }
408572
408655
  } catch (error64) {
408573
408656
  deps.write(`Could not remove this computer's developer sign-in for ${env3}: ${error64 instanceof Error ? plainMessage(error64) : String(error64)}`);
@@ -412339,6 +412422,10 @@ ${ROOT_HELP_DOCS_LINES.join("\n")}`);
412339
412422
  });
412340
412423
  const projects = await fetchDeveloperProjects(developerSession(), result4.env);
412341
412424
  services.stdout.write(globals.json ? formatSuccess({ env: projects.env, url: projects.url, ...projects.projects }, true) : whoamiText(projects));
412425
+ if (result4.env !== DEFAULT_ENVIRONMENT) {
412426
+ services.stderr.write(`Commands without --env still use ${DEFAULT_ENVIRONMENT}; add --env ${result4.env} to use ${result4.env}.
412427
+ `);
412428
+ }
412342
412429
  return;
412343
412430
  }
412344
412431
  const settings = await deploymentSettings(globals);
@@ -413113,6 +413200,7 @@ Next: have your platform team run ${result4.dir}/deploy-access.sh (see ${result4
413113
413200
  return stored === void 0 ? void 0 : { env: name3, expiresAt: stored.expiresAt };
413114
413201
  };
413115
413202
  registerSessionCommands(program2, { developerSession, developerEnv, globalOptions: globalOptions2, write: (text16) => services.stdout.write(text16) });
413203
+ registerCompanyCommands(program2, { developerSession, developerEnv, globalOptions: globalOptions2, write: (text16) => services.stdout.write(text16) });
413116
413204
  registerRecordCommands(program2, { write: (text16) => services.stdout.write(text16), json: (command5) => globalOptions2(command5).json, version: CLI_VERSION, ...dependencies.record ?? {} });
413117
413205
  const mcp2 = program2.command("mcp").description("run the AgentX MCP server for your AI tool (stdio); add it with agentx mcp install").action(async (_options, command5) => {
413118
413206
  const env3 = developerEnv(command5);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preplabsai/rovara-code",
3
- "version": "0.5.12",
3
+ "version": "0.5.14",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "rovara": "bin/agentx.mjs",