@scheduler-systems/gal-run 0.0.666 → 0.0.667
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/index.cjs +122 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3881,7 +3881,7 @@ var cliVersion, defaultApiUrl, BUILD_CONSTANTS, constants_default;
|
|
|
3881
3881
|
var init_constants = __esm({
|
|
3882
3882
|
"module_6"() {
|
|
3883
3883
|
"use strict";
|
|
3884
|
-
cliVersion = true ? "0.0.
|
|
3884
|
+
cliVersion = true ? "0.0.667" : "0.0.0-dev";
|
|
3885
3885
|
defaultApiUrl = true ? "https://api.gal.run" : "http://localhost:3000";
|
|
3886
3886
|
BUILD_CONSTANTS = Object.freeze([cliVersion, defaultApiUrl]);
|
|
3887
3887
|
constants_default = BUILD_CONSTANTS;
|
|
@@ -11912,7 +11912,7 @@ function detectEnvironment() {
|
|
|
11912
11912
|
return "dev";
|
|
11913
11913
|
}
|
|
11914
11914
|
try {
|
|
11915
|
-
const version2 = true ? "0.0.
|
|
11915
|
+
const version2 = true ? "0.0.667" : void 0;
|
|
11916
11916
|
if (version2 && version2.includes("-local")) {
|
|
11917
11917
|
return "dev";
|
|
11918
11918
|
}
|
|
@@ -14593,7 +14593,7 @@ function getId() {
|
|
|
14593
14593
|
}
|
|
14594
14594
|
function getCliVersion() {
|
|
14595
14595
|
try {
|
|
14596
|
-
return true ? "0.0.
|
|
14596
|
+
return true ? "0.0.667" : "0.0.0-dev";
|
|
14597
14597
|
} catch {
|
|
14598
14598
|
return "0.0.0-dev";
|
|
14599
14599
|
}
|
|
@@ -187858,7 +187858,7 @@ var init_gal_code_session_collection = __esm({
|
|
|
187858
187858
|
});
|
|
187859
187859
|
|
|
187860
187860
|
function resolveCliVersion() {
|
|
187861
|
-
return true ? "0.0.
|
|
187861
|
+
return true ? "0.0.667" : "0.0.0-dev";
|
|
187862
187862
|
}
|
|
187863
187863
|
function resolveGalCodeRunnerAsset(version2) {
|
|
187864
187864
|
const platformMap = {
|
|
@@ -188233,7 +188233,7 @@ async function uploadSessionArchive(config, cwd, commandArgs, startedAt, exitCod
|
|
|
188233
188233
|
return;
|
|
188234
188234
|
}
|
|
188235
188235
|
const endedAt = /* @__PURE__ */ new Date();
|
|
188236
|
-
const wrapperVersion = true ? "0.0.
|
|
188236
|
+
const wrapperVersion = true ? "0.0.667" : "0.0.0-dev";
|
|
188237
188237
|
const model = childEnv.GAL_CODE_MODEL ?? "glm-vertex/glm-5";
|
|
188238
188238
|
await uploadGalCodeSessionArchive(
|
|
188239
188239
|
{
|
|
@@ -204899,6 +204899,40 @@ async function fetchWithAuth2(url, authToken, method = "GET", body) {
|
|
|
204899
204899
|
clearTimeout(timeoutId);
|
|
204900
204900
|
}
|
|
204901
204901
|
}
|
|
204902
|
+
function resolveBusinessOpsAgentUrl(input) {
|
|
204903
|
+
return (input || process.env.GAL_BUSINESS_OPS_AGENT_URL || process.env.BUSINESS_OPS_AGENT_URL || defaultBusinessOpsAgentUrl).replace(/\/+$/, "");
|
|
204904
|
+
}
|
|
204905
|
+
function resolveEnforcementMode(input) {
|
|
204906
|
+
const raw = (input || process.env.GAL_POLICY_ENFORCEMENT_MODE || "warn").toLowerCase();
|
|
204907
|
+
if (raw === "off" || raw === "warn" || raw === "block") return raw;
|
|
204908
|
+
return "warn";
|
|
204909
|
+
}
|
|
204910
|
+
async function fetchBusinessOpsDecision(options) {
|
|
204911
|
+
const url = new URL(`${options.agentUrl}/decide`);
|
|
204912
|
+
url.searchParams.set("product_id", options.product);
|
|
204913
|
+
url.searchParams.set("work_class", options.workClass);
|
|
204914
|
+
const controller = new AbortController();
|
|
204915
|
+
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
204916
|
+
try {
|
|
204917
|
+
const res = await fetch(url, {
|
|
204918
|
+
method: "GET",
|
|
204919
|
+
headers: {
|
|
204920
|
+
...options.agentToken ? { Authorization: `Bearer ${options.agentToken}` } : {}
|
|
204921
|
+
},
|
|
204922
|
+
signal: controller.signal
|
|
204923
|
+
});
|
|
204924
|
+
const body = await res.json().catch(() => ({}));
|
|
204925
|
+
if (!res.ok) {
|
|
204926
|
+
throw new Error(String(body.error || `Business Ops Admin agent returned HTTP ${res.status}`));
|
|
204927
|
+
}
|
|
204928
|
+
return body;
|
|
204929
|
+
} finally {
|
|
204930
|
+
clearTimeout(timeoutId);
|
|
204931
|
+
}
|
|
204932
|
+
}
|
|
204933
|
+
function activeGateNames(gates) {
|
|
204934
|
+
return Object.entries(gates || {}).filter(([, active]) => active).map(([name]) => name);
|
|
204935
|
+
}
|
|
204902
204936
|
function createPolicyCommand() {
|
|
204903
204937
|
const command = new Command("policy").description(
|
|
204904
204938
|
"Manage org-wide AI agent policies (enterprise)"
|
|
@@ -205319,6 +205353,86 @@ function createPolicyCommand() {
|
|
|
205319
205353
|
process.exit(1);
|
|
205320
205354
|
}
|
|
205321
205355
|
});
|
|
205356
|
+
command.command("check").description("Check a product/work-class decision through the Business Ops Admin agent").requiredOption("--product <id>", "Product id, e.g. gal or stratus").requiredOption("--work-class <class>", "Requested work class, e.g. feature_depth or release_integrity").option("--agent-url <url>", "Business Ops Admin agent URL (defaults to GAL_BUSINESS_OPS_AGENT_URL or localhost)").option("--agent-token <token>", "Bearer token for the Business Ops Admin agent").option("--enforcement-mode <mode>", "off, warn, or block (default: GAL_POLICY_ENFORCEMENT_MODE or warn)").option("--json", "Output as JSON").action(async (options) => {
|
|
205357
|
+
const enforcementMode = resolveEnforcementMode(options.enforcementMode);
|
|
205358
|
+
const agentUrl = resolveBusinessOpsAgentUrl(options.agentUrl);
|
|
205359
|
+
const agentToken = options.agentToken || process.env.GAL_BUSINESS_OPS_AGENT_TOKEN || process.env.BUSINESS_OPS_AGENT_TOKEN;
|
|
205360
|
+
if (enforcementMode === "off") {
|
|
205361
|
+
const payload = {
|
|
205362
|
+
schema_version: "gal-policy-check.v1",
|
|
205363
|
+
source: "gal-cli",
|
|
205364
|
+
checked_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
205365
|
+
enforcement_mode: enforcementMode,
|
|
205366
|
+
product_id: options.product,
|
|
205367
|
+
requested_work_class: options.workClass,
|
|
205368
|
+
decision: "allow",
|
|
205369
|
+
decision_reason: "enforcement_off"
|
|
205370
|
+
};
|
|
205371
|
+
if (options.json) {
|
|
205372
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
205373
|
+
} else {
|
|
205374
|
+
console.log(source_default.yellow("Policy enforcement is off."));
|
|
205375
|
+
}
|
|
205376
|
+
return;
|
|
205377
|
+
}
|
|
205378
|
+
const spinner = options.json ? null : ora("Checking product policy...").start();
|
|
205379
|
+
try {
|
|
205380
|
+
const decision = await fetchBusinessOpsDecision({
|
|
205381
|
+
agentUrl,
|
|
205382
|
+
agentToken,
|
|
205383
|
+
product: options.product,
|
|
205384
|
+
workClass: options.workClass
|
|
205385
|
+
});
|
|
205386
|
+
const payload = {
|
|
205387
|
+
schema_version: "gal-policy-check.v1",
|
|
205388
|
+
source: "gal-cli",
|
|
205389
|
+
checked_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
205390
|
+
enforcement_mode: enforcementMode,
|
|
205391
|
+
business_ops_agent_url: agentUrl,
|
|
205392
|
+
decision
|
|
205393
|
+
};
|
|
205394
|
+
spinner?.stop();
|
|
205395
|
+
if (options.json) {
|
|
205396
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
205397
|
+
} else {
|
|
205398
|
+
const decisionText = String(decision.decision || "warn").toUpperCase();
|
|
205399
|
+
const color = decision.decision === "block" ? source_default.red : decision.decision === "allow" ? source_default.green : source_default.yellow;
|
|
205400
|
+
console.log(`${color(decisionText)} ${decision.product_id || options.product}`);
|
|
205401
|
+
console.log(`Reason: ${decision.decision_reason || "unknown"}`);
|
|
205402
|
+
console.log(`Requested work: ${decision.requested_work_class || options.workClass}`);
|
|
205403
|
+
console.log(`Recommended work: ${decision.recommended_work_class || "(none)"}`);
|
|
205404
|
+
if (decision.priority_class) {
|
|
205405
|
+
console.log(`Priority: ${decision.priority_class} ${decision.priority_score ?? ""}`.trim());
|
|
205406
|
+
}
|
|
205407
|
+
const gates = activeGateNames(decision.gates);
|
|
205408
|
+
console.log(`Gates: ${gates.length ? gates.join(",") : "none"}`);
|
|
205409
|
+
if (decision.required_actions?.length) {
|
|
205410
|
+
console.log("Required actions:");
|
|
205411
|
+
for (const action of decision.required_actions) console.log(`- ${action}`);
|
|
205412
|
+
}
|
|
205413
|
+
}
|
|
205414
|
+
if (decision.decision === "block" && enforcementMode === "block") {
|
|
205415
|
+
process.exit(2);
|
|
205416
|
+
}
|
|
205417
|
+
} catch (error2) {
|
|
205418
|
+
spinner?.stop();
|
|
205419
|
+
const msg = error2 instanceof Error ? error2.message : String(error2);
|
|
205420
|
+
const payload = {
|
|
205421
|
+
schema_version: "gal-policy-check.v1",
|
|
205422
|
+
source: "gal-cli",
|
|
205423
|
+
checked_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
205424
|
+
enforcement_mode: enforcementMode,
|
|
205425
|
+
business_ops_agent_url: agentUrl,
|
|
205426
|
+
error: msg
|
|
205427
|
+
};
|
|
205428
|
+
if (options.json) {
|
|
205429
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
205430
|
+
} else {
|
|
205431
|
+
console.error(source_default.yellow("Could not reach Business Ops Admin agent:"), msg);
|
|
205432
|
+
}
|
|
205433
|
+
if (enforcementMode === "block") process.exit(2);
|
|
205434
|
+
}
|
|
205435
|
+
});
|
|
205322
205436
|
command.command("status").description("Show merged effective policy for the organization").option("--json", "Output as JSON").action(async (options) => {
|
|
205323
205437
|
const config = ConfigManager.load();
|
|
205324
205438
|
const authToken = config.authToken || config.apiKey;
|
|
@@ -205383,7 +205497,7 @@ function createPolicyCommand() {
|
|
|
205383
205497
|
});
|
|
205384
205498
|
return command;
|
|
205385
205499
|
}
|
|
205386
|
-
var defaultApiUrl12;
|
|
205500
|
+
var defaultApiUrl12, defaultBusinessOpsAgentUrl;
|
|
205387
205501
|
var init_policy = __esm({
|
|
205388
205502
|
"module_421"() {
|
|
205389
205503
|
"use strict";
|
|
@@ -205393,6 +205507,7 @@ var init_policy = __esm({
|
|
|
205393
205507
|
init_config_manager();
|
|
205394
205508
|
init_constants();
|
|
205395
205509
|
defaultApiUrl12 = constants_default[1];
|
|
205510
|
+
defaultBusinessOpsAgentUrl = "http://127.0.0.1:8787";
|
|
205396
205511
|
}
|
|
205397
205512
|
});
|
|
205398
205513
|
|
|
@@ -239928,7 +240043,7 @@ var init_index = __esm({
|
|
|
239928
240043
|
}
|
|
239929
240044
|
});
|
|
239930
240045
|
|
|
239931
|
-
var cliVersion10 = true ? "0.0.
|
|
240046
|
+
var cliVersion10 = true ? "0.0.667" : "0.0.0-dev";
|
|
239932
240047
|
var args = process.argv.slice(2);
|
|
239933
240048
|
var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
|
|
239934
240049
|
var requestedVersion = args.length === 1 && (args[0] === "--version" || args[0] === "-V");
|
package/package.json
CHANGED