autotouch-cli 0.2.115__tar.gz → 0.2.117__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 (67) hide show
  1. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/PKG-INFO +47 -16
  2. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/README.md +46 -15
  3. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/cli.py +277 -0
  4. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/cli_contracts.py +1 -0
  5. autotouch_cli-0.2.117/autotouch_cli/commands/companies.py +174 -0
  6. autotouch_cli-0.2.117/autotouch_cli/commands/crm.py +275 -0
  7. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/leads.py +119 -0
  8. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/search.py +9 -10
  9. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/data/CLI_REFERENCE.md +934 -367
  10. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/data/cli-manifest.json +9680 -6117
  11. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/parser.py +77 -8
  12. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/templates.py +99 -338
  13. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli.egg-info/PKG-INFO +47 -16
  14. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli.egg-info/SOURCES.txt +6 -3
  15. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_shared/list_build_contract.py +15 -6
  16. autotouch_cli-0.2.117/autotouch_shared/pipeline_patterns.py +550 -0
  17. autotouch_cli-0.2.117/autotouch_shared/product_use_cases.py +671 -0
  18. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_shared/provider_registry.py +17 -14
  19. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_shared/search_contract.py +5 -7
  20. autotouch_cli-0.2.117/autotouch_shared/workflow_plans.py +1164 -0
  21. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/pyproject.toml +2 -2
  22. autotouch_cli-0.2.115/autotouch_cli/workflows/__init__.py +0 -5
  23. autotouch_cli-0.2.115/autotouch_cli/workflows/registry.py +0 -470
  24. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/MANIFEST.in +0 -0
  25. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/__init__.py +0 -0
  26. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/__init__.py +0 -0
  27. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/agents.py +0 -0
  28. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/auth.py +0 -0
  29. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/capacity.py +0 -0
  30. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/cells.py +0 -0
  31. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/columns.py +0 -0
  32. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/integrations.py +0 -0
  33. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/jobs.py +0 -0
  34. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/linkedin.py +0 -0
  35. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/list_build.py +0 -0
  36. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/outreach.py +0 -0
  37. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/prompts.py +0 -0
  38. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/rows.py +0 -0
  39. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/sender_accounts.py +0 -0
  40. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/sequences.py +0 -0
  41. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/tables.py +0 -0
  42. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/tasks.py +0 -0
  43. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/webhooks.py +0 -0
  44. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/commands/workspace_secrets.py +0 -0
  45. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/core/__init__.py +0 -0
  46. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/core/auth.py +0 -0
  47. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/core/config.py +0 -0
  48. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/core/csv_import.py +0 -0
  49. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/core/http.py +0 -0
  50. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/core/io.py +0 -0
  51. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/core/output.py +0 -0
  52. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/core/polling.py +0 -0
  53. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/core/run.py +0 -0
  54. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/core/validation.py +0 -0
  55. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/exceptions.py +0 -0
  56. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/mongo_status.py +0 -0
  57. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/parser_groups.py +0 -0
  58. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli/sequence_support.py +0 -0
  59. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli.egg-info/dependency_links.txt +0 -0
  60. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli.egg-info/entry_points.txt +0 -0
  61. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli.egg-info/requires.txt +0 -0
  62. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_cli.egg-info/top_level.txt +0 -0
  63. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_shared/__init__.py +0 -0
  64. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_shared/linkedin_contract.py +0 -0
  65. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_shared/linkedin_filters.py +0 -0
  66. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/autotouch_shared/product_lifecycle.py +0 -0
  67. {autotouch_cli-0.2.115 → autotouch_cli-0.2.117}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autotouch-cli
3
- Version: 0.2.115
3
+ Version: 0.2.117
4
4
  Summary: Autotouch Smart Table CLI
5
5
  Project-URL: Homepage, https://app.autotouch.ai
6
6
  Project-URL: Documentation, https://github.com/nicolonic/autotouch_main/tree/main/docs/research-table/reference
@@ -47,16 +47,46 @@ Use the lifecycle to choose commands:
47
47
 
48
48
  Smart Table is the operating layer. Most workflows should land records there before enrichment, dedupe, routing, or engagement. Run `autotouch workflows list --output json` for lifecycle-grouped plans.
49
49
 
50
+ ## Codex-Style Agent Use
51
+
52
+ The CLI is designed to be used like a Codex tool surface: inspect the local contract, plan from explicit state, run one bounded primitive, observe authoritative backend state, then continue from the observed IDs.
53
+
54
+ Recommended loop:
55
+
56
+ 1. Discover / inspect: `autotouch auth check --output json`, `autotouch capabilities --output json`, `autotouch capabilities operations search "<goal>"`, `autotouch cli-manifest --output json`, and the relevant `recipe` / `schema` command.
57
+ 2. Plan: choose a lifecycle workflow from `autotouch workflows list --output json`; prefer Smart Table as the operating layer.
58
+ 3. Preview/scaffold: write payloads to files with `recipe` / `schema` / `workflows scaffold` before mutation-heavy runs.
59
+ 4. Execute a bounded slice: use `--scope firstN`, `--first-n`, `--unprocessed-only`, `--wait`, or small list-build targets when validating.
60
+ 5. Observe: treat `autotouch jobs get`, `rows get`, and `cells get` as source of truth; do not infer success from terminal text alone.
61
+ 6. Continue: pass explicit `TABLE_ID`, `ROW_ID`, `COLUMN_ID`, `JOB_ID`, `LEAD_ID`, and `SEQUENCE_ID` values into the next command instead of relying on hidden session state.
62
+
63
+ For the detailed agent operating model, use `docs/research-table/guides/autotouch-cli-agent-playbook.md`. For maintainer rules, use `docs/development/autotouch-cli-architecture.md`. The local Codex reference checkout at `/private/tmp/openai-codex` may be used as inspiration for operating-model patterns only; never make that temporary repository a package dependency or source of truth.
64
+
65
+ Discovery is a phase, not a separate top-level command. Use the existing inspection commands:
66
+
67
+ | Need | Command |
68
+ | --- | --- |
69
+ | Product operations and whether CLI can run them | `autotouch capabilities operations search "<goal>" --cli-available` |
70
+ | Exact operation detail and CLI bindings | `autotouch capabilities operations get <operation_id>` |
71
+ | Goal-level workflow choices | `autotouch workflows list --output json` and `autotouch workflows plan --type <TYPE>` |
72
+ | Current command grammar | `autotouch cli-manifest --output json` or `autotouch cli-reference` |
73
+ | Connected sources and destinations | `autotouch integrations list` and `autotouch integrations status --provider <provider>` |
74
+ | List-build filter IDs and pricing | `autotouch list-build inputs` and `autotouch list-build pricing` |
75
+ | Scheduled-agent signal choices | `autotouch agents signals --target LEADS` or `--target ACCOUNTS` |
76
+
50
77
  ## Install
51
78
 
52
79
  Released package:
53
80
 
54
81
  ```bash
55
- pipx install --force autotouch-cli
82
+ pipx install autotouch-cli
56
83
  # or
57
84
  python -m pip install autotouch-cli
85
+
58
86
  # upgrade
59
- python -m pip install -U autotouch-cli
87
+ pipx upgrade autotouch-cli
88
+ # or
89
+ python -m pip install --upgrade autotouch-cli
60
90
  ```
61
91
 
62
92
  Unreleased branch or pre-publish build:
