@rosthq/cli 0.7.65 → 0.7.66
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/dist/host-resource.d.ts +23 -0
- package/dist/host-resource.d.ts.map +1 -0
- package/dist/index.js +132 -4
- package/dist/index.js.map +4 -4
- package/dist/runner-serve.d.ts +4 -0
- package/dist/runner-serve.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type HostResourceTelemetry = {
|
|
2
|
+
load_avg_1m: number | null;
|
|
3
|
+
memory_available_mb: number | null;
|
|
4
|
+
swap_used_mb: number | null;
|
|
5
|
+
swap_total_mb: number | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function parseLinuxMeminfoSwap(meminfo: string): {
|
|
8
|
+
swap_used_mb: number;
|
|
9
|
+
swap_total_mb: number;
|
|
10
|
+
} | null;
|
|
11
|
+
export declare function parseDarwinSwapusage(output: string): {
|
|
12
|
+
swap_used_mb: number;
|
|
13
|
+
swap_total_mb: number;
|
|
14
|
+
} | null;
|
|
15
|
+
export type HostResourceDeps = {
|
|
16
|
+
platform: () => string;
|
|
17
|
+
loadAvg: () => number[];
|
|
18
|
+
freeMemBytes: () => number;
|
|
19
|
+
readLinuxMeminfo: () => string;
|
|
20
|
+
readDarwinSwapusage: () => string;
|
|
21
|
+
};
|
|
22
|
+
export declare function detectHostResource(deps?: HostResourceDeps): HostResourceTelemetry;
|
|
23
|
+
//# sourceMappingURL=host-resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-resource.d.ts","sourceRoot":"","sources":["../src/host-resource.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAGF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAS7G;AAGD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAmB3G;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,MAAM,CAAC;IAC/B,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC,CAAC;AAUF,wBAAgB,kBAAkB,CAAC,IAAI,GAAE,gBAA8B,GAAG,qBAAqB,CAiC9F"}
|
package/dist/index.js
CHANGED
|
@@ -38266,6 +38266,23 @@ var CATALOG_ENTRIES = [
|
|
|
38266
38266
|
// `agent.script_run` account entitlement gates availability on top of this.
|
|
38267
38267
|
default_access_policy: "always_ask"
|
|
38268
38268
|
},
|
|
38269
|
+
{
|
|
38270
|
+
id: "secret.broker",
|
|
38271
|
+
title: "Call an authenticated API (brokered)",
|
|
38272
|
+
provider: "rost",
|
|
38273
|
+
description: "Call this to make ONE authenticated request to a pre-approved third-party API on the agent's behalf. You supply only the grant key, method, path, and query/body \u2014 never a credential. A server-side broker injects the secret, calls the single allowlisted host/path/method the grant permits, and returns a size-capped, secret-scrubbed result (response bodies that echo credential-shaped material are redacted wholesale). The secret never enters your context or the sandbox. Read requests run directly; any write (POST/PUT/PATCH/DELETE) is HELD for human approval before it is sent. Every attempt is audited.",
|
|
38274
|
+
// A write goes out over the network with a real credential — the broadest tier.
|
|
38275
|
+
// Reads on the same grant self-select the read behaviour at call time; the
|
|
38276
|
+
// catalog tier is the ceiling (a write is held-with-approval).
|
|
38277
|
+
default_scope_tier: "write_with_approval",
|
|
38278
|
+
scope_tiers: ["read", "write_with_approval"],
|
|
38279
|
+
// The broker resolves a vault ref per grant and injects it server-side.
|
|
38280
|
+
credential_required: true,
|
|
38281
|
+
// Conservative by default (invariant #10): brokered egress is confirmed by
|
|
38282
|
+
// default; writes are additionally held for /approvals. A per-seat grant
|
|
38283
|
+
// (script_run_secret_grants) gates availability on top of this — no grant, no call.
|
|
38284
|
+
default_access_policy: "always_ask"
|
|
38285
|
+
},
|
|
38269
38286
|
{
|
|
38270
38287
|
id: "ap.invoices.read",
|
|
38271
38288
|
title: "Read AP invoices",
|
|
@@ -39000,8 +39017,29 @@ var agentSetupNextActionSchema = external_exports.enum([
|
|
|
39000
39017
|
"sign_manifest",
|
|
39001
39018
|
"run_dry_run",
|
|
39002
39019
|
"go_live",
|
|
39003
|
-
"complete"
|
|
39020
|
+
"complete",
|
|
39021
|
+
// DER-1628: live-agent remediation actions. A live agent is NOT automatically
|
|
39022
|
+
// "complete" — a missing/never-approved active Charter or an ARCHIVED
|
|
39023
|
+
// configured parent is a real post-go-live defect that must route the operator
|
|
39024
|
+
// to the exact repair instead of falsely reading complete. These only ever
|
|
39025
|
+
// appear for a live/promotable agent (the setup wizard's forward actions above
|
|
39026
|
+
// cover the draft flow), and DER-1652 deep-links each to its repair surface.
|
|
39027
|
+
"fix_charter",
|
|
39028
|
+
"fix_reporting_line"
|
|
39004
39029
|
]);
|
|
39030
|
+
var agentSetupBlockerCodeSchema = external_exports.enum([
|
|
39031
|
+
"missing_active_charter",
|
|
39032
|
+
"archived_parent",
|
|
39033
|
+
"missing_parent",
|
|
39034
|
+
"missing_steward",
|
|
39035
|
+
"missing_occupancy",
|
|
39036
|
+
"missing_goal_or_measurable",
|
|
39037
|
+
"skill_dependency_blocked"
|
|
39038
|
+
]);
|
|
39039
|
+
var agentSetupBlockerSchema = external_exports.object({
|
|
39040
|
+
code: agentSetupBlockerCodeSchema,
|
|
39041
|
+
message: external_exports.string().min(1).max(500)
|
|
39042
|
+
}).strict();
|
|
39005
39043
|
var agentSetupSkillRecommendationSchema = skillSummarySchema.extend({
|
|
39006
39044
|
match_score: external_exports.number().int().min(0).max(100),
|
|
39007
39045
|
recommendation_reason: external_exports.string().min(1).max(240)
|
|
@@ -39067,7 +39105,10 @@ var agentSetupStateSchema = external_exports.object({
|
|
|
39067
39105
|
// reload. Optional so a pre-DER-842 recorded result still validates.
|
|
39068
39106
|
transcript: dryRunTranscriptSchema.optional()
|
|
39069
39107
|
}).strict().nullable(),
|
|
39070
|
-
|
|
39108
|
+
// DER-1628: typed, stable completeness blockers (was `string[]`). `complete`
|
|
39109
|
+
// is impossible while this array is non-empty — every surface reads the same
|
|
39110
|
+
// canonical result rather than doing its own completeness math.
|
|
39111
|
+
blockers: external_exports.array(agentSetupBlockerSchema),
|
|
39071
39112
|
next_action: agentSetupNextActionSchema
|
|
39072
39113
|
}).strict();
|
|
39073
39114
|
var agentSetupToolUpdateSchema = external_exports.object({
|
|
@@ -45759,7 +45800,7 @@ For CLI and MCP setup, read agent-skill-setup-guide before adding or assigning S
|
|
|
45759
45800
|
order: 42,
|
|
45760
45801
|
title: "Design a custom agent",
|
|
45761
45802
|
summary: "How to build a custom agent from operational questions through the Charter Builder, tools, dry run, and go-live without writing prompts.",
|
|
45762
|
-
version: "2026-07-
|
|
45803
|
+
version: "2026-07-12.1",
|
|
45763
45804
|
public: true,
|
|
45764
45805
|
audiences: ["human", "cli", "mcp", "in_app_agent"],
|
|
45765
45806
|
stages: ["staffing", "charter_design"],
|
|
@@ -45824,6 +45865,14 @@ The same path is command-backed:
|
|
|
45824
45865
|
7. \`agent.configure_tools\` / \`rost_configure_agent_tools\` records connect/decline decisions and credential-ingress requests (vault refs only).
|
|
45825
45866
|
8. \`agent.run_dry_run\` / \`rost_run_agent_dry_run\` rehearses the task after the manifest is signed.
|
|
45826
45867
|
|
|
45868
|
+
## Setup completeness and blockers
|
|
45869
|
+
|
|
45870
|
+
\`agent_setup.get\` derives completeness canonically, so every surface \u2014 the web builder, the CLI, and the \`agent.show_markdown\` readout \u2014 reads one result instead of doing its own math. It returns a \`blockers\` array plus a \`next_action\`. Each blocker is a typed \`{ code, message }\`: consumers key off the stable \`code\` (to group blockers or deep-link to the exact repair) and show \`message\` verbatim. A setup is \`complete\` only when \`blockers\` is empty; while any blocker is present, \`next_action\` points at the highest-priority repair rather than \`complete\`.
|
|
45871
|
+
|
|
45872
|
+
The blocker codes are a stable vocabulary \u2014 new reasons get a new code rather than a rename. Emitted today: \`missing_active_charter\`, \`archived_parent\`, \`missing_parent\`, \`missing_steward\`, and \`skill_dependency_blocked\` (\`missing_occupancy\` and \`missing_goal_or_measurable\` are reserved for later checks).
|
|
45873
|
+
|
|
45874
|
+
Completeness is not just a draft gate: a **live** agent is not automatically \`complete\`. If a live seat has no active, approved Charter, its configured parent is archived, or its steward chain no longer resolves to a human, \`agent_setup.get\` surfaces the matching blocker and routes \`next_action\` to the fix \u2014 \`fix_charter\` for \`missing_active_charter\`, \`fix_reporting_line\` for \`archived_parent\`, then \`set_steward\` for \`missing_steward\`, in that priority order. A live agent with no configured parent at all is the legitimate top-level case and stays \`complete\`; only an archived configured parent blocks it.
|
|
45875
|
+
|
|
45827
45876
|
## Dry run and go-live
|
|
45828
45877
|
|
|
45829
45878
|
The dry run is a real sandbox rehearsal, not a stamp. It executes a mock-provider run derived from the Charter \u2014 the agent works against sandbox data only and is expected to escalate where the Charter's must-escalate clause requires it. The same rehearsal works on all three lanes: cloud, external MCP, and local Runner. External MCP dry runs require an active seat-scoped MCP token; Runner dry runs require a paired Runner. Missing substrate returns a typed precondition error, not a generic failure. The recorded run keeps the agent's actual lane, so the evidence you review matches the lane you selected. The result is earned: a run that escalates the must-escalate boundary passes; a run that acts on that boundary instead of escalating fails. A failed dry run keeps the draft and shows the reason so you can edit and rerun. The rehearsal returns a transcript \u2014 the steps the agent took and the escalation it raised \u2014 shown step by step in the builder and printed by the CLI, so you can see the governance model working before anything goes live. The transcript is also lane-honest: each granted tool is marked executable, held for the steward, or granted but unimplemented in this lane, with a plain-count verdict such as "2 of 6 granted tools don't execute in the cloud lane yet" \u2014 so a grant that would silently no-op in the cloud runtime is visible before go-live instead of passing green. Runner and MCP-session agents run those tools through their own local skills, so their grants are not flagged as unimplemented. When the dry run passes, a human promotes the agent live. The dry run rehearses the specific model tier you chose, so once it passes the model is locked \u2014 changing the model requires re-running the dry run on the new model before go-live.
|
|
@@ -54599,6 +54648,80 @@ async function removeWorkspace(ws) {
|
|
|
54599
54648
|
await removeWorktree(ws.baseRepo, ws.worktreeDir);
|
|
54600
54649
|
}
|
|
54601
54650
|
|
|
54651
|
+
// src/host-resource.ts
|
|
54652
|
+
import { execFileSync } from "node:child_process";
|
|
54653
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
54654
|
+
import { freemem, loadavg, platform as osPlatform } from "node:os";
|
|
54655
|
+
var MB = 1024 * 1024;
|
|
54656
|
+
function parseLinuxMeminfoSwap(meminfo) {
|
|
54657
|
+
const total = /^SwapTotal:\s+(\d+)\s*kB/m.exec(meminfo);
|
|
54658
|
+
const free = /^SwapFree:\s+(\d+)\s*kB/m.exec(meminfo);
|
|
54659
|
+
if (!total || !free) return null;
|
|
54660
|
+
const totalKb = Number(total[1]);
|
|
54661
|
+
const freeKb = Number(free[1]);
|
|
54662
|
+
if (!Number.isFinite(totalKb) || !Number.isFinite(freeKb)) return null;
|
|
54663
|
+
const usedKb = Math.max(0, totalKb - freeKb);
|
|
54664
|
+
return { swap_used_mb: Math.round(usedKb / 1024), swap_total_mb: Math.round(totalKb / 1024) };
|
|
54665
|
+
}
|
|
54666
|
+
function parseDarwinSwapusage(output) {
|
|
54667
|
+
const total = /total\s*=\s*([\d.]+)\s*([KMGT])/i.exec(output);
|
|
54668
|
+
const used = /used\s*=\s*([\d.]+)\s*([KMGT])/i.exec(output);
|
|
54669
|
+
if (!total || !used) return null;
|
|
54670
|
+
const toMb = (value, unit) => {
|
|
54671
|
+
const n = Number(value);
|
|
54672
|
+
const u = unit.toUpperCase();
|
|
54673
|
+
const mult = u === "G" ? 1024 : u === "T" ? 1024 * 1024 : u === "K" ? 1 / 1024 : 1;
|
|
54674
|
+
return n * mult;
|
|
54675
|
+
};
|
|
54676
|
+
const usedValue = used[1];
|
|
54677
|
+
const usedUnit = used[2];
|
|
54678
|
+
const totalValue = total[1];
|
|
54679
|
+
const totalUnit = total[2];
|
|
54680
|
+
if (usedValue === void 0 || usedUnit === void 0 || totalValue === void 0 || totalUnit === void 0) return null;
|
|
54681
|
+
const usedMb = toMb(usedValue, usedUnit);
|
|
54682
|
+
const totalMb = toMb(totalValue, totalUnit);
|
|
54683
|
+
if (!Number.isFinite(usedMb) || !Number.isFinite(totalMb)) return null;
|
|
54684
|
+
return { swap_used_mb: Math.round(usedMb), swap_total_mb: Math.round(totalMb) };
|
|
54685
|
+
}
|
|
54686
|
+
var defaultDeps = {
|
|
54687
|
+
platform: () => osPlatform(),
|
|
54688
|
+
loadAvg: () => loadavg(),
|
|
54689
|
+
freeMemBytes: () => freemem(),
|
|
54690
|
+
readLinuxMeminfo: () => readFileSync4("/proc/meminfo", "utf8"),
|
|
54691
|
+
readDarwinSwapusage: () => execFileSync("sysctl", ["-n", "vm.swapusage"], { encoding: "utf8", timeout: 2e3 })
|
|
54692
|
+
};
|
|
54693
|
+
function detectHostResource(deps = defaultDeps) {
|
|
54694
|
+
let load_avg_1m = null;
|
|
54695
|
+
try {
|
|
54696
|
+
const l = deps.loadAvg();
|
|
54697
|
+
const first = Array.isArray(l) ? l[0] : void 0;
|
|
54698
|
+
load_avg_1m = typeof first === "number" && Number.isFinite(first) ? first : null;
|
|
54699
|
+
} catch {
|
|
54700
|
+
load_avg_1m = null;
|
|
54701
|
+
}
|
|
54702
|
+
let memory_available_mb = null;
|
|
54703
|
+
try {
|
|
54704
|
+
const bytes = deps.freeMemBytes();
|
|
54705
|
+
memory_available_mb = Number.isFinite(bytes) && bytes >= 0 ? Math.round(bytes / MB) : null;
|
|
54706
|
+
} catch {
|
|
54707
|
+
memory_available_mb = null;
|
|
54708
|
+
}
|
|
54709
|
+
let swap = null;
|
|
54710
|
+
try {
|
|
54711
|
+
const p = deps.platform();
|
|
54712
|
+
if (p === "linux") swap = parseLinuxMeminfoSwap(deps.readLinuxMeminfo());
|
|
54713
|
+
else if (p === "darwin") swap = parseDarwinSwapusage(deps.readDarwinSwapusage());
|
|
54714
|
+
} catch {
|
|
54715
|
+
swap = null;
|
|
54716
|
+
}
|
|
54717
|
+
return {
|
|
54718
|
+
load_avg_1m,
|
|
54719
|
+
memory_available_mb,
|
|
54720
|
+
swap_used_mb: swap?.swap_used_mb ?? null,
|
|
54721
|
+
swap_total_mb: swap?.swap_total_mb ?? null
|
|
54722
|
+
};
|
|
54723
|
+
}
|
|
54724
|
+
|
|
54602
54725
|
// src/runner-serve.ts
|
|
54603
54726
|
var execFile5 = promisify5(execFileCallback5);
|
|
54604
54727
|
var RUNNER_WORK_ORDER_TOOLS = [
|
|
@@ -54784,6 +54907,7 @@ function capabilitiesForAnalytics(capabilities) {
|
|
|
54784
54907
|
}
|
|
54785
54908
|
function detectTelemetry(capabilities, env, activeSessions, cliVersion) {
|
|
54786
54909
|
const usageState = env.RUNNER_MODEL_ACCOUNT_STATE ?? env.ROST_RUNNER_MODEL_ACCOUNT_STATE ?? "unknown";
|
|
54910
|
+
const host = detectHostResource();
|
|
54787
54911
|
return {
|
|
54788
54912
|
os: platform(),
|
|
54789
54913
|
cpu_count: cpus().length,
|
|
@@ -54797,7 +54921,11 @@ function detectTelemetry(capabilities, env, activeSessions, cliVersion) {
|
|
|
54797
54921
|
usage_limit_observation: {
|
|
54798
54922
|
state: usageState,
|
|
54799
54923
|
source: "runner_env_or_unknown"
|
|
54800
|
-
}
|
|
54924
|
+
},
|
|
54925
|
+
load_avg_1m: host.load_avg_1m,
|
|
54926
|
+
memory_available_mb: host.memory_available_mb,
|
|
54927
|
+
swap_used_mb: host.swap_used_mb,
|
|
54928
|
+
swap_total_mb: host.swap_total_mb
|
|
54801
54929
|
};
|
|
54802
54930
|
}
|
|
54803
54931
|
function parseServeArgs(args, appUrl2, env, homeDir) {
|