Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/changelog-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ permissions:

jobs:
changelog:
uses: WireCatLabs/cli-base/.github/workflows/changelog-guard.yml@fe3430bae73bc7ccb5854124343fcb4549c26243 # cli-base main at #555: the guard accepts changes/ fragments
uses: WireCatLabs/cli-base/.github/workflows/changelog-guard.yml@183e25196cb9c9b777946b8783d0f7f222bd66f9 # v0.103.0
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ permissions:

jobs:
ci:
uses: WireCatLabs/cli-base/.github/workflows/node-ci.yml@34a442be7352a59598b0bdcccc03186ae1f6a728 # v0.85.1
uses: WireCatLabs/cli-base/.github/workflows/node-ci.yml@183e25196cb9c9b777946b8783d0f7f222bd66f9 # v0.103.0
with:
pack: ${{ inputs.pack || false }}
bun-run: pnpm build && pnpm smoke:bun
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/monthly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
contents: read
actions: read
security-events: write
uses: WireCatLabs/cli-base/.github/workflows/release-checks.yml@34a442be7352a59598b0bdcccc03186ae1f6a728 # v0.85.1
uses: WireCatLabs/cli-base/.github/workflows/release-checks.yml@183e25196cb9c9b777946b8783d0f7f222bd66f9 # v0.103.0
with:
dependencies: true
languages: '["actions","javascript-typescript"]'
2 changes: 1 addition & 1 deletion .github/workflows/release-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
permissions:
contents: read
actions: write
uses: WireCatLabs/cli-base/.github/workflows/release-start.yml@34a442be7352a59598b0bdcccc03186ae1f6a728 # v0.85.1
uses: WireCatLabs/cli-base/.github/workflows/release-start.yml@183e25196cb9c9b777946b8783d0f7f222bd66f9 # v0.103.0
with:
app-client-id: ${{ vars.RELEASE_APP_CLIENT_ID }}
check: '[ -d kit ] || pnpm exec cli-dev live check --version "$VERSION"'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
contents: read
actions: read
security-events: write
uses: WireCatLabs/cli-base/.github/workflows/release-checks.yml@34a442be7352a59598b0bdcccc03186ae1f6a728 # v0.85.1
uses: WireCatLabs/cli-base/.github/workflows/release-checks.yml@183e25196cb9c9b777946b8783d0f7f222bd66f9 # v0.103.0

build:
needs: [checks, validation]
Expand Down
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@ Notable changes to `@wirecat/beeline-cli`. One section per version, newest first

### Added

- **The meetings answers mark other people's text untrusted** (cli-core 0.671.0, was 0.663.0; cli-base 0.103.0, was
0.100.0). `meetings transcript` and `meetings export` answer an `untrusted` list: each line's text and speaker, and
- **A call says its direction, its manager and the client's number.** `meetings list`, `meetings show` and the
meetings of a deal, lead or person in another WireCat CLI carry `call`: `direction` (`in` or `out`), `manager`
(`name`, `person`) and `client_phone`. A call synced before gets them at its next sync; `--since-time` reaches the
older ones.
- **The meetings answers mark other people's text untrusted** (cli-core 0.674.0, was 0.663.0; cli-base 0.103.0, was
0.100.0). The shared store moves to version 67, which the other WireCat CLIs on the same store open from their
releases on cli-core 0.674.0. `meetings transcript` and `meetings export` answer an `untrusted` list: each line's text and speaker, and
the export's `content`. A caller and its agent read those fields as data, not instructions.
- **A `search meetings` hit may carry `by`, `score` and `passage`**, the fields of a search by meaning, so beeline's
hits keep the same shape as every other meetings tool.

### Fixed

- **`meetings sync` moves callers stored under old numbers to their `+7` numbers.** An unpublished build from before
13.11.2026 kept a client as `phone:9…` (or, for a day, `phone:+9…`), so its calls did not link to the CRM contact
and a new sync added a second client. Each sync now first renames such a client, or merges it into the client the
`+7` number already has, and prints how many it moved. A second sync finds nothing to move.
- **`meetings transcribe --help` quotes its `duration_ms>=60000` example**, so a shell no longer reads `>` as a
redirect to a file named `=60000`.

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ Calls synced by a version before this one are not linked until a sync saves them
days again, `--since-time` reaches further back. The same holds for a contact added to Bitrix24 after its calls were
synced.

