agentic-fabriq-sdk 0.1.15__py3-none-any.whl → 0.1.17__py3-none-any.whl

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.

Potentially problematic release.


This version of agentic-fabriq-sdk might be problematic. Click here for more details.

af_cli/commands/tools.py CHANGED
@@ -224,30 +224,28 @@ def add(
224
224
  tool: str = typer.Argument(..., help="Tool name (google_drive, google_slides, slack, notion, github, etc.)"),
225
225
  connection_id: str = typer.Option(..., "--connection-id", help="Unique connection ID"),
226
226
  display_name: str = typer.Option(None, "--display-name", help="Human-readable name"),
227
- method: str = typer.Option(..., "--method", help="Connection method: 'api', 'credentials', or 'oauth'"),
227
+ method: str = typer.Option(..., "--method", help="Connection method: 'api_credentials' or 'oauth'"),
228
228
 
229
- # API method fields
230
- token: str = typer.Option(None, "--token", help="API token (for api method)"),
231
-
232
- # Credentials method fields
233
- client_id: str = typer.Option(None, "--client-id", help="OAuth client ID (for credentials method)"),
234
- client_secret: str = typer.Option(None, "--client-secret", help="OAuth client secret (for credentials method)"),
229
+ # API credentials method fields (can be either a token OR client_id/secret)
230
+ token: str = typer.Option(None, "--token", help="API token (for simple token-based auth like Notion, Slack bot)"),
231
+ client_id: str = typer.Option(None, "--client-id", help="OAuth client ID (for app-based auth like Google, Slack)"),
232
+ client_secret: str = typer.Option(None, "--client-secret", help="OAuth client secret (for app-based auth)"),
235
233
  redirect_uri: str = typer.Option(None, "--redirect-uri", help="OAuth redirect URI (optional, auto-generated)"),
236
234
  ):
237
235
  """
238
236
  Add a new tool connection with credentials.
239
237
 
240
238
  Examples:
241
- # Notion (api method - single token)
242
- afctl tools add notion --connection-id notion-work --method api --token "secret_abc123"
239
+ # Notion (api_credentials method - single token)
240
+ afctl tools add notion --connection-id notion-work --method api_credentials --token "secret_abc123"
243
241
 
244
- # Google (credentials method - OAuth app)
245
- afctl tools add google --connection-id google-work --method credentials \\
242
+ # Google (api_credentials method - OAuth app)
243
+ afctl tools add google_drive --connection-id google-work --method api_credentials \\
246
244
  --client-id "123.apps.googleusercontent.com" \\
247
245
  --client-secret "GOCSPX-abc123"
248
246
 
249
- # Slack bot (api method)
250
- afctl tools add slack --connection-id slack-bot --method api --token "xoxb-123..."
247
+ # Slack bot (api_credentials method - single token)
248
+ afctl tools add slack --connection-id slack-bot --method api_credentials --token "xoxb-123..."
251
249
  """
252
250
  try:
253
251
  from af_cli.core.config import get_config
