@pinta-ai/pinta-gemini 0.2.0 → 0.3.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/dist/index.js +12 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -130,6 +130,12 @@ function asString(v) {
|
|
|
130
130
|
|
|
131
131
|
// src/core/guard.ts
|
|
132
132
|
var TIMEOUT_MS = 50;
|
|
133
|
+
function shellCommandText(toolInput) {
|
|
134
|
+
if (!toolInput || typeof toolInput !== "object" || Array.isArray(toolInput)) return void 0;
|
|
135
|
+
const o = toolInput;
|
|
136
|
+
const v = o["command"] ?? o["CommandLine"];
|
|
137
|
+
return typeof v === "string" ? v : void 0;
|
|
138
|
+
}
|
|
133
139
|
function sleep(ms) {
|
|
134
140
|
return new Promise(
|
|
135
141
|
(_, reject) => setTimeout(() => {
|
|
@@ -139,7 +145,7 @@ function sleep(ms) {
|
|
|
139
145
|
}, ms)
|
|
140
146
|
);
|
|
141
147
|
}
|
|
142
|
-
async function evaluateGuard(input, endpoint) {
|
|
148
|
+
async function evaluateGuard(input, endpoint, relayToken) {
|
|
143
149
|
if (!endpoint) return null;
|
|
144
150
|
if (process.env.PINTA_GUARD_DISABLED === "1") return null;
|
|
145
151
|
const start = Date.now();
|
|
@@ -149,7 +155,7 @@ async function evaluateGuard(input, endpoint) {
|
|
|
149
155
|
method: "POST",
|
|
150
156
|
headers: {
|
|
151
157
|
"content-type": "application/json",
|
|
152
|
-
"x-pinta-relay-token": process.env.PINTA_RELAY_TOKEN ?? ""
|
|
158
|
+
"x-pinta-relay-token": relayToken ?? process.env.PINTA_RELAY_TOKEN ?? ""
|
|
153
159
|
},
|
|
154
160
|
body: JSON.stringify({ input })
|
|
155
161
|
}),
|
|
@@ -402,7 +408,7 @@ function redact(input, opts = {}) {
|
|
|
402
408
|
}
|
|
403
409
|
|
|
404
410
|
// src/core/otlp.ts
|
|
405
|
-
var PLUGIN_VERSION = "0.
|
|
411
|
+
var PLUGIN_VERSION = "0.3.0";
|
|
406
412
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
407
413
|
function ulidToTraceId(ulid) {
|
|
408
414
|
if (ulid.length !== 26) throw new Error(`ulidToTraceId: expected 26 chars, got ${ulid.length}`);
|
|
@@ -668,10 +674,11 @@ async function main() {
|
|
|
668
674
|
const trace = new TraceManager(config);
|
|
669
675
|
const traceId = isTurnStart(agent, c, ev) ? trace.newTrace(sessionId) : trace.currentTrace(sessionId);
|
|
670
676
|
if (c.hook === gateEvent(agent)) {
|
|
671
|
-
const rawToolInput = typeof c.tool_input === "string" ? c.tool_input : JSON.stringify(c.tool_input ?? null);
|
|
677
|
+
const rawToolInput = shellCommandText(c.tool_input) ?? (typeof c.tool_input === "string" ? c.tool_input : JSON.stringify(c.tool_input ?? null));
|
|
672
678
|
guard = await evaluateGuard(
|
|
673
679
|
{ spanId: sessionId, toolName: c.tool_name, toolInput: c.tool_input, rawTextFields: { toolInput: rawToolInput } },
|
|
674
|
-
config.guardEndpoint
|
|
680
|
+
config.guardEndpoint,
|
|
681
|
+
config.headers["x-pinta-relay-token"]
|
|
675
682
|
);
|
|
676
683
|
}
|
|
677
684
|
const product = isGemini(agent) ? void 0 : antigravityProduct(ev);
|
package/package.json
CHANGED