ccproxy.cli.commands.permission_handler¶
ccproxy.cli.commands.permission_handler
¶
CLI command for handling confirmation requests via SSE stream.
SSEConfirmationHandler
¶
Handles confirmation requests received via SSE stream.
Source code in ccproxy/cli/commands/permission_handler.py
handle_event
async
¶
Handle an SSE event by dispatching to specific handlers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event_type
|
str
|
Type of the event |
required |
data
|
dict[str, Any]
|
Event data |
required |
Source code in ccproxy/cli/commands/permission_handler.py
send_response
async
¶
Send a confirmation response to the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request_id
|
str
|
ID of the confirmation request |
required |
allowed
|
bool
|
Whether to allow or deny |
required |
Source code in ccproxy/cli/commands/permission_handler.py
parse_sse_stream
async
¶
Parse SSE events from the response stream.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
response
|
Response
|
The httpx response with streaming content |
required |
Yields:
Type | Description |
---|---|
AsyncIterator[tuple[str, dict[str, Any]]]
|
Tuples of (event_type, data) |
Source code in ccproxy/cli/commands/permission_handler.py
run
async
¶
Run the SSE client with reconnection logic.
Source code in ccproxy/cli/commands/permission_handler.py
connect
¶
connect(
api_url=Option(
None,
"--api-url",
"-u",
help="API server URL (defaults to settings)",
),
no_ui=Option(False, "--no-ui", help="Disable UI mode"),
verbose=Option(
0,
"-v",
"--verbose",
count=True,
help="Increase verbosity (-v for INFO, -vv for DEBUG)",
),
auth_token=Option(
None,
"--auth-token",
"-t",
help="Bearer token for API authentication (overrides config)",
envvar="CCPROXY_AUTH_TOKEN",
),
no_reconnect=Option(
False,
"--no-reconnect",
help="Disable automatic reconnection when connection is lost",
),
)
Connect to the API server and handle confirmation requests.
This command connects to the CCProxy API server via Server-Sent Events and handles permission confirmation requests in the terminal.
Source code in ccproxy/cli/commands/permission_handler.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 |
|