@gendigital/sage-opencode 0.11.0 → 0.12.0
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/README.md +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +255 -74
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.cjs +194 -88
- package/dist/mcp-server.cjs.map +4 -4
- package/dist/plugin-discovery.d.ts +1 -0
- package/dist/plugin-discovery.d.ts.map +1 -1
- package/dist/plugin-discovery.js +27 -1
- package/dist/plugin-discovery.js.map +1 -1
- package/dist/startup-scan.d.ts +11 -3
- package/dist/startup-scan.d.ts.map +1 -1
- package/dist/startup-scan.js +59 -21
- package/dist/startup-scan.js.map +1 -1
- package/dist/tool-handler.d.ts +2 -1
- package/dist/tool-handler.d.ts.map +1 -1
- package/dist/tool-handler.js +13 -2
- package/dist/tool-handler.js.map +1 -1
- package/package.json +3 -3
- package/resources/threats/dummy.yaml +22 -17
package/dist/mcp-server.cjs
CHANGED
|
@@ -46,13 +46,54 @@ function getProcEnv() {
|
|
|
46
46
|
function getHomeDir() {
|
|
47
47
|
return getProcEnv().HOME || (0, import_node_os.homedir)();
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
async function removeStaleFileLock(lockPath, staleAgeMs) {
|
|
50
|
+
try {
|
|
51
|
+
const s = await fsPromises.stat(lockPath);
|
|
52
|
+
if (Date.now() - s.mtimeMs < staleAgeMs)
|
|
53
|
+
return;
|
|
54
|
+
await fsPromises.rmdir(lockPath);
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function acquireFileLock(filePath, timeoutMs = 250, staleAgeMs = 3e4) {
|
|
59
|
+
const lockPath = `${filePath}.lock`;
|
|
60
|
+
const deadline = Date.now() + timeoutMs;
|
|
61
|
+
while (true) {
|
|
62
|
+
try {
|
|
63
|
+
await fsPromises.mkdir(lockPath);
|
|
64
|
+
return async () => {
|
|
65
|
+
try {
|
|
66
|
+
await fsPromises.rmdir(lockPath);
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
} catch {
|
|
71
|
+
await removeStaleFileLock(lockPath, staleAgeMs);
|
|
72
|
+
const remainingMs = deadline - Date.now();
|
|
73
|
+
if (remainingMs <= 0)
|
|
74
|
+
return void 0;
|
|
75
|
+
await (0, import_promises.setTimeout)(Math.min(50, remainingMs));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async function withFileLock(filePath, callback) {
|
|
80
|
+
const release = await acquireFileLock(filePath);
|
|
81
|
+
if (!release)
|
|
82
|
+
return;
|
|
83
|
+
try {
|
|
84
|
+
return await callback();
|
|
85
|
+
} finally {
|
|
86
|
+
await release();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
var fs, fsPromises, import_node_os, import_promises, name1, name2;
|
|
50
90
|
var init_file_utils = __esm({
|
|
51
91
|
"../core/dist/file-utils.js"() {
|
|
52
92
|
"use strict";
|
|
53
93
|
fs = __toESM(require("node:fs"), 1);
|
|
54
94
|
fsPromises = __toESM(require("node:fs/promises"), 1);
|
|
55
95
|
import_node_os = require("node:os");
|
|
96
|
+
import_promises = require("node:timers/promises");
|
|
56
97
|
name1 = "read";
|
|
57
98
|
name2 = "File";
|
|
58
99
|
}
|
|
@@ -4165,7 +4206,7 @@ var init_zod = __esm({
|
|
|
4165
4206
|
});
|
|
4166
4207
|
|
|
4167
4208
|
// ../core/dist/types.js
|
|
4168
|
-
var nullLogger, ArtifactTypeSchema, ArtifactSchema, VerdictSeveritySchema, ThreatSchema, DecisionSchema, SensitivitySchema, UrlCheckConfigSchema, CacheConfigSchema, LoggingConfigSchema, OperationalLogLevelSchema, OperationalLoggingConfigSchema, FileCheckConfigSchema, PackageCheckConfigSchema, AmsiCheckConfigSchema,
|
|
4209
|
+
var nullLogger, ArtifactTypeSchema, ArtifactSchema, VerdictSeveritySchema, ThreatSchema, DecisionSchema, SensitivitySchema, UrlCheckConfigSchema, CacheConfigSchema, LoggingConfigSchema, OperationalLogLevelSchema, OperationalLoggingConfigSchema, FileCheckConfigSchema, PackageCheckConfigSchema, AmsiCheckConfigSchema, SkillCheckConfigSchema, PiCheckConfigSchema, ExceptionDecisionSchema, ExceptionMatchSchema, ExceptionRuleSchema, ExceptionsFileSchema, ExceptionsConfigSchema, ConfigSchema, HookTypeSchema;
|
|
4169
4210
|
var init_types2 = __esm({
|
|
4170
4211
|
"../core/dist/types.js"() {
|
|
4171
4212
|
"use strict";
|
|
@@ -4242,14 +4283,21 @@ var init_types2 = __esm({
|
|
|
4242
4283
|
AmsiCheckConfigSchema = external_exports.object({
|
|
4243
4284
|
enabled: external_exports.boolean().default(true)
|
|
4244
4285
|
});
|
|
4245
|
-
|
|
4246
|
-
|
|
4286
|
+
SkillCheckConfigSchema = external_exports.object({
|
|
4287
|
+
enabled: external_exports.boolean().default(true),
|
|
4288
|
+
cache_ttl_days: external_exports.number().min(0).default(1),
|
|
4289
|
+
/**
|
|
4290
|
+
* Upload unknown skills (never seen by the analyzer) for deep content
|
|
4291
|
+
* analysis. When false, the scan still looks skills up by content hash and
|
|
4292
|
+
* still flags known-risky ones — but no skill content ever leaves the
|
|
4293
|
+
* machine and the upload worker never runs (lookup-only mode).
|
|
4294
|
+
*/
|
|
4295
|
+
upload_enabled: external_exports.boolean().default(true)
|
|
4296
|
+
});
|
|
4247
4297
|
PiCheckConfigSchema = external_exports.object({
|
|
4248
4298
|
enabled: external_exports.boolean().default(false),
|
|
4249
4299
|
max_content_length: external_exports.number().default(16384),
|
|
4250
|
-
model_path: external_exports.string().optional()
|
|
4251
|
-
high_risk_threshold: external_exports.number().default(DEFAULT_PI_HIGH_RISK_THRESHOLD),
|
|
4252
|
-
medium_risk_threshold: external_exports.number().default(DEFAULT_PI_MEDIUM_RISK_THRESHOLD)
|
|
4300
|
+
model_path: external_exports.string().optional()
|
|
4253
4301
|
});
|
|
4254
4302
|
ExceptionDecisionSchema = external_exports.enum(["allow", "deny"]);
|
|
4255
4303
|
ExceptionMatchSchema = external_exports.enum(["executable", "domain", "path", "plugin", "regex"]);
|
|
@@ -4271,6 +4319,7 @@ var init_types2 = __esm({
|
|
|
4271
4319
|
file_check: FileCheckConfigSchema.default({}),
|
|
4272
4320
|
package_check: PackageCheckConfigSchema.default({}),
|
|
4273
4321
|
amsi_check: AmsiCheckConfigSchema.default({}),
|
|
4322
|
+
skill_check: SkillCheckConfigSchema.default({}),
|
|
4274
4323
|
pi_check: PiCheckConfigSchema.default({}),
|
|
4275
4324
|
heuristics_enabled: external_exports.boolean().default(true),
|
|
4276
4325
|
cache: CacheConfigSchema.default({}),
|
|
@@ -4279,6 +4328,7 @@ var init_types2 = __esm({
|
|
|
4279
4328
|
operational_logging: OperationalLoggingConfigSchema.default({}),
|
|
4280
4329
|
sensitivity: SensitivitySchema.default("balanced"),
|
|
4281
4330
|
disabled_threats: external_exports.array(external_exports.string()).default([]),
|
|
4331
|
+
announce_clean_scans: external_exports.boolean().default(true),
|
|
4282
4332
|
brand_key: external_exports.string().min(1).max(32).regex(/^[a-z0-9_-]+$/u).optional(),
|
|
4283
4333
|
community_iq: external_exports.boolean().default(true)
|
|
4284
4334
|
});
|
|
@@ -4362,7 +4412,7 @@ function sanitizeBrandKey(data, logger2) {
|
|
|
4362
4412
|
if (typeof brandKey === "string" && brandKey.length >= 1 && brandKey.length <= 32 && BRAND_KEY_RE.test(brandKey)) {
|
|
4363
4413
|
return data;
|
|
4364
4414
|
}
|
|
4365
|
-
logger2.warn(`Invalid brand_key in config
|
|
4415
|
+
logger2.warn(`Invalid brand_key in config - ignoring`, { brand_key: brandKey });
|
|
4366
4416
|
const { brand_key: _, ...rest } = data;
|
|
4367
4417
|
return rest;
|
|
4368
4418
|
}
|
|
@@ -4414,6 +4464,21 @@ function parseConfig(raw, path2, logger2) {
|
|
|
4414
4464
|
return defaultConfig(logger2);
|
|
4415
4465
|
}
|
|
4416
4466
|
}
|
|
4467
|
+
async function readExplicitSkillUploadEnabled(configPath, logger2 = nullLogger) {
|
|
4468
|
+
const path2 = configPath ? resolvePath(configPath) : defaultConfigPath();
|
|
4469
|
+
try {
|
|
4470
|
+
const data = JSON.parse(await getFileContent(path2));
|
|
4471
|
+
const skillCheck = data.skill_check;
|
|
4472
|
+
if (skillCheck && typeof skillCheck === "object" && !Array.isArray(skillCheck) && "upload_enabled" in skillCheck) {
|
|
4473
|
+
const value = skillCheck.upload_enabled;
|
|
4474
|
+
if (typeof value === "boolean")
|
|
4475
|
+
return { present: true, value };
|
|
4476
|
+
logger2.warn("Config skill_check.upload_enabled is not a boolean; ignoring", { value });
|
|
4477
|
+
}
|
|
4478
|
+
} catch {
|
|
4479
|
+
}
|
|
4480
|
+
return { present: false, value: false };
|
|
4481
|
+
}
|
|
4417
4482
|
async function loadConfig(configPath, logger2 = nullLogger) {
|
|
4418
4483
|
const path2 = configPath ? resolvePath(configPath) : defaultConfigPath();
|
|
4419
4484
|
try {
|
|
@@ -4422,7 +4487,7 @@ async function loadConfig(configPath, logger2 = nullLogger) {
|
|
|
4422
4487
|
return defaultConfig(logger2);
|
|
4423
4488
|
}
|
|
4424
4489
|
}
|
|
4425
|
-
var import_node_path, SAGE_DIR, BRAND_KEY_RE;
|
|
4490
|
+
var import_node_path, SAGE_DIR, MS_PER_DAY, CLOCK_SKEW_TOLERANCE_MS, BRAND_KEY_RE;
|
|
4426
4491
|
var init_config = __esm({
|
|
4427
4492
|
"../core/dist/config.js"() {
|
|
4428
4493
|
"use strict";
|
|
@@ -4430,6 +4495,8 @@ var init_config = __esm({
|
|
|
4430
4495
|
init_file_utils();
|
|
4431
4496
|
init_types2();
|
|
4432
4497
|
SAGE_DIR = "~/.sage";
|
|
4498
|
+
MS_PER_DAY = 24 * 60 * 60 * 1e3;
|
|
4499
|
+
CLOCK_SKEW_TOLERANCE_MS = 5 * 60 * 1e3;
|
|
4433
4500
|
BRAND_KEY_RE = /^[a-z0-9_-]+$/u;
|
|
4434
4501
|
}
|
|
4435
4502
|
});
|
|
@@ -20440,7 +20507,7 @@ function resolveBranding(brandKey, logger2) {
|
|
|
20440
20507
|
return defaultBranding;
|
|
20441
20508
|
const entry = BRANDS[brandKey];
|
|
20442
20509
|
if (!entry) {
|
|
20443
|
-
logger2?.warn(`Unknown brand_key "${brandKey}" in config
|
|
20510
|
+
logger2?.warn(`Unknown brand_key "${brandKey}" in config - using default branding`);
|
|
20444
20511
|
return defaultBranding;
|
|
20445
20512
|
}
|
|
20446
20513
|
return { ...entry, brand_key: brandKey };
|
|
@@ -20456,88 +20523,74 @@ var APPROVED_TTL_MS = 10 * 60 * 1e3;
|
|
|
20456
20523
|
|
|
20457
20524
|
// ../core/dist/audit-log.js
|
|
20458
20525
|
init_config();
|
|
20526
|
+
|
|
20527
|
+
// ../core/dist/content-snapshot.js
|
|
20528
|
+
var CONTENT_FIELD_LIMITS = Object.freeze({
|
|
20529
|
+
command: 512,
|
|
20530
|
+
url: 512,
|
|
20531
|
+
file_path: 512,
|
|
20532
|
+
package_name: 256,
|
|
20533
|
+
package_version: 128,
|
|
20534
|
+
package_registry: 128
|
|
20535
|
+
});
|
|
20536
|
+
function safeTruncate(value, maxLen) {
|
|
20537
|
+
if (maxLen <= 0)
|
|
20538
|
+
return "";
|
|
20539
|
+
if (value.length <= maxLen)
|
|
20540
|
+
return value;
|
|
20541
|
+
const cutIndex = maxLen;
|
|
20542
|
+
const codeUnit = value.charCodeAt(cutIndex - 1);
|
|
20543
|
+
if (codeUnit >= 55296 && codeUnit <= 56319) {
|
|
20544
|
+
return value.slice(0, cutIndex - 1);
|
|
20545
|
+
}
|
|
20546
|
+
return value.slice(0, cutIndex);
|
|
20547
|
+
}
|
|
20548
|
+
|
|
20549
|
+
// ../core/dist/audit-log.js
|
|
20459
20550
|
init_file_utils();
|
|
20460
20551
|
|
|
20461
20552
|
// ../core/dist/jsonl-log-writer.js
|
|
20462
|
-
var
|
|
20553
|
+
var import_promises2 = require("node:fs/promises");
|
|
20463
20554
|
var import_node_path2 = require("node:path");
|
|
20464
|
-
var import_promises2 = require("node:timers/promises");
|
|
20465
20555
|
init_config();
|
|
20556
|
+
init_file_utils();
|
|
20466
20557
|
var writeQueues = /* @__PURE__ */ new Map();
|
|
20467
|
-
var ROTATE_LOCK_TIMEOUT_MS = 250;
|
|
20468
|
-
var ROTATE_LOCK_STALE_MS = 3e4;
|
|
20469
|
-
var ROTATE_LOCK_POLL_MS = 50;
|
|
20470
20558
|
async function shouldRotate(filePath, maxBytes, maxFiles) {
|
|
20471
20559
|
if (maxBytes <= 0 || maxFiles <= 0)
|
|
20472
20560
|
return false;
|
|
20473
20561
|
try {
|
|
20474
|
-
const s = await (0,
|
|
20562
|
+
const s = await (0, import_promises2.stat)(filePath);
|
|
20475
20563
|
return s.size >= maxBytes;
|
|
20476
20564
|
} catch {
|
|
20477
20565
|
return false;
|
|
20478
20566
|
}
|
|
20479
20567
|
}
|
|
20480
|
-
async function removeStaleRotateLock(lockPath) {
|
|
20481
|
-
try {
|
|
20482
|
-
const s = await (0, import_promises.stat)(lockPath);
|
|
20483
|
-
if (Date.now() - s.mtimeMs < ROTATE_LOCK_STALE_MS)
|
|
20484
|
-
return;
|
|
20485
|
-
await (0, import_promises.rmdir)(lockPath);
|
|
20486
|
-
} catch {
|
|
20487
|
-
}
|
|
20488
|
-
}
|
|
20489
|
-
async function acquireRotateLock(filePath) {
|
|
20490
|
-
const lockPath = `${filePath}.lock`;
|
|
20491
|
-
const deadline = Date.now() + ROTATE_LOCK_TIMEOUT_MS;
|
|
20492
|
-
while (true) {
|
|
20493
|
-
try {
|
|
20494
|
-
await (0, import_promises.mkdir)(lockPath);
|
|
20495
|
-
return async () => {
|
|
20496
|
-
try {
|
|
20497
|
-
await (0, import_promises.rmdir)(lockPath);
|
|
20498
|
-
} catch {
|
|
20499
|
-
}
|
|
20500
|
-
};
|
|
20501
|
-
} catch {
|
|
20502
|
-
await removeStaleRotateLock(lockPath);
|
|
20503
|
-
const remainingMs = deadline - Date.now();
|
|
20504
|
-
if (remainingMs <= 0)
|
|
20505
|
-
return void 0;
|
|
20506
|
-
await (0, import_promises2.setTimeout)(Math.min(ROTATE_LOCK_POLL_MS, remainingMs));
|
|
20507
|
-
}
|
|
20508
|
-
}
|
|
20509
|
-
}
|
|
20510
20568
|
async function rotateIfNeeded(filePath, maxBytes, maxFiles) {
|
|
20511
20569
|
if (!await shouldRotate(filePath, maxBytes, maxFiles))
|
|
20512
20570
|
return;
|
|
20513
|
-
|
|
20514
|
-
if (!releaseLock)
|
|
20515
|
-
return;
|
|
20516
|
-
try {
|
|
20571
|
+
await withFileLock(filePath, async () => {
|
|
20517
20572
|
if (!await shouldRotate(filePath, maxBytes, maxFiles))
|
|
20518
20573
|
return;
|
|
20519
20574
|
try {
|
|
20520
|
-
await (0,
|
|
20575
|
+
await (0, import_promises2.unlink)(`${filePath}.${maxFiles}`);
|
|
20521
20576
|
} catch {
|
|
20522
20577
|
}
|
|
20523
20578
|
for (let i = maxFiles - 1; i >= 1; i--) {
|
|
20524
20579
|
try {
|
|
20525
|
-
await (0,
|
|
20580
|
+
await (0, import_promises2.rename)(`${filePath}.${i}`, `${filePath}.${i + 1}`);
|
|
20526
20581
|
} catch {
|
|
20527
20582
|
}
|
|
20528
20583
|
}
|
|
20529
20584
|
try {
|
|
20530
|
-
await (0,
|
|
20585
|
+
await (0, import_promises2.rename)(filePath, `${filePath}.1`);
|
|
20531
20586
|
} catch {
|
|
20532
20587
|
}
|
|
20533
|
-
}
|
|
20534
|
-
await releaseLock();
|
|
20535
|
-
}
|
|
20588
|
+
});
|
|
20536
20589
|
}
|
|
20537
20590
|
async function appendJsonlEntryNow(path2, config2, entry) {
|
|
20538
|
-
await (0,
|
|
20591
|
+
await (0, import_promises2.mkdir)((0, import_node_path2.dirname)(path2), { recursive: true });
|
|
20539
20592
|
await rotateIfNeeded(path2, config2.max_bytes, config2.max_files);
|
|
20540
|
-
await (0,
|
|
20593
|
+
await (0, import_promises2.appendFile)(path2, `${JSON.stringify(entry)}
|
|
20541
20594
|
`);
|
|
20542
20595
|
}
|
|
20543
20596
|
async function appendJsonlEntry(config2, entry) {
|
|
@@ -20555,6 +20608,7 @@ async function appendJsonlEntry(config2, entry) {
|
|
|
20555
20608
|
}
|
|
20556
20609
|
|
|
20557
20610
|
// ../core/dist/audit-log.js
|
|
20611
|
+
init_types2();
|
|
20558
20612
|
async function getRecentEntries(config2, limit = 100) {
|
|
20559
20613
|
const path2 = resolvePath(config2.path);
|
|
20560
20614
|
try {
|
|
@@ -20734,7 +20788,7 @@ init_file_utils();
|
|
|
20734
20788
|
var import_meta = {};
|
|
20735
20789
|
function resolveVersion() {
|
|
20736
20790
|
if (true)
|
|
20737
|
-
return "0.
|
|
20791
|
+
return "0.12.0";
|
|
20738
20792
|
try {
|
|
20739
20793
|
const pkgPath = (0, import_node_path3.join)((0, import_node_path3.dirname)((0, import_node_url.fileURLToPath)(import_meta.url)), "..", "package.json");
|
|
20740
20794
|
const pkg = JSON.parse(getFileContentSync(pkgPath));
|
|
@@ -20753,8 +20807,11 @@ init_config();
|
|
|
20753
20807
|
init_types2();
|
|
20754
20808
|
var STALE_LOCK_MS = 60 * 60 * 1e3;
|
|
20755
20809
|
|
|
20810
|
+
// ../core/dist/clients/model-manifest.js
|
|
20811
|
+
init_config();
|
|
20812
|
+
|
|
20756
20813
|
// ../core/dist/sage-proxy.js
|
|
20757
|
-
function
|
|
20814
|
+
function mapSageHostOs(platform) {
|
|
20758
20815
|
switch (platform) {
|
|
20759
20816
|
case "win32":
|
|
20760
20817
|
return "WINDOWS";
|
|
@@ -20766,21 +20823,37 @@ function mapSageProxyOs(platform) {
|
|
|
20766
20823
|
return platform;
|
|
20767
20824
|
}
|
|
20768
20825
|
}
|
|
20769
|
-
function
|
|
20826
|
+
function mapSageHostArchitecture(arch) {
|
|
20770
20827
|
return arch.toUpperCase();
|
|
20771
20828
|
}
|
|
20829
|
+
function buildSageUserConfig(config2) {
|
|
20830
|
+
return {
|
|
20831
|
+
sensitivity: config2.sensitivity,
|
|
20832
|
+
url_check_enabled: config2.url_check.enabled,
|
|
20833
|
+
file_check_enabled: config2.file_check.enabled,
|
|
20834
|
+
package_check_enabled: config2.package_check.enabled,
|
|
20835
|
+
heuristics_enabled: config2.heuristics_enabled,
|
|
20836
|
+
pi_check_enabled: config2.pi_check.enabled,
|
|
20837
|
+
community_iq_enabled: config2.community_iq,
|
|
20838
|
+
// Optional-chained + defaulted: real callers pass a loadConfig result (skill_check
|
|
20839
|
+
// always present via the schema default), but this feeds fail-open telemetry, so a
|
|
20840
|
+
// partial config must never crash the envelope build.
|
|
20841
|
+
skill_check_upload_enabled: config2.skill_check?.upload_enabled ?? true
|
|
20842
|
+
};
|
|
20843
|
+
}
|
|
20772
20844
|
function buildSageProxyEnvelope(args) {
|
|
20773
20845
|
return {
|
|
20774
20846
|
identity: { uuid: args.iid },
|
|
20775
20847
|
product: { version_app: args.versionApp },
|
|
20776
20848
|
platform: {
|
|
20777
|
-
os: args.platformOs ??
|
|
20778
|
-
architecture: args.platformArchitecture ??
|
|
20849
|
+
os: args.platformOs ?? mapSageHostOs(process.platform),
|
|
20850
|
+
architecture: args.platformArchitecture ?? mapSageHostArchitecture(process.arch)
|
|
20779
20851
|
},
|
|
20780
20852
|
agent: {
|
|
20781
20853
|
agent_runtime: args.agentRuntime,
|
|
20782
20854
|
agent_runtime_version: args.agentRuntimeVersion
|
|
20783
|
-
}
|
|
20855
|
+
},
|
|
20856
|
+
...args.config ? { config: buildSageUserConfig(args.config) } : {}
|
|
20784
20857
|
};
|
|
20785
20858
|
}
|
|
20786
20859
|
|
|
@@ -20817,39 +20890,24 @@ init_types2();
|
|
|
20817
20890
|
// ../core/dist/index.js
|
|
20818
20891
|
init_pi_deps_installer();
|
|
20819
20892
|
|
|
20893
|
+
// ../core/dist/clients/skill-analyze.js
|
|
20894
|
+
init_types2();
|
|
20895
|
+
|
|
20820
20896
|
// ../core/dist/clients/skill-check.js
|
|
20821
20897
|
init_types2();
|
|
20822
20898
|
|
|
20823
20899
|
// ../core/dist/index.js
|
|
20824
20900
|
init_config();
|
|
20825
20901
|
|
|
20902
|
+
// ../core/dist/config-defaults.js
|
|
20903
|
+
init_file_utils();
|
|
20904
|
+
init_types2();
|
|
20905
|
+
|
|
20826
20906
|
// ../core/dist/config-diagnostics.js
|
|
20827
20907
|
init_config();
|
|
20828
20908
|
init_file_utils();
|
|
20829
20909
|
init_types2();
|
|
20830
20910
|
|
|
20831
|
-
// ../core/dist/content-snapshot.js
|
|
20832
|
-
var CONTENT_FIELD_LIMITS = Object.freeze({
|
|
20833
|
-
command: 512,
|
|
20834
|
-
url: 512,
|
|
20835
|
-
file_path: 512,
|
|
20836
|
-
package_name: 256,
|
|
20837
|
-
package_version: 128,
|
|
20838
|
-
package_registry: 128
|
|
20839
|
-
});
|
|
20840
|
-
function safeTruncate(value, maxLen) {
|
|
20841
|
-
if (maxLen <= 0)
|
|
20842
|
-
return "";
|
|
20843
|
-
if (value.length <= maxLen)
|
|
20844
|
-
return value;
|
|
20845
|
-
const cutIndex = maxLen;
|
|
20846
|
-
const codeUnit = value.charCodeAt(cutIndex - 1);
|
|
20847
|
-
if (codeUnit >= 55296 && codeUnit <= 56319) {
|
|
20848
|
-
return value.slice(0, cutIndex - 1);
|
|
20849
|
-
}
|
|
20850
|
-
return value.slice(0, cutIndex);
|
|
20851
|
-
}
|
|
20852
|
-
|
|
20853
20911
|
// ../core/dist/extended-info.js
|
|
20854
20912
|
var import_promises3 = require("node:fs/promises");
|
|
20855
20913
|
var import_node_os2 = require("node:os");
|
|
@@ -21056,6 +21114,9 @@ async function getInstallationId(sageDirPath) {
|
|
|
21056
21114
|
// ../core/dist/detection-telemetry.js
|
|
21057
21115
|
init_types2();
|
|
21058
21116
|
|
|
21117
|
+
// ../core/dist/e2e-capture.js
|
|
21118
|
+
var CAPTURE_MAX_BYTES = 10 * 1024 * 1024;
|
|
21119
|
+
|
|
21059
21120
|
// ../core/dist/policy.js
|
|
21060
21121
|
init_types2();
|
|
21061
21122
|
|
|
@@ -21102,6 +21163,32 @@ init_file_utils();
|
|
|
21102
21163
|
init_config();
|
|
21103
21164
|
init_types2();
|
|
21104
21165
|
|
|
21166
|
+
// ../core/dist/install-state.js
|
|
21167
|
+
init_config();
|
|
21168
|
+
init_file_utils();
|
|
21169
|
+
|
|
21170
|
+
// ../core/dist/notices.js
|
|
21171
|
+
init_config();
|
|
21172
|
+
var SKILL_UPLOAD_NOTICE = {
|
|
21173
|
+
id: "skill_upload_v1",
|
|
21174
|
+
body: () => [
|
|
21175
|
+
"unknown skills \u2014 each skill's SKILL.md and every supporting file in its",
|
|
21176
|
+
"folder \u2014 will be uploaded and checked against potential malicious artifacts",
|
|
21177
|
+
"starting next session. To keep skill content on this machine, set",
|
|
21178
|
+
'"skill_check": { "upload_enabled": false } in ~/.sage/config.json.'
|
|
21179
|
+
],
|
|
21180
|
+
// Suppressed once the user has explicitly set upload_enabled either way: an
|
|
21181
|
+
// explicit choice needs no consent prompt (the rollout obeys it directly).
|
|
21182
|
+
isEligible: async ({ configPath, logger: logger2 }) => !(await readExplicitSkillUploadEnabled(configPath, logger2)).present
|
|
21183
|
+
};
|
|
21184
|
+
var NOTICES = {
|
|
21185
|
+
[SKILL_UPLOAD_NOTICE.id]: SKILL_UPLOAD_NOTICE
|
|
21186
|
+
};
|
|
21187
|
+
|
|
21188
|
+
// ../core/dist/install-state.js
|
|
21189
|
+
init_types2();
|
|
21190
|
+
var SKILL_UPLOAD_NOTICE_ID = SKILL_UPLOAD_NOTICE.id;
|
|
21191
|
+
|
|
21105
21192
|
// ../core/dist/model-download.js
|
|
21106
21193
|
init_types2();
|
|
21107
21194
|
|
|
@@ -21223,6 +21310,7 @@ function createOperationalLogger(config2, runtime) {
|
|
|
21223
21310
|
|
|
21224
21311
|
// ../core/dist/plugin-scan-cache.js
|
|
21225
21312
|
var import_node_path6 = require("node:path");
|
|
21313
|
+
init_config();
|
|
21226
21314
|
init_file_utils();
|
|
21227
21315
|
init_types2();
|
|
21228
21316
|
var DEFAULT_CACHE_PATH = (0, import_node_path6.join)(getHomeDir(), ".sage", "plugin_scan_cache.json");
|
|
@@ -21230,6 +21318,22 @@ var DEFAULT_CACHE_PATH = (0, import_node_path6.join)(getHomeDir(), ".sage", "plu
|
|
|
21230
21318
|
// ../core/dist/plugin-scanner.js
|
|
21231
21319
|
init_config();
|
|
21232
21320
|
init_file_utils();
|
|
21321
|
+
|
|
21322
|
+
// ../core/dist/skill-id.js
|
|
21323
|
+
var MAX_SKILL_BYTES = 50 * 1024 * 1024;
|
|
21324
|
+
|
|
21325
|
+
// ../core/dist/skill-pending.js
|
|
21326
|
+
init_config();
|
|
21327
|
+
init_file_utils();
|
|
21328
|
+
init_types2();
|
|
21329
|
+
var PENDING_TTL_MS = 60 * 60 * 1e3;
|
|
21330
|
+
|
|
21331
|
+
// ../core/dist/skill-verdict-cache.js
|
|
21332
|
+
init_config();
|
|
21333
|
+
init_file_utils();
|
|
21334
|
+
init_types2();
|
|
21335
|
+
|
|
21336
|
+
// ../core/dist/plugin-scanner.js
|
|
21233
21337
|
init_types2();
|
|
21234
21338
|
var MAX_FILE_SIZE = 512 * 1024;
|
|
21235
21339
|
|
|
@@ -21265,6 +21369,7 @@ init_types2();
|
|
|
21265
21369
|
init_types2();
|
|
21266
21370
|
|
|
21267
21371
|
// ../core/dist/version-check.js
|
|
21372
|
+
init_config();
|
|
21268
21373
|
init_types2();
|
|
21269
21374
|
|
|
21270
21375
|
// ../core/dist/tool-names.js
|
|
@@ -31649,7 +31754,8 @@ ${reasoning}`;
|
|
|
31649
31754
|
iid,
|
|
31650
31755
|
versionApp,
|
|
31651
31756
|
agentRuntime: agent_runtime,
|
|
31652
|
-
agentRuntimeVersion: runtimeVersion
|
|
31757
|
+
agentRuntimeVersion: runtimeVersion,
|
|
31758
|
+
config: config2
|
|
31653
31759
|
}),
|
|
31654
31760
|
block_event: {
|
|
31655
31761
|
hook_type,
|
|
@@ -31763,7 +31869,7 @@ async function main() {
|
|
|
31763
31869
|
);
|
|
31764
31870
|
const branding = resolveBranding(config2.brand_key, logger);
|
|
31765
31871
|
await runSageMcpServerStdio({
|
|
31766
|
-
version: "0.
|
|
31872
|
+
version: "0.12.0",
|
|
31767
31873
|
logger,
|
|
31768
31874
|
branding
|
|
31769
31875
|
});
|