@oxagen/cli 5.5.1-113 → 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 +437 -16
- 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();
|
|
@@ -45293,7 +45296,9 @@ function memoryTextOf(text6) {
|
|
|
45293
45296
|
const summary = textField(fields.description, MEMORY_SUMMARY_MAX_CHARS);
|
|
45294
45297
|
const memoryType = typeField(fields);
|
|
45295
45298
|
return {
|
|
45296
|
-
|
|
45299
|
+
// Never clipped: a cut statement would drop the end of a rule with no
|
|
45300
|
+
// sign it was cut (#9087).
|
|
45301
|
+
statement: body2.trim(),
|
|
45297
45302
|
...label !== void 0 ? { label } : {},
|
|
45298
45303
|
...summary !== void 0 ? { summary } : {},
|
|
45299
45304
|
...memoryType !== void 0 ? { memoryType } : {}
|
|
@@ -45306,7 +45311,7 @@ var MEMORY_STATEMENT_MAX_CHARS, MEMORY_LABEL_MAX_CHARS, MEMORY_SUMMARY_MAX_CHARS
|
|
|
45306
45311
|
var init_memory_text = __esm({
|
|
45307
45312
|
"../../packages/tacho/src/collector/memory-capture/memory-text.ts"() {
|
|
45308
45313
|
"use strict";
|
|
45309
|
-
MEMORY_STATEMENT_MAX_CHARS =
|
|
45314
|
+
MEMORY_STATEMENT_MAX_CHARS = 32e3;
|
|
45310
45315
|
MEMORY_LABEL_MAX_CHARS = 200;
|
|
45311
45316
|
MEMORY_SUMMARY_MAX_CHARS = 1e3;
|
|
45312
45317
|
MEMORY_TYPE_PATTERN = /^[a-z][a-z0-9_-]{0,31}$/;
|
|
@@ -54568,7 +54573,7 @@ function storedTextOf(memory) {
|
|
|
54568
54573
|
const type = memory.memoryType?.trim().toLowerCase();
|
|
54569
54574
|
const memoryType = type !== void 0 && MEMORY_TYPE_PATTERN.test(type) ? type : void 0;
|
|
54570
54575
|
return {
|
|
54571
|
-
statement:
|
|
54576
|
+
statement: memory.statement.trim(),
|
|
54572
54577
|
...label !== void 0 ? { label } : {},
|
|
54573
54578
|
...summary !== void 0 ? { summary } : {},
|
|
54574
54579
|
...memoryType !== void 0 ? { memoryType } : {}
|
|
@@ -55180,7 +55185,7 @@ function createMemoryUpload(deps) {
|
|
|
55180
55185
|
{
|
|
55181
55186
|
harness: entry2.harness,
|
|
55182
55187
|
path: entry2.path,
|
|
55183
|
-
statement:
|
|
55188
|
+
statement: redactText(entry2.statement),
|
|
55184
55189
|
...entry2.label !== void 0 ? { label: redacted(entry2.label, MEMORY_LABEL_MAX_CHARS) } : {},
|
|
55185
55190
|
...entry2.summary !== void 0 ? { summary: redacted(entry2.summary, MEMORY_SUMMARY_MAX_CHARS) } : {},
|
|
55186
55191
|
...entry2.memoryType !== void 0 ? { memory_type: entry2.memoryType } : {},
|
|
@@ -56102,7 +56107,7 @@ function stellaMemoryOf(row) {
|
|
|
56102
56107
|
const lineage = lineageOf(row["lineage"]);
|
|
56103
56108
|
const content = row["content"];
|
|
56104
56109
|
if (lineage === void 0 || typeof content !== "string") return void 0;
|
|
56105
|
-
const statement =
|
|
56110
|
+
const statement = content.trim();
|
|
56106
56111
|
if (statement.length === 0) return void 0;
|
|
56107
56112
|
const rawKind = row["kind"];
|
|
56108
56113
|
const kind = typeof rawKind === "string" ? rawKind.trim().toLowerCase() : void 0;
|
|
@@ -78055,7 +78060,7 @@ var init_package = __esm({
|
|
|
78055
78060
|
"package.json"() {
|
|
78056
78061
|
package_default = {
|
|
78057
78062
|
name: "@oxagen/cli",
|
|
78058
|
-
version: "5.5.1-
|
|
78063
|
+
version: "5.5.1-147",
|
|
78059
78064
|
description: "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
|
|
78060
78065
|
type: "module",
|
|
78061
78066
|
main: "./dist/index.js",
|
|
@@ -92833,11 +92838,14 @@ var init_work_order_shared = __esm({
|
|
|
92833
92838
|
WORK_ACTION_CLOSE_RESOLUTIONS = [
|
|
92834
92839
|
"cancelled",
|
|
92835
92840
|
"declined",
|
|
92836
|
-
"duplicate"
|
|
92841
|
+
"duplicate",
|
|
92842
|
+
"stale",
|
|
92843
|
+
"addressed"
|
|
92837
92844
|
];
|
|
92838
92845
|
WORK_CLOSURE_RESOLUTIONS = [
|
|
92839
92846
|
...WORK_ACTION_CLOSE_RESOLUTIONS,
|
|
92840
|
-
"source_closed"
|
|
92847
|
+
"source_closed",
|
|
92848
|
+
"source_gone"
|
|
92841
92849
|
];
|
|
92842
92850
|
workItemAfterSchema = external_exports.object({
|
|
92843
92851
|
id: workItemIdSchema,
|
|
@@ -93844,6 +93852,291 @@ var init_sandbox_runtime = __esm({
|
|
|
93844
93852
|
}
|
|
93845
93853
|
});
|
|
93846
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
|
+
|
|
93847
94140
|
// src/commands/agent.ts
|
|
93848
94141
|
var agent_exports = {};
|
|
93849
94142
|
__export(agent_exports, {
|
|
@@ -105961,6 +106254,7 @@ var MEMORY_CAPTURES, memoryCaptureSchema, MEMORY_STATEMENT_MAX, memoryIdSchema,
|
|
|
105961
106254
|
var init_memory = __esm({
|
|
105962
106255
|
"../../packages/oxagen/src/steering-repo/memory.ts"() {
|
|
105963
106256
|
"use strict";
|
|
106257
|
+
init_memory_text();
|
|
105964
106258
|
init_zod();
|
|
105965
106259
|
init_common2();
|
|
105966
106260
|
init_record_kind();
|
|
@@ -105971,7 +106265,7 @@ var init_memory = __esm({
|
|
|
105971
106265
|
"import"
|
|
105972
106266
|
];
|
|
105973
106267
|
memoryCaptureSchema = external_exports.enum(MEMORY_CAPTURES);
|
|
105974
|
-
MEMORY_STATEMENT_MAX =
|
|
106268
|
+
MEMORY_STATEMENT_MAX = MEMORY_STATEMENT_MAX_CHARS;
|
|
105975
106269
|
memoryIdSchema = external_exports.string().regex(
|
|
105976
106270
|
/^mem_[0-9A-Za-z]+$/,
|
|
105977
106271
|
"a memory id is mem_ and letters or digits, as Oxagen assigns it"
|
|
@@ -106537,7 +106831,8 @@ var init_context_steering_shared = __esm({
|
|
|
106537
106831
|
"memory_pr",
|
|
106538
106832
|
"agent_file",
|
|
106539
106833
|
"agent_proposal",
|
|
106540
|
-
"workspace"
|
|
106834
|
+
"workspace",
|
|
106835
|
+
"removal"
|
|
106541
106836
|
]);
|
|
106542
106837
|
proposalKindSchema = external_exports.enum([
|
|
106543
106838
|
...recordKindSchema3.options,
|
|
@@ -110518,11 +110813,12 @@ var init_reflection = __esm({
|
|
|
110518
110813
|
init_zod();
|
|
110519
110814
|
init_run_list();
|
|
110520
110815
|
init_common2();
|
|
110816
|
+
init_memory();
|
|
110521
110817
|
init_record_kind();
|
|
110522
110818
|
gradeSchema = external_exports.number().int().min(1).max(5);
|
|
110523
110819
|
reflectionOutcomeSchema = runOutcomeSchema.exclude(["running"]);
|
|
110524
110820
|
lessonSchema = external_exports.object({
|
|
110525
|
-
statement: external_exports.string().min(1).max(
|
|
110821
|
+
statement: external_exports.string().min(1).max(MEMORY_STATEMENT_MAX),
|
|
110526
110822
|
kind: recordKindSchema2.describe(
|
|
110527
110823
|
"What the lesson would be as a record. Most are memory."
|
|
110528
110824
|
),
|
|
@@ -112418,6 +112714,14 @@ function lockFinding(path2, line, verb, problems) {
|
|
|
112418
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.`
|
|
112419
112715
|
});
|
|
112420
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
|
+
}
|
|
112421
112725
|
function writesFindings(env, base2) {
|
|
112422
112726
|
const findings = [];
|
|
112423
112727
|
const readLock3 = env.servers?.lock;
|
|
@@ -112430,6 +112734,8 @@ function writesFindings(env, base2) {
|
|
|
112430
112734
|
const line = after === void 0 ? null : before === void 0 ? 1 : firstDifferingLine(before, after);
|
|
112431
112735
|
const verb = after === void 0 ? "removes" : before === void 0 ? "adds" : "changes";
|
|
112432
112736
|
const server = kind === "server-lock" ? serverName(path2) : null;
|
|
112737
|
+
if (env.removal === true && server !== null && after === void 0 && serverRemoved(env, server))
|
|
112738
|
+
continue;
|
|
112433
112739
|
if (server !== null && after !== void 0 && readLock3 !== void 0) {
|
|
112434
112740
|
const outcome = readLock3(server, env.head, base2);
|
|
112435
112741
|
if (!outcome.ok)
|
|
@@ -113859,6 +114165,7 @@ function* checkResults(input) {
|
|
|
113859
114165
|
if (input.cedar !== void 0) env.cedar = input.cedar;
|
|
113860
114166
|
if (input.servers !== void 0) env.servers = input.servers;
|
|
113861
114167
|
if (input.repo !== void 0) env.repo = input.repo;
|
|
114168
|
+
if (input.removal === true) env.removal = true;
|
|
113862
114169
|
for (const check3 of STEERING_CHECK_NAMES) {
|
|
113863
114170
|
yield selected.has(check3) ? runOne(check3, input, env) : skippedResult(check3);
|
|
113864
114171
|
}
|
|
@@ -184736,6 +185043,76 @@ var init_work_staffing = __esm({
|
|
|
184736
185043
|
}
|
|
184737
185044
|
});
|
|
184738
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
|
+
|
|
184739
185116
|
// src/lib/resolve.ts
|
|
184740
185117
|
function list(path2, writer) {
|
|
184741
185118
|
return writer ? apiPost(path2, {}, writer) : apiPost(path2, {});
|
|
@@ -185742,6 +186119,41 @@ function addSandboxRunsAndRuntimes(sandbox) {
|
|
|
185742
186119
|
async (opts) => (await Promise.resolve().then(() => (init_sandbox_runtime(), sandbox_runtime_exports))).sandboxRuntimeSetup(opts)
|
|
185743
186120
|
);
|
|
185744
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
|
+
}
|
|
185745
186157
|
function addAgentLifecycleCommands(agent) {
|
|
185746
186158
|
agent.command("retire").description(
|
|
185747
186159
|
"Retire an agent: archive it and revoke its credentials, hosts, and mandates. Its runs keep their identity. Owner only"
|
|
@@ -186642,6 +187054,7 @@ function buildProgram() {
|
|
|
186642
187054
|
await runRecorderCommand2(process.argv);
|
|
186643
187055
|
});
|
|
186644
187056
|
addRuntimeCommands(program2);
|
|
187057
|
+
addRemovalCommands(program2);
|
|
186645
187058
|
const credentialsCmd = program2.command("credentials").alias("keys").description(
|
|
186646
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"
|
|
186647
187060
|
);
|
|
@@ -187351,6 +187764,14 @@ function buildProgram() {
|
|
|
187351
187764
|
const { workStaffing: workStaffing2 } = await Promise.resolve().then(() => (init_work_staffing(), work_staffing_exports));
|
|
187352
187765
|
await workStaffing2(item, opts);
|
|
187353
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
|
+
);
|
|
187354
187775
|
work.command("claim").description(
|
|
187355
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."
|
|
187356
187777
|
).argument(
|
package/package.json
CHANGED