@@ -180,7 +210,7 @@ When a user asks to create a campaign sequence, distinguish these separate decis
180
210
 
181
211
  - Manual AI-draft review: `autotouch sequences recipe --type manual_review` (or `create`) sets `executionMode=MANUAL` and `aiDraft=true`; AI drafts content and a human approves/completes each task.
182
212
  - Template-based automated send: `autotouch sequences recipe --type automated_template` (or `bulk_automated`) sets `executionMode=AUTOMATED` and `emailSendMode=AUTOMATED` with fixed templates; use this when the user explicitly asks to automate sending without review.
183
- - LinkedIn-assisted outreach: `autotouch sequences recipe --type linkedin_outreach` uses an automated profile visit followed by manual AI-draft LinkedIn connection, LinkedIn message, and fallback email tasks. Use it only when LinkedIn touches are part of the campaign.
213
+ - LinkedIn-assisted outreach: `autotouch sequences recipe --type linkedin_outreach` uses an automated profile visit followed by manual AI-draft LinkedIn connection, connected-only LinkedIn chat, and fallback email tasks. Use it only when LinkedIn touches are part of the campaign. Use `LINKEDIN_MESSAGE` for best-available LinkedIn delivery on paths that are not guaranteed to be connected.
184
214
  - Research-field routing: `autotouch sequences recipe --type research_field_routing` starts one source-table sequence that routes each enrollment by a research-table column value, such as persona, segment, territory, product line, or campaign path.
185
215
 
186
216
  If the user says "automate the sequence" without asking for AI-written sends, choose the template-based automated path. Offer manual AI-draft review as the higher-personalization path, but call out that it creates upfront manual tasks while the system learns.
@@ -193,7 +223,7 @@ Keep `requiredVariables` limited to variables that the sequence actually needs.
193
223
 
194
224
  Version guard:
195
225
 
196
- - Use `autotouch --version` before relying on recipe defaults. This repo expects `autotouch-cli` `0.2.115` or newer.
226
+ - Use `autotouch --version` before relying on recipe defaults. This repo expects `autotouch-cli` `0.2.117` or newer.
197
227
  - If `python3 -m pip install -U autotouch-cli` upgrades the package but `which autotouch` still points at an older shim, run the upgraded binary directly or fix PATH before creating production sequences.
198
228
  - Before authoring a LinkedIn sequence, inspect the live recipe:
199
229
 
@@ -201,12 +231,12 @@ Version guard:
201
231
  autotouch sequences recipe --type linkedin_outreach --output json --compact