A store that already holds calls synced by an unpublished build from before 13.11.2026 keeps their old client numbers
(`phone:9…`, without `+7`). Those calls do not link, and a re-sync adds a second client to each, until a later version
migrates them. A fresh install is not affected.
A store that holds calls synced by an unpublished build from before 13.11.2026 has their clients under old numbers
(`phone:9…`, without `+7`). Since 0.2.0, `meetings sync` moves each to its `+7` number first, merging it into the client
that number already has, and says how many it moved. A `--since-time` back to the first call then also corrects the
older calls' titles. A fresh install is not affected.

More: [use it](docs/usage.md).

Expand Down
7 changes: 4 additions & 3 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ beeline work meetings sync --since-time 2026-01-01T00:00:00Z # и более
последние 30 дней, `--since-time` уходит дальше в прошлое. То же для контакта, добавленного в Битрикс24 после того, как
его звонки уже скопированы.

Если в базе уже есть звонки, скопированные неопубликованной сборкой до 13.11.2026, у их клиентов остаётся старый номер
(`phone:9…`, без `+7`). Такие звонки не связываются, а повторная синхронизация добавляет каждому второго клиента, пока
одна из следующих версий их не перенесёт. Новой установки это не касается.
Если в базе есть звонки, скопированные неопубликованной сборкой до 13.11.2026, их клиенты записаны под старыми номерами
(`phone:9…`, без `+7`). С версии 0.2.0 `meetings sync` сначала переносит каждого на номер с `+7`, объединяя с клиентом,
у которого этот номер уже есть, и пишет, сколько перенёс. Синхронизация с `--since-time` до первого звонка затем
исправляет и названия старых звонков. Новой установки это не касается.

## ИИ-агент

Expand Down
4 changes: 2 additions & 2 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ beeline meetings list [query] [options]
| `--limit <n>` | meetings per page; the profile's defaults.limit when absent. |
| `--page <n>` | which page, starting at 1. |

**Returns:** meeting — ref, id, provider_id, provider, account, title, url, started_at, and 11 more; every field: beeline commands info meetings list
**Returns:** meeting — ref, id, provider_id, provider, account, title, url, started_at, and 12 more; every field: beeline commands info meetings list

**Next usually:** `beeline meetings show <meeting>`, `beeline meetings transcript <meeting>`, `beeline meetings export <meeting>`

Expand All @@ -175,7 +175,7 @@ beeline meetings show <meeting> [options]
|---|---|
| `--backend <archive\|server\|both>` | where to read: the store (archive), the service (server), or both, kept in the store (default: both). |

**Returns:** meeting details — ref, id, provider_id, provider, account, title, url, started_at, and 20 more; every field: beeline commands info meetings show
**Returns:** meeting details — ref, id, provider_id, provider, account, title, url, started_at, and 21 more; every field: beeline commands info meetings show

**Next usually:** `beeline meetings transcript <meeting>`, `beeline meetings export <meeting>`

