Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jfrog",
"version": "0.1.15",
"version": "0.1.16",
"description": "JFrog skills and the JFrog MCP server for Codex \u2014 interact with the JFrog Platform.",
"author": {
"name": "JFrog",
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/sync-modules-vendor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"repo": "JFROG/jfrog-agent-hooks",
"pin": "jfrog-agent-hooks/v0.15.1",
"pin": "jfrog-agent-hooks/v0.16.0",
"paths": [
"modules"
]
Expand Down
5 changes: 5 additions & 0 deletions modules/claude-session-start.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
parseWorkspaceRoots,
} from "./core/io.mjs";
import { setLogContext, createLogger } from "./core/logger.mjs";
import { startTelemetry } from "./core/telemetry-runner.mjs";

const HARNESS_ID = "claude_code";
const log = createLogger("session-start");
Expand Down Expand Up @@ -70,6 +71,10 @@ async function main() {
for (const w of agentsConfigLoadWarnings()) {
log.warn(w.message, { path: w.path });
}
// After the harness check, so a payload identified as another harness never
// reports as claude_code (an unidentified one still does). Returns at once;
// the send runs in its own process.
startTelemetry(HARNESS_ID);
const text = await runCapability(capability, {
ide: HARNESS_ID,
sessionId,
Expand Down
5 changes: 5 additions & 0 deletions modules/codex-session-start.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
parseWorkspaceRoots,
} from "./core/io.mjs";
import { setLogContext, createLogger } from "./core/logger.mjs";
import { startTelemetry } from "./core/telemetry-runner.mjs";

const HARNESS_ID = "codex";
const log = createLogger("session-start");
Expand Down Expand Up @@ -75,6 +76,10 @@ async function main() {
for (const w of agentsConfigLoadWarnings()) {
log.warn(w.message, { path: w.path });
}
// After the harness check, so a payload identified as another harness never
// reports as codex (an unidentified one still does). Returns at once; the
// send runs in its own process.
startTelemetry(HARNESS_ID);
const text = await runCapability(capability, {
ide: HARNESS_ID,
sessionId,
Expand Down
5 changes: 5 additions & 0 deletions modules/copilot-session-start.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
parseWorkspaceRoots,
} from "./core/io.mjs";
import { setLogContext, createLogger } from "./core/logger.mjs";
import { startTelemetry } from "./core/telemetry-runner.mjs";

const HARNESS_ID = "copilot";
const log = createLogger("session-start");
Expand Down Expand Up @@ -75,6 +76,10 @@ async function main() {
for (const w of agentsConfigLoadWarnings()) {
log.warn(w.message, { path: w.path });
}
// After the harness check, so a payload identified as another harness never
// reports as vscode (an unidentified one still does). Returns at once; the
// send runs in its own process.
startTelemetry(HARNESS_ID);
const text = await runCapability(capability, {
ide: HARNESS_ID,
sessionId,
Expand Down
21 changes: 18 additions & 3 deletions modules/core/agent-guard-check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import process from "node:process";
import { isMainEntry } from "./entry.mjs";
import { jfInvocation } from "./jf-process.mjs";
import { skillsProductUserAgent } from "./jf-user-agent.mjs";
import { proxyFetch } from "./proxy-fetch.mjs";

export const SETTINGS_PATH =
"/ml/core/api/v1/administration/account-settings/mcp_gateway_plugin_enabled";
Expand Down Expand Up @@ -77,6 +78,7 @@ function makeDebug(env, debug) {
* env?: NodeJS.ProcessEnv,
* execFileSyncFn?: typeof execFileSync,
* debug?: (message: string) => void,
* platform?: NodeJS.Platform,
* }} [opts]
* @returns {{ baseUrl: string, token: string, source: string } | null}
*/
Expand All @@ -92,6 +94,7 @@ export function resolveAgentGuardCredentials(opts = {}) {
env,
execFileSyncFn: execFn,
debug,
platform: opts.platform,
});
if (fromCli) return fromCli;
debug(
Expand Down Expand Up @@ -119,6 +122,7 @@ export function resolveAgentGuardCredentials(opts = {}) {
env,
execFileSyncFn: execFn,
debug,
platform: opts.platform,
});
}

Expand All @@ -137,15 +141,26 @@ function resolveFromCliConfig(opts) {
const exportArgs = opts.serverId
? ["config", "export", opts.serverId]
: ["config", "export"];
const invocation = jfInvocation(exportArgs, { env });
const invocation = jfInvocation(exportArgs, {
env,
platform: opts.platform,
});
if (!invocation.command) {
debug(
invocation.refused
? `'jf config export' not run: ${invocation.refused} for cmd.exe`
: "'jf config export' skipped: jf not on PATH",
);
return null;
}
let exported;
try {
exported = execFn(invocation.command, invocation.args, {
encoding: "utf8",
stdio: ["ignore", "pipe", "ignore"],
timeout: 2000,
windowsHide: true,
shell: false,
shell: invocation.shell,
env,
}).trim();
} catch (error) {
Expand Down Expand Up @@ -200,7 +215,7 @@ function strip({ notFound: _notFound, ...result }) {
*/
export async function isGatewayPluginEnabled(baseUrl, token, opts = {}) {
const debug = opts.debug ?? (() => {});
const fetchFn = opts.fetchFn ?? fetch;
const fetchFn = opts.fetchFn ?? proxyFetch;
const timeoutMs = opts.timeoutMs ?? REQUEST_TIMEOUT_MS;

const root = baseUrl.replace(/\/+$/, "").replace(/\/artifactory$/, "");
Expand Down
13 changes: 12 additions & 1 deletion modules/core/agents-config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export function getAgentsConfigSection(name) {
return section && typeof section === "object" ? section : null;
}

/** @returns {{ logLevel: string, packageResolution: object }} merged with documented defaults */
/** @returns {{ logLevel: string, packageResolution: object, telemetry: { enabled: boolean } }} merged with documented defaults */
export function loadAgentsConfig() {
const file = readAgentsConfigRaw() ?? {};
const pr =
Expand All @@ -284,6 +284,8 @@ export function loadAgentsConfig() {
pr.defaultGlobalRepos && typeof pr.defaultGlobalRepos === "object"
? normalizeRepoMap(pr.defaultGlobalRepos)
: {};
const telemetry =
file.telemetry && typeof file.telemetry === "object" ? file.telemetry : {};

return {
logLevel: normalizeLogLevel(file.logLevel),
Expand All @@ -295,6 +297,7 @@ export function loadAgentsConfig() {
defaultGlobalRepos,
autoSetup: normalizeAutoSetup(pr.autoSetup),
},
telemetry: { enabled: normalizeTelemetryEnabled(telemetry.enabled) },
};
}

Expand Down Expand Up @@ -437,6 +440,14 @@ export function isAutoSetup(type) {
return Array.isArray(e) && e.includes(type);
}

/** Off only for `false` or a string that lowercases to "false"; anything else is on. */
function normalizeTelemetryEnabled(raw) {
return !(
raw === false ||
(typeof raw === "string" && raw.toLowerCase() === "false")
);
}

function normalizeLogLevel(level) {
const s = typeof level === "string" ? level.toLowerCase() : "";
const allowed = new Set(["silent", "debug", "info", "warn", "error"]);
Expand Down
Loading
Loading