202
232
  ```
203
233
 
204
- As of `0.2.107`, that recipe emits:
234
+ As of `0.2.115`, that recipe emits:
205
235
 
206
236
  1. `LINKEDIN_VISIT_PROFILE` - `AUTOMATED`
207
237
  2. `LINKEDIN_CONNECT` - `MANUAL`, `aiDraft=true`, empty `scriptTemplate`, after 7 minutes
208
238
  3. outcome wait for `linkedin_connection_accepted` - up to 7 days
209
- 4. connected branch -> `LINKEDIN_CHAT_MESSAGE` - `MANUAL`, `aiDraft=true`
239
+ 4. connected branch -> `LINKEDIN_CHAT_MESSAGE` - `MANUAL`, `aiDraft=true`; chat-only after connection acceptance
210
240
  5. not-connected branch -> `EMAIL` - `MANUAL`, `emailSendMode=MANUAL`, `aiDraft=true`
211
241
 
212
242
  For one sequence with multiple paths based on a source-table value, inspect the route recipe:
@@ -225,7 +255,7 @@ Use `autotouch search companies` for Exa Company Search when the target is basic
225
255
 
226
256
  Use `autotouch search similar-companies` as a convenience wrapper for Exa Company Search similarity. Prefer `--query` for Exa's documented semantic patterns, such as "companies like Notion", "competitors of Stripe", or "companies working on making space travel cheaper". The older seed fields `company_name`, `company_domain`, and `company_description` remain available when you want the CLI/API to compose that query; it does not use Exa `/findSimilar`.
227
257
 
228
- Use `autotouch search people` for provider-hidden people search when the target is niche, semantic, or hard to express with structured filters. Describe the person or responsibility in natural language, for example "person responsible for endpoint management and SaaS app access", then use company, location, title, or skills only as optional anchors. People search currently returns at most 10 results per API call and costs 1 credit per API call.
258
+ Use `autotouch search people` for provider-hidden people search when the target is niche, semantic, or hard to express with structured filters. Send `--person-description` / `person_description` as a responsibility, for example "person responsible for endpoint management and SaaS app access", and use only company, domain, or location as optional public-search anchors. The CLI still accepts `--query` as a deprecated alias. Legacy `lead_description`, title, skills, and plural criteria are rejected by the backend people-search contract so the provider does not guess from ambiguous fields. People search currently returns at most 10 results per API call and costs 1 credit per API call.
229
259
 
230
260
  Use `autotouch list-build companies` and `autotouch list-build leads` for structured, repeatable LinkedIn/Sales Navigator list construction. This is the only CLI path for building LinkedIn-sourced company and lead lists. Treat list builds as the sourcing step for the Smart Table research workspace: build company/account records first by default, sync the records to a research table with `autotouch list-build sync-to-table`, then enrich, score, segment, find related leads, attach signals/notes, and continue downstream workflows from that table. Use lead builds directly when the request is explicitly person/contact focused. This path uses Autotouch-managed provider access, so users do not need to connect their own LinkedIn account. Use filters like geography IDs, company size, industry IDs, title/persona, and current company IDs; call `autotouch list-build inputs` for supported values. Durable list builds run as background jobs with status/results endpoints and cost 1 credit per successful non-empty result page.
231
261
 
@@ -235,7 +265,7 @@ For structured company builds, start with industry IDs plus geo/company-size fil
235
265
 
236
266
  For account-first prospecting from LinkedIn/Sales Navigator, build companies/accounts first, inspect the returned company IDs, then pass those IDs to `autotouch list-build leads --current-company-id ...`. Do not use Exa company search as a default pre-step for every LinkedIn list build; use it when the user's target is genuinely semantic, niche, competitor-based, or not meant to be LinkedIn-sourced.
237
267
 
238
- Use `autotouch agents ...` for recurring signal-based discovery. Scheduled agents support `--target ACCOUNTS` for company/account output and `--target LEADS` for people output. Every agent writes a source/signal table for the evidence it used; lead agents then write `candidate_research.candidates[]` on source rows and list-sync those candidates into the lead/candidate output table. LinkedIn engagement lead agents screen all harvested engagers by headline/title before company resolution and final lead scoring; company agents can keep matches in review or auto-promote qualified matches into the Companies workspace. See the agent playbook for the full source-table, candidate-sync, and company-promotion contract.
268
+ Use `autotouch agents ...` for recurring signal-based discovery. Scheduled agents support `--target ACCOUNTS` for company/account output and `--target LEADS` for people output. Every agent writes a source/signal table for the evidence it used; lead agents then write `candidate_research.candidates[]` on source rows and list-sync those candidates into the lead/candidate output table. LinkedIn engagement lead agents screen all harvested engagers by headline/title before company resolution and final lead scoring; company agents can keep matches in review or auto-promote qualified matches into the Companies workspace. See the agent playbook and `docs/systems/scheduled-agents.md` for the full source-table, candidate-sync, company-promotion, and runtime contract.
239
269
 
240
270
  ## Workflow Plans
241
271
 
@@ -250,7 +280,7 @@ discover -> plan -> scaffold -> run primitives -> inspect
250
280
  - `autotouch workflows scaffold --type <TYPE> --out-dir <DIR>` writes payload files and a command runbook.
251
281
  - `autotouch columns recipe` and `autotouch sequences recipe` remain leaf-level templates.
252
282
 
253
- Goal-level workflow types include `bulk-outreach`, `company-table-to-people`, `table-to-outreach`, `research-to-sequence`, `agent-to-sequence`, `agent-to-leads`, `account-research`, `signal-outreach`, `website-visitors`, and `list-build-to-table`. These keep CRM, outreach providers, Autotouch Leads, Autotouch Sequences, scheduled agents, webhooks, visitor sources, and external intent sources as sources/destinations inside one organized workflow layer instead of creating one-off top-level commands.
283
+ Goal-level workflow types include `bulk_outreach`, `company_table_to_people`, `table_to_outreach`, `research_to_sequence`, `agent_to_sequence`, `agent_to_leads`, `account_research`, `signal_outreach`, `website_visitors`, `list_build_to_table`, and `system_to_table`. These keep CRM, outreach providers, Autotouch Leads, Autotouch Sequences, scheduled agents, webhooks, visitor sources, external intent sources, and existing Autotouch workspace records as sources/destinations inside one organized workflow layer instead of creating one-off top-level commands.
254
284
 
255
285
  ## Sources And Destinations
256
286
 
@@ -293,7 +323,7 @@ https://app.autotouch.ai/api/webhooks/tables/<TABLE_ID>/ingest?token=<WEBHOOK_TO
293
323
 
294
324
  Use query-token URLs only for no-header providers because URLs may appear in provider logs or history. Rotate the table token if it is exposed.
295
325
 
296
- Webhook ingest stores the raw provider object in the `Webhook Payload` JSON column. For website visitor and external intent provider workflows, use `autotouch workflows plan --type website-visitors` first. The recommended shape is usually two starter tables: one for company-level events and one for person-level events. After a sample payload lands, use `autotouch columns projections` to split provider-specific JSON into stable columns such as `company_domain`, `linkedin_url`, `email`, `page_url`, `event_type`, and `last_seen_at`, then continue with enrichment, email finding, and the chosen destination.
326
+ Webhook ingest stores the raw provider object in the `Webhook Payload` JSON column. For website visitor and external intent provider workflows, use `autotouch workflows plan --type website_visitors` first. The recommended shape is usually two starter tables: one for company-level events and one for person-level events. After a sample payload lands, use `autotouch columns projections` to split provider-specific JSON into stable columns such as `company_domain`, `linkedin_url`, `email`, `page_url`, `event_type`, and `last_seen_at`, then continue with enrichment, email finding, and the chosen destination.
297
327
 
298
328
  CRM round trip:
299
329
 
@@ -322,13 +352,14 @@ For automation or agent-driven setup, use:
322
352
  - `autotouch cli-manifest --output json` for the local machine-readable command contract
323
353
  - `autotouch cli-reference` for the shipped parser-generated reference
324
354
  - `autotouch capabilities --output json` for provider/workflow contracts
325
- - `autotouch --version` should be `0.2.115` or newer for structured company list builds without user-supplied keywords, stored list-build input lookup, research-workspace list-build guidance, the cleaned single LinkedIn-sourced list-build path, Exa Company Search up to 100 results, scheduled agent `--target ACCOUNTS|LEADS`, `agents signals --target`, the `agent-to-sequence` and `agent-to-leads` workflow scaffolds, paced HTTP Request column contracts, branch-aware LinkedIn sequence recipes, `LINKEDIN_MESSAGE` best-available delivery versus `LINKEDIN_CHAT_MESSAGE` chat-only guidance, sequence campaign intake guards before mutating objects, real agent soft-delete with associated-table handling, research-table sequence handoff assignee and active-sequence-conflict guard config, backend-owned directional source/destination helpers, goal-level workflow plans, website visitor/external intent webhook workflow guidance, create-time agent assignment defaults, company-page signal configuration guidance, sequence authoring warnings when AI draft is mixed with fixed templates, sender-account discovery/management for explicit sequence routing, mixed parent-row/child-list Sync to Table and Sync to Leads recipe configs, and company variable guidance for `company_name_clean` versus internal match keys
355
+ - `autotouch capabilities operations search "find work emails"` and `autotouch capabilities operations get research_table.email_finder` to map product operations to the current CLI command path
356
+ - `autotouch --version` should be `0.2.117` or newer for product-operation discovery via `capabilities operations list/search/get`, CRM custom-field catalog/create/update commands, lead/company custom-field value writes, structured company list builds without user-supplied keywords, stored list-build input lookup, research-workspace list-build guidance, the cleaned single LinkedIn-sourced list-build path, Exa Company Search up to 100 results, scheduled agent `--target ACCOUNTS|LEADS`, `agents signals --target`, the `agent_to_sequence` and `agent_to_leads` workflow scaffolds, paced HTTP Request column contracts, branch-aware LinkedIn sequence recipes, `LINKEDIN_MESSAGE` best-available delivery versus `LINKEDIN_CHAT_MESSAGE` chat-only guidance, sequence campaign intake guards before mutating objects, real agent soft-delete with associated-table handling, research-table sequence handoff assignee and active-sequence-conflict guard config, backend-owned directional source/destination helpers, goal-level workflow plans, website visitor/external intent webhook workflow guidance, create-time agent assignment defaults, company-page signal configuration guidance, sequence authoring warnings when AI draft is mixed with fixed templates, sender-account discovery/management for explicit sequence routing, mixed parent-row/child-list Sync to Table and Sync to Leads recipe configs, and company variable guidance for `company_name_clean` versus internal match keys
326
357
  - `autotouch capabilities --output json --select list_builds` for documented list-build inputs such as geography IDs, company size buckets, profile language, and company IDs
327
358
  - `autotouch integrations list` and `autotouch integrations status --provider <provider>` before choosing source/destination workflows
328
- - `autotouch workflows plan --type bulk-outreach` and `autotouch workflows scaffold --type bulk-outreach --out-dir workflow` for goal-level workflow planning
329
- - `autotouch workflows plan --type agent-to-leads` and `autotouch workflows scaffold --type agent-to-leads --out-dir workflow` for scheduled agent discovery into qualified Autotouch Leads without sequence tasks
330
- - `autotouch workflows plan --type agent-to-sequence` and `autotouch workflows scaffold --type agent-to-sequence --out-dir workflow` for scheduled agent discovery into Autotouch Sequence tasks
331
- - `autotouch workflows plan --type website-visitors` and `autotouch workflows scaffold --type website-visitors --out-dir workflow` for website visitor or external intent provider webhook workflows
359
+ - `autotouch workflows plan --type bulk_outreach` and `autotouch workflows scaffold --type bulk_outreach --out-dir workflow` for goal-level workflow planning
360
+ - `autotouch workflows plan --type agent_to_leads` and `autotouch workflows scaffold --type agent_to_leads --out-dir workflow` for scheduled agent discovery into qualified Autotouch Leads without sequence tasks
361
+ - `autotouch workflows plan --type agent_to_sequence` and `autotouch workflows scaffold --type agent_to_sequence --out-dir workflow` for scheduled agent discovery into Autotouch Sequence tasks
362
+ - `autotouch workflows plan --type website_visitors` and `autotouch workflows scaffold --type website_visitors --out-dir workflow` for website visitor or external intent provider webhook workflows
332
363
  - `autotouch integrations recipe --type from_crm --provider hubspot` for CRM-to-research-table imports
333
364
  - `autotouch columns recipe --type to_crm|to_outreach|to_leads|to_sequence` for research-table destination workflows
334
365
  - `autotouch list-build inputs` and `autotouch list-build pricing` before creating durable list-build jobs
@@ -22,16 +22,46 @@ Use the lifecycle to choose commands:
22
22
 
23
23
  Smart Table is the operating layer. Most workflows should land records there before enrichment, dedupe, routing, or engagement. Run `autotouch workflows list --output json` for lifecycle-grouped plans.
24
24
 
25
+ ## Codex-Style Agent Use
26
+
27
+ The CLI is designed to be used like a Codex tool surface: inspect the local contract, plan from explicit state, run one bounded primitive, observe authoritative backend state, then continue from the observed IDs.
28
+
29
+ Recommended loop:
30
+
31
+ 1. Discover / inspect: `autotouch auth check --output json`, `autotouch capabilities --output json`, `autotouch capabilities operations search "<goal>"`, `autotouch cli-manifest --output json`, and the relevant `recipe` / `schema` command.
32
+ 2. Plan: choose a lifecycle workflow from `autotouch workflows list --output json`; prefer Smart Table as the operating layer.
33
+ 3. Preview/scaffold: write payloads to files with `recipe` / `schema` / `workflows scaffold` before mutation-heavy runs.
34
+ 4. Execute a bounded slice: use `--scope firstN`, `--first-n`, `--unprocessed-only`, `--wait`, or small list-build targets when validating.
35
+ 5. Observe: treat `autotouch jobs get`, `rows get`, and `cells get` as source of truth; do not infer success from terminal text alone.
36
+ 6. Continue: pass explicit `TABLE_ID`, `ROW_ID`, `COLUMN_ID`, `JOB_ID`, `LEAD_ID`, and `SEQUENCE_ID` values into the next command instead of relying on hidden session state.
37
+
38
+ For the detailed agent operating model, use `docs/research-table/guides/autotouch-cli-agent-playbook.md`. For maintainer rules, use `docs/development/autotouch-cli-architecture.md`. The local Codex reference checkout at `/private/tmp/openai-codex` may be used as inspiration for operating-model patterns only; never make that temporary repository a package dependency or source of truth.
39
+
40
+ Discovery is a phase, not a separate top-level command. Use the existing inspection commands:
41
+
42
+ | Need | Command |
43
+ | --- | --- |
44
+ | Product operations and whether CLI can run them | `autotouch capabilities operations search "<goal>" --cli-available` |
45
+ | Exact operation detail and CLI bindings | `autotouch capabilities operations get <operation_id>` |
46
+ | Goal-level workflow choices | `autotouch workflows list --output json` and `autotouch workflows plan --type <TYPE>` |
47
+ | Current command grammar | `autotouch cli-manifest --output json` or `autotouch cli-reference` |
48
+ | Connected sources and destinations | `autotouch integrations list` and `autotouch integrations status --provider <provider>` |
49
+ | List-build filter IDs and pricing | `autotouch list-build inputs` and `autotouch list-build pricing` |
50
+ | Scheduled-agent signal choices | `autotouch agents signals --target LEADS` or `--target ACCOUNTS` |
51
+
25
52
  ## Install
26
53
 
27
54
  Released package:
28
55
 
29
56
  ```bash