@@ -276,23 +274,24 @@ def add(
276
274
  raise typer.Exit(1)
277
275
 
278
276
  # Validate method
279
- if method not in ["api", "credentials", "oauth"]:
280
- error("Method must be 'api', 'credentials', or 'oauth'")
277
+ if method not in ["api_credentials", "oauth"]:
278
+ error("Method must be 'api_credentials' or 'oauth'")
281
279
  raise typer.Exit(1)
282
280
 
283
- # Validate API method requirements
284
- if method == "api":
285
- if not token:
286
- error("API method requires --token")
287
- info(f"Example: afctl tools add {tool} --connection-id {connection_id} --method api --token YOUR_TOKEN")
288
- raise typer.Exit(1)
289
-
290
- # Validate credentials method requirements
291
- elif method == "credentials":
292
- if not client_id or not client_secret:
293
- error("Credentials method requires --client-id and --client-secret")
294
- info(f"Example: afctl tools add {tool} --connection-id {connection_id} --method credentials \\")
295
- info(f" --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET")
281
+ # Validate api_credentials method requirements
282
+ if method == "api_credentials":
283
+ # Must have either token OR (client_id + client_secret)
284
+ has_token = bool(token)
285
+ has_oauth_creds = bool(client_id and client_secret)
286
+
287
+ if not has_token and not has_oauth_creds:
288
+ error("api_credentials method requires either:")
289
+ info(" • --token (for simple token auth like Notion, Slack bot)")
290
+ info(" • --client-id and --client-secret (for OAuth app auth like Google)")
291
+ info("")
292
+ info(f"Examples:")
293
+ info(f" afctl tools add {tool} --connection-id {connection_id} --method api_credentials --token YOUR_TOKEN")
294
+ info(f" afctl tools add {tool} --connection-id {connection_id} --method api_credentials --client-id ID --client-secret SECRET")
296
295
  raise typer.Exit(1)
297
296
 
298
297
  info(f"Creating connection: {connection_id}")
@@ -310,51 +309,59 @@ def add(
310
309
  client.post("/api/v1/user-connections", data=connection_data)
311
310
  success(f"✅ Connection entry created: {connection_id}")
312
311
 
313
- # Step 2: Store credentials based on method
314
- if method == "credentials" or method == "oauth":
312
+ # Step 2: Store credentials based on what was provided
313
+ if method == "api_credentials":
315
314
  # Determine the API base tool name (Google tools all use "google")
316
315
  api_tool_name = "google" if (tool.startswith("google_") or tool == "gmail") else tool
317
316
 
318
- # Auto-generate redirect_uri if not provided
319
- if not redirect_uri:
320
- config = get_config()
321
- redirect_uri = f"{config.gateway_url}/api/v1/tools/{api_tool_name}/oauth/callback"
322
- info(f"Using default redirect URI: {redirect_uri}")
323
-
324
- # Store OAuth app config
325
- info("Storing OAuth app credentials...")
326
- config_payload = {
327
- "client_id": client_id,
328
- "client_secret": client_secret,
329
- }
330
- if redirect_uri:
331
- config_payload["redirect_uri"] = redirect_uri
332
-
333
- client.post(
334
- f"/api/v1/tools/{api_tool_name}/config?connection_id={connection_id}",
335
- data=config_payload
336
- )
337
- success("✅ OAuth app credentials stored")
338
- info("")
339
- info(f"Next: Run 'afctl tools connect {connection_id}' to complete OAuth setup")
340
-
341
- elif method == "api":
342
- # Store API token directly
343
- info("Storing API credentials...")
344
-
345
- # Tool-specific endpoint and payload mappings
346
- if tool == "notion":
347
- # Notion uses /config endpoint with integration_token field
348
- endpoint = f"/api/v1/tools/{tool}/config?connection_id={connection_id}"
349
- cred_payload = {"integration_token": token}
350
- else:
351
- # Generic tools use /connection endpoint with api_token field
352
- endpoint = f"/api/v1/tools/{tool}/connection?connection_id={connection_id}"
353
- cred_payload = {"api_token": token}
354
-
355
- client.post(endpoint, data=cred_payload)
356
- success("✅ API credentials stored")
357
- success(f"✅ Connection '{connection_id}' is ready to use!")
317
+ if token:
318
+ # Simple token-based auth (Notion, Slack bot, etc.)
319
+ info("Storing API token...")
320
+
321
+ # Tool-specific endpoint and payload mappings
322
+ if tool == "notion":
323
+ # Notion uses /config endpoint with integration_token field
324
+ endpoint = f"/api/v1/tools/{tool}/config?connection_id={connection_id}"
325
+ cred_payload = {"integration_token": token}
326
+ else:
327
+ # Generic tools use /connection endpoint with api_token field
328
+ endpoint = f"/api/v1/tools/{tool}/connection?connection_id={connection_id}"
329
+ cred_payload = {"api_token": token}
330
+
331
+ client.post(endpoint, data=cred_payload)
332
+ success("✅ API token stored")
333
+ success(f"✅ Connection '{connection_id}' is ready to use!")
334
+
335
+ elif client_id and client_secret:
336
+ # OAuth app credentials (Google, Slack app, etc.)
337
+ # Auto-generate redirect_uri if not provided
338
+ if not redirect_uri:
339
+ config = get_config()
340
+ redirect_uri = f"{config.gateway_url}/api/v1/tools/{api_tool_name}/oauth/callback"
341
+ info(f"Using default redirect URI: {redirect_uri}")
342
+
343
+ # Store OAuth app config
344
+ info("Storing OAuth app credentials...")
345
+ config_payload = {
346
+ "client_id": client_id,
347
+ "client_secret": client_secret,
348
+ }
349
+ if redirect_uri:
350
+ config_payload["redirect_uri"] = redirect_uri
351
+
352
+ client.post(
353
+ f"/api/v1/tools/{api_tool_name}/config?connection_id={connection_id}",
354
+ data=config_payload
355
+ )
356
+ success("✅ OAuth app credentials stored")
357
+ info("")
358
+ info(f"Next: Run 'afctl tools connect {connection_id}' to complete OAuth setup")
359
+
360
+ elif method == "oauth":
361
+ # OAuth flow (legacy, redirect to api_credentials)
362
+ error("The 'oauth' method is deprecated. Please use 'api_credentials' instead.")
363
+ info("All credential storage now uses the 'api_credentials' method.")
364
+ raise typer.Exit(1)
358
365
 
359
366
  # Show helpful info
360
367
  info("")
@@ -394,14 +401,7 @@ def connect(
394
401
  tool = connection["tool"]
395
402
  method = connection["method"]
396
403
 
397
- # Only credentials/oauth method needs OAuth completion
398
- if method not in ["credentials", "oauth"]:
399
- error(f"Connection '{connection_id}' uses '{method}' method")
400
- info("Only 'credentials' or 'oauth' method connections need OAuth setup")
401
- info("API connections are already connected after 'afctl tools add'")
402
- raise typer.Exit(1)
403
-
404
- # Check if already connected
404
+ # Check if connection is already set up (has credentials stored)
405
405
  if connection.get("connected"):
406
406
  warning(f"Connection '{connection_id}' is already connected")
407
407
  confirm = typer.confirm("Do you want to reconnect (re-authorize)?")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentic-fabriq-sdk
3
- Version: 0.1.15
3
+ Version: 0.1.17
4
4
  Summary: Agentic Fabriq SDK: high-level client, CLI tool, DX helpers, and auth for AI agents
5
5
  License: Apache-2.0
6
6
  Keywords: fabriq,agentic-fabriq,sdk,ai,agents,agentic,fabric,cli
@@ -6,7 +6,7 @@ af_cli/commands/auth.py,sha256=gz7DLiTTV0nv2DnKaa7_9nLHevCWslG54rRKRA1alx0,11967
6
6
  af_cli/commands/config.py,sha256=_k4ixGZfa7Yl_yUL-W1jeMQzykFcPcbw20Yr1v6_ShM,2748
7
7
  af_cli/commands/mcp_servers.py,sha256=1hEb4tX80dYb-j_2Z3gDud_v1FcMxl83syJ2N2eLWzI,2390
8
8
  af_cli/commands/secrets.py,sha256=z_rHfn8-KEonTC5dioBgH7sc1ppMOltFVFz-58Nqwa0,3436
9
- af_cli/commands/tools.py,sha256=Eqgd3KJ0uWVMq5rFEM_rWQaUaCUTpxqz_jAiM6uRGPI,24908
9
+ af_cli/commands/tools.py,sha256=CUbqxl1UGdoOzz6h-Gp5mrXFeq7CQ7GQDUXathzQIWQ,25428
10
10
  af_cli/core/__init__.py,sha256=cQ0H7rGfaMISQPhoNe4Xfu_EKU2TqRVt2OMI7tPea5U,51
11
11
  af_cli/core/client.py,sha256=BELf6889BOzOWP6kCk4hSY4DolIATB0YNpui38l7EaI,3939
12
12
  af_cli/core/config.py,sha256=fwLUF0blNII2RKdFlJ3Hat51vwwNyxpIkU_HvViz8To,8538
@@ -37,7 +37,7 @@ af_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  af_sdk/transport/__init__.py,sha256=HsOc6MmlxIS-PSYC_-6E36-dZYyT_auZeoXvGzVAqeg,104
38
38
  af_sdk/transport/http.py,sha256=QB3eqQbwug95QHf5PG_714NKtlTjV9PzVTo8izJCylc,13203
39
39
  af_sdk/vault.py,sha256=QVNGigIw8ND5sVXt05gvUY222b5-i9EbzLWNsDGdOU4,17926
40
- agentic_fabriq_sdk-0.1.15.dist-info/METADATA,sha256=3fGRijwhZaKkMTSRfKw2CUrerHTSWdVosYYn-0v5m6Y,3658
41
- agentic_fabriq_sdk-0.1.15.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
42
- agentic_fabriq_sdk-0.1.15.dist-info/entry_points.txt,sha256=XUO2EaJhUtUS5pwVIkhemC-nEeFbKgXXLW97gQCCGm8,41
43
- agentic_fabriq_sdk-0.1.15.dist-info/RECORD,,
40
+ agentic_fabriq_sdk-0.1.17.dist-info/METADATA,sha256=-vUv4DYhFC_MFAabwOnQh3VglGqssolr7rlXLA1f4Hg,3658
41
+ agentic_fabriq_sdk-0.1.17.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
42
+ agentic_fabriq_sdk-0.1.17.dist-info/entry_points.txt,sha256=XUO2EaJhUtUS5pwVIkhemC-nEeFbKgXXLW97gQCCGm8,41
43
+ agentic_fabriq_sdk-0.1.17.dist-info/RECORD,,