@oxagen/cli 5.5.1-126 → 5.5.1-147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/oxagen.mjs +426 -9
- 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 !
|
|
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-
|
|
32037
|
+
if (true) return "5.5.1-147";
|
|
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-
|
|
78063
|
+
version: "5.5.1-147",
|
|
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,
|
|
@@ -112422,6 +112714,14 @@ function lockFinding(path2, line, verb, problems) {
|
|
|
112422
112714
|
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
112715
|
});
|
|
112424
112716
|
}
|
|
112717
|
+
function serverRemoved(env, server) {
|
|
112718
|
+
const folder = `${TOOL_SERVERS_DIR}/${server}/`;
|
|
112719
|
+
if (!env.removed.has(`${folder}${SERVER_TOML_NAME}`)) return false;
|
|
112720
|
+
for (const path2 of env.head.keys()) {
|
|
112721
|
+
if (path2.startsWith(folder)) return false;
|
|
112722
|
+
}
|
|
112723
|
+
return true;
|
|
112724
|
+
}
|
|
112425
112725
|
function writesFindings(env, base2) {
|
|
112426
112726
|
const findings = [];
|
|
112427
112727
|
const readLock3 = env.servers?.lock;
|
|
@@ -112434,6 +112734,8 @@ function writesFindings(env, base2) {
|
|
|
112434
112734
|
const line = after === void 0 ? null : before === void 0 ? 1 : firstDifferingLine(before, after);
|
|
112435
112735
|
const verb = after === void 0 ? "removes" : before === void 0 ? "adds" : "changes";
|
|
112436
112736
|
const server = kind === "server-lock" ? serverName(path2) : null;
|
|
112737
|
+
if (env.removal === true && server !== null && after === void 0 && serverRemoved(env, server))
|
|
112738
|
+
continue;
|
|
112437
112739
|
if (server !== null && after !== void 0 && readLock3 !== void 0) {
|
|
112438
112740
|
const outcome = readLock3(server, env.head, base2);
|
|
112439
112741
|
if (!outcome.ok)
|
|
@@ -113863,6 +114165,7 @@ function* checkResults(input) {
|
|
|
113863
114165
|
if (input.cedar !== void 0) env.cedar = input.cedar;
|
|
113864
114166
|
if (input.servers !== void 0) env.servers = input.servers;
|
|
113865
114167
|
if (input.repo !== void 0) env.repo = input.repo;
|
|
114168
|
+
if (input.removal === true) env.removal = true;
|
|
113866
114169
|
for (const check3 of STEERING_CHECK_NAMES) {
|
|
113867
114170
|
yield selected.has(check3) ? runOne(check3, input, env) : skippedResult(check3);
|
|
113868
114171
|
}
|
|
@@ -184740,6 +185043,76 @@ var init_work_staffing = __esm({
|
|
|
184740
185043
|
}
|
|
184741
185044
|
});
|
|
184742
185045
|
|
|
185046
|
+
// src/commands/work_stale.ts
|
|
185047
|
+
var work_stale_exports = {};
|
|
185048
|
+
__export(work_stale_exports, {
|
|
185049
|
+
workStale: () => workStale
|
|
185050
|
+
});
|
|
185051
|
+
function findingLine(row) {
|
|
185052
|
+
const what = row.mismatch !== null ? MISMATCH_LABEL[row.mismatch] ?? row.mismatch : `${row.resolution ?? row.kind}${row.report_only ? " (a send is out)" : ""}`;
|
|
185053
|
+
const reason3 = row.reason === null ? "" : `: ${row.reason}`;
|
|
185054
|
+
return `${row.item.number} ${what}${reason3}`;
|
|
185055
|
+
}
|
|
185056
|
+
async function workStale(opts, writer = stdoutWriter) {
|
|
185057
|
+
const out = createOutput({ json: opts.json }, writer);
|
|
185058
|
+
if (opts.mine && opts.backlog) {
|
|
185059
|
+
process.exitCode = 2;
|
|
185060
|
+
out.error("Pass --mine or --backlog, not both.", "usage");
|
|
185061
|
+
return;
|
|
185062
|
+
}
|
|
185063
|
+
const body2 = {
|
|
185064
|
+
...opts.repo?.trim() ? { repository: opts.repo.trim() } : {},
|
|
185065
|
+
...opts.mine ? { owner: "me" } : {},
|
|
185066
|
+
...opts.backlog ? { owner: "nobody" } : {},
|
|
185067
|
+
fresh: opts.stored !== true
|
|
185068
|
+
};
|
|
185069
|
+
let result2;
|
|
185070
|
+
try {
|
|
185071
|
+
result2 = await apiPostOrThrow("work/stale/find", body2);
|
|
185072
|
+
} catch (err2) {
|
|
185073
|
+
out.error(err2, "api");
|
|
185074
|
+
return;
|
|
185075
|
+
}
|
|
185076
|
+
if (out.isJson) {
|
|
185077
|
+
out.data(result2);
|
|
185078
|
+
return;
|
|
185079
|
+
}
|
|
185080
|
+
const line = (text6) => writer.write(printable(text6));
|
|
185081
|
+
line(
|
|
185082
|
+
`${result2.suggestions.length} close ${result2.suggestions.length === 1 ? "suggestion waits" : "suggestions wait"}.`
|
|
185083
|
+
);
|
|
185084
|
+
for (const row of result2.suggestions)
|
|
185085
|
+
line(`${row.item.number} ${row.resolution}: ${row.reason}`);
|
|
185086
|
+
line("");
|
|
185087
|
+
if (result2.fresh.status === "skipped") return;
|
|
185088
|
+
if (result2.fresh.status === "limited") {
|
|
185089
|
+
line(
|
|
185090
|
+
"The workspace ran its 10 fresh passes for today. These are the stored suggestions."
|
|
185091
|
+
);
|
|
185092
|
+
return;
|
|
185093
|
+
}
|
|
185094
|
+
const shown3 = result2.fresh.findings.filter(
|
|
185095
|
+
(row) => row.outcome !== "secondary"
|
|
185096
|
+
);
|
|
185097
|
+
line(
|
|
185098
|
+
`Read ${result2.fresh.read} work ${result2.fresh.read === 1 ? "item" : "items"} and found ${shown3.length}.`
|
|
185099
|
+
);
|
|
185100
|
+
for (const row of shown3) line(findingLine(row));
|
|
185101
|
+
}
|
|
185102
|
+
var MISMATCH_LABEL;
|
|
185103
|
+
var init_work_stale = __esm({
|
|
185104
|
+
"src/commands/work_stale.ts"() {
|
|
185105
|
+
init_api();
|
|
185106
|
+
init_output();
|
|
185107
|
+
init_capture_writer();
|
|
185108
|
+
MISMATCH_LABEL = {
|
|
185109
|
+
closed_source_open: "Closed here and open in the tracker",
|
|
185110
|
+
merged_not_done: "Merged and not done",
|
|
185111
|
+
tracker_not_updated: "Tracker not updated"
|
|
185112
|
+
};
|
|
185113
|
+
}
|
|
185114
|
+
});
|
|
185115
|
+
|
|
184743
185116
|
// src/lib/resolve.ts
|
|
184744
185117
|
function list(path2, writer) {
|
|
184745
185118
|
return writer ? apiPost(path2, {}, writer) : apiPost(path2, {});
|
|
@@ -185746,6 +186119,41 @@ function addSandboxRunsAndRuntimes(sandbox) {
|
|
|
185746
186119
|
async (opts) => (await Promise.resolve().then(() => (init_sandbox_runtime(), sandbox_runtime_exports))).sandboxRuntimeSetup(opts)
|
|
185747
186120
|
);
|
|
185748
186121
|
}
|
|
186122
|
+
function addRemovalCommands(program2) {
|
|
186123
|
+
const groups = [
|
|
186124
|
+
{
|
|
186125
|
+
noun: "equipment",
|
|
186126
|
+
description: "Agents, runtimes, MCP servers, toolbelts, skills and steering records",
|
|
186127
|
+
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",
|
|
186128
|
+
types: "agent, runtime, mcp, toolbelt, skill or steering",
|
|
186129
|
+
run: "equipmentRemove"
|
|
186130
|
+
},
|
|
186131
|
+
{
|
|
186132
|
+
noun: "guardrails",
|
|
186133
|
+
description: "Auto-approval rules, off switches, mandates and spend budgets",
|
|
186134
|
+
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",
|
|
186135
|
+
types: "approval_rule, kill_switch, mandate or spend_budget",
|
|
186136
|
+
run: "guardrailsRemove"
|
|
186137
|
+
}
|
|
186138
|
+
];
|
|
186139
|
+
for (const group of groups) {
|
|
186140
|
+
program2.command(group.noun).description(group.description).command("delete").alias("rm").description(group.deleteDescription).argument(
|
|
186141
|
+
"<records...>",
|
|
186142
|
+
`Each record as <type>:<id>, where the type is ${group.types}. Up to 100`
|
|
186143
|
+
).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(
|
|
186144
|
+
async (records, opts) => {
|
|
186145
|
+
const what = records.length === 1 ? `Deleting ${records[0]}` : `Deleting ${records.length} records`;
|
|
186146
|
+
if (!await confirmsIrreversible(what, opts.yes)) return;
|
|
186147
|
+
const removal = await Promise.resolve().then(() => (init_removal(), removal_exports));
|
|
186148
|
+
await removal[group.run](records, {
|
|
186149
|
+
reason: opts.reason,
|
|
186150
|
+
workspaceSlug: opts.workspaceSlug,
|
|
186151
|
+
json: opts.json
|
|
186152
|
+
});
|
|
186153
|
+
}
|
|
186154
|
+
);
|
|
186155
|
+
}
|
|
186156
|
+
}
|
|
185749
186157
|
function addAgentLifecycleCommands(agent) {
|
|
185750
186158
|
agent.command("retire").description(
|
|
185751
186159
|
"Retire an agent: archive it and revoke its credentials, hosts, and mandates. Its runs keep their identity. Owner only"
|
|
@@ -186646,6 +187054,7 @@ function buildProgram() {
|
|
|
186646
187054
|
await runRecorderCommand2(process.argv);
|
|
186647
187055
|
});
|
|
186648
187056
|
addRuntimeCommands(program2);
|
|
187057
|
+
addRemovalCommands(program2);
|
|
186649
187058
|
const credentialsCmd = program2.command("credentials").alias("keys").description(
|
|
186650
187059
|
"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
187060
|
);
|
|
@@ -187355,6 +187764,14 @@ function buildProgram() {
|
|
|
187355
187764
|
const { workStaffing: workStaffing2 } = await Promise.resolve().then(() => (init_work_staffing(), work_staffing_exports));
|
|
187356
187765
|
await workStaffing2(item, opts);
|
|
187357
187766
|
});
|
|
187767
|
+
work.command("stale").description(
|
|
187768
|
+
"List the work stella suggests closing, and find work that is stale, repeated, already done, or out of step with its tracker. Closes nothing."
|
|
187769
|
+
).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(
|
|
187770
|
+
async (opts) => {
|
|
187771
|
+
const { workStale: workStale2 } = await Promise.resolve().then(() => (init_work_stale(), work_stale_exports));
|
|
187772
|
+
await workStale2(opts);
|
|
187773
|
+
}
|
|
187774
|
+
);
|
|
187358
187775
|
work.command("claim").description(
|
|
187359
187776
|
"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
187777
|
).argument(
|
package/package.json
CHANGED