30
- pipx install --force autotouch-cli
57
+ pipx install autotouch-cli
31
58
  # or
32
59
  python -m pip install autotouch-cli
60
+
33
61
  # upgrade
34
- python -m pip install -U autotouch-cli
62
+ pipx upgrade autotouch-cli
63
+ # or
64
+ python -m pip install --upgrade autotouch-cli
35
65
  ```
36
66
 
37
67
  Unreleased branch or pre-publish build:
@@ -155,7 +185,7 @@ When a user asks to create a campaign sequence, distinguish these separate decis
155
185
 
156
186
  - Manual AI-draft review: `autotouch sequences recipe --type manual_review` (or `create`) sets `executionMode=MANUAL` and `aiDraft=true`; AI drafts content and a human approves/completes each task.
157
187
  - Template-based automated send: `autotouch sequences recipe --type automated_template` (or `bulk_automated`) sets `executionMode=AUTOMATED` and `emailSendMode=AUTOMATED` with fixed templates; use this when the user explicitly asks to automate sending without review.
158
- - LinkedIn-assisted outreach: `autotouch sequences recipe --type linkedin_outreach` uses an automated profile visit followed by manual AI-draft LinkedIn connection, LinkedIn message, and fallback email tasks. Use it only when LinkedIn touches are part of the campaign.
188
+ - LinkedIn-assisted outreach: `autotouch sequences recipe --type linkedin_outreach` uses an automated profile visit followed by manual AI-draft LinkedIn connection, connected-only LinkedIn chat, and fallback email tasks. Use it only when LinkedIn touches are part of the campaign. Use `LINKEDIN_MESSAGE` for best-available LinkedIn delivery on paths that are not guaranteed to be connected.
159
189
  - Research-field routing: `autotouch sequences recipe --type research_field_routing` starts one source-table sequence that routes each enrollment by a research-table column value, such as persona, segment, territory, product line, or campaign path.
160
190
 
161
191
  If the user says "automate the sequence" without asking for AI-written sends, choose the template-based automated path. Offer manual AI-draft review as the higher-personalization path, but call out that it creates upfront manual tasks while the system learns.
@@ -168,7 +198,7 @@ Keep `requiredVariables` limited to variables that the sequence actually needs.
168
198
 
169
199
  Version guard:
170
200
 
171
- - Use `autotouch --version` before relying on recipe defaults. This repo expects `autotouch-cli` `0.2.115` or newer.
201
+ - Use `autotouch --version` before relying on recipe defaults. This repo expects `autotouch-cli` `0.2.117` or newer.
172
202
  - If `python3 -m pip install -U autotouch-cli` upgrades the package but `which autotouch` still points at an older shim, run the upgraded binary directly or fix PATH before creating production sequences.
173
203
  - Before authoring a LinkedIn sequence, inspect the live recipe:
174
204
 
@@ -176,12 +206,12 @@ Version guard:
176
206
  autotouch sequences recipe --type linkedin_outreach --output json --compact
177
207
  ```
178
208
 
179
- As of `0.2.107`, that recipe emits:
209
+ As of `0.2.115`, that recipe emits:
180
210
 
181
211
  1. `LINKEDIN_VISIT_PROFILE` - `AUTOMATED`
182
212
  2. `LINKEDIN_CONNECT` - `MANUAL`, `aiDraft=true`, empty `scriptTemplate`, after 7 minutes
183
213
  3. outcome wait for `linkedin_connection_accepted` - up to 7 days
184
- 4. connected branch -> `LINKEDIN_CHAT_MESSAGE` - `MANUAL`, `aiDraft=true`
214
+ 4. connected branch -> `LINKEDIN_CHAT_MESSAGE` - `MANUAL`, `aiDraft=true`; chat-only after connection acceptance
185
215
  5. not-connected branch -> `EMAIL` - `MANUAL`, `emailSendMode=MANUAL`, `aiDraft=true`
186
216
 
