talentprism-cli 0.3.0__tar.gz → 0.3.1__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.
Files changed (29) hide show
  1. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/PKG-INFO +4 -1
  2. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/pyproject.toml +1 -1
  3. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/README.md +3 -0
  4. talentprism_cli-0.3.1/talentprism_cli/__init__.py +1 -0
  5. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/cli.py +32 -6
  6. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/skill.py +7 -7
  7. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/transport.py +26 -5
  8. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli.egg-info/PKG-INFO +4 -1
  9. talentprism_cli-0.3.0/talentprism_cli/__init__.py +0 -1
  10. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/README.md +0 -0
  11. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/setup.cfg +0 -0
  12. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/LICENSE.txt +0 -0
  13. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/__main__.py +0 -0
  14. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/auth.py +0 -0
  15. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/config.py +0 -0
  16. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/config_store.py +0 -0
  17. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/credentials.py +0 -0
  18. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/errors.py +0 -0
  19. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/format.py +0 -0
  20. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/loopback.py +0 -0
  21. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/network_bootstrap.py +0 -0
  22. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/oauth.py +0 -0
  23. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/readonly_api.py +0 -0
  24. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli/sequence_writes.py +0 -0
  25. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli.egg-info/SOURCES.txt +0 -0
  26. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli.egg-info/dependency_links.txt +0 -0
  27. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli.egg-info/entry_points.txt +0 -0
  28. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli.egg-info/requires.txt +0 -0
  29. {talentprism_cli-0.3.0 → talentprism_cli-0.3.1}/talentprism_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: talentprism-cli
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Command line for TalentPrism: team-scoped recruiting data and actions for people and AI agents
5
5
  License-Expression: LicenseRef-Proprietary
6
6
  Project-URL: Homepage, https://talentprism.ai
@@ -65,10 +65,13 @@ When several credentials are present, `tp` uses the first of: the `--api-key` fl
65
65
  tp whoami
66
66
  tp sequences list --status Active --json
67
67
  tp candidates search --query "aircraft assembler North Charleston" --json
68
+ tp candidates search --query "welder" --limit 20 --json
68
69
  tp activity summary --days 14 --json
69
70
  tp candidates timeline <candidate_id> --days 30 --json
70
71
  ```
71
72
 
73
+ List commands stop with `too_many_results` when a list has more than 100 items. Add `--limit N` for the first N rows in the server's order (the result keeps `count`, the server's total, and sets `truncated`), or `--all` to fetch every page. The two cannot be combined.
74
+
72
75
  ## Changing data
73
76
 
74
77
  Every write is two steps. Run the command once to get a preview and a one-time approval token. Nothing changes. Then run the same command again with `--confirm-write --approval-token <token>`:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "talentprism-cli"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Command line for TalentPrism: team-scoped recruiting data and actions for people and AI agents"
9
9
  readme = "talentprism_cli/README.md"
10
10
  license = "LicenseRef-Proprietary"
@@ -42,10 +42,13 @@ When several credentials are present, `tp` uses the first of: the `--api-key` fl
42
42
  tp whoami
43
43
  tp sequences list --status Active --json
44
44
  tp candidates search --query "aircraft assembler North Charleston" --json
45
+ tp candidates search --query "welder" --limit 20 --json
45
46
  tp activity summary --days 14 --json
46
47
  tp candidates timeline <candidate_id> --days 30 --json
47
48
  ```
48
49
 
50
+ List commands stop with `too_many_results` when a list has more than 100 items. Add `--limit N` for the first N rows in the server's order (the result keeps `count`, the server's total, and sets `truncated`), or `--all` to fetch every page. The two cannot be combined.
51
+
49
52
  ## Changing data
50
53
 
51
54
  Every write is two steps. Run the command once to get a preview and a one-time approval token. Nothing changes. Then run the same command again with `--confirm-write --approval-token <token>`:
@@ -0,0 +1 @@
1
+ __version__ = "0.3.1"
@@ -133,6 +133,7 @@ def _build_parser() -> argparse.ArgumentParser:
133
133
  sequences_list = sequence_subparsers.add_parser("list", parents=[common])
134
134
  sequences_list.add_argument("--status")
135
135
  sequences_list.add_argument("--all", action="store_true")
136
+ sequences_list.add_argument("--limit", type=int)
136
137
  sequences_show = sequence_subparsers.add_parser("show", parents=[common])
137
138
  sequences_show.add_argument("sequence_id")
