# @lookio/cli 中文文档

规范地址：https://npmcn.com/package/%40lookio/cli/

版本：2\.0\.0
npm 元数据更新时间：2026-11-01T18:01:19.555Z
中文译文更新时间：2026-11-01T18:31:02.158Z
软件包许可：MIT

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40lookio/cli
原文对照：https://npmcn.com/package/%40lookio/cli/?lang=original
项目主页：https://lookio.app/
源码仓库：https://github.com/DuvInc/lookio

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：2.1 MB，65 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- Node.js 要求：\>=20\.0\.0
- 运行依赖：1 个
- 首次发布：2026-11-01T18:00:24.108Z
- 最新版本发布：2026-11-01T18:01:19.395Z
- 已发布版本数：2（近 12 个月 2 个）

## 中文简介

官方的Lookio CLI：来自终端、CI工作或AI代理的资源、助手和问题。

## 安装

```sh
npm install @lookio/cli
```

也可以使用：`pnpm add @lookio/cli`、`yarn add @lookio/cli`、`bun add @lookio/cli`

## README

# @lookio / cli

Lookio CLI：导入文档、构建助手并向它们提问 从终端、CI工作或人工智能代理。主页: [https://lookio.app](https://lookio.app/)

```bash
npm install -g @lookio/cli
# or, without installing:
npx @lookio/cli account
```

二进制文件叫做 `lookio`． 要求node20或更高版本。

**npm上还没有。** 包仍然是私有的(`"private": true`)，所以 一旦发布，上面的安装行就可以工作了。

## 什么是信用成本

-   **`lookio ask` 花学分** 每个问题，不管答案是什么 长度：Flash 30（默认），Eco 10, Deep 80 (`--mode`)，即使什么也没找到。不读取资源的助手 先被拒绝(`assistant_has_no_resources`)，然后再持有任何信用。
-   **`lookio search` 一次搜索花费1分**，不管它找到什么。公共助理 就像问你自己一样，用它的id (`lookio ask`， `lookio search`)，由你的工作场所支付。 管理访问、访问密钥和发布是免费的。
-   导入是免费的：文本，url，文件和网站，并重新索引它们。
-   其他一切（列表、读取、创建助手、成员、访问）都是免费的。

## 开始

```bash
lookio auth login                       # opens a browser, stores the token in your keychain
lookio account                          # workspace, plan, credit balance

lookio resources add-url https://example.com/pricing --tags pricing
lookio resources get <resource_id>      # repeat until status is ready or failed

lookio assistants create --name "Support" --follow-tags pricing
lookio ask <assistant_id> "How much does the pro plan cost?"
```

对于CI，使用在应用的开发者设置中创建的API密钥：

```bash
export LOOKIO_API_KEY="sk_live_..."
lookio account
```

API密钥属于WORKSPACE，并且在人员离开时不会过期。 这就是为什么它更适合一份工作，而不是一个人。

## 导入是异步的

每次进口(`add-text`， `add-url`， `add-file`， `sites add`， `reindex`)返回 立即使用资源 `queued`． 中读取并索引它 背景：一个页面或一个短文件需要几秒钟，一个站点需要几分钟。民意调查 `lookio resources get <id>` 直到 `status` 是 `ready` (搜索)或 `failed` (见 `status_detail`那么，解决原因 `lookio resources reindex <id>`）。

## 命令

```bash
# Resources: what assistants answer from. All free.
lookio resources list --type url --tag pricing --status ready --query refund --limit 50
lookio resources get <id>
lookio resources add-text --title "Refund policy" --from-file policy.md --tags legal,faq
lookio resources add-url https://example.com/pricing --title "Pricing"
lookio resources add-file ./handbook.pdf --tags hr          # streamed from disk
lookio resources update <id> --title "New title" --tags a,b
lookio resources delete <id> --force
lookio resources content <id> --offset 0 --limit 20000      # the text as indexed, in pieces
lookio resources reindex <id>

# Sites: imports use no credits; recurring updates require a paid plan.
lookio sites preview https://example.com/docs               # nothing is created
lookio sites add https://example.com --include "/docs/**" --exclude "/blog/**" --schedule every_3_days
lookio sites pages <id> --status failed --limit 100        # paginated, --cursor for the next page
lookio sites rules <id> --include "/docs/**"                # replaces all rules; keeps the current schedule
lookio sites retry <id>

# Assistants. Free.
lookio assistants list
lookio assistants create --name "Support" --context "You are the help center assistant of Acme, talking to customers" --resources id1,id2 --follow-tags faq
lookio assistants update <id> --knowledge all
lookio assistants delete <id> --force

# Widgets: a chat box that shows one assistant to anonymous visitors on a website.
# Free to manage; visitors' answers are charged to your workspace, in the widget's mode.
lookio widgets list
lookio widgets create --assistant <assistant_id> --domain docs.acme.com --setting theme=dark
lookio widgets update <id> --domain docs.acme.com --domain "*.acme.com"   # replaces the whole domain list
lookio widgets update <id> --status paused --monthly-credits 5000
lookio widgets duplicate <id>                              # a copy, with its images
lookio widgets set-image <id> launcher ./logo.png          # or favicon; paid plans, 256 KB
lookio widgets clear-image <id> launcher
lookio widgets snippet <id> --format bubble                 # the install snippet, as plain text
lookio widgets conversations <id>                           # what visitors asked; add a conversation id for one
lookio widgets delete <id> --force

# Accesses: share assistants with people outside the workspace, by MCP and HTTP. Admins only, free to manage;
# the workspace pays for what callers spend, capped by the ceilings.
lookio accesses list
lookio accesses create --name "Acme docs" --assistant <assistant_id>="Answers from the docs" --modes flash,deep --passages true --monthly-credits 200000
lookio accesses update <id> --status paused                # --assistant replaces the whole list; none removes a ceiling
lookio accesses get <id>                                    # URLs to hand out, ceilings, keys, spending
lookio accesses delete <id> --force
lookio accesses keys create <access_id> --name Globex --daily-credits 3000   # prints the secret ONCE
lookio accesses keys update <access_id> <key_id> --monthly-credits 50000
lookio accesses keys revoke <access_id> <key_id> --force

# Publishing: ask Lookio to list an assistant in the public directory (reviewed first). Admins only, free.
lookio assistants publish <assistant_id> --description "Answers questions on German employment law from the statutes, with citations."
lookio assistants publication <assistant_id>                # private, pending, public or rejected (with the reason)
lookio assistants unpublish <assistant_id> --force

# The public directory. Browsing is free; ask one like your own assistants, paid by YOUR workspace,
# the conversation kept in your workspace.
lookio public list --q "employment law" --limit 10
lookio public get <assistant_id>
lookio ask <public_assistant_id> "How long is the notice period?" --mode eco

# Passages of an assistant (yours or a public one), without an answer, for your own model to read. SPENDS 1 CREDIT per search.
lookio search <assistant_id> "refund window" --limit 5

# Asking. SPENDS CREDITS (Flash 30, Eco 10, Deep 80 per question).
lookio ask <assistant_id> "What is the refund window?"
lookio ask <assistant_id> "And for annual plans?" --conversation <conversation_id>   # the history is read server-side
lookio ask <assistant_id> "What is the refund window?" --end-user user_42            # API keys: your own id for the person asking
lookio ask <assistant_id> "A private question" --no-store                            # API keys: keep nothing
lookio ask <assistant_id> "And for annual plans?" --history-file turns.json          # you keep the conversation yourself
lookio ask <assistant_id> "Summarise the handbook" --stream

# Your conversations: your personal chats after 'lookio auth login', or the
# conversations of your API key (--end-user narrows to one of your users).
lookio conversations list --assistant <assistant_id> --end-user user_42 --limit 20
lookio conversations get <conversation_id>
lookio conversations rename <conversation_id> New title
lookio conversations delete <conversation_id> --force   # an API key's conversation leaves the logs too
lookio conversations feedback <conversation_id> <answer_id> down --comment "Out of date"   # your user's thumb (API keys)

# Logs, four kinds, all free. Add --stats to any of the first three for its figures.
# conversations: what people OUTSIDE the workspace asked (widget visitors, your product's
# users through an API key or the MCP). Kept 90 days after the last message; members'
# own chats are not in them.
lookio logs conversations --rating down --channel widget,api --from 2026-10-01
lookio logs conversations --stats --widget <widget_id>
lookio logs get <conversation_id>
# answers: every answer from any channel, metadata only (no question or answer text)
lookio logs answers --channel widget,api
lookio logs answers --stats --from 2026-10-01
# indexing: every file, page or text read and indexed, with its status and any error
lookio logs indexing --status failed
lookio logs indexing --stats --resource <resource_id>
# activity: who changed what, through which door (admins), kept a year
lookio logs activity --origin cli,mcp --action assistant --from 2026-10-01

# Tags (rename and delete: workspace admins).
lookio tags list
lookio tags rename <from> <to>
lookio tags delete <tag> --force

# Members (workspace admins, signed in with 'lookio auth login'). Permissions:
# resources_list, resources_create, resources_edit, resources_delete,
# assistants_create, assistants_edit, assistants_delete, api, mcp
# (the old camelCase names, such as resourcesCreate, are still accepted).
lookio members list
lookio members set <user_id> --allow resources_create,api --deny mcp --assistants all

# Account, escape hatches.
lookio account                  # plan, balance, seats, word allowance, query modes with prices, scopes
lookio credits
lookio usage --from 2026-01-01  # totals, by day, by mode and assistant, words stored
lookio api GET /resources --query type=url
lookio doctor
lookio mcp
```

### 流式传输答案

`lookio ask --stream` 显示所写的答案。在终端你看到 文本到达，然后是来源。当stdout不是终端时，您将得到一个终端 JSON对象每行，每个服务器事件一个：

```
{"event":"status","data":{"phase":"searching"}}
{"event":"delta","data":{"text":"The refund window is "}}
{"event":"done","data":{"answer":"...","citations":[...],"conversation_id":"…","message_id":"…","credit_cost":30,"credits_remaining":970,"simulated":false}}
```

这个 `done` 数据是非流调用返回的相同的snake\_case答案。一个 `error` 事件携带标准错误信封 （`{"error":{"type","code","message",...},"request_id"}`)：是印上去的 的退出代码退出 `code`，同一张表 HTTP错误（即流） `insufficient_credits` 7)退出。一个结束的流 既无 `done` 也不 `error` 出口1。保持活跃的评论行(`: keep-alive`） 将被忽略。

## 小部件

小部件是一个聊天框，显示一个助手，匿名访问者在您的 的网站。创建一个 `lookio widgets create --assistant <id> --domain docs.acme.com`，然后安装什么？ `lookio widgets snippet <id>` 打印: `bubble` 之前 `</body>`, `embed` 聊天应该放在哪里 `hosted` 链接，或 `iframe` 对于拒绝脚本的构建器。列出 展示它 `--domain`：浏览器拒绝任何的气泡和嵌入 网站未列出，和 `update --domain` 替换整个列表。管理部件 是免费的; **访客的回答将计入你的工作空间**，在小部件的 `--mode`，所以给它们盖上 `--limit-per-visitor-hour`， `--limit-per-visitor-day` 和 `--monthly-credits`。使用 `--monthly-credits-enabled false` 暂停每月上限而不损失其金额，和 `true` 来恢复它。外表和言语 `--setting key=value` （`theme`， `accent`， `radius`， `bubbles`， `position`， `launcher`， `launcher_label`， `launcher_icon`， `header_icon`， `title`， `subtitle`， `greeting`， `placeholder`， `suggestions`， `disclaimer`， `language`， `sources`， `memory`， `visitor_history`， `feedback`， `branding`， `bubble`， `embed`， `hosted_page`）. 最后三个命令打开或关闭三种格式： `bubble` 是在 默认情况下, `embed` 和 `hosted_page` 就消失不见了。

## 输出

**当stdout不是终端时，自动使用JSON。** 管道进 `jq` 只是 工作，没有命令需要 `--json` 标志在CI中添加。在终点站你会得到一个 表格。强迫… `--output json|table|ndjson`.

列表命令以JSON格式打印整个信封(`data`， `has_more`， `next_cursor`， `limit`）. 通过 `next_cursor` 在 `--cursor` 下一页。

## 退出代码

脚本可以在不解析消息的情况下进行分支：

| 代码 | 意义 |
| --- | --- |
| 0 | 成功 |
| 1 | 意外的失败 |
| 2 | 使用不当，或者请求被服务器视为无效而拒绝 |
| 3 | 身份验证或权限 |
| 4 | 没有找到 |
| 5 | 速度有限 |
| 6 | 冲突 |
| 7 | 学分用完(`insufficient_credits`） |

`insufficient_credits` 有它自己的代码的目的：一个作业，运行完 积分必须停止并告诉人类，而不是重试。

## 作用域

`account:read`， `usage:read`， `resources:read`， `resources:write`， `resources:delete`， `assistants:read`， `assistants:write`， `assistants:delete`， `query`， `admin`. `lookio auth login` 请求编辑器集(`account:read`， `usage:read`， `resources:read`， `resources:write`， `assistants:read`， `assistants:write`， `query`)，它不会删除任何内容：pass `--scope` 添加 `resources:delete`， `assistants:delete` 或者 `admin`. `widgets delete` 需要 `assistants:delete`． 重命名和删除 对话，并发送反馈的答案，需要 `query`； `logs conversations` 和 `logs get` 需要 `assistants:write`， `logs answers` 需要 `usage:read`， `logs indexing` 需要 `resources:read` 和 `logs activity` 需要 `admin`.

## 为代理

```bash
lookio help --json
```

打印整个命令树、退出代码、重试策略和错误 信封作为一个机器可读的文档。首先读取它的代理停止 猜旗子。看到 `AGENTS.md` 对于更长的参考。

## 重试

每条命令都重试429。408和5xx是幂等的 请求（RFC 9110§9.2.2） **对于每个POST**：每个POST携带一个 `Idempotency-Key` 头(每个请求的随机UUID，由 CLI的自动重试)，所以API只应用它一次 的到来。只有 `PATCH` （`resources update`， `assistants update`， `widgets update`， `members set`， `conversations rename`） 在5xx后报告而不是重复；之前重新读取资源 你自己再试一次。

禁用重试 `--no-retry`.

## 常见问题

### @lookio/cli 是什么？

官方的Lookio CLI：来自终端、CI工作或AI代理的资源、助手和问题。

### 如何安装 @lookio/cli？

在项目目录运行 npm install @lookio/cli，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 lookio，可以用 npx lookio 直接运行。

### @lookio/cli 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/lookio\_\_cli 是否存在。

### @lookio/cli 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @lookio/cli 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=20\.0\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @lookio/cli 可以商用吗？

@lookio/cli 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @lookio/cli 还在维护吗？

最新版本 2\.0\.0 发布于 2026/11/02（1 天前）；至今共发布 2 个版本，其中过去 12 个月发布了 2 个；首次发布于 2026/11/02。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