187
217
  For one sequence with multiple paths based on a source-table value, inspect the route recipe:
@@ -200,7 +230,7 @@ Use `autotouch search companies` for Exa Company Search when the target is basic
200
230
 
201
231
  Use `autotouch search similar-companies` as a convenience wrapper for Exa Company Search similarity. Prefer `--query` for Exa's documented semantic patterns, such as "companies like Notion", "competitors of Stripe", or "companies working on making space travel cheaper". The older seed fields `company_name`, `company_domain`, and `company_description` remain available when you want the CLI/API to compose that query; it does not use Exa `/findSimilar`.
202
232
 
203
- Use `autotouch search people` for provider-hidden people search when the target is niche, semantic, or hard to express with structured filters. Describe the person or responsibility in natural language, for example "person responsible for endpoint management and SaaS app access", then use company, location, title, or skills only as optional anchors. People search currently returns at most 10 results per API call and costs 1 credit per API call.
233
+ Use `autotouch search people` for provider-hidden people search when the target is niche, semantic, or hard to express with structured filters. Send `--person-description` / `person_description` as a responsibility, for example "person responsible for endpoint management and SaaS app access", and use only company, domain, or location as optional public-search anchors. The CLI still accepts `--query` as a deprecated alias. Legacy `lead_description`, title, skills, and plural criteria are rejected by the backend people-search contract so the provider does not guess from ambiguous fields. People search currently returns at most 10 results per API call and costs 1 credit per API call.
204
234
 
205
235
  Use `autotouch list-build companies` and `autotouch list-build leads` for structured, repeatable LinkedIn/Sales Navigator list construction. This is the only CLI path for building LinkedIn-sourced company and lead lists. Treat list builds as the sourcing step for the Smart Table research workspace: build company/account records first by default, sync the records to a research table with `autotouch list-build sync-to-table`, then enrich, score, segment, find related leads, attach signals/notes, and continue downstream workflows from that table. Use lead builds directly when the request is explicitly person/contact focused. This path uses Autotouch-managed provider access, so users do not need to connect their own LinkedIn account. Use filters like geography IDs, company size, industry IDs, title/persona, and current company IDs; call `autotouch list-build inputs` for supported values. Durable list builds run as background jobs with status/results endpoints and cost 1 credit per successful non-empty result page.
206
236
 
@@ -210,7 +240,7 @@ For structured company builds, start with industry IDs plus geo/company-size fil
210
240
 
211
241
  For account-first prospecting from LinkedIn/Sales Navigator, build companies/accounts first, inspect the returned company IDs, then pass those IDs to `autotouch list-build leads --current-company-id ...`. Do not use Exa company search as a default pre-step for every LinkedIn list build; use it when the user's target is genuinely semantic, niche, competitor-based, or not meant to be LinkedIn-sourced.
212
242
 
213
- Use `autotouch agents ...` for recurring signal-based discovery. Scheduled agents support `--target ACCOUNTS` for company/account output and `--target LEADS` for people output. Every agent writes a source/signal table for the evidence it used; lead agents then write `candidate_research.candidates[]` on source rows and list-sync those candidates into the lead/candidate output table. LinkedIn engagement lead agents screen all harvested engagers by headline/title before company resolution and final lead scoring; company agents can keep matches in review or auto-promote qualified matches into the Companies workspace. See the agent playbook for the full source-table, candidate-sync, and company-promotion contract.
243
+ Use `autotouch agents ...` for recurring signal-based discovery. Scheduled agents support `--target ACCOUNTS` for company/account output and `--target LEADS` for people output. Every agent writes a source/signal table for the evidence it used; lead agents then write `candidate_research.candidates[]` on source rows and list-sync those candidates into the lead/candidate output table. LinkedIn engagement lead agents screen all harvested engagers by headline/title before company resolution and final lead scoring; company agents can keep matches in review or auto-promote qualified matches into the Companies workspace. See the agent playbook and `docs/systems/scheduled-agents.md` for the full source-table, candidate-sync, company-promotion, and runtime contract.
214
244
 
215
245
  ## Workflow Plans
216
246
 
@@ -225,7 +255,7 @@ discover -> plan -> scaffold -> run primitives -> inspect
225
255
  - `autotouch workflows scaffold --type <TYPE> --out-dir <DIR>` writes payload files and a command runbook.
226
256
  - `autotouch columns recipe` and `autotouch sequences recipe` remain leaf-level templates.
227
257
 
228
- Goal-level workflow types include `bulk-outreach`, `company-table-to-people`, `table-to-outreach`, `research-to-sequence`, `agent-to-sequence`, `agent-to-leads`, `account-research`, `signal-outreach`, `website-visitors`, and `list-build-to-table`. These keep CRM, outreach providers, Autotouch Leads, Autotouch Sequences, scheduled agents, webhooks, visitor sources, and external intent sources as sources/destinations inside one organized workflow layer instead of creating one-off top-level commands.
258
+ Goal-level workflow types include `bulk_outreach`, `company_table_to_people`, `table_to_outreach`, `research_to_sequence`, `agent_to_sequence`, `agent_to_leads`, `account_research`, `signal_outreach`, `website_visitors`, `list_build_to_table`, and `system_to_table`. These keep CRM, outreach providers, Autotouch Leads, Autotouch Sequences, scheduled agents, webhooks, visitor sources, external intent sources, and existing Autotouch workspace records as sources/destinations inside one organized workflow layer instead of creating one-off top-level commands.
229
259
 
230
260
  ## Sources And Destinations
231
261
 
@@ -268,7 +298,7 @@ https://app.autotouch.ai/api/webhooks/tables/<TABLE_ID>/ingest?token=<WEBHOOK_TO
268
298
 
269
299
  Use query-token URLs only for no-header providers because URLs may appear in provider logs or history. Rotate the table token if it is exposed.
270
300
 
271
- Webhook ingest stores the raw provider object in the `Webhook Payload` JSON column. For website visitor and external intent provider workflows, use `autotouch workflows plan --type website-visitors` first. The recommended shape is usually two starter tables: one for company-level events and one for person-level events. After a sample payload lands, use `autotouch columns projections` to split provider-specific JSON into stable columns such as `company_domain`, `linkedin_url`, `email`, `page_url`, `event_type`, and `last_seen_at`, then continue with enrichment, email finding, and the chosen destination.
301
+ Webhook ingest stores the raw provider object in the `Webhook Payload` JSON column. For website visitor and external intent provider workflows, use `autotouch workflows plan --type website_visitors` first. The recommended shape is usually two starter tables: one for company-level events and one for person-level events. After a sample payload lands, use `autotouch columns projections` to split provider-specific JSON into stable columns such as `company_domain`, `linkedin_url`, `email`, `page_url`, `event_type`, and `last_seen_at`, then continue with enrichment, email finding, and the chosen destination.
272
302
 
273
303
  CRM round trip:
274
304
 
@@ -297,13 +327,14 @@ For automation or agent-driven setup, use:
297
327
  - `autotouch cli-manifest --output json` for the local machine-readable command contract
298
328
  - `autotouch cli-reference` for the shipped parser-generated reference
299
329
  - `autotouch capabilities --output json` for provider/workflow contracts
