@oxagen/cli 5.5.1-126 → 5.5.1-155

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/oxagen.mjs +517 -18
  2. package/package.json +1 -1
package/oxagen.mjs CHANGED
@@ -23958,6 +23958,9 @@ async function readAgentDir(path2, guard) {
23958
23958
  try {
23959
23959
  const st = await handle.stat();
23960
23960
  if (!st.isDirectory() || st.uid !== guard.allowedOwner) throw refused(path2);
23961
+ const named2 = await fsp.lstat(path2);
23962
+ if (named2.isSymbolicLink() || named2.dev !== st.dev || named2.ino !== st.ino)
23963
+ throw refused(path2);
23961
23964
  try {
23962
23965
  return await fsp.readdir(`/proc/self/fd/${String(handle.fd)}`);
23963
23966
  } catch (error2) {
@@ -29150,13 +29153,13 @@ function claudeManagedSettingsPath(platform2 = process.platform) {
29150
29153
  return "C:\\Program Files\\ClaudeCode\\managed-settings.json";
29151
29154
  return "/etc/claude-code/managed-settings.json";
29152
29155
  }
29153
- function stellaManagedSettingsPath(platform2 = process.platform, env = process.env) {
29156
+ function stellaManagedSettingsPath(platform2 = process.platform, env = process.env, exists = existsSync8) {
29154
29157
  const named2 = env["STELLA_MANAGED_SETTINGS"];
29155
29158
  if (named2 !== void 0 && named2.length > 0) return named2;
29156
29159
  const dir = platform2 === "darwin" ? "/Library/Application Support/stella" : "/etc/stella";
29157
29160
  const toml = join18(dir, "stella.toml");
29158
29161
  const json2 = join18(dir, "settings.json");
29159
- return !existsSync8(toml) && existsSync8(json2) ? json2 : toml;
29162
+ return !exists(toml) && exists(json2) ? json2 : toml;
29160
29163
  }
29161
29164
  function managedShadow(harness, managedFile, expected) {
29162
29165
  try {
@@ -32031,7 +32034,7 @@ import { readFileSync as readFileSync11 } from "node:fs";
32031
32034
  import { dirname as dirname14, resolve as resolve3 } from "node:path";
32032
32035
  import { fileURLToPath } from "node:url";
32033
32036
  function readVersion() {
32034
- if (true) return "5.5.1-126";
32037
+ if (true) return "5.5.1-155";
32035
32038
  try {
32036
32039
  const here = dirname14(fileURLToPath(import.meta.url));
32037
32040
  const pkg = JSON.parse(
@@ -32345,8 +32348,8 @@ function cursorFacts(exec4, platform2 = process.platform, env = process.env, hom
32345
32348
  }
32346
32349
  return found;
32347
32350
  }
32348
- function claudeFacts(exec4, platform2 = process.platform, env = process.env, home) {
32349
- return harnessFacts(exec4, "claude", platform2, env, home);
32351
+ function claudeFacts(exec4, platform2 = process.platform, env = process.env, home, exists) {
32352
+ return harnessFacts(exec4, "claude", platform2, env, home, exists);
32350
32353
  }
32351
32354
  function settleOrThrow(harnessFiles) {
32352
32355
  const outcomes = harnessFiles.settle();
@@ -78057,7 +78060,7 @@ var init_package = __esm({
78057
78060
  "package.json"() {
78058
78061
  package_default = {
78059
78062
  name: "@oxagen/cli",
78060
- version: "5.5.1-126",
78063
+ version: "5.5.1-155",
78061
78064
  description: "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
78062
78065
  type: "module",
78063
78066
  main: "./dist/index.js",
@@ -92835,11 +92838,14 @@ var init_work_order_shared = __esm({
92835
92838
  WORK_ACTION_CLOSE_RESOLUTIONS = [
92836
92839
  "cancelled",
92837
92840
  "declined",
92838
- "duplicate"
92841
+ "duplicate",
92842
+ "stale",
92843
+ "addressed"
92839
92844
  ];
92840
92845
  WORK_CLOSURE_RESOLUTIONS = [
92841
92846
  ...WORK_ACTION_CLOSE_RESOLUTIONS,
92842
- "source_closed"
92847
+ "source_closed",
92848
+ "source_gone"
92843
92849
  ];
92844
92850
  workItemAfterSchema = external_exports.object({
92845
92851
  id: workItemIdSchema,
@@ -93846,6 +93852,291 @@ var init_sandbox_runtime = __esm({
93846
93852
  }
93847
93853
  });
93848
93854
 
93855
+ // ../../packages/oxagen/src/contracts/removal.shared.ts
93856
+ function uniqueRemovalItems(items) {
93857
+ const seen = new Set(items.map((item) => `${item.type}\0${item.id}`));
93858
+ return seen.size === items.length;
93859
+ }
93860
+ function removalResultSchema(type) {
93861
+ return external_exports.object({
93862
+ type,
93863
+ id: removalIdSchema,
93864
+ outcome: removalOutcomeSchema,
93865
+ /** Set when the item rides the call's steering pull request. */
93866
+ pull_request: removalPullRequestSchema.nullable(),
93867
+ /** Set when the outcome is `refused`. */
93868
+ refusal: removalRefusalSchema.nullable()
93869
+ }).strict();
93870
+ }
93871
+ var REMOVAL_BULK_MAX, REMOVAL_OUTCOMES, removalOutcomeSchema, removalRefusalSchema, removalPullRequestSchema, removalIdSchema;
93872
+ var init_removal_shared = __esm({
93873
+ "../../packages/oxagen/src/contracts/removal.shared.ts"() {
93874
+ "use strict";
93875
+ init_zod();
93876
+ REMOVAL_BULK_MAX = 100;
93877
+ REMOVAL_OUTCOMES = [
93878
+ "removed",
93879
+ "retired",
93880
+ "merged",
93881
+ "awaiting_review",
93882
+ "refused"
93883
+ ];
93884
+ removalOutcomeSchema = external_exports.enum(REMOVAL_OUTCOMES);
93885
+ removalRefusalSchema = external_exports.object({
93886
+ /** A stable code, such as `runtime_has_agents` or `not_found`. */
93887
+ reason: external_exports.string().min(1).max(128),
93888
+ /** One sentence a person can act on. */
93889
+ message: external_exports.string().min(1).max(2e3)
93890
+ }).strict();
93891
+ removalPullRequestSchema = external_exports.object({
93892
+ /** The proposal row's public id, which `merge_steering_pr` takes. */
93893
+ proposal_id: external_exports.string().min(1),
93894
+ number: external_exports.number().int().positive(),
93895
+ url: external_exports.string().url(),
93896
+ /** True when Oxagen merged it in solo mode. */
93897
+ merged: external_exports.boolean()
93898
+ }).strict();
93899
+ removalIdSchema = external_exports.string().trim().min(1).max(256);
93900
+ }
93901
+ });
93902
+
93903
+ // ../../packages/oxagen/src/contracts/equipment.delete.ts
93904
+ var EQUIPMENT_REMOVAL_TYPES, equipmentRemovalTypeSchema, equipmentDelete;
93905
+ var init_equipment_delete = __esm({
93906
+ "../../packages/oxagen/src/contracts/equipment.delete.ts"() {
93907
+ "use strict";
93908
+ init_zod();
93909
+ init_registry4();
93910
+ init_removal_shared();
93911
+ EQUIPMENT_REMOVAL_TYPES = [
93912
+ "agent",
93913
+ "runtime",
93914
+ "mcp",
93915
+ "toolbelt",
93916
+ "skill",
93917
+ "steering"
93918
+ ];
93919
+ equipmentRemovalTypeSchema = external_exports.enum(EQUIPMENT_REMOVAL_TYPES);
93920
+ equipmentDelete = registerCapability({
93921
+ name: "delete_equipment",
93922
+ domain: "equipment",
93923
+ description: "Delete one or up to 100 agents, runtimes, MCP servers, toolbelts, skills or steering records. A record a run or the audit trail names is kept and hidden. Records tracked in the steering repo leave through one steering pull request, merged at once in solo mode and left for review in team mode.",
93924
+ mode: "sync",
93925
+ surfaces: ["api", "mcp", "cli", "agent"],
93926
+ // stella calls it on the agent surface, and the whole list waits for one
93927
+ // confirmation from the person.
93928
+ agent: { requiresApproval: true, riskLevel: "high", category: "write" },
93929
+ layers: ["schema", "api", "mcp", "cli", "unit", "docs", "app"],
93930
+ scoped: true,
93931
+ noBillingGate: true,
93932
+ sensitivity: "high",
93933
+ mutates: true,
93934
+ defaultEffect: "deny",
93935
+ // Each item also runs its own type's role check, so a role that may call
93936
+ // this capability deletes only the types its roles may delete.
93937
+ defaultRoles: {
93938
+ org: { Owner: "allow" },
93939
+ workspace: { Admin: "allow", Member: "allow" }
93940
+ },
93941
+ input: external_exports.object({
93942
+ items: external_exports.array(
93943
+ external_exports.object({
93944
+ type: equipmentRemovalTypeSchema,
93945
+ /**
93946
+ * The record's id as Equipment lists it: an agent's `agt_…` id
93947
+ * or slug, a runtime's id, an MCP server's id, a toolbelt's
93948
+ * `tbt_…` id, or a skill's or steering record's record ID.
93949
+ */
93950
+ id: removalIdSchema
93951
+ }).strict()
93952
+ ).min(1).max(REMOVAL_BULK_MAX).refine(uniqueRemovalItems, { message: "Name each record once." }),
93953
+ /** Why, recorded on the retirements and the pull request. */
93954
+ reason: external_exports.string().trim().min(1).max(512).optional()
93955
+ }).strict(),
93956
+ output: external_exports.object({
93957
+ items: external_exports.array(removalResultSchema(equipmentRemovalTypeSchema)),
93958
+ /** The steering pull request, when an item is tracked in the repo. */
93959
+ pull_request: removalPullRequestSchema.nullable()
93960
+ }).strict()
93961
+ });
93962
+ }
93963
+ });
93964
+
93965
+ // ../../packages/oxagen/src/contracts/guardrails.delete.ts
93966
+ var GUARDRAIL_REMOVAL_TYPES, guardrailRemovalTypeSchema, guardrailsDelete;
93967
+ var init_guardrails_delete = __esm({
93968
+ "../../packages/oxagen/src/contracts/guardrails.delete.ts"() {
93969
+ "use strict";
93970
+ init_zod();
93971
+ init_registry4();
93972
+ init_removal_shared();
93973
+ GUARDRAIL_REMOVAL_TYPES = [
93974
+ "approval_rule",
93975
+ "kill_switch",
93976
+ "mandate",
93977
+ "spend_budget"
93978
+ ];
93979
+ guardrailRemovalTypeSchema = external_exports.enum(GUARDRAIL_REMOVAL_TYPES);
93980
+ guardrailsDelete = registerCapability({
93981
+ name: "delete_guardrails",
93982
+ domain: "guardrails",
93983
+ description: "Delete one or up to 100 auto-approval rules, off switches, mandates or spend budgets. Each stops applying at once and leaves its list, and every one is kept marked deleted so the runs and approvals that name it still resolve it.",
93984
+ mode: "sync",
93985
+ surfaces: ["api", "mcp", "cli", "agent"],
93986
+ agent: { requiresApproval: true, riskLevel: "high", category: "write" },
93987
+ layers: ["schema", "api", "mcp", "cli", "unit", "docs", "app"],
93988
+ scoped: true,
93989
+ noBillingGate: true,
93990
+ sensitivity: "high",
93991
+ mutates: true,
93992
+ defaultEffect: "deny",
93993
+ // Each item also runs its own type's role check. Compliance and Billing
93994
+ // may call it because a spend budget's own delete admits them, and every
93995
+ // other type's check refuses them.
93996
+ defaultRoles: {
93997
+ org: { Owner: "allow", ComplianceBilling: "allow" },
93998
+ workspace: { Admin: "allow" }
93999
+ },
94000
+ input: external_exports.object({
94001
+ items: external_exports.array(
94002
+ external_exports.object({
94003
+ type: guardrailRemovalTypeSchema,
94004
+ /**
94005
+ * The record's id as Guardrails lists it: a rule id, an off
94006
+ * switch's `emd_…` id, a mandate id or a budget's `bdg_…` id.
94007
+ */
94008
+ id: removalIdSchema
94009
+ }).strict()
94010
+ ).min(1).max(REMOVAL_BULK_MAX).refine(uniqueRemovalItems, { message: "Name each record once." }),
94011
+ /** Why. A mandate revoke and a cleared off switch record it. */
94012
+ reason: external_exports.string().trim().min(1).max(512).optional()
94013
+ }).strict(),
94014
+ output: external_exports.object({
94015
+ items: external_exports.array(removalResultSchema(guardrailRemovalTypeSchema))
94016
+ }).strict()
94017
+ });
94018
+ }
94019
+ });
94020
+
94021
+ // src/commands/removal.ts
94022
+ var removal_exports = {};
94023
+ __export(removal_exports, {
94024
+ describePullRequest: () => describePullRequest,
94025
+ describeRemoval: () => describeRemoval,
94026
+ equipmentRemove: () => equipmentRemove,
94027
+ guardrailsRemove: () => guardrailsRemove,
94028
+ parseRemovalItems: () => parseRemovalItems
94029
+ });
94030
+ function parseRemovalItems(args, types, out) {
94031
+ if (args.length === 0) {
94032
+ out.error("Name at least one record as <type>:<id>.", "usage");
94033
+ return void 0;
94034
+ }
94035
+ if (args.length > REMOVAL_BULK_MAX) {
94036
+ out.error(
94037
+ `One call deletes at most ${REMOVAL_BULK_MAX} records. You named ${args.length}.`,
94038
+ "usage"
94039
+ );
94040
+ return void 0;
94041
+ }
94042
+ const items = [];
94043
+ const seen = /* @__PURE__ */ new Set();
94044
+ for (const arg of args) {
94045
+ const colon = arg.indexOf(":");
94046
+ const type = colon === -1 ? "" : arg.slice(0, colon);
94047
+ const id2 = colon === -1 ? "" : arg.slice(colon + 1).trim();
94048
+ if (!types.includes(type) || id2 === "") {
94049
+ out.error(
94050
+ `Name each record as <type>:<id>, where the type is one of ${types.join(", ")}. "${arg}" is not one.`,
94051
+ "usage"
94052
+ );
94053
+ return void 0;
94054
+ }
94055
+ const key = `${type}:${id2}`;
94056
+ if (seen.has(key)) {
94057
+ out.error(`"${key}" is named twice. Name each record once.`, "usage");
94058
+ return void 0;
94059
+ }
94060
+ seen.add(key);
94061
+ items.push({ type, id: id2 });
94062
+ }
94063
+ return items;
94064
+ }
94065
+ function pullRequestLabel(pr) {
94066
+ return `pull request #${pr.number}`;
94067
+ }
94068
+ function describeRemoval(item) {
94069
+ const name2 = `${item.type} ${item.id}`;
94070
+ switch (item.outcome) {
94071
+ case "removed":
94072
+ return `${name2}: deleted`;
94073
+ case "retired":
94074
+ return `${name2}: deleted, and kept for the runs that name it`;
94075
+ case "merged":
94076
+ return item.pull_request ? `${name2}: deleted by ${pullRequestLabel(item.pull_request)}, merged` : `${name2}: deleted by the steering pull request, merged`;
94077
+ case "awaiting_review":
94078
+ return item.pull_request ? `${name2}: waits for review on ${pullRequestLabel(item.pull_request)}` : `${name2}: waits for review on the steering pull request`;
94079
+ case "refused":
94080
+ return `${name2}: refused. ${item.refusal?.message ?? "The server gave no reason."}`;
94081
+ }
94082
+ }
94083
+ function describePullRequest(pr) {
94084
+ return pr.merged ? `Merged steering ${pullRequestLabel(pr)}: ${pr.url}` : `Steering ${pullRequestLabel(pr)} waits for a reviewer: ${pr.url}`;
94085
+ }
94086
+ async function runRemoval(path2, args, types, opts, writer) {
94087
+ const out = createOutput({ json: opts.json }, writer);
94088
+ const items = parseRemovalItems(args, types, out);
94089
+ if (!items) return;
94090
+ const scope = scopeOrRefuse(opts.workspaceSlug, out);
94091
+ if (!scope) return;
94092
+ const body2 = opts.reason ? { items, reason: opts.reason } : { items };
94093
+ let answer;
94094
+ try {
94095
+ answer = await apiPostOrThrow(path2, body2, scope);
94096
+ } catch (err2) {
94097
+ const refusal = refusalOf3(err2);
94098
+ out.error(refusal.message, refusal.reason ?? "api");
94099
+ return;
94100
+ }
94101
+ const anyRefused = answer.items.some((item) => item.outcome === "refused");
94102
+ if (out.isJson) out.data(answer);
94103
+ else {
94104
+ for (const item of answer.items) writer.write(describeRemoval(item));
94105
+ const pr = answer.pull_request ?? answer.items.find((item) => item.pull_request)?.pull_request ?? null;
94106
+ if (pr) writer.write(describePullRequest(pr));
94107
+ }
94108
+ if (anyRefused) process.exitCode = 1;
94109
+ }
94110
+ async function equipmentRemove(args, opts, writer = stdoutWriter) {
94111
+ await runRemoval(
94112
+ "equipment/delete",
94113
+ args,
94114
+ EQUIPMENT_REMOVAL_TYPES,
94115
+ opts,
94116
+ writer
94117
+ );
94118
+ }
94119
+ async function guardrailsRemove(args, opts, writer = stdoutWriter) {
94120
+ await runRemoval(
94121
+ "guardrails/delete",
94122
+ args,
94123
+ GUARDRAIL_REMOVAL_TYPES,
94124
+ opts,
94125
+ writer
94126
+ );
94127
+ }
94128
+ var init_removal = __esm({
94129
+ "src/commands/removal.ts"() {
94130
+ init_equipment_delete();
94131
+ init_guardrails_delete();
94132
+ init_removal_shared();
94133
+ init_api();
94134
+ init_capture_writer();
94135
+ init_output();
94136
+ init_sandbox_run();
94137
+ }
94138
+ });
94139
+
93849
94140
  // src/commands/agent.ts
93850
94141
  var agent_exports = {};
93851
94142
  __export(agent_exports, {
@@ -106540,7 +106831,8 @@ var init_context_steering_shared = __esm({
106540
106831
  "memory_pr",
106541
106832
  "agent_file",
106542
106833
  "agent_proposal",
106543
- "workspace"
106834
+ "workspace",
106835
+ "removal"
106544
106836
  ]);
106545
106837
  proposalKindSchema = external_exports.enum([
106546
106838
  ...recordKindSchema3.options,
@@ -110311,6 +110603,44 @@ var init_codegraph_settings = __esm({
110311
110603
  }
110312
110604
  });
110313
110605
 
110606
+ // ../../packages/oxagen/src/steering-repo/company-email-domains.ts
110607
+ var CONSUMER_MAIL_DOMAINS, CONSUMER, DOMAIN, companyEmailDomainSchema;
110608
+ var init_company_email_domains = __esm({
110609
+ "../../packages/oxagen/src/steering-repo/company-email-domains.ts"() {
110610
+ "use strict";
110611
+ init_zod();
110612
+ init_json_schema();
110613
+ CONSUMER_MAIL_DOMAINS = [
110614
+ "aol.com",
110615
+ "gmail.com",
110616
+ "gmx.com",
110617
+ "googlemail.com",
110618
+ "hotmail.com",
110619
+ "icloud.com",
110620
+ "live.com",
110621
+ "mail.com",
110622
+ "me.com",
110623
+ "msn.com",
110624
+ "outlook.com",
110625
+ "proton.me",
110626
+ "protonmail.com",
110627
+ "qq.com",
110628
+ "yahoo.com",
110629
+ "yandex.com",
110630
+ "zoho.com"
110631
+ ];
110632
+ CONSUMER = new Set(CONSUMER_MAIL_DOMAINS);
110633
+ DOMAIN = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/;
110634
+ companyEmailDomainSchema = withJsonSchema(
110635
+ external_exports.string().max(253).regex(DOMAIN, "a domain name in lower case, such as example.com").refine(
110636
+ (domain) => !CONSUMER.has(domain),
110637
+ "a mail domain anyone can sign up for would pass every address there"
110638
+ ),
110639
+ { not: { enum: [...CONSUMER_MAIL_DOMAINS] } }
110640
+ );
110641
+ }
110642
+ });
110643
+
110314
110644
  // ../../packages/oxagen/src/steering-repo/delivery.ts
110315
110645
  function toolMentionText(name2, modes) {
110316
110646
  const ref = parseToolRef(name2);
@@ -110376,6 +110706,14 @@ var init_delivery = __esm({
110376
110706
  });
110377
110707
 
110378
110708
  // ../../packages/oxagen/src/steering-repo/governance.ts
110709
+ function companyEmailDomainsOf(file) {
110710
+ return [...file.personal_data?.company_email_domains ?? []];
110711
+ }
110712
+ function companyEmailDomainsInToml(text6) {
110713
+ if (text6 === null) return [];
110714
+ const read2 = readTomlFile(text6, "governance/v1", governanceSchema);
110715
+ return read2.ok ? companyEmailDomainsOf(read2.value) : [];
110716
+ }
110379
110717
  var ledgerRotationSchema, governanceSchema, ALWAYS_ON_TOKENS_SETTING, MEMORY_HALF_LIFE_SETTING, STEERING_OVER_BUDGET_SETTING;
110380
110718
  var init_governance = __esm({
110381
110719
  "../../packages/oxagen/src/steering-repo/governance.ts"() {
@@ -110386,6 +110724,8 @@ var init_governance = __esm({
110386
110724
  init_settings_bag();
110387
110725
  init_workspace_settings();
110388
110726
  init_common2();
110727
+ init_company_email_domains();
110728
+ init_files2();
110389
110729
  init_json_schema();
110390
110730
  init_paths2();
110391
110731
  init_tokens();
@@ -110416,6 +110756,14 @@ var init_governance = __esm({
110416
110756
  ),
110417
110757
  auto_merge: external_exports.boolean().optional().describe("Allowed in solo mode only.")
110418
110758
  }).strict().optional(),
110759
+ personal_data: external_exports.object({
110760
+ company_email_domains: uniqueArray(
110761
+ companyEmailDomainSchema,
110762
+ "company_email_domains"
110763
+ ).optional().describe(
110764
+ "The email domains the company owns. A steering record may name an address at one of them or at one of its subdomains, such as contact@example.com. A domain counts only when an Owner of the organization has a verified account email at exactly that domain. Every other address fails the secret and personal-data check."
110765
+ )
110766
+ }).strict().optional(),
110419
110767
  reviewers: external_exports.array(
110420
110768
  external_exports.object({
110421
110769
  paths: external_exports.array(external_exports.string().min(1)).min(1),
@@ -111394,6 +111742,7 @@ var init_steering_repo = __esm({
111394
111742
  init_bundle4();
111395
111743
  init_codegraph_settings();
111396
111744
  init_common2();
111745
+ init_company_email_domains();
111397
111746
  init_delivery();
111398
111747
  init_files2();
111399
111748
  init_governance();
@@ -112422,6 +112771,14 @@ function lockFinding(path2, line, verb, problems) {
112422
112771
  fix: `Restore ${path2} from the production branch. Change the server's tools in Studio and open its Review, or sync the server, and Oxagen writes the lock.`
112423
112772
  });
112424
112773
  }
112774
+ function serverRemoved(env, server) {
112775
+ const folder = `${TOOL_SERVERS_DIR}/${server}/`;
112776
+ if (!env.removed.has(`${folder}${SERVER_TOML_NAME}`)) return false;
112777
+ for (const path2 of env.head.keys()) {
112778
+ if (path2.startsWith(folder)) return false;
112779
+ }
112780
+ return true;
112781
+ }
112425
112782
  function writesFindings(env, base2) {
112426
112783
  const findings = [];
112427
112784
  const readLock3 = env.servers?.lock;
@@ -112434,6 +112791,8 @@ function writesFindings(env, base2) {
112434
112791
  const line = after === void 0 ? null : before === void 0 ? 1 : firstDifferingLine(before, after);
112435
112792
  const verb = after === void 0 ? "removes" : before === void 0 ? "adds" : "changes";
112436
112793
  const server = kind === "server-lock" ? serverName(path2) : null;
112794
+ if (env.removal === true && server !== null && after === void 0 && serverRemoved(env, server))
112795
+ continue;
112437
112796
  if (server !== null && after !== void 0 && readLock3 !== void 0) {
112438
112797
  const outcome = readLock3(server, env.head, base2);
112439
112798
  if (!outcome.ok)
@@ -113446,9 +113805,19 @@ function isSecretToken(token) {
113446
113805
  }
113447
113806
  return isJwt(token) || isHighEntropyBlob(token);
113448
113807
  }
113449
- function hasPersonalEmail(text6) {
113808
+ function isCompanyDomain(domain, owned) {
113809
+ const name2 = domain.toLowerCase();
113810
+ return owned.some((entry2) => {
113811
+ const own = entry2.toLowerCase();
113812
+ return own !== "" && (name2 === own || name2.endsWith(`.${own}`));
113813
+ });
113814
+ }
113815
+ function hasPersonalEmail(text6, owned) {
113450
113816
  for (const m of text6.matchAll(EMAIL)) {
113451
- if (!SERVICE_ACCOUNT_DOMAIN.test(m[1])) return true;
113817
+ const domain = m[1];
113818
+ if (SERVICE_ACCOUNT_DOMAIN.test(domain)) continue;
113819
+ if (isCompanyDomain(domain, owned)) continue;
113820
+ return true;
113452
113821
  }
113453
113822
  return false;
113454
113823
  }
@@ -113466,7 +113835,7 @@ function luhn(digits2) {
113466
113835
  }
113467
113836
  return sum3 % 10 === 0;
113468
113837
  }
113469
- function findSecretsAndPii(text6) {
113838
+ function findSecretsAndPii(text6, options = {}) {
113470
113839
  const findings = [];
113471
113840
  if (/-----BEGIN [A-Z ]*PRIVATE KEY-----/.test(text6))
113472
113841
  findings.push("private key block");
@@ -113484,7 +113853,8 @@ function findSecretsAndPii(text6) {
113484
113853
  break;
113485
113854
  }
113486
113855
  }
113487
- if (hasPersonalEmail(text6)) findings.push("email address");
113856
+ if (hasPersonalEmail(text6, options.companyEmailDomains ?? []))
113857
+ findings.push("email address");
113488
113858
  if (/\b\d{3}-\d{2}-\d{4}\b/.test(text6))
113489
113859
  findings.push("US social security number");
113490
113860
  for (const m of text6.matchAll(/\b(?:\d[ -]?){13,19}\b/g)) {
@@ -113607,16 +113977,29 @@ function describe6(label) {
113607
113977
  fix: PERSONAL_FIX
113608
113978
  };
113609
113979
  }
113610
- function firstLines(text6, labels) {
113980
+ function firstLines(text6, labels, options) {
113611
113981
  const found = /* @__PURE__ */ new Map();
113612
113982
  for (const [index, line] of text6.split("\n").entries()) {
113613
- for (const label of findSecretsAndPii(line)) {
113983
+ for (const label of findSecretsAndPii(line, options)) {
113614
113984
  if (labels.has(label) && !found.has(label)) found.set(label, index + 1);
113615
113985
  }
113616
113986
  if (found.size === labels.size) break;
113617
113987
  }
113618
113988
  return found;
113619
113989
  }
113990
+ function listedDomains(tree) {
113991
+ return companyEmailDomainsInToml(tree.get(GOVERNANCE_TOML_PATH) ?? null);
113992
+ }
113993
+ function scanOptions(tree, env) {
113994
+ const own = listedDomains(tree);
113995
+ const production = env.base === null ? null : new Set(listedDomains(env.base));
113996
+ const owners = env.context.ownerEmailDomains === void 0 ? null : new Set(env.context.ownerEmailDomains);
113997
+ return {
113998
+ companyEmailDomains: own.filter(
113999
+ (domain) => (production === null || production.has(domain)) && (owners === null || owners.has(domain))
114000
+ )
114001
+ };
114002
+ }
113620
114003
  var find10, OXAGEN_WRITES2, LOCK_KIND, SANDBOX_SERVICE_KIND, CREDENTIAL_FIX, PERSONAL_FIX, PERSONAL2, secretsCheck;
113621
114004
  var init_secrets3 = __esm({
113622
114005
  "../../packages/steering-check/src/checks/secrets.ts"() {
@@ -113635,16 +114018,17 @@ var init_secrets3 = __esm({
113635
114018
  "US social security number": "a US social security number",
113636
114019
  "payment card number": "a payment card number"
113637
114020
  };
113638
- secretsCheck = (tree) => {
114021
+ secretsCheck = (tree, env) => {
113639
114022
  const findings = [];
114023
+ const options = scanOptions(tree, env);
113640
114024
  for (const [path2, text6] of tree) {
113641
114025
  const kind = classifySteeringRepoPath(path2);
113642
114026
  if (OXAGEN_WRITES2.has(kind)) continue;
113643
114027
  const labels = new Set(
113644
- findSecretsAndPii(text6).filter((label) => !skipped(kind, label))
114028
+ findSecretsAndPii(text6, options).filter((label) => !skipped(kind, label))
113645
114029
  );
113646
114030
  if (labels.size === 0) continue;
113647
- const lines = firstLines(text6, labels);
114031
+ const lines = firstLines(text6, labels, options);
113648
114032
  for (const label of labels) {
113649
114033
  const described2 = describe6(label);
113650
114034
  if (kind === LOCK_KIND && described2.rule !== "credential") continue;
@@ -113863,6 +114247,7 @@ function* checkResults(input) {
113863
114247
  if (input.cedar !== void 0) env.cedar = input.cedar;
113864
114248
  if (input.servers !== void 0) env.servers = input.servers;
113865
114249
  if (input.repo !== void 0) env.repo = input.repo;
114250
+ if (input.removal === true) env.removal = true;
113866
114251
  for (const check3 of STEERING_CHECK_NAMES) {
113867
114252
  yield selected.has(check3) ? runOne(check3, input, env) : skippedResult(check3);
113868
114253
  }
@@ -184740,6 +185125,76 @@ var init_work_staffing = __esm({
184740
185125
  }
184741
185126
  });
184742
185127
 
185128
+ // src/commands/work_stale.ts
185129
+ var work_stale_exports = {};
185130
+ __export(work_stale_exports, {
185131
+ workStale: () => workStale
185132
+ });
185133
+ function findingLine(row) {
185134
+ const what = row.mismatch !== null ? MISMATCH_LABEL[row.mismatch] ?? row.mismatch : `${row.resolution ?? row.kind}${row.report_only ? " (a send is out)" : ""}`;
185135
+ const reason3 = row.reason === null ? "" : `: ${row.reason}`;
185136
+ return `${row.item.number} ${what}${reason3}`;
185137
+ }
185138
+ async function workStale(opts, writer = stdoutWriter) {
185139
+ const out = createOutput({ json: opts.json }, writer);
185140
+ if (opts.mine && opts.backlog) {
185141
+ process.exitCode = 2;
185142
+ out.error("Pass --mine or --backlog, not both.", "usage");
185143
+ return;
185144
+ }
185145
+ const body2 = {
185146
+ ...opts.repo?.trim() ? { repository: opts.repo.trim() } : {},
185147
+ ...opts.mine ? { owner: "me" } : {},
185148
+ ...opts.backlog ? { owner: "nobody" } : {},
185149
+ fresh: opts.stored !== true
185150
+ };
185151
+ let result2;
185152
+ try {
185153
+ result2 = await apiPostOrThrow("work/stale/find", body2);
185154
+ } catch (err2) {
185155
+ out.error(err2, "api");
185156
+ return;
185157
+ }
185158
+ if (out.isJson) {
185159
+ out.data(result2);
185160
+ return;
185161
+ }
185162
+ const line = (text6) => writer.write(printable(text6));
185163
+ line(
185164
+ `${result2.suggestions.length} close ${result2.suggestions.length === 1 ? "suggestion waits" : "suggestions wait"}.`
185165
+ );
185166
+ for (const row of result2.suggestions)
185167
+ line(`${row.item.number} ${row.resolution}: ${row.reason}`);
185168
+ line("");
185169
+ if (result2.fresh.status === "skipped") return;
185170
+ if (result2.fresh.status === "limited") {
185171
+ line(
185172
+ "The workspace ran its 10 fresh passes for today. These are the stored suggestions."
185173
+ );
185174
+ return;
185175
+ }
185176
+ const shown3 = result2.fresh.findings.filter(
185177
+ (row) => row.outcome !== "secondary"
185178
+ );
185179
+ line(
185180
+ `Read ${result2.fresh.read} work ${result2.fresh.read === 1 ? "item" : "items"} and found ${shown3.length}.`
185181
+ );
185182
+ for (const row of shown3) line(findingLine(row));
185183
+ }
185184
+ var MISMATCH_LABEL;
185185
+ var init_work_stale = __esm({
185186
+ "src/commands/work_stale.ts"() {
185187
+ init_api();
185188
+ init_output();
185189
+ init_capture_writer();
185190
+ MISMATCH_LABEL = {
185191
+ closed_source_open: "Closed here and open in the tracker",
185192
+ merged_not_done: "Merged and not done",
185193
+ tracker_not_updated: "Tracker not updated"
185194
+ };
185195
+ }
185196
+ });
185197
+
184743
185198
  // src/lib/resolve.ts
184744
185199
  function list(path2, writer) {
184745
185200
  return writer ? apiPost(path2, {}, writer) : apiPost(path2, {});
@@ -185746,6 +186201,41 @@ function addSandboxRunsAndRuntimes(sandbox) {
185746
186201
  async (opts) => (await Promise.resolve().then(() => (init_sandbox_runtime(), sandbox_runtime_exports))).sandboxRuntimeSetup(opts)
185747
186202
  );
185748
186203
  }
186204
+ function addRemovalCommands(program2) {
186205
+ const groups = [
186206
+ {
186207
+ noun: "equipment",
186208
+ description: "Agents, runtimes, MCP servers, toolbelts, skills and steering records",
186209
+ deleteDescription: "Delete agents, runtimes, MCP servers, toolbelts, skills or steering records. A record a run names is kept and hidden. Records in the steering repo leave through one steering pull request, merged at once in solo mode",
186210
+ types: "agent, runtime, mcp, toolbelt, skill or steering",
186211
+ run: "equipmentRemove"
186212
+ },
186213
+ {
186214
+ noun: "guardrails",
186215
+ description: "Auto-approval rules, off switches, mandates and spend budgets",
186216
+ deleteDescription: "Delete auto-approval rules, off switches, mandates or spend budgets. Each stops applying at once and is kept for the runs that name it",
186217
+ types: "approval_rule, kill_switch, mandate or spend_budget",
186218
+ run: "guardrailsRemove"
186219
+ }
186220
+ ];
186221
+ for (const group of groups) {
186222
+ program2.command(group.noun).description(group.description).command("delete").alias("rm").description(group.deleteDescription).argument(
186223
+ "<records...>",
186224
+ `Each record as <type>:<id>, where the type is ${group.types}. Up to 100`
186225
+ ).option("--reason <text>", "Why, recorded with each deletion").option("--yes", "Delete without asking").option("--workspace-slug <slug>", WORKSPACE_SLUG_HELP).option("--json", "Output the answer as JSON").action(
186226
+ async (records, opts) => {
186227
+ const what = records.length === 1 ? `Deleting ${records[0]}` : `Deleting ${records.length} records`;
186228
+ if (!await confirmsIrreversible(what, opts.yes)) return;
186229
+ const removal = await Promise.resolve().then(() => (init_removal(), removal_exports));
186230
+ await removal[group.run](records, {
186231
+ reason: opts.reason,
186232
+ workspaceSlug: opts.workspaceSlug,
186233
+ json: opts.json
186234
+ });
186235
+ }
186236
+ );
186237
+ }
186238
+ }
185749
186239
  function addAgentLifecycleCommands(agent) {
185750
186240
  agent.command("retire").description(
185751
186241
  "Retire an agent: archive it and revoke its credentials, hosts, and mandates. Its runs keep their identity. Owner only"
@@ -186646,6 +187136,7 @@ function buildProgram() {
186646
187136
  await runRecorderCommand2(process.argv);
186647
187137
  });
186648
187138
  addRuntimeCommands(program2);
187139
+ addRemovalCommands(program2);
186649
187140
  const credentialsCmd = program2.command("credentials").alias("keys").description(
186650
187141
  "Manage your model credentials: API keys and Claude or ChatGPT logins. They belong to your account, so every workspace you work in can use them. The gateway attaches them to your runs and never puts one in a sandbox. Also named keys"
186651
187142
  );
@@ -187355,6 +187846,14 @@ function buildProgram() {
187355
187846
  const { workStaffing: workStaffing2 } = await Promise.resolve().then(() => (init_work_staffing(), work_staffing_exports));
187356
187847
  await workStaffing2(item, opts);
187357
187848
  });
187849
+ work.command("stale").description(
187850
+ "List the work stella suggests closing, and find work that is stale, repeated, already done, or out of step with its tracker. Closes nothing."
187851
+ ).option("--repo <owner/name>", "Read only work from this repository").option("--mine", "Read only your own work").option("--backlog", "Read only work nobody owns").option("--stored", "List the stored suggestions without a fresh pass").option("--json", "Output JSON").action(
187852
+ async (opts) => {
187853
+ const { workStale: workStale2 } = await Promise.resolve().then(() => (init_work_stale(), work_stale_exports));
187854
+ await workStale2(opts);
187855
+ }
187856
+ );
187358
187857
  work.command("claim").description(
187359
187858
  "From inside a work order's run, claim that the pushed head commit meets one item of the Done Checklist. A person still decides."
187360
187859
  ).argument(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxagen/cli",
3
- "version": "5.5.1-126",
3
+ "version": "5.5.1-155",
4
4
  "description": "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
5
5
  "type": "module",
6
6
  "bin": {