138
139
  sequences_summary = sequence_subparsers.add_parser("summary", parents=[common])
@@ -157,9 +158,11 @@ def _build_parser() -> argparse.ArgumentParser:
157
158
  candidates_list = candidate_subparsers.add_parser("list", parents=[common])
158
159
  candidates_list.add_argument("--sequence", required=True)
159
160
  candidates_list.add_argument("--all", action="store_true")
161
+ candidates_list.add_argument("--limit", type=int)
160
162
  candidates_search = candidate_subparsers.add_parser("search", parents=[common])
161
163
  candidates_search.add_argument("--query", required=True)
162
164
  candidates_search.add_argument("--all", action="store_true")
165
+ candidates_search.add_argument("--limit", type=int)
163
166
  candidates_show = candidate_subparsers.add_parser("show", parents=[common])
164
167
  candidates_show.add_argument("candidate_id")
165
168
  candidates_show.add_argument("--conversations", action="store_true")
@@ -185,6 +188,7 @@ def _build_parser() -> argparse.ArgumentParser:
185
188
  candidates_engaged = candidate_subparsers.add_parser("engaged", parents=[common])
186
189
  candidates_engaged.add_argument("--sequence", required=True)
187
190
  candidates_engaged.add_argument("--all", action="store_true")
191
+ candidates_engaged.add_argument("--limit", type=int)
188
192
  # Slice 2 evidence reads: the record behind a claim, not just the claim.
189
193
  candidates_provenance = candidate_subparsers.add_parser("provenance", parents=[common])
190
194
  candidates_provenance.add_argument("candidate_id", type=int)
@@ -220,6 +224,7 @@ def _build_parser() -> argparse.ArgumentParser:
220
224
  reminders_list.add_argument("--due")
221
225
  reminders_list.add_argument("--status")
222
226
  reminders_list.add_argument("--all", action="store_true")
227
+ reminders_list.add_argument("--limit", type=int)
223
228
  reminders_create = reminders_subparsers.add_parser("create", parents=[common])
224
229
  reminders_create.add_argument("--candidate", type=int)
225
230
  reminders_create.add_argument("--due", required=True)
@@ -276,6 +281,7 @@ def _build_parser() -> argparse.ArgumentParser:
276
281
  interviews_list = interview_subparsers.add_parser("list", parents=[common])
277
282
  interviews_list.add_argument("--sequence", required=True)
278
283
  interviews_list.add_argument("--all", action="store_true")
284
+ interviews_list.add_argument("--limit", type=int)
279
285
  interviews_show = interview_subparsers.add_parser("show", parents=[common])
280
286
  interviews_show.add_argument("interview_id")
281
287
  interviews_create_link = interview_subparsers.add_parser("create-link", parents=[common])
@@ -407,6 +413,26 @@ class TalentPrismArgumentParser(argparse.ArgumentParser):
407
413
  )
408
414
 
409
415
 
416
+ def _page_options(args: argparse.Namespace) -> dict:
417
+ """Turn --all / --limit into get_paginated keywords, refusing combinations that make no sense."""
418
+ if args.limit is not None and args.all:
419
+ raise TalentPrismError(
420
+ code="invalid_input",
421
+ type="invalid_input",
422
+ message="--limit and --all cannot be used together.",
423
+ remediation="Use --limit N for the first N rows, or --all for every row.",
424
+ )
425
+ if args.limit is not None and args.limit < 1:
426
+ raise TalentPrismError(
427
+ code="invalid_input",
428
+ type="invalid_input",
429
+ message="--limit must be a positive integer.",
430
+ details={"limit": args.limit},
431
+ remediation="Pass --limit with a number of 1 or more.",
432
+ )
433
+ return {"all_pages": args.all, "limit": args.limit}
434
+
435
+
410
436
  def _add_write_approval_arguments(parser: argparse.ArgumentParser) -> None:
411
437
  parser.add_argument("--confirm-write", action="store_true")
412
438
  parser.add_argument("--approval-token")
@@ -535,7 +561,7 @@ def _dispatch_sequences(args: argparse.Namespace, client: APIClient):
535
561
  if args.action == "list":
536
562
  query = urlencode({"status": args.status}) if args.status else ""
537
563
  suffix = f"?{query}" if query else ""
538
- return client.get_paginated(f"/api/sequences/{suffix}", all_pages=args.all)
564
+ return client.get_paginated(f"/api/sequences/{suffix}", **_page_options(args))
539
565
  if args.action == "show":