300
- - `autotouch --version` should be `0.2.115` or newer for structured company list builds without user-supplied keywords, stored list-build input lookup, research-workspace list-build guidance, the cleaned single LinkedIn-sourced list-build path, Exa Company Search up to 100 results, scheduled agent `--target ACCOUNTS|LEADS`, `agents signals --target`, the `agent-to-sequence` and `agent-to-leads` workflow scaffolds, paced HTTP Request column contracts, branch-aware LinkedIn sequence recipes, `LINKEDIN_MESSAGE` best-available delivery versus `LINKEDIN_CHAT_MESSAGE` chat-only guidance, sequence campaign intake guards before mutating objects, real agent soft-delete with associated-table handling, research-table sequence handoff assignee and active-sequence-conflict guard config, backend-owned directional source/destination helpers, goal-level workflow plans, website visitor/external intent webhook workflow guidance, create-time agent assignment defaults, company-page signal configuration guidance, sequence authoring warnings when AI draft is mixed with fixed templates, sender-account discovery/management for explicit sequence routing, mixed parent-row/child-list Sync to Table and Sync to Leads recipe configs, and company variable guidance for `company_name_clean` versus internal match keys
330
+ - `autotouch capabilities operations search "find work emails"` and `autotouch capabilities operations get research_table.email_finder` to map product operations to the current CLI command path
331
+ - `autotouch --version` should be `0.2.117` or newer for product-operation discovery via `capabilities operations list/search/get`, CRM custom-field catalog/create/update commands, lead/company custom-field value writes, structured company list builds without user-supplied keywords, stored list-build input lookup, research-workspace list-build guidance, the cleaned single LinkedIn-sourced list-build path, Exa Company Search up to 100 results, scheduled agent `--target ACCOUNTS|LEADS`, `agents signals --target`, the `agent_to_sequence` and `agent_to_leads` workflow scaffolds, paced HTTP Request column contracts, branch-aware LinkedIn sequence recipes, `LINKEDIN_MESSAGE` best-available delivery versus `LINKEDIN_CHAT_MESSAGE` chat-only guidance, sequence campaign intake guards before mutating objects, real agent soft-delete with associated-table handling, research-table sequence handoff assignee and active-sequence-conflict guard config, backend-owned directional source/destination helpers, goal-level workflow plans, website visitor/external intent webhook workflow guidance, create-time agent assignment defaults, company-page signal configuration guidance, sequence authoring warnings when AI draft is mixed with fixed templates, sender-account discovery/management for explicit sequence routing, mixed parent-row/child-list Sync to Table and Sync to Leads recipe configs, and company variable guidance for `company_name_clean` versus internal match keys
301
332
  - `autotouch capabilities --output json --select list_builds` for documented list-build inputs such as geography IDs, company size buckets, profile language, and company IDs
302
333
  - `autotouch integrations list` and `autotouch integrations status --provider <provider>` before choosing source/destination workflows
303
- - `autotouch workflows plan --type bulk-outreach` and `autotouch workflows scaffold --type bulk-outreach --out-dir workflow` for goal-level workflow planning
304
- - `autotouch workflows plan --type agent-to-leads` and `autotouch workflows scaffold --type agent-to-leads --out-dir workflow` for scheduled agent discovery into qualified Autotouch Leads without sequence tasks
305
- - `autotouch workflows plan --type agent-to-sequence` and `autotouch workflows scaffold --type agent-to-sequence --out-dir workflow` for scheduled agent discovery into Autotouch Sequence tasks
306
- - `autotouch workflows plan --type website-visitors` and `autotouch workflows scaffold --type website-visitors --out-dir workflow` for website visitor or external intent provider webhook workflows
334
+ - `autotouch workflows plan --type bulk_outreach` and `autotouch workflows scaffold --type bulk_outreach --out-dir workflow` for goal-level workflow planning
335
+ - `autotouch workflows plan --type agent_to_leads` and `autotouch workflows scaffold --type agent_to_leads --out-dir workflow` for scheduled agent discovery into qualified Autotouch Leads without sequence tasks
336
+ - `autotouch workflows plan --type agent_to_sequence` and `autotouch workflows scaffold --type agent_to_sequence --out-dir workflow` for scheduled agent discovery into Autotouch Sequence tasks
337
+ - `autotouch workflows plan --type website_visitors` and `autotouch workflows scaffold --type website_visitors --out-dir workflow` for website visitor or external intent provider webhook workflows
307
338
  - `autotouch integrations recipe --type from_crm --provider hubspot` for CRM-to-research-table imports
308
339
  - `autotouch columns recipe --type to_crm|to_outreach|to_leads|to_sequence` for research-table destination workflows
309
340
  - `autotouch list-build inputs` and `autotouch list-build pricing` before creating durable list-build jobs
@@ -54,6 +54,17 @@ from autotouch_cli.commands.columns import (
54
54
  cmd_columns_test_http_request as cmd_columns_test_http_request_impl,
55
55
  cmd_columns_update as cmd_columns_update_impl,
56
56
  )
