@pinta-ai/pinta-gemini 0.2.1 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.js +10 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -130,6 +130,13 @@ function asString(v) {
130
130
 
131
131
  // src/core/guard.ts
132
132
  var TIMEOUT_MS = 50;
133
+ var GUARD_UA = "pinta-gemini/0.4.0";
134
+ function shellCommandText(toolInput) {
135
+ if (!toolInput || typeof toolInput !== "object" || Array.isArray(toolInput)) return void 0;
136
+ const o = toolInput;
137
+ const v = o["command"] ?? o["CommandLine"];
138
+ return typeof v === "string" ? v : void 0;
139
+ }
133
140
  function sleep(ms) {
134
141
  return new Promise(
135
142
  (_, reject) => setTimeout(() => {
@@ -149,6 +156,7 @@ async function evaluateGuard(input, endpoint, relayToken) {
149
156
  method: "POST",
150
157
  headers: {
151
158
  "content-type": "application/json",
159
+ "user-agent": GUARD_UA,
152
160
  "x-pinta-relay-token": relayToken ?? process.env.PINTA_RELAY_TOKEN ?? ""
153
161
  },
154
162
  body: JSON.stringify({ input })
@@ -402,7 +410,7 @@ function redact(input, opts = {}) {
402
410
  }
403
411
 
404
412
  // src/core/otlp.ts
405
- var PLUGIN_VERSION = "0.2.1";
413
+ var PLUGIN_VERSION = "0.3.0";
406
414
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
407
415
  function ulidToTraceId(ulid) {
408
416
  if (ulid.length !== 26) throw new Error(`ulidToTraceId: expected 26 chars, got ${ulid.length}`);
@@ -668,7 +676,7 @@ async function main() {
668
676
  const trace = new TraceManager(config);
669
677
  const traceId = isTurnStart(agent, c, ev) ? trace.newTrace(sessionId) : trace.currentTrace(sessionId);
670
678
  if (c.hook === gateEvent(agent)) {
671
- const rawToolInput = typeof c.tool_input === "string" ? c.tool_input : JSON.stringify(c.tool_input ?? null);
679
+ const rawToolInput = shellCommandText(c.tool_input) ?? (typeof c.tool_input === "string" ? c.tool_input : JSON.stringify(c.tool_input ?? null));
672
680
  guard = await evaluateGuard(
673
681
  { spanId: sessionId, toolName: c.tool_name, toolInput: c.tool_input, rawTextFields: { toolInput: rawToolInput } },
674
682
  config.guardEndpoint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinta-ai/pinta-gemini",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "Unified OTLP forwarder + guard adapter for Gemini CLI and Antigravity (agy v1.0.x / 2.0) hooks",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",