nixflex 0.8.0 → 0.11.0

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.
package/B57-DELETES.md ADDED
@@ -0,0 +1,52 @@
1
+ # B57 content deletion — unpublished K9 candidates
2
+
3
+ Node/CLI 0.11.0, Python 0.4.0 and MCP 0.5.0. MCP has 97 tools. This change does not publish anything.
4
+
5
+ | Operation | Node | Python sync / async | CLI | MCP |
6
+ |---|---|---|---|---|
7
+ | Call | client.calls.delete(id) | client.calls.delete(id), await on AsyncNixflex | nixflex calls delete ID --confirm | delete_call with call_id and confirm:true |
8
+ | Voice campaign | client.campaigns.delete(id) | client.campaigns.delete(id), await on AsyncNixflex | nixflex campaigns delete ID --confirm | delete_campaign with campaign_id and confirm:true |
9
+ | SMS campaign | client.sms.campaigns.delete(id) | client.sms.campaigns.delete(id), await on AsyncNixflex | nixflex sms campaigns delete ID --confirm | delete_sms_campaign with campaign_id and confirm:true |
10
+
11
+ One DELETE per invocation. Never an automatic retry. SDK mutations require the application's deliberate authorization. The new voice CLI command and all three MCP content-delete tools preview locally with zero requests unless confirmed.
12
+
13
+ Calls end before their content is deleted. Success returns call_id, deleted:true, recording_deleted (boolean) and recording_cleanup (carrier_best_effort or queued). These fields do not prove every external recording copy is erased.
14
+
15
+ Campaign deletion cancels waiting work, ends running calls and hides the campaign. History and used charges remain; no refunds, and sent SMS cannot be recalled. Success returns campaign_id, deleted:true and message:"Campaign deleted". Owner/Admin only; missing/foreign resources return 404, including already absent resources. The kits never turn 404 into invented success. A previously hidden but still tracked owned item can return the same successful receipt on a deliberate repeat; hidden does not mean physically absent.
16
+
17
+ HTTP 503 with error.code hangup_pending and error.details {deleted:false,retry_pending:true} means the server queued deletion and finishes once hang-up is confirmed. Node/Python raise NixflexServerError with that exact status/code/details; CLI/MCP report a structured error, never success. A later deliberate repeat of the same DELETE is safe; the kit does not repeat it or poll automatically.
18
+
19
+ Other 5xx, lost replies or invalid JSON remain outcome_unknown: inspect the outcome before a deliberate retry. HTTP status and server details survive; the original server code is in details.original_code when uncertainty wrapping applies. Known 403/404 retain their exact code/details. No synthetic successful receipt is created. The three MCP tools require the matching ID and full documented success receipt; empty, incomplete or wrong-ID replies remain uncertain. Existing SDK methods continue passing valid JSON through; callers should require the documented deleted:true receipt rather than treating an arbitrary JSON object as proof.
20
+
21
+ Bulk calls.deleteAll() / calls.delete_all() / nixflex calls delete-all --confirm remains a separate guarded cleanup route with deleted/calls_deleted/recordings_deleted/sms_deleted counters. It is not account or SMS erasure and does not use B57's single-item queue classification. Bulk deletion stays outside MCP for safety.
22
+
23
+ Use fresh list/detail reads to inspect current server state. The kits do not cache deletion, hide rows locally or erase retained billing/history evidence. A deleted/retained stub and a 404 are returned as the API reports them.
24
+
25
+ ```js
26
+ // Using an already configured client; authorize the exact campaign first.
27
+ try {
28
+ const receipt = await client.campaigns.delete(campaignId);
29
+ if (receipt.deleted !== true) throw new Error('Deletion is not confirmed');
30
+ } catch (error) {
31
+ if (error.status === 503 && error.code === 'hangup_pending' &&
32
+ error.details.deleted === false && error.details.retry_pending === true) {
33
+ // Show "Deletion queued". Do not send another request automatically.
34
+ } else { throw error; }
35
+ }
36
+ ```
37
+
38
+ ```python
39
+ from nixflex.errors import NixflexServerError
40
+
41
+ # Use await client.campaigns.delete(campaign_id) with AsyncNixflex.
42
+ try:
43
+ receipt = client.campaigns.delete(campaign_id)
44
+ if receipt.get("deleted") is not True:
45
+ raise RuntimeError("Deletion is not confirmed")
46
+ except NixflexServerError as error:
47
+ if (error.status == 503 and error.code == "hangup_pending"
48
+ and error.details.get("deleted") is False and error.details.get("retry_pending") is True):
49
+ pass # Show "Deletion queued"; do not repeat automatically.
50
+ else:
51
+ raise
52
+ ```
@@ -0,0 +1,73 @@
1
+ # Call booking results and durable call requests (K7)
2
+
3
+ Source: B56 engine f6ff94d, 5 November 2026. Candidate versions remain Node/CLI 0.11.0, Python 0.4.0, MCP 0.5.0; unpublished.
4
+
5
+ ## Coverage
6
+
7
+ | Operation | Node | CLI | Python sync / async | MCP |
8
+ | --- | --- | --- | --- | --- |
9
+ | GET /v1/calls/{call_id}/bookings | calls.bookings(id) | calls bookings ID | calls.bookings(id) | get_call_bookings |
10
+ | POST /v1/calls/outbound, optional UUID request_id | calls.create(params) | calls create --request-id UUID or --body @prepared.json | calls.create(..., request_id=uuid) | create_call, optional request_id / safe_retry / confirm |
11
+ | GET /v1/calls/outbound/requests/{request_id} | calls.outboundRequest(uuid) | calls outboundRequest UUID | calls.outbound_request(uuid) | get_outbound_call_request |
12
+ | Local preparation, no API request | calls.prepare(params), prepareOutboundCall(params) | calls prepare --output prepared.json | calls.prepare(**params), prepare_outbound_call(params) | create_call with safe_retry:true and no request_id |
13
+
14
+ The two GET routes are new coverage. POST already existed; request_id extends it. Preparation is local, not another API endpoint. At K7, MCP registered 96 tools (94 prior plus two reads); only create_call gained optional inputs/guidance. Those historical contracts were pinned to K6. The current K9 count is 97; see B57-DELETES.md for its one added tool and two updated delete handlers/descriptions. Public-scope exclusions remain unchanged.
15
+
16
+ ## Retained booking result
17
+
18
+ All envelopes have exactly {call_id, state, result}. States are:
19
+
20
+ | State | Meaning | result |
21
+ | --- | --- | --- |
22
+ | ready | Retained, stamped booking changes from this call are available | CallBookingResult |
23
+ | none | Complete result proves no successful booking changes | null |
24
+ | processing | Call/post-call work is unfinished | null |
25
+ | deleted | Data was removed or expired | null |
26
+ | unavailable | Result cannot be established from retained evidence | null |
27
+
28
+ Never treat processing, deleted, unavailable, an error, or a missing call as none. An old empty history without completion proof is unavailable. These are this call's results, not current calendar inventory. They do not query the customer's calendar or prove the appointment still exists today.
29
+
30
+ The ready result has event:'call.bookings', call_id, agent_id, from, to, number, ended_at, timeline, final. agent_id/from/to/number/ended_at are nullable strings; ended_at is an ISO timestamp when known. The wire name is `from` in every language.
31
+
32
+ Each ordered timeline entry has action:created|rescheduled|cancelled, booking_uid, start, end, attendee_name, attendee_email, service, timezone, at. booking_uid and at are strings; the other fields are nullable. service may be string, number or null. Each final entry has booking_uid, status:active|cancelled and the same six appointment fields; no action/at. Preserve order, nulls, and server UID rotation. Do not refold events, invent appointments, or expose internal proof markers. Lookup/availability/duplicate-found operations are not new booking changes.
33
+
34
+ 404 not_found means missing, invalid or not owned; it is not an empty result. 503 call_bookings_unavailable means the read failed. SDKs provide NixflexCallBookingsUnavailableError. Authentication/permission errors remain errors. Reads are not cached by the server. Response projection drops unknown/private fields and rejects malformed public shapes instead of making up an outcome.
35
+
36
+ The new helpers reject missing, control-character, overlong and dot-only (`.` / `..`) call IDs before sending. Dot-only IDs would otherwise be normalized into a different URL by HTTP clients. Other special characters are encoded as one path component.
37
+
38
+ ## UUID preparation and one intentional send
39
+
40
+ Generate a UUID before the first POST, save it with the exact call inputs, and pass the saved body to create. `prepare` deep-copies JSON inputs; repeated preparation generates a different ID, so never prepare again to retry a prior intent. An explicitly supplied valid request_id is kept. A malformed UUID fails locally before any request. Python prepare accepts variables as an alias and stores canonical dynamic_vars; supply only one alias.
41
+
42
+ CLI --output writes UTF-8 without a BOM, publishes the whole file only after writing succeeds, and never overwrites a file. It sends no HTTP request, needs no API key and returns sent:false. Without --output use --json to obtain the prepared body. Keep that file private: it contains call inputs. Avoid PowerShell 5.1 `>` for JSON files (its default encoding is incompatible); use --output instead.
43
+
44
+ Every POST makes one attempt only. There is no automatic retry, ID replacement, redial, status-polling loop, cancellation or hidden reservation by the kit. A subsequent explicit POST with the same ID and identical inputs uses the server journal. Same-ID changed intent returns 409 request_id_conflict. The fingerprint includes agent_id, from_number, to_number, prompt, dynamic_vars, campaign_id, recipient_timezone, recipient_country and consent_confirmed. Keep all these identical. UUID scope is the API account in the selected environment. Keep using the same account and base URL; the same UUID on another account or environment is a separate request and can place another call. Do not assume a journal lifetime or promise perpetual idempotency.
45
+
46
+ Normal first acceptance is HTTP 201 with call_id, status:'initiated', request_id and the existing receipt fields. Accepted replay is HTTP 200 with {call_id, request_id, status:'initiated', replayed:true}; to/from are absent on replay. Acceptance means a call was accepted, not connected/completed or successfully booked.
47
+
48
+ If a call ID is known but the journal update was not confirmed, the successful response also has request_status:'unconfirmed', safe_to_retry:false. Keep the call ID; do not convert this response into a failed call or start another one. A lost, invalid or malformed acceptance is an unknown outcome with the saved UUID.
49
+
50
+ Calls without request_id retain the old request/response path. Public /v1 does not acquire the dashboard-only preview/consent requirements. No billing, carrier, role, ownership or admission rules are changed.
51
+
52
+ Node typing follows the actual response: a known no-ID input retains OutboundCallResponse; a required-ID input has OutboundRequestReceipt. A broadly annotated OutboundCallParams has an optional ID, so its return type is the union and to/from must be checked. Use `satisfies OutboundCallParams` to validate a no-ID literal without widening its type. This is a type-safety change, not a no-ID runtime change.
53
+
54
+ Cancelling an HTTP request does not cancel a remote call or prove it was never accepted. Node aborts on the UUID path report an unknown outcome with the saved ID. Python native async task cancellation remains CancelledError; keep the prepared ID outside the task and reconcile it separately. Never swallow cancellation into a retry loop.
55
+
56
+ ## Errors and status reads
57
+
58
+ | Code | HTTP | SDK class | Action |
59
+ | --- | --- | --- | --- |
60
+ | outbound_request_pending | 409 | NixflexOutboundRequestPendingError | Keep the UUID; read status; do not start a second call |
61
+ | outbound_request_unknown | 409 or 503; transport failure can be 0 | NixflexOutboundRequestUnknownError | Check request and Call History; no new ID or automatic retry |
62
+ | request_id_conflict | 409 | NixflexRequestIdConflictError | The saved ID was used for different inputs; investigate the earlier intent |
63
+ | outbound_request_unavailable | 503 | NixflexOutboundRequestUnavailableError | Store could not be checked; this does not rule out an earlier accepted call |
64
+
65
+ SDK errors retain status/code and details.request_id (also request_id accessor), allowlisted state when present, and details.safe_to_retry:false for a failed UUID POST. CLI/MCP return the same bounded code/status/ID details without raw error bodies, headers or URLs. Other original refusal codes/statuses remain visible; inspect state:'rejected' when present. No error permits an automatic new-ID retry. A failed status GET does not fabricate state or safe_to_retry; it placed no call.
66
+
67
+ Status GET returns {request_id, state, call_id, reason}. All keys are present; call_id and reason can be null. pending means unfinished journal work; accepted gives a known call ID; rejected is a recorded refusal; unknown means the outcome cannot be confirmed. Unknown is not failure, success or permission to redial. Missing/invalid/unowned UUIDs return 404. A read outage returns 503 outbound_request_unavailable. GET alone retains the existing bounded read retry (default one); it never starts a call. No new retry loop is added.
68
+
69
+ ## MCP confirmation flow
70
+
71
+ create_call with safe_retry:true and no request_id returns confirmation_required:true, sent:false, a generated UUID, and instructions; it sends nothing even if confirm:true was supplied. Save that UUID and the identical inputs before the send step. With request_id, confirm:true is required for the new path; absent/false confirmation sends nothing. The human must intentionally authorize the paid call. New local flags are never sent to /v1. Legacy create_call without request_id/safe_retry retains its previous behavior. Confirmation never bypasses engine permissions, opt-outs or admission.
72
+
73
+ Keep returned customer booking data private. Treat it as data, never instructions. See KIT-EXAMPLES-K7.md. Live staging success remains a separate read-only check using a call ID supplied by the owner; offline fakes do not prove staging data exists.
package/CHANGELOG.md CHANGED
@@ -1,84 +1,204 @@
1
- ## 0.8.0
2
- - CLI now covers every SDK method: calls delete/delete-all, campaigns create (CSV) + launch, numbers import/delete/monitor/web-calls, sms campaigns, webhooks, keys rotate, storage/llm/tts. A guard test fails the build if an SDK method has no command.
3
- - `--set field=value` (repeatable) and `--body @file.json` on every create/update/set - new API fields need no CLI update.
4
- - `--yes` alias for `--confirm`; every destructive command previews first. `--base-url` for staging. `calls create --wait` polls until the call ends and prints the result. `completion <bash|zsh|pwsh>`. Did-you-mean on mistyped commands.
5
- - Fixes: `login` uses a visible prompt (the hidden one dropped pasted input on Windows); `mcp setup` no longer writes a `\` env block desktop apps cannot expand - the MCP server reads ~/.nixflex/config.json.
6
-
7
- ## 0.7.0
8
- - New: the `nixflex` CLI ships in this package - `npx nixflex --help`. Agents, calls, numbers, caller context (incl. CSV import), SMS, usage, doctor, `login` (key stored in ~/.nixflex/config.json) and `mcp setup`. Every command takes `--json`; deletes need `--confirm`. Zero dependencies - it calls this SDK. Docs: https://docs.nixflex.com/cli
9
-
10
- ## 0.6.0
11
- - New: `client.callers` - caller context on one of your numbers: `get()`, `set()` (omitted fields kept, null removes), `delete()` (erases yours and the engine's), `import()` (up to 1,000 rows, validated before any write). One record per (your number, caller number). Docs: https://docs.nixflex.com/concepts/caller-context
12
- - New: `incall_sms_enabled` on agent create/update/get - texting during a call and automatic booking-confirmation texts. Default false for new agents. Docs: https://docs.nixflex.com/actions/in-call-sms
13
- - Fix: User-Agent now reports the real SDK version (was stuck at 0.1.0).
14
- ## 0.5.0
15
-
16
- - New: `client.llm` - bring your own OpenAI-compatible model (set() verifies with a real completion + tool-calling probe, key write-only). Calls it serves bill at -0.015/min.
17
- - New: `client.tts` - bring your own voice (elevenlabs/cartesia, set() verifies with a real synthesis, key write-only). Phone calls only; -0.02/min.
18
- - Docs: https://docs.nixflex.com/advanced/your-own-llm and /advanced/your-own-tts
19
-
20
- ## 0.4.0
21
-
22
- - New: `client.storage` - connect your own S3-compatible bucket for call recordings (data residency). `storage.set()` verifies with a probe write before saving, `storage.get()` never returns the secret, `storage.delete()` disconnects. Recordings then upload to your bucket and `recording_url` becomes a `byo:` path. See https://docs.nixflex.com/advanced/your-own-storage
23
-
24
- ## 0.3.1 (2026-08-24)
25
-
26
- - Voicemail as a structured setting: `voicemail_leave_enabled` + `voicemail_message` on Agent (applies to dashboard-imported numbers) and on PhoneNumber / PhoneNumberUpdateParams (the only voicemail control for API-imported numbers - no inheritance across the two worlds)
27
- - Enabling without a message is rejected with `voicemail_message_required`
28
- - No breaking changes.
29
- ## 0.3.0 (2026-08-23)
30
-
31
- - Call type: `charged_minutes` (minutes actually billed - transfers stop the meter at handoff, so this can be less than the recording length)
32
- - Call type: `ended_reason` documented with the full value list, including the new `callee_hangup` (outbound) and carrier words (`busy`, `failed`, `no-answer`, `canceled`)
33
- - No breaking changes. `list` pagination (`limit`/`offset`) shipped previously in 0.2.x.
34
- # Changelog
35
-
36
- All notable changes to the `nixflex` package. This project follows
37
- [semantic versioning](https://semver.org): patch for fixes, minor for new
38
- features, major for breaking changes. Published methods are never removed or
39
- renamed within a major version.
40
-
41
- ## 0.2.2
42
-
43
- - Corrected the SMS campaign documentation: rom_number may be on either carrier
44
- (Twilio or Telnyx). An earlier docs page wrongly stated Telnyx was rejected at
45
- create; the engine routes by provider. No code behaviour changed.
46
-
47
- ## 0.2.1
48
-
49
- - Added MIT `LICENSE`, this changelog, and repository/homepage/issue metadata
50
- so the npm page links back to the source and docs.
51
- - Documented `verifyWebhookSignature` in the README.
52
- - Continuous integration now builds and runs the test suite on every push.
53
- - No API changes.
54
-
55
- ## 0.2.0
56
-
57
- - **Added** `verifyWebhookSignature(rawBody, signatureHeader, keySecret)` and
58
- `client.webhooks.verify(...)` - verifies the `X-Nixflex-Signature` header
59
- (HMAC-SHA256 over `"<timestamp>.<body>"`) with a constant-time comparison and
60
- a configurable replay window (5 minutes by default). Never throws.
61
- - **Added** `client.calls.delete(callId)` - permanently erases one call record,
62
- transcript, and recording file.
63
- - **Added** `client.calls.deleteAll()` - erases all calls, recordings, and SMS
64
- messages on the key.
65
- - Added `@types/node` as a development dependency (required for `Buffer` and
66
- `node:crypto` types in the generated declarations).
67
-
68
- ## 0.1.0
69
-
70
- First public release.
71
-
72
- - `agents` - create, list, get, update, delete, `iter()`
73
- - `calls` - create outbound, list, get, `iter()`
74
- - `campaigns` - create and launch voice batch campaigns
75
- - `phoneNumbers` - import, list, update, delete, monitor and web-call toggles
76
- - `sms` - single sends and bulk campaigns
77
- - `keys` - rotate the API secret
78
- - `usage` - account usage and limits
79
- - `webhooks` - per-number webhook configuration
80
- - Typed errors per HTTP status, automatic retry on `429` honouring
81
- `Retry-After`, retries on network failure, and no blind retry of `POST`
82
- requests after a `5xx` (a call is never dialled twice).
83
- - Dual ESM and CommonJS builds, TypeScript declarations, zero runtime
84
- dependencies, Node 18 or newer.
1
+ # K9 — 2026-11-11 (same unpublished candidate versions)
2
+
3
+ - Added voice campaign deletion to Node, Python sync/async, CLI and the confirmed MCP delete_campaign tool (97 tools total).
4
+ - Call and SMS campaign deletion now describe B57: running calls end first, waiting work is cancelled, campaigns are hidden; history and used charges remain, no refund.
5
+ - Complete 503 hangup_pending proof is preserved as a queued error, not success or an unknown outcome. Other uncertain replies remain uncertain. One DELETE per invocation, no automatic retry.
6
+ - MCP content-delete previews make zero requests. Existing tool inputs/permissions and all unrelated tools are preserved. Bulk deletion remains excluded from MCP and keeps its separate SDK/CLI safety guard.
7
+ - See B57-DELETES.md for receipts and error handling. K8 approved and completed the historical K7 lock updates; no earlier "awaiting K7 approval" note remains an open decision.
8
+
9
+ # K7 — 2026-11-05 (same unpublished candidate versions)
10
+
11
+ - Added call booking-result and outbound request-status reads to Node, CLI, Python sync/async and MCP (96 tools).
12
+ - Optional UUID request_id on outbound create; local prepare helpers save the identity before sending. CLI --output writes exclusive UTF-8 JSON; no implicit redial or replacement ID.
13
+ - First acceptance 201 and same-call replay 200 are distinct; unconfirmed journal acknowledgement preserves a known call ID. Four typed B56 errors retain safe UUID/status/code details.
14
+ - Booking ready/none/processing/deleted/unavailable stay distinct; private markers are removed. Exact timeline/final shapes and examples are in CALL-REQUESTS.md / KIT-EXAMPLES-K7.md.
15
+ - MCP create_call keeps the old no-ID path. New safe_retry prepares only; request_id requires confirm:true. The other 93 contracts and all unrelated handlers remain unchanged. Earlier exclusions remain.
16
+ - Local candidate only. Locked full-list/schema checks await K7 owner approval; no publication is authorized by this changelog.
17
+
18
+ # 0.11.0 — 2026-11-04 (unpublished candidate)
19
+
20
+ - Added four per-number Google Calendar methods and in-place carrier credential updates; matching CLI commands / five MCP tools (94 total).
21
+ - Credential CLI input is private environment/stdin only; MCP reads private environment after explicit confirmation. No secret arguments/output or automatic write retries.
22
+ - Added typed calendar/credential errors and nullable booking webhook models; service accepts string, number or null.
23
+ - Compatibility notice: SMS suppression is now HTTP 409 do_not_contact/conflict. Node/Python: catch NixflexDoNotContactError, while retaining old-server 400 invalid_request handling. MCP/CLI: inspect structured status/code. Never retry or remove opt-out automatically; not every 400 is suppression.
24
+ - All 89 previous MCP tools, schemas, handlers and safeguards preserved. Engine endpoints and previous kit exclusions unchanged except the expressly added K6 operations.
25
+
26
+ ## Unreleased K5b — 2 November 2026
27
+
28
+ - Document and verify caller_not_found versus phone_number_not_found; error mapping and retry behavior are unchanged.
29
+ - Node keyterms return typing includes all six B49g response fields; no runtime request change.
30
+ - Safe staging checker uses an owned non-protected number and exact caller absence code.
31
+
32
+ ## K5 approved follow-up — 2 November 2026
33
+
34
+ - Versions approved; SDK/CLI Knowledge coverage unchanged. Legacy draft GET can normalize and save: manual use only, excluded from the safe checker and MCP.
35
+ - Published-mode MCP setup pins 0.4.0; publish and verify MCP before Node. Unpublished-mode refusal remains tested.
36
+ - No push or publication performed.
37
+
38
+ ## Unreleased K5 — 2 November 2026
39
+
40
+ - All 39 public Knowledge operations plus automatic keyterms read.
41
+ - Explicit revisions/operation keys, bounded polling, streamed uploads and JSON exports; partial exports never replay.
42
+ - New CLI POST/change commands require confirmation. Safe CLI errors preserve uncertainty.
43
+ - Complete K1–K5 public method guides; no private signing-secret or account-erasure additions.
44
+ - Node public declarations no longer export unused private provider-specific types; engine endpoints unchanged.
45
+ - Approved versions, not published; successful writes await manual staging.
46
+
47
+ ## Unreleased K4 — 2 November 2026
48
+
49
+ - MCP now has 70 tools: 59 prior descriptors/permissions unchanged plus 11
50
+ approved additions. Only get_webhook and the unconfirmed delete_webhook preview
51
+ mask URL output; their errors, retries, confirmation and confirmed deletion stay
52
+ unchanged. New credential-setting/disconnect tools and signing secrets stay out.
53
+ - Organisation activity accepts UTC dates; event IDs/cursors are strings and
54
+ types now describe actor/sentence/displayed result. Added streamed CSV export
55
+ and organisation rename. CSV never retries after emitting data.
56
+ - Added all public integration settings to Node/CLI and Python sync/async.
57
+ PUT replaces config; function PATCH changes supplied fields only.
58
+ - CLI private integration output omits URLs, credentials, headers and free-form
59
+ schemas, including existing webhook reads/previews. SDK responses retain exact
60
+ wire data; callers must not log private configuration.
61
+ - New CLI writes require confirmation before any request. Existing mutation
62
+ retry/outcome safety stays unchanged. No signing-secret method; personal
63
+ session-only flows stay dashboard only.
64
+ - Candidate versions unchanged; nothing published. Successful real writes
65
+ require separate manual testing; offline tests are not staging evidence.
66
+
67
+ ## Unreleased K3 — 2 November 2026
68
+
69
+ - Added voice/SMS campaign controls, contact-hour preview and suppression lists,
70
+ web widget settings, and agent inbox reads/settings with exact public paths.
71
+ - Node/CLI and Python sync/async now cover all 27 C5 operations. Revisions and
72
+ read versions stay strings; nullable fields, JSON variables and cursors survive.
73
+ - Python inbox boolean queries use lowercase true/false. Reads never mark read.
74
+ - MCP now has 59 tools: 44 existing definitions/handlers unchanged plus 15 reviewed
75
+ additions. Every new mutation requires confirmation before any request.
76
+ - Intentional MCP exclusions: voice/SMS resume, voice/SMS consent and suppression
77
+ removal can enable outreach. All remain in API/SDK/CLI. Signup remains excluded
78
+ because it returns a new secret; bulk deletion remains excluded for AI safety.
79
+ - Creation can start work immediately; there is no safe draft-only campaign mode.
80
+ Writes never automatically repeat. Successful real writes need separate testing.
81
+ - Candidate versions unchanged; nothing published. Existing SDK/CLI methods and
82
+ engine endpoints remain available. SMS reuse_campaign_id is not supported.
83
+
84
+ # 0.10.0 — K1, 1 November 2026 (unpublished)
85
+
86
+ Removed calls.billing, phoneNumbers.setMonitor/getMonitor, storage/llm/tts.set/get/delete; CLI calls billing, numbers monitor and storage/llm/tts commands.
87
+ Reason: **non-public by Fahim decision**. Engine endpoints stay unchanged.
88
+
89
+ K1 corrects SMS campaign `message_template` and `scheduled_date`, root recipient
90
+ country/timezone, explicit policy values, single-contact location/context, SMS
91
+ cursors and envelopes, agent empty-create/defaults, and recording `expires_at`.
92
+ New agents use engine defaults: 300-second maximum, 10-second silence hang-up,
93
+ dynamic greeting ON. Omission uses engine defaults; explicit values are preserved.
94
+ With agent knowledge enabled, prompt admission is 3,000 tokens; the legacy OFF
95
+ path has its 16,000-character limit. This release adds no prompt-measurement methods.
96
+ Use the organisation webhook signing secret, independent of API-key rotation.
97
+
98
+ All kits expose errors as `{error:{type,code,message,details,doc_url,status,request_id}}`.
99
+ Node uses `toJSON()`, Python `to_dict()`, CLI/MCP use JSON. Missing metadata is null.
100
+ Timeout defaults to 30 seconds. GET retries once (Node/Python configurable, capped
101
+ at three); mutations never retry automatically, even DELETE or 429. A lost or
102
+ malformed mutation reply is outcome unknown: check before retrying. Explicit
103
+ not-sent proof stays visible. Do not wrap mutations in blind retry loops.
104
+ Launch acknowledges scheduling; recipient-local gates still apply. SMS deletion
105
+ refuses active work, returns the engine message and never promises cancellation.
106
+ Recording availability may be pending/unavailable; use expires_at, not a fixed
107
+ five-minute lifetime (private mode 600 seconds, compatibility mode 300).
108
+ Legacy SDK calls.list(agent_id=...) now refuses the ineffective filter; use history.
109
+ The CLI routes calls list --agent to history. MCP filtered lists already use history.
110
+ Dedicated billing, monitoring, BYO and personal-auth actions are non-public.
111
+ Number PATCH monitor_enabled remains an existing public setting; it is not a listener operation.
112
+ Engine endpoints are unchanged. This release is local and not published.
113
+
114
+ TypeScript: from_number is now required for SMS. Use message_template and scheduled_date in new code; old JavaScript message/scheduled_at aliases translate only when unambiguous. SMS detail is {campaign,recipients,messages,pagination}, not a flat campaign. Raw byte/idempotency/revision transport is preparation only; no knowledge endpoint wrappers were added.
115
+
116
+ ## Historical releases
117
+
118
+ ## 0.8.0
119
+ - CLI now covers every SDK method: calls delete/delete-all, campaigns create (CSV) + launch, numbers import/delete/monitor/web-calls, sms campaigns, webhooks, keys rotate, storage/llm/tts. A guard test fails the build if an SDK method has no command.
120
+ - `--set field=value` (repeatable) and `--body @file.json` on every create/update/set - new API fields need no CLI update.
121
+ - `--yes` alias for `--confirm`; every destructive command previews first. `--base-url` for staging. `calls create --wait` polls until the call ends and prints the result. `completion <bash|zsh|pwsh>`. Did-you-mean on mistyped commands.
122
+ - Fixes: `login` uses a visible prompt (the hidden one dropped pasted input on Windows); `mcp setup` no longer writes a `\` env block desktop apps cannot expand - the MCP server reads ~/.nixflex/config.json.
123
+
124
+ ## 0.7.0
125
+ - New: the `nixflex` CLI ships in this package - `npx nixflex --help`. Agents, calls, numbers, caller context (incl. CSV import), SMS, usage, doctor, `login` (key stored in ~/.nixflex/config.json) and `mcp setup`. Every command takes `--json`; deletes need `--confirm`. Zero dependencies - it calls this SDK. Docs: https://docs.nixflex.com/cli
126
+
127
+ ## 0.6.0
128
+ - New: `client.callers` - caller context on one of your numbers: `get()`, `set()` (omitted fields kept, null removes), `delete()` (erases yours and the engine's), `import()` (up to 1,000 rows, validated before any write). One record per (your number, caller number). Docs: https://docs.nixflex.com/concepts/caller-context
129
+ - New: `incall_sms_enabled` on agent create/update/get - texting during a call and automatic booking-confirmation texts. Default false for new agents. Docs: https://docs.nixflex.com/actions/in-call-sms
130
+ - Fix: User-Agent now reports the real SDK version (was stuck at 0.1.0).
131
+ ## 0.5.0
132
+
133
+ - Historical private model and voice integrations were removed from the public kits by the K1 scope decision. Manage them in the dashboard.
134
+ - Docs: https://docs.nixflex.com/advanced/your-own-llm and /advanced/your-own-tts
135
+
136
+ ## 0.4.0
137
+
138
+ - New: `client.storage` - connect your own S3-compatible bucket for call recordings (data residency). `storage.set()` verifies with a probe write before saving, `storage.get()` never returns the secret, `storage.delete()` disconnects. Recordings then upload to your bucket and `recording_url` becomes a `byo:` path. See https://docs.nixflex.com/advanced/your-own-storage
139
+
140
+ ## 0.3.1 (2026-08-24)
141
+
142
+ - Voicemail as a structured setting: `voicemail_leave_enabled` + `voicemail_message` on Agent (applies to dashboard-imported numbers) and on PhoneNumber / PhoneNumberUpdateParams (the only voicemail control for API-imported numbers - no inheritance across the two worlds)
143
+ - Enabling without a message is rejected with `voicemail_message_required`
144
+ - No breaking changes.
145
+ ## 0.3.0 (2026-08-23)
146
+
147
+ - Call type: `charged_minutes` (minutes actually billed - transfers stop the meter at handoff, so this can be less than the recording length)
148
+ - Call type: `ended_reason` documented with the full value list, including the new `callee_hangup` (outbound) and carrier words (`busy`, `failed`, `no-answer`, `canceled`)
149
+ - No breaking changes. `list` pagination (`limit`/`offset`) shipped previously in 0.2.x.
150
+ # Changelog
151
+
152
+ All notable changes to the `nixflex` package. This project follows
153
+ [semantic versioning](https://semver.org): patch for fixes, minor for new
154
+ features, major for breaking changes. Published methods are never removed or
155
+ renamed within a major version.
156
+
157
+ ## 0.2.2
158
+
159
+ - Corrected the SMS campaign documentation: rom_number may be on either carrier
160
+ (Twilio or Telnyx). An earlier docs page wrongly stated Telnyx was rejected at
161
+ create; the engine routes by provider. No code behaviour changed.
162
+
163
+ ## 0.2.1
164
+
165
+ - Added MIT `LICENSE`, this changelog, and repository/homepage/issue metadata
166
+ so the npm page links back to the source and docs.
167
+ - Documented `verifyWebhookSignature` in the README.
168
+ - Continuous integration now builds and runs the test suite on every push.
169
+ - No API changes.
170
+
171
+ ## 0.2.0
172
+
173
+ - **Added** `verifyWebhookSignature(rawBody, signatureHeader, keySecret)` and
174
+ `client.webhooks.verify(...)` - verifies the `X-Nixflex-Signature` header
175
+ (HMAC-SHA256 over `"<timestamp>.<body>"`) with a constant-time comparison and
176
+ a configurable replay window (5 minutes by default). Never throws.
177
+ - **Added** `client.calls.delete(callId)` - permanently erases one call record,
178
+ transcript, and recording file.
179
+ - **Added** `client.calls.deleteAll()` - erases all calls, recordings, and SMS
180
+ messages on the key.
181
+ - Added `@types/node` as a development dependency (required for `Buffer` and
182
+ `node:crypto` types in the generated declarations).
183
+
184
+ ## 0.1.0
185
+
186
+ First public release.
187
+
188
+ - `agents` - create, list, get, update, delete, `iter()`
189
+ - `calls` - create outbound, list, get, `iter()`
190
+ - `campaigns` - create and launch voice batch campaigns
191
+ - `phoneNumbers` - import, list, update, delete, monitor and web-call toggles
192
+ - `sms` - single sends and bulk campaigns
193
+ - `keys` - rotate the API secret
194
+ - `usage` - account usage and limits
195
+ - `webhooks` - per-number webhook configuration
196
+ - Typed errors per HTTP status, automatic retry on `429` honouring
197
+ `Retry-After`, retries on network failure, and no blind retry of `POST`
198
+ requests after a `5xx` (a call is never dialled twice).
199
+ - Dual ESM and CommonJS builds, TypeScript declarations, zero runtime
200
+ dependencies, Node 18 or newer.
201
+
202
+ ## K2 core API additions — 1 November 2026
203
+
204
+ K2 core additions (same unpublished 0.10.0 candidate): account.retention(), keys.activity(), voices.list()/get(); CLI account retention / keys activity / voices list|get / keys create. keys create requires --confirm and sends no existing credential. Calls list now forwards --offset; callers import --body preserves JSON null clears and numeric references. All writes remain single-attempt. No billing, monitoring or account-closure wrappers were added.
@@ -0,0 +1,118 @@
1
+ # K6 examples — Node 0.11.0 / Python 0.4.0 / MCP 0.5.0
2
+
3
+ Examples are not an instruction to perform a live write. Use your owned number and explicit environment; no keys or carrier secrets belong in source, terminal arguments or chat. API authentication is NIXFLEX_API_KEY. The read-only smoke is separate.
4
+
5
+ ## Node / TypeScript
6
+
7
+ ```ts
8
+ import Nixflex, {NixflexDoNotContactError, NixflexInvalidRequestError,
9
+ type Booking, type CallCompletedBookingEvent, type SmsBookingEvent} from 'nixflex';
10
+ const client = new Nixflex({apiKey:process.env.NIXFLEX_API_KEY!, baseUrl:process.env.NIXFLEX_BASE_URL!});
11
+ const number = '+12025550123'; // fictional example; replace with your owned number
12
+ const consent = await client.integrations.connectGoogleCalendar(number, 'https://app.example.test/calendar-return');
13
+ // Present consent.url privately to the human; never auto-open or log it.
14
+ const status = await client.integrations.getGoogleCalendar(number);
15
+ if (status.needs_reconnect) { /* Request fresh human consent, not a silent reconnect. */ }
16
+ const settings = await client.integrations.updateGoogleCalendarSettings(number, {
17
+ timezone:'America/New_York', slot_minutes:30, calendar_id:'primary', send_invites:false,
18
+ hours:{monday:['09:00','17:00'],tuesday:['09:00','17:00'],wednesday:['09:00','17:00'],
19
+ thursday:['09:00','17:00'],friday:['09:00','17:00'],saturday:null,sunday:null}
20
+ });
21
+ // Only on a separate, deliberate disconnect request:
22
+ await client.integrations.disconnectGoogleCalendar(number);
23
+ // Sensitive routing change. Read values from a privately configured process, never log.
24
+ const receipt = await client.phoneNumbers.updateCredentials(number, {
25
+ twilio_sid:process.env.NIXFLEX_TWILIO_SID!,twilio_token:process.env.NIXFLEX_TWILIO_TOKEN!
26
+ });
27
+ try {
28
+ await client.sms.send({agent_id:'your-agent-id',from_number:number,to:'+12025550124',message:'Requested information'});
29
+ } catch (error) {
30
+ if (error instanceof NixflexDoNotContactError) { /* Stop; do not resend or remove suppression. */ }
31
+ else if (error instanceof NixflexInvalidRequestError) { /* Retain old 400 validation/suppression handling. */ }
32
+ else throw error;
33
+ }
34
+ function bookingPart(event: CallCompletedBookingEvent | SmsBookingEvent): Booking[] {
35
+ // Call only AFTER the existing verifier has checked the original raw webhook body.
36
+ return event.event === 'call.completed' ? event.bookings : [event.booking];
37
+ }
38
+ ```
39
+
40
+ Telnyx uses the same updateCredentials method with only `{telnyx_api_key:process.env.NIXFLEX_TELNYX_API_KEY!,telnyx_connection_id:process.env.NIXFLEX_TELNYX_CONNECTION_ID!}`. Never mix pairs or send provider in the body. Type assertions are not runtime secret validation; the method rejects missing/invalid pairs without HTTP.
41
+
42
+ ## Python sync and async
43
+
44
+ ```python
45
+ import os
46
+ from nixflex import (Nixflex, AsyncNixflex, NixflexDoNotContactError,
47
+ NixflexInvalidRequestError, Booking, CallCompletedBookingEvent, SmsBookingEvent)
48
+ number = '+12025550123'
49
+ config = dict(api_key=os.environ['NIXFLEX_API_KEY'],base_url=os.environ['NIXFLEX_BASE_URL'])
50
+ with Nixflex(**config) as client:
51
+ consent = client.integrations.connect_google_calendar(number, 'https://app.example.test/calendar-return')
52
+ # Present the short-lived link privately to a human; never print it to logs.
53
+ status = client.integrations.get_google_calendar(number)
54
+ settings = client.integrations.update_google_calendar_settings(number, send_invites=False)
55
+ # Separate deliberate disconnect:
56
+ client.integrations.disconnect_google_calendar(number)
57
+ receipt = client.phone_numbers.update_credentials(number,
58
+ telnyx_api_key=os.environ['NIXFLEX_TELNYX_API_KEY'],
59
+ telnyx_connection_id=os.environ['NIXFLEX_TELNYX_CONNECTION_ID'])
60
+ try:
61
+ client.sms.send(agent_id='your-agent-id',from_number=number,to='+12025550124',message='Requested information')
62
+ except NixflexDoNotContactError:
63
+ pass # Stop; nothing sent. Do not retry or bypass opt-out.
64
+ except NixflexInvalidRequestError:
65
+ pass # Existing old-server 400 handling; not all validation failures mean opt-out.
66
+
67
+ async def read_status():
68
+ async with AsyncNixflex(**config) as client:
69
+ return await client.integrations.get_google_calendar(number)
70
+ # Every other method has the same arguments and is awaited in AsyncNixflex.
71
+
72
+ def booking_part(event):
73
+ # Only after raw-body signature verification. TypedDict is not authentication.
74
+ return event['bookings'] if event['event'] == 'call.completed' else [event['booking']]
75
+ ```
76
+
77
+ ## CLI (PowerShell-safe argument shapes)
78
+
79
+ Privately configure NIXFLEX_API_KEY, NIXFLEX_BASE_URL and the selected carrier pair. These command lines contain no secret values. These are independent actions, not one recommended sequence.
80
+
81
+ ```powershell
82
+ nixflex integrations connectGoogleCalendar '+12025550123' --return-url 'https://app.example.test/calendar-return' --confirm
83
+ nixflex integrations getGoogleCalendar '+12025550123' --json
84
+ nixflex integrations updateGoogleCalendarSettings '+12025550123' --body '@calendar-settings.json' --confirm
85
+ nixflex integrations disconnectGoogleCalendar '+12025550123' --confirm
86
+ nixflex numbers updateCredentials '+12025550123' --provider twilio --confirm --json
87
+ # Alternative: a trusted local secret-manager process pipes the exact JSON pair to stdin:
88
+ # <private secret-manager command> | nixflex numbers updateCredentials '+12025550123' --provider telnyx --credentials-stdin --confirm
89
+ ```
90
+
91
+ calendar-settings.json contains settings only, e.g. `{"send_invites":false}`; never carrier credentials. Omit --confirm to preview without a request. Credential commands reject --body, --key and secret flags before the argument parser can echo values. SMS --json errors expose status/type/code: stop on 409 do_not_contact; retain old 400 handling. Webhook types do not add a CLI listener or ingest endpoint.
92
+
93
+ ## MCP — K6's five additions (current total: 96 with K7)
94
+
95
+ Ask the human to approve the exact number/change before using confirm:true. Credentials are preconfigured privately in the SERVER process environment, never tool arguments or chat. Missing configuration sends nothing. Existing 89 tools retain their original safeguards.
96
+
97
+ | Tool | Arguments example | Result |
98
+ | --- | --- | --- |
99
+ | connect_google_calendar | `{ "phone_number":"+12025550123", "return_url":"https://app.example.test/calendar-return", "confirm":true }` | Consent url + expires_at; human opens it |
100
+ | get_google_calendar | `{ "phone_number":"+12025550123" }` | Six status fields including needs_reconnect and send_invites |
101
+ | update_google_calendar_settings | `{ "phone_number":"+12025550123", "send_invites":false, "confirm":true }` | Safe settings, false preserved |
102
+ | disconnect_google_calendar | `{ "phone_number":"+12025550123", "confirm":true }` | ok:true, connected:false; no claim of remote revoke |
103
+ | update_phone_number_credentials | `{ "phone_number":"+12025550123", "provider":"twilio", "confirm":true }` | Number, provider, updated:true only |
104
+
105
+ All new writes without confirmation return confirmation_required:true, sent:false. Google settings accepts the same fields as Node/Python, including the seven-day hours object above. Use provider telnyx for the alternate private environment pair. No bulk deletion, signup, suppression removal, campaign resume/consent or hidden-write Knowledge draft tool is added.
106
+
107
+ MCP SMS errors use `error.status=409`, `error.type=conflict`, `error.code=do_not_contact`; report that nothing was sent and stop. Older 400 invalid_request remains generic. The shipped booking schema can validate the booking part of an authenticated webhook locally:
108
+
109
+ ```js
110
+ import {callCompletedBookingSchema, smsBookingSchema} from 'nixflex-mcp/k6-schemas.js';
111
+ // verifiedEvent is supplied only after existing raw-body signature verification.
112
+ function parseBookingEvent(verifiedEvent) {
113
+ return verifiedEvent.event === 'call.completed'
114
+ ? callCompletedBookingSchema.parse(verifiedEvent) : smsBookingSchema.parse(verifiedEvent);
115
+ }
116
+ ```
117
+
118
+ No MCP webhook-receiver tool is registered. Booking required keys: action, booking_uid, start, end, attendee_name, attendee_email, service, timezone. Preserve null; service can be numeric. Never count internal already_exists lookups as mutations.