540
566
  return client.get(f"/api/sequences/{args.sequence_id}/")
541
567
  if args.action == "summary":
@@ -555,10 +581,10 @@ def _dispatch_sequences(args: argparse.Namespace, client: APIClient):
555
581
 
556
582
  def _dispatch_candidates(args: argparse.Namespace, client: APIClient):
557
583
  if args.action == "list":
558
- return client.get_paginated(f"/api/sequences/{args.sequence}/candidates/", all_pages=args.all)
584
+ return client.get_paginated(f"/api/sequences/{args.sequence}/candidates/", **_page_options(args))
559
585
  if args.action == "search":
560
586
  query = urlencode({"query": args.query})
561
- return client.get_paginated(f"/api/candidates/search/?{query}", all_pages=args.all)
587
+ return client.get_paginated(f"/api/candidates/search/?{query}", **_page_options(args))
562
588
  if args.action == "show":
563
589
  params = {}
564
590
  if args.conversations:
@@ -610,7 +636,7 @@ def _dispatch_candidates(args: argparse.Namespace, client: APIClient):
610
636
  command="tp candidates send-sms",
611
637
  )
612
638
  if args.action == "engaged":
613
- return client.get_paginated(f"/api/sequences/{args.sequence}/candidates/engaged/", all_pages=args.all)
639
+ return client.get_paginated(f"/api/sequences/{args.sequence}/candidates/engaged/", **_page_options(args))
614
640
  if args.action == "provenance":