57
+ from autotouch_cli.commands.companies import (
58
+ CompanyCommandRuntime as CompanyCommandHandlerRuntime,
59
+ cmd_companies_custom_fields_bulk_set as cmd_companies_custom_fields_bulk_set_impl,
60
+ cmd_companies_custom_fields_set as cmd_companies_custom_fields_set_impl,
61
+ )
62
+ from autotouch_cli.commands.crm import (
63
+ CrmCommandRuntime as CrmCommandHandlerRuntime,
64
+ cmd_crm_fields_create as cmd_crm_fields_create_impl,
65
+ cmd_crm_fields_list as cmd_crm_fields_list_impl,
66
+ cmd_crm_fields_update as cmd_crm_fields_update_impl,
67
+ )
57
68
  from autotouch_cli.commands.cells import (
58
69
  CellCommandRuntime as CellCommandHandlerRuntime,
59
70
  cmd_cells_get as cmd_cells_get_impl,
@@ -95,6 +106,8 @@ from autotouch_cli.commands.leads import (
95
106
  LeadCommandRuntime as LeadCommandHandlerRuntime,
96
107
  cmd_leads_count as cmd_leads_count_impl,
97
108
  cmd_leads_create as cmd_leads_create_impl,
109
+ cmd_leads_custom_fields_bulk_set as cmd_leads_custom_fields_bulk_set_impl,
110
+ cmd_leads_custom_fields_set as cmd_leads_custom_fields_set_impl,
98
111
  cmd_leads_filters_metadata as cmd_leads_filters_metadata_impl,
99
112
  cmd_leads_get as cmd_leads_get_impl,
100
113
  cmd_leads_query as cmd_leads_query_impl,
@@ -1398,6 +1411,28 @@ def _lead_command_runtime() -> LeadCommandHandlerRuntime:
1398
1411
  )
1399
1412
 
1400
1413
 
1414
+ def _company_command_runtime() -> CompanyCommandHandlerRuntime:
1415
+ return CompanyCommandHandlerRuntime(
1416
+ resolve_token=_resolve_token,
1417
+ request_api=_request_api,
1418
+ print_json=lambda data, compact=False: _print_json(data, compact=compact),
1419
+ load_json_input=_load_json_input,
1420
+ split_cli_string_values=_split_cli_string_values,
1421
+ parse_string_list_payload=_parse_string_list_payload,
1422
+ dedupe_keep_order=_dedupe_keep_order,
1423
+ normalize_string_value=_normalize_string_value,
1424
+ )
1425
+
1426
+
1427
+ def _crm_command_runtime() -> CrmCommandHandlerRuntime:
1428
+ return CrmCommandHandlerRuntime(
1429
+ resolve_token=_resolve_token,
1430
+ request_api=_request_api,
1431
+ print_json=lambda data, compact=False: _print_json(data, compact=compact),
1432
+ load_json_input=_load_json_input,
1433
+ )
1434
+
1435
+
1401
1436
  def _search_command_runtime() -> SearchCommandHandlerRuntime:
1402
1437
  return SearchCommandHandlerRuntime(
1403
1438
  resolve_token=_resolve_token,
@@ -1594,6 +1629,11 @@ _register("integrations_recipe", cmd_integrations_recipe_impl, _integration_comm
1594
1629
  _register("integrations_from_crm_status", cmd_integrations_from_crm_status_impl, _integration_command_runtime)
1595
1630
  _register("integrations_to_crm_status", cmd_integrations_to_crm_status_impl, _integration_command_runtime)
1596
1631
 
1632
+ # -- CRM commands --
1633
+ _register("crm_fields_list", cmd_crm_fields_list_impl, _crm_command_runtime)
1634
+ _register("crm_fields_create", cmd_crm_fields_create_impl, _crm_command_runtime)
1635
+ _register("crm_fields_update", cmd_crm_fields_update_impl, _crm_command_runtime)
1636
+
1597
1637
  # -- Outreach commands --
1598
1638
  _register("outreach_accounts_list", cmd_outreach_accounts_list_impl, _outreach_command_runtime)
1599
1639
  _register("outreach_campaigns_list", cmd_outreach_campaigns_list_impl, _outreach_command_runtime)
@@ -1616,6 +1656,8 @@ _register("leads_query", cmd_leads_query_impl, _lead_command_runtime)
1616
1656
  _register("leads_get", cmd_leads_get_impl, _lead_command_runtime)
1617
1657
  _register("leads_create", cmd_leads_create_impl, _lead_command_runtime)
1618
1658
  _register("leads_update", cmd_leads_update_impl, _lead_command_runtime)
1659
+ _register("leads_custom_fields_set", cmd_leads_custom_fields_set_impl, _lead_command_runtime)
1660
+ _register("leads_custom_fields_bulk_set", cmd_leads_custom_fields_bulk_set_impl, _lead_command_runtime)
1619
1661
  _register("leads_upsert_contact_channels", cmd_leads_upsert_contact_channels_impl, _lead_command_runtime)
1620
1662
  _register("leads_count", cmd_leads_count_impl, _lead_command_runtime)
1621
1663
  _register("leads_stats", cmd_leads_stats_impl, _lead_command_runtime)
@@ -1625,6 +1667,10 @@ _register("leads_research_tables", cmd_leads_research_tables_impl, _lead_command
1625
1667
  _register("leads_update_status", cmd_leads_update_status_impl, _lead_command_runtime)
1626
1668
  _register("leads_reassign_owner", cmd_leads_reassign_owner_impl, _lead_command_runtime)
1627
1669
 
1670
+ # -- Company commands --
1671
+ _register("companies_custom_fields_set", cmd_companies_custom_fields_set_impl, _company_command_runtime)
1672
+ _register("companies_custom_fields_bulk_set", cmd_companies_custom_fields_bulk_set_impl, _company_command_runtime)
1673
+
1628
1674
  # -- Task commands --
1629
1675
  _register("tasks_query", cmd_tasks_query_impl, _task_command_runtime)
1630
1676
  _register("tasks_count", cmd_tasks_count_impl, _task_command_runtime)
@@ -2184,6 +2230,234 @@ def cmd_capabilities(args: argparse.Namespace) -> None:
2184
2230
  _print_json(data, compact=args.compact)
2185
2231
 
2186
2232
 
2233
+ _EXECUTABLE_ACTION_SUPPORT = {"approval_required", "direct_write", "read_only"}
2234
+
2235
+
2236
+ def _fetch_capabilities_payload(args: argparse.Namespace) -> Any:
2237
+ token = _resolve_token(args.token, required=False)
2238
+ return _request_api(
2239
+ "GET",
2240
+ "/api/capabilities",
2241
+ base_url=args.base_url,
2242
+ token=token,
2243
+ use_x_api_key=args.use_x_api_key,
2244
+ timeout=args.timeout,
2245
+ verbose=args.verbose,
2246
+ )
2247
+
2248
+
2249
+ def _fetch_operation_detail(args: argparse.Namespace, operation_id: str) -> Any:
2250
+ token = _resolve_token(args.token, required=False)
2251
+ return _request_api(
2252
+ "GET",
2253
+ f"/api/capabilities/operations/{operation_id}",
2254
+ base_url=args.base_url,
2255
+ token=token,
2256
+ use_x_api_key=args.use_x_api_key,
2257
+ timeout=args.timeout,
2258
+ verbose=args.verbose,
2259
+ )
2260
+
2261
+
2262
+ def _operation_index_from_capabilities(payload: Any) -> List[Dict[str, Any]]:
2263
+ if not isinstance(payload, dict):
2264
+ return []
2265
+ operations = payload.get("operations")
2266
+ if not isinstance(operations, dict):
2267
+ return []
2268
+ index = operations.get("index")
2269
+ if not isinstance(index, list):
2270
+ return []
2271
+ return [entry for entry in index if isinstance(entry, dict)]
2272
+
2273
+
2274
+ def _operation_matches_filters(entry: Dict[str, Any], args: argparse.Namespace) -> bool:
2275
+ surface = getattr(args, "surface", None)
2276
+ if surface and str(entry.get("surface") or "") != str(surface):
2277
+ return False
2278
+ cli_status = getattr(args, "cli_status", None)
2279
+ if cli_status and str(entry.get("cli_status") or "") != str(cli_status):
2280
+ return False
2281
+ if bool(getattr(args, "cli_available", False)) and bool(entry.get("cli_available")) is not True:
2282
+ return False
2283
+ if bool(getattr(args, "approval_required", False)) and bool(entry.get("approval_required")) is not True:
2284
+ return False
2285
+ if bool(getattr(args, "no_approval_required", False)) and bool(entry.get("approval_required")) is True:
2286
+ return False
2287
+ if bool(getattr(args, "executable_only", False)) and str(entry.get("action_support") or "") not in _EXECUTABLE_ACTION_SUPPORT:
2288
+ return False
2289
+ return True
2290
+
2291
+
2292
+ def _operation_matches_query(entry: Dict[str, Any], query: str) -> bool:
2293
+ needle = query.strip().lower()
2294
+ if not needle:
2295
+ return True
2296
+ searchable: List[str] = []
2297
+ for key in ("id", "surface", "label", "description", "action_support", "cli_status"):
2298
+ value = entry.get(key)
2299
+ if value is not None:
2300
+ searchable.append(str(value))
2301
+ tags = entry.get("tags")
2302
+ if isinstance(tags, list):
2303
+ searchable.extend(str(tag) for tag in tags)
2304
+ return needle in " ".join(searchable).lower()
2305
+
2306
+
2307
+ def _filtered_operation_index(args: argparse.Namespace, *, query: Optional[str] = None) -> Tuple[Any, List[Dict[str, Any]]]:
2308
+ payload = _fetch_capabilities_payload(args)
2309
+ entries = [
2310
+ entry
2311
+ for entry in _operation_index_from_capabilities(payload)
2312
+ if _operation_matches_filters(entry, args)
2313
+ and (query is None or _operation_matches_query(entry, query))
2314
+ ]
2315
+ return payload, entries
2316
+
2317
+
2318
+ def _operation_index_from_capability_search(payload: Any) -> List[Dict[str, Any]]:
2319
+ if not isinstance(payload, dict):
2320
+ return []
2321
+ results = payload.get("results")
2322
+ if not isinstance(results, list):
2323
+ return []
2324
+ entries: List[Dict[str, Any]] = []
2325
+ for result in results:
2326
+ if not isinstance(result, dict) or result.get("kind") != "operation":
2327
+ continue
2328
+ item = result.get("item")
2329
+ if isinstance(item, dict):
2330
+ entries.append(item)
2331
+ return entries
2332
+
2333
+
2334
+ def _search_operation_index(args: argparse.Namespace, *, query: str) -> Tuple[Any, List[Dict[str, Any]]]:
2335
+ token = _resolve_token(args.token, required=False)
2336
+ params: Dict[str, Any] = {
2337
+ "q": query,
2338
+ "limit": 25,
2339
+ "executable_only": bool(getattr(args, "executable_only", False)),
2340
+ }
2341
+ surface = str(getattr(args, "surface", "") or "").strip()
2342
+ if surface:
2343
+ params["surface"] = surface
2344
+ payload = _request_api(
2345
+ "GET",
2346
+ "/api/capabilities/search",
2347
+ base_url=args.base_url,
2348
+ token=token,
2349
+ use_x_api_key=args.use_x_api_key,
2350
+ params=params,
2351
+ timeout=args.timeout,
2352
+ verbose=args.verbose,
2353
+ )
2354
+ entries = [
2355
+ entry
2356
+ for entry in _operation_index_from_capability_search(payload)
2357
+ if _operation_matches_filters(entry, args)
2358
+ ]
2359
+ return payload, entries
2360
+
2361
+
2362
+ def _operation_command_path(operation: Dict[str, Any]) -> str:
2363
+ bindings = operation.get("cli_bindings")
2364
+ if not isinstance(bindings, list):
2365
+ cli = operation.get("cli")
2366
+ if isinstance(cli, dict):
2367
+ bindings = cli.get("bindings")
2368
+ if not isinstance(bindings, list):
2369
+ return "-"
2370
+ paths: List[str] = []
2371
+ for binding in bindings:
2372
+ if not isinstance(binding, dict):
2373
+ continue
2374
+ command_keys = binding.get("command_keys")
2375
+ if not isinstance(command_keys, list):
2376
+ continue
2377
+ for command_key in command_keys:
2378
+ command_text = " ".join(str(command_key).split(".")).strip()
2379
+ if command_text:
2380
+ paths.append(f"autotouch {command_text}")
2381
+ return ", ".join(paths) if paths else "-"
2382
+
2383
+
2384
+ def _enrich_operations_for_human(args: argparse.Namespace, entries: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
2385
+ enriched: List[Dict[str, Any]] = []
2386
+ for entry in entries:
2387
+ operation_id = str(entry.get("id") or "").strip()
2388
+ if not operation_id:
2389
+ enriched.append(entry)
2390
+ continue
2391
+ detail = _fetch_operation_detail(args, operation_id)
2392
+ if isinstance(detail, dict):
2393
+ merged = dict(entry)
2394
+ merged["cli_bindings"] = detail.get("cli_bindings", [])
2395
+ merged["cli"] = detail.get("cli", entry.get("cli"))
2396
+ enriched.append(merged)
2397
+ else:
2398
+ enriched.append(entry)
2399
+ return enriched
2400
+
2401
+
2402
+ def _print_operations_human(entries: List[Dict[str, Any]], *, heading: str) -> None:
2403
+ print(heading)
2404
+ print("-" * len(heading))
2405
+ if not entries:
2406
+ print("No matching operations.")
2407
+ return
2408
+ for entry in entries:
2409
+ operation_id = _as_display(entry.get("id"))
2410
+ label = _as_display(entry.get("label"))
2411
+ support = _as_display(entry.get("action_support"))
2412
+ approval = "approval" if entry.get("approval_required") else "no approval"
2413
+ cli_status = _as_display(entry.get("cli_status"))
2414
+ command_path = _operation_command_path(entry)
2415
+ print(f"{operation_id} | {label}")
2416
+ print(f" support={support} | {approval} | cli={cli_status} | command={command_path}")
2417
+
2418
+
2419
+ def _operation_list_payload(entries: List[Dict[str, Any]], *, query: Optional[str] = None) -> Dict[str, Any]:
2420
+ payload: Dict[str, Any] = {"operations": {"index": entries, "count": len(entries)}}
2421
+ if query is not None:
2422
+ payload["query"] = query
2423
+ return payload
2424
+
2425
+
2426
+ def cmd_capabilities_operations_list(args: argparse.Namespace) -> None:
2427
+ _payload, entries = _filtered_operation_index(args)
2428
+ if OUTPUT_MODE == "human" and not (OUTPUT_SELECT or OUTPUT_JSON_POINTER):
2429
+ _print_operations_human(
2430
+ _enrich_operations_for_human(args, entries),
2431
+ heading="Product operations",
2432
+ )
2433
+ return
2434
+ _print_json(_operation_list_payload(entries), compact=args.compact)
2435
+
2436
+
2437
+ def cmd_capabilities_operations_search(args: argparse.Namespace) -> None:
2438
+ query = str(getattr(args, "query", "") or "")
2439
+ _payload, entries = _search_operation_index(args, query=query)
2440
+ if OUTPUT_MODE == "human" and not (OUTPUT_SELECT or OUTPUT_JSON_POINTER):
2441
+ _print_operations_human(
2442
+ _enrich_operations_for_human(args, entries),
2443
+ heading=f"Product operations matching {query!r}",
2444
+ )
2445
+ return
2446
+ _print_json(_operation_list_payload(entries, query=query), compact=args.compact)
2447
+
2448
+
2449
+ def cmd_capabilities_operations_get(args: argparse.Namespace) -> None:
2450
+ operation_id = str(getattr(args, "operation_id", "") or "").strip()
2451
+ data = _fetch_operation_detail(args, operation_id)
2452
+ if OUTPUT_MODE == "human" and isinstance(data, dict) and not (OUTPUT_SELECT or OUTPUT_JSON_POINTER):
2453
+ _print_operations_human([data], heading="Product operation")
2454
+ description = data.get("description")
2455
+ if description:
2456
+ print(f" description={description}")
2457
+ return
2458
+ _print_json(data, compact=args.compact)
2459
+
2460
+
2187
2461
  def cmd_sop(args: argparse.Namespace) -> None:
2188
2462
  if args.out_file:
2189
2463
  with open(args.out_file, "w", encoding="utf-8") as f:
@@ -2568,6 +2842,9 @@ def _build_commands_dict() -> Dict[str, Callable]:
2568
2842
  commands["personal_context_set"] = cmd_personal_context_set
2569
2843
  commands["context_resolved"] = cmd_context_resolved
2570
2844
  commands["capabilities"] = cmd_capabilities
2845
+ commands["capabilities_operations_list"] = cmd_capabilities_operations_list
2846
+ commands["capabilities_operations_search"] = cmd_capabilities_operations_search
2847
+ commands["capabilities_operations_get"] = cmd_capabilities_operations_get
2571
2848
  commands["blacklist_list"] = cmd_blacklist_list
2572
2849
  commands["blacklist_add"] = cmd_blacklist_add
2573
2850
  commands["blacklist_remove"] = cmd_blacklist_remove