Expand Down
7 changes: 4 additions & 3 deletions docs/dev/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ Owner, 2026-11-13 (NEED-2600 A). The client participant carries its number as `p
country to the source, and Beeline is a Russian PBX. A number that plan does not read (an extension, a foreign number)
keeps its raw digits in the id and gets no phone.

A store written by an unpublished build before this fix keeps `phone:<national>` ids (the owner's: 1626 of them on
2026-11-13). They stay until cli-core offers an identity rename and merge and beeline calls it once on a writable
open; beeline writes no SQL of its own. A fresh install is not affected. cli-core links the callers a sync saved
A store written by an unpublished build before this fix has `phone:<national>` ids, and a build of one day
`phone:+<national>` ones (the owner's: 1626 old ids on 2026-11-13). Each `meetings sync` first moves them to the id
`clientPhone` gives, through cli-core's `rekeyIdentities` (0.674.0), which merges one into the identity already there;
beeline writes no SQL of its own. A second run finds nothing to move. A fresh install is not affected. cli-core links the callers a sync saved
to the CRM contact that holds the same number: at once for a mobile only the two of them hold, as a proposal for a
landline, which everyone in an office shares. It joins only when the identity is exactly `phone:<E.164>`, so the `+`
must be there. The manager is keyed by Beeline's `abonent` and gets no phone: an extension is the company's, not a
Expand Down
1 change: 1 addition & 0 deletions docs/dev/live-checks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
0.1.0 2c646f665c19c605b697e8791e14b3dea0a88243 2026-11-14 bin/beeline-live v2:7bba9f9dea2e6697d70b53920e7f5bb299d8b74496f23ace63a154564b9795aa
0.1.0 abb4fc2cc641b06dac08b70549932e7ecd957abd 2026-11-14 bin/beeline-live v2:f0890ea000648a4b52e18c94c7033f5d57afa91143a19ea49db193641232f230
0.2.0 2ca139df848db1862a2638e8dc8ebf7f48974bf8 2026-11-16 bin/beeline-live v2:01b5cb21edd481af660362e286ef321399e8704e175b1c1178971b6bb6418134
0.2.0 8bbbfd7fd044df87552c79ce8abea195e6100e48 2026-11-16 bin/beeline-live v2:eadc369017ed7ef2941f203c6521991eb8e3a6c05f0c98ffbd2ef655c590b516
15 changes: 4 additions & 11 deletions lint/audit-differences.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
[
{
"group": "shared-roots",
"rule": "same-error-reason",
"target": "reason meeting-project.stale: code",
"reason": "cli-core 0.651.0 made a stale meeting project fingerprint conflict, not configuration_error; the published CLIs are still on 0.650.0 or older, and the entry goes once they publish on 0.651.0.",
"review_after": "2026-11-27"
},
{
"group": "shared-roots",
"rule": "same-entity-schema",
"target": "entity meeting_details",
"reason": "cli-core 0.650.0 names each participant's person in meetings show; the published zm is older, and the entry goes once it publishes on 0.650.0+.",
"target": "entity meeting",
"reason": "cli-core 0.674.0 adds a phone call's `call` (direction, manager, client_phone) to each meeting; the published zm is on 0.667.0, and the entry goes once it publishes on 0.674.0+.",
"review_after": "2026-11-27"
},
{
"group": "shared-roots",
"rule": "same-entity-schema",
"target": "entity meeting_participants",
"reason": "cli-core 0.650.0 names each participant's person in meetings people; the published zm is older, and the entry goes once it publishes on 0.650.0+.",
"target": "entity meeting_details",
"reason": "cli-core 0.674.0 adds a phone call's `call` (direction, manager, client_phone) to meetings show; the published zm is on 0.667.0, and the entry goes once it publishes on 0.674.0+.",
"review_after": "2026-11-27"
}
]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
},
"dependencies": {
"@wirecat/cli-base": "0.103.0",
"@wirecat/cli-core": "0.671.0",
"@wirecat/cli-core": "0.674.0",
"commander": "15.0.0",
"valibot": "1.5.0"
},
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions scripts/audit.sh

This file was deleted.

1 change: 1 addition & 0 deletions src/call-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const callTitle = (record: CallRecord): string =>
(clientPhone(record.phone) ?? record.phone)

const meetingOf = (record: CallRecord): SourceMeeting => ({
call: { direction: record.direction === "INBOUND" ? "in" : "out", clientPhone: clientPhone(record.phone) ?? null },
series: null,
occurrence: {
id: record.id,
Expand Down
154 changes: 154 additions & 0 deletions src/client-rekey.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import { DatabaseSync } from "node:sqlite"
import type { FetchLike } from "@wirecat/cli-base/http"
import { storePath } from "@wirecat/cli-core/store"
import { afterEach, expect, it } from "vitest"
import { run } from "./program.js"
import { oldClientRekeys, openBeelineStore, rekeyOldClients } from "./store.js"
import { record } from "./testing/records.js"

const ran = async (argv: string[], fetch: FetchLike) => {
const out: string[] = []
const err: string[] = []
const code = await run(argv, {
streams: { data: (text) => out.push(text), diagnostic: (text) => err.push(text) },
tty: false,
fetch,
})
return { code, out: out.join("\n"), err: err.join("\n") }
}

const sync = (records: ReturnType<typeof record>[]) =>
ran(["work", "meetings", "sync", "--since-time", "2026-10-01T00:00:00Z", "--json"], async () =>
Response.json(records),
)

const sql = <T>(work: (db: DatabaseSync) => T): T => {
const db = new DatabaseSync(storePath(process.env))
try {
return work(db)
} finally {
db.close()
}
}

const clientIds = () =>
sql((db) =>
db
.prepare(
"SELECT external_id AS id, phone FROM identities WHERE provider = 'beeline' AND external_id LIKE 'phone:%'",
)
.all()
.map((row) => ({ id: String(row.id), phone: row.phone })),
)

const clientOfMeeting = (call: string) =>
sql(
(db) =>
db
.prepare(
`SELECT i.external_id AS id FROM meeting_participants p JOIN identities i ON i.id = p.identity_id
JOIN meetings m ON m.id = p.meeting_id WHERE m.external_id = ? AND p.role = 'client'`,
)
.get(call)?.id,
)

afterEach(() => {
delete process.env.BEELINE_TOKEN
})

it("names the old caller ids' E.164 ids and leaves the current ones and extensions", () => {
expect(
oldClientRekeys([
"phone:9000000009",
"phone:+9000000009",
"phone:+4950000001",
"phone:+79000000009",
"phone:1234",
"abonent:70000000001@example.test",
]),
).toEqual([
{ from: "phone:9000000009", to: "phone:+79000000009", phone: "+79000000009" },
{ from: "phone:+9000000009", to: "phone:+79000000009", phone: "+79000000009" },
{ from: "phone:+4950000001", to: "phone:+74950000001", phone: "+74950000001" },
])
})

it("a sync moves the callers an older build stored to their E.164 ids, merging into one already there", async () => {
process.env.BEELINE_TOKEN = "test-token"
const first = await sync([
record(701, { phone: "9000000001" }),
record(702, { phone: "9000000002" }),
record(703, { phone: "9000000003" }),
record(704, { phone: "1234" }),
])
expect(first.code, first.err).toBe(0)
// As development builds of 0.1.0 wrote them; 703's client is 701's in the other old form.
sql((db) => {
const rename = db.prepare("UPDATE identities SET external_id = ?, phone = ? WHERE external_id = ?")
rename.run("phone:9000000001", null, "phone:+79000000001")
rename.run("phone:+9000000002", "+9000000002", "phone:+79000000002")
rename.run("phone:+9000000001", "+9000000001", "phone:+79000000003")
})
expect(clientOfMeeting("703")).toBe("phone:+9000000001")

const second = await sync([])
expect(second.code, second.err).toBe(0)
expect(second.err).toContain("moved old caller ids to their E.164 numbers: 2 renamed, 1 merged")
expect(clientIds()).toEqual(
expect.arrayContaining([
{ id: "phone:+79000000001", phone: "+79000000001" },
{ id: "phone:+79000000002", phone: "+79000000002" },
{ id: "phone:1234", phone: null },
]),
)
expect(clientIds()).toHaveLength(3)
expect(clientOfMeeting("701")).toBe("phone:+79000000001")
expect(clientOfMeeting("703")).toBe("phone:+79000000001")

const third = await sync([])
expect(third.code, third.err).toBe(0)
expect(third.err).not.toContain("moved old caller ids")
const store = await openBeelineStore(process.env)
try {
expect(await rekeyOldClients(store)).toEqual({ renamed: 0, merged: 0, refused: 0 })
} finally {
await store.close()
}
})

it("merges an old caller id into the E.164 id a newer sync already stored", async () => {
process.env.BEELINE_TOKEN = "test-token"
expect((await sync([record(801, { phone: "9000000004" }), record(802, { phone: "9000000005" })])).code).toBe(0)
sql((db) =>
db
.prepare("UPDATE identities SET external_id = ? WHERE external_id = ?")
.run("phone:9000000004", "phone:+79000000005"),
)

const synced = await sync([])
expect(synced.code, synced.err).toBe(0)
expect(synced.err).toContain("0 renamed, 1 merged")
expect(clientOfMeeting("802")).toBe("phone:+79000000004")
})

it("a call synced again gets its direction, the client's number and a corrected title", async () => {
process.env.BEELINE_TOKEN = "test-token"
const call = record(901, { phone: "9000000006", direction: "INBOUND" })
expect((await sync([call])).code).toBe(0)
// As an older build stored it: a `+` before the national number, no call fields.
sql((db) =>
db
.prepare("UPDATE meetings SET title = ?, direction = NULL, client_phone = NULL WHERE external_id = '901'")
.run("Входящий звонок · Test Manager ↔ +9000000006"),
)
expect((await sync([call])).code).toBe(0)
const listed = await ran(["work", "meetings", "list", "--json"], async () => Response.json([]))
const id = (JSON.parse(listed.out).items as { id: number; title: string }[]).find((one) =>
one.title.endsWith("+79000000006"),
)?.id
const shown = await ran(["work", "meetings", "show", String(id), "--json"], async () => Response.json([]))
expect(shown.code, shown.err).toBe(0)
expect(JSON.parse(shown.out).item).toMatchObject({
call: { direction: "in", client_phone: "+79000000006", manager: { name: "Test Manager" } },
})
})
Loading
Loading