615
641
  return _read_capability(
616
642
  client,
@@ -674,7 +700,7 @@ def _dispatch_reminders(args: argparse.Namespace, client: APIClient):
674
700
  params["status"] = args.status
675
701
  query = urlencode(params)
676
702
  suffix = f"?{query}" if query else ""
677
- return client.get_paginated(f"/api/reminders/{suffix}", all_pages=args.all)
703
+ return client.get_paginated(f"/api/reminders/{suffix}", **_page_options(args))
678
704
  if args.action == "create":
679
705
  payload = {"candidate_id": args.candidate, "due": args.due, "text": args.text}
680
706
  if args.candidate is None:
@@ -1011,7 +1037,7 @@ def _dispatch_copilot(args: argparse.Namespace, client: APIClient):
1011
1037
 
1012
1038
  def _dispatch_interviews(args: argparse.Namespace, client: APIClient):
1013
1039
  if args.action == "list":
1014
- return client.get_paginated(f"/api/sequences/{args.sequence}/interviews/", all_pages=args.all)
1040
+ return client.get_paginated(f"/api/sequences/{args.sequence}/interviews/", **_page_options(args))
1015
1041
  if args.action == "show":
1016
1042
  return client.get(f"/api/interviews/{args.interview_id}/")
1017
1043
  if args.action == "create-link":
@@ -8,22 +8,22 @@ COMMANDS = [
8
8
  "tp config set <name> [--api-key <key>] [--base-url <url>]",
9
9
  "tp config set-profile <name>",
10
10
  "tp whoami",
11
- "tp sequences list [--status <status>] [--all]",
11
+ "tp sequences list [--status <status>] [--all] [--limit <n>]",
12
12
  "tp sequences show <uuid>",
13
13
  "tp sequences summary <uuid>",
14
- "tp candidates list --sequence <uuid> [--all]",
15
- "tp candidates search --query <text> [--all]",
14
+ "tp candidates list --sequence <uuid> [--all] [--limit <n>]",
15
+ "tp candidates search --query <text> [--all] [--limit <n>]",
16
16
  "tp candidates show <id> [--conversations] [--reminders]",
17
17
  "tp candidates add-note <id> --text <note> [--confirm-write --approval-token <token>]",
18
18
  "tp candidates send-email <id> [--recipient <email>] --subject <subject> --body <body> [--idempotency-key <key>] [--confirm-write --approval-token <token>]",
19
19
  "tp candidates send-sms <id> --message <message> [--recipient <phone>] [--sequence <uuid>] [--idempotency-key <key>] [--confirm-write --approval-token <token>]",
20
- "tp candidates engaged --sequence <uuid> [--all]",
20
+ "tp candidates engaged --sequence <uuid> [--all] [--limit <n>]",
21
21
  "tp candidates provenance <id> [--field <name>] [--days <n>] [--limit <n>]",
22
22
  "tp candidates timeline <id> [--kinds <list>] [--days <n>] [--limit <n>]",
23
23
  "tp candidates records <id> [--record-type <type>] [--days <n>] [--limit <n>]",
24
24
  "tp leads maturity <id>",
25
25
  "tp leads consent-evidence [--candidate <id>] [--limit <n>]",
26
- "tp reminders list [--owner <id>] [--due <when>] [--status <status>] [--all]",
26
+ "tp reminders list [--owner <id>] [--due <when>] [--status <status>] [--all] [--limit <n>]",
27
27
  "tp reminders create [--candidate <id>] --due <when> --text <text> [--confirm-write --approval-token <token>]",
28
28
  "tp reminders complete <id> [--confirm-write --approval-token <token>]",
29
29
  "tp capabilities list",
@@ -37,7 +37,7 @@ COMMANDS = [
37
37
  "tp campaigns deliverability <uuid>",
38
38
  "tp copilot brief [--recruiter <id>] [--since <when>]",
39
39
  "tp copilot ask <prompt>",
40
- "tp interviews list --sequence <uuid> [--all]",
40
+ "tp interviews list --sequence <uuid> [--all] [--limit <n>]",
41
41
  "tp interviews show <uuid>",
42
42
  "tp interviews create-link --candidate <id> --sequence <uuid> [--base-url <url>] [--confirm-write --approval-token <token>]",
43
43
  "tp recruiters notify --candidate <id> --sequence <uuid> --update <text> [--update <text> ...] [--action-needed <text>] [--action-tag <tag>] [--subject <text>] [--message <text>] [--force-channel <channel> ...] [--confirm-write --approval-token <token>]",
@@ -96,7 +96,7 @@ A `not_authorized` error is never a reason to rotate the key. It means the key w
96
96
 
97
97
  ## Output And Errors
98
98
 
99
- Use `--output json` when an agent needs structured data. Use `tp capabilities list --json` to discover typed Agent Capability schemas and policies generated by the Django registry; use `tp capabilities mcp --json` for MCP-style tool metadata; use `tp capabilities commands --json` to generate `tp capabilities invoke ...` examples from the live registry; use `tp capabilities invoke <name> --input-json <json>` for registry-driven execution. A write command without approval flags is a non-mutating proposal and returns its resolved preview plus a 15-minute, one-shot approval token. Execute only by repeating the exact command and arguments with `--confirm-write --approval-token <token>`. Successful command data is written to stdout. Errors are JSON on stderr with `code`, `type`, `message`, `details`, and `remediation`.
99
+ Use `--output json` when an agent needs structured data. Use `tp capabilities list --json` to discover typed Agent Capability schemas and policies generated by the Django registry; use `tp capabilities mcp --json` for MCP-style tool metadata; use `tp capabilities commands --json` to generate `tp capabilities invoke ...` examples from the live registry; use `tp capabilities invoke <name> --input-json <json>` for registry-driven execution. A write command without approval flags is a non-mutating proposal and returns its resolved preview plus a 15-minute, one-shot approval token. Execute only by repeating the exact command and arguments with `--confirm-write --approval-token <token>`. List commands (`sequences list`, `candidates list|search|engaged`, `reminders list`, `interviews list`) stop with `too_many_results` when a list has more than 100 items. Pass `--limit N` for the first N rows in the server's order (the payload reports `count`, the server's total, and `truncated`), or `--all` to fetch every page; the two cannot be combined. Successful command data is written to stdout. Errors are JSON on stderr with `code`, `type`, `message`, `details`, and `remediation`.
100
100
 
101
101
  Chat and message counts never include simulator or eval-fork conversations - they carry a real team and a real candidate but were typed by a tester, so counting them as engagement has repeatedly misled production audits. `tp activity summary` reports what it left out under `excluded` (`chats`, `chat_messages`), so "12 conversations" is never silently "9 real plus 3 test runs".
102
102
 
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  import time
4
4
  from email.utils import parsedate_to_datetime
5
5
  from typing import Any, Callable
6
- from urllib.parse import urlparse
6
+ from urllib.parse import parse_qsl, urlencode, urlparse, urlsplit, urlunsplit
7
7
 
8
8
  from . import __version__
9
9
  from .config import TalentPrismConfig
@@ -15,6 +15,7 @@ RequestFn = Callable[..., Any]
15
15
 
16
16
  RETRY_BACKOFF_SECONDS = 0.2
17
17
  MAX_PAGES = 1000
18
+ MAX_PAGE_SIZE = 100 # the server's page_size ceiling
18
19
  ERROR_BODY_PREVIEW_CHARS = 2000
19
20
  MAX_RETRY_AFTER_SECONDS = 10.0
20
21
 
@@ -32,24 +33,28 @@ class APIClient:
32
33
  def get(self, path: str) -> Any:
33
34
  return self._send("GET", path)
34
35
 
35
- def get_paginated(self, path: str, *, all_pages: bool = False, cap: int = 100) -> Any:
36
+ def get_paginated(self, path: str, *, all_pages: bool = False, cap: int = 100, limit: int | None = None) -> Any:
37
+ # A limit is the caller refining the request, so it replaces the cap check: fetch only as many
38
+ # pages as needed for the first `limit` rows, in the server's order.
39
+ if limit is not None:
40
+ path = _with_page_size(path, min(limit, MAX_PAGE_SIZE))
36
41
  first_page = self.get(path)
37
42
  if not _is_paginated(first_page):
38
43
  return first_page
39
44
  total_count = first_page.get("count", 0)
40
- if total_count > cap and not all_pages:
45
+ if limit is None and total_count > cap and not all_pages:
41
46
  raise TalentPrismError(
42
47
  code="too_many_results",
43
48
  type="validation",
44
49
  message="List result exceeds the safe automatic cap.",
45
50
  details={"count": total_count, "cap": cap},
46
- remediation="Refine the query or pass --all to walk every page.",
51
+ remediation="Refine the query, pass --limit N for the first N rows, or pass --all to walk every page.",
47
52
  )
48
53
 
49
54
  results = list(first_page.get("results", []))
50
55
  next_url = first_page.get("next")
51
56
  seen_urls: set[str] = set()
52
- while next_url:
57
+ while next_url and (limit is None or len(results) < limit):
53
58
  if next_url in seen_urls or len(seen_urls) >= MAX_PAGES:
54
59
  raise TalentPrismError(
55
60
  code="pagination_not_terminating",
@@ -62,6 +67,14 @@ class APIClient:
62
67
  page = self.get(next_url)
63
68
  results.extend(page.get("results", []))
64
69
  next_url = page.get("next")
70
+ if limit is not None:
71
+ return {
72
+ **first_page,
73
+ "next": None,
74
+ "results": results[:limit],
75
+ "truncated": total_count > limit,
76
+ "limit": limit,
77
+ }
65
78
  return {**first_page, "next": None, "results": results, "truncated": False}
66
79
 
67
80
  def post(self, path: str, payload: dict[str, Any]) -> Any:
@@ -275,3 +288,11 @@ def _safe_json(response) -> Any:
275
288
 
276
289
  def _is_paginated(payload: Any) -> bool:
277
290
  return isinstance(payload, dict) and "results" in payload and "count" in payload
291
+
292
+
293
+ def _with_page_size(path: str, page_size: int) -> str:
294
+ """Set page_size on a path, keeping any query string it already carries."""
295
+ parts = urlsplit(path)
296
+ query = [(key, value) for key, value in parse_qsl(parts.query, keep_blank_values=True) if key != "page_size"]
297
+ query.append(("page_size", str(page_size)))
298
+ return urlunsplit(parts._replace(query=urlencode(query)))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: talentprism-cli
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Command line for TalentPrism: team-scoped recruiting data and actions for people and AI agents
5
5
  License-Expression: LicenseRef-Proprietary
6
6
  Project-URL: Homepage, https://talentprism.ai
@@ -65,10 +65,13 @@ When several credentials are present, `tp` uses the first of: the `--api-key` fl
65
65
  tp whoami
66
66
  tp sequences list --status Active --json
67
67
  tp candidates search --query "aircraft assembler North Charleston" --json
68
+ tp candidates search --query "welder" --limit 20 --json
68
69
  tp activity summary --days 14 --json
69
70
  tp candidates timeline <candidate_id> --days 30 --json
70
71
  ```
71
72
 
73
+ List commands stop with `too_many_results` when a list has more than 100 items. Add `--limit N` for the first N rows in the server's order (the result keeps `count`, the server's total, and sets `truncated`), or `--all` to fetch every page. The two cannot be combined.
74
+
72
75
  ## Changing data
73
76
 
74
77
  Every write is two steps. Run the command once to get a preview and a one-time approval token. Nothing changes. Then run the same command again with `--confirm-write --approval-token <token>`:
@@ -1 +0,0 @@
1
- __version__ = "0.3.0"