conduct-cli 0.4.6__tar.gz → 0.4.7__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conduct-cli
3
- Version: 0.4.6
3
+ Version: 0.4.7
4
4
  Summary: CLI for Conduct AI — install agents, manage projects, run tests
5
5
  Author-email: Conduct AI <hello@conductai.ai>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "conduct-cli"
7
- version = "0.4.6"
7
+ version = "0.4.7"
8
8
  description = "CLI for Conduct AI — install agents, manage projects, run tests"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -125,7 +125,7 @@ def _detect_ai_tool():
125
125
  return "unknown"
126
126
 
127
127
 
128
- def _post_event(tool_name, tool_input, decision, rule_id=None, message=None, tool_use_id=None):
128
+ def _post_event(tool_name, tool_input, decision, rule_id=None, message=None, session_id=None):
129
129
  try:
130
130
  cfg = json.loads(CONFIG_PATH.read_text()) if CONFIG_PATH.exists() else {}
131
131
  except Exception:
@@ -144,7 +144,7 @@ def _post_event(tool_name, tool_input, decision, rule_id=None, message=None, too
144
144
  "decision": decision,
145
145
  "rule_id": rule_id,
146
146
  "rule_message": message,
147
- "tool_use_id": tool_use_id,
147
+ "session_id": session_id,
148
148
  })
149
149
  api_url = cfg.get("api_url", "https://api.conductai.ai").rstrip("/")
150
150
  script = (
@@ -163,18 +163,19 @@ def _post_event(tool_name, tool_input, decision, rule_id=None, message=None, too
163
163
  )
164
164
 
165
165
 
166
- def _post_usage(tool_use_id, tokens_input, tokens_output, duration_ms, ai_tool):
166
+ def _post_usage(session_id, tool_name, tokens_input, tokens_output, duration_ms):
167
167
  """Fire-and-forget POST to /guard/events/usage"""
168
168
  try:
169
169
  cfg = json.loads(CONFIG_PATH.read_text()) if CONFIG_PATH.exists() else {}
170
170
  except Exception:
171
171
  return
172
172
  workspace_id = cfg.get("workspace_id")
173
- if not workspace_id or not tool_use_id:
173
+ if not workspace_id or not session_id:
174
174
  return
175
175
  payload = json.dumps({
176
176
  "workspace_id": workspace_id,
177
- "tool_use_id": tool_use_id,
177
+ "session_id": session_id,
178
+ "tool_name": tool_name,
178
179
  "tokens_input": tokens_input,
179
180
  "tokens_output": tokens_output,
180
181
  "duration_ms": duration_ms,
@@ -203,12 +204,13 @@ def post_usage_main():
203
204
  data = json.load(sys.stdin)
204
205
  except Exception:
205
206
  sys.exit(0)
206
- tool_use_id = data.get("tool_use_id")
207
+ session_id = data.get("session_id")
208
+ tool_name = (data.get("tool_name") or "").lower()
207
209
  usage = data.get("usage") or {}
208
210
  tokens_input = usage.get("input_tokens", 0)
209
211
  tokens_output = usage.get("output_tokens", 0)
210
212
  duration_ms = data.get("duration_ms")
211
- _post_usage(tool_use_id, tokens_input, tokens_output, duration_ms, _detect_ai_tool())
213
+ _post_usage(session_id, tool_name, tokens_input, tokens_output, duration_ms)
212
214
  sys.exit(0)
213
215
 
214
216
 
@@ -226,15 +228,15 @@ def main():
226
228
  print(f"[ConductGuard] {reason or 'Budget hard cap reached. Contact your manager.'}")
227
229
  sys.exit(2)
228
230
 
231
+ session_id = data.get("session_id")
229
232
  tool_name = (data.get("tool_name") or "").lower()
230
233
  tool_input = data.get("tool_input") or {}
231
- tool_use_id = data.get("tool_use_id")
232
234
 
233
235
  _, action, rule_id, message = _check_policy(tool_name, tool_input)
234
236
 
235
237
  # Always post an event — "allowed" for normal calls, "blocked"/"warned" for violations
236
238
  decision = {"block": "blocked", "warn": "warned", "approval": "blocked"}.get(action, "allowed")
237
- _post_event(tool_name, tool_input, decision, rule_id, message, tool_use_id=tool_use_id)
239
+ _post_event(tool_name, tool_input, decision, rule_id, message, session_id=session_id)
238
240
 
239
241
  if action == "block":
240
242
  print(f"[ConductGuard] {message}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conduct-cli
3
- Version: 0.4.6
3
+ Version: 0.4.7
4
4
  Summary: CLI for Conduct AI — install agents, manage projects, run tests
5
5
  Author-email: Conduct AI <hello@conductai.ai>
6
6
  License: MIT
File without changes
File without changes
File without changes