@autopilot-agent/core 0.1.0 → 0.2.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/README.md +55 -3
- package/dist/experimental/index.js +62 -59
- package/dist/experimental/index.mjs +62 -59
- package/dist/index.d.ts +14 -6
- package/dist/index.js +202 -198
- package/dist/index.mjs +202 -198
- package/dist/internal/agent-runtime.d.ts +13 -1
- package/dist/internal/kernel/completion-policy.d.ts +4 -0
- package/dist/internal/kernel/run-context.d.ts +8 -0
- package/dist/internal/tool-scheduler.d.ts +1 -0
- package/dist/internal/tools/builtins/open-preview-tool.d.ts +18 -0
- package/dist/internal/tools/builtins/run-command-tool.d.ts +2 -2
- package/dist/internal/tools/builtins/start-background-job-tool.d.ts +9 -0
- package/dist/internal/tools/builtins/todo-write-tool.d.ts +14 -0
- package/dist/internal/tools/mcp-runtime.d.ts +5 -0
- package/dist/internal/tools/normalized-tool-input.d.ts +1 -0
- package/dist/internal/tools/permissions/command-policy.d.ts +11 -0
- package/dist/internal/tools/permissions/external-execution-policy.d.ts +14 -0
- package/dist/internal/tools/permissions/mutation-policy.d.ts +7 -0
- package/dist/internal/tools/permissions/path-access-policy.d.ts +13 -0
- package/dist/internal/tools/permissions/workspace-path.d.ts +5 -0
- package/dist/internal/tools/policy-engine.d.ts +1 -0
- package/dist/internal/tools/process-utils.d.ts +11 -0
- package/dist/internal/tools/sandbox-policy-resolver.d.ts +2 -0
- package/dist/internal/tools/tool-executor.d.ts +2 -1
- package/dist/internal/tools/types.d.ts +66 -2
- package/dist/runtime/adapters/memory/memory-approval-store.d.ts +39 -0
- package/dist/runtime/adapters/memory/memory-file-mutation-store.d.ts +1 -1
- package/dist/runtime/application/approval-service.d.ts +69 -3
- package/dist/runtime/application/job-execution-facts.d.ts +2 -0
- package/dist/runtime/application/job-service-ownership.d.ts +5 -0
- package/dist/runtime/application/job-service.d.ts +9 -0
- package/dist/runtime/application/turn/turn-conversation-builder.d.ts +3 -3
- package/dist/runtime/application/turn/turn-runtime-config-resolver.d.ts +2 -2
- package/dist/runtime/application/undo-service.d.ts +4 -0
- package/dist/runtime/bootstrap/runtime-bootstrap-service.d.ts +2 -1
- package/dist/runtime/config/autopilot-settings.d.ts +9 -0
- package/dist/runtime/config/runtime-limits.d.ts +2 -4
- package/dist/runtime/domain/approval.d.ts +18 -0
- package/dist/runtime/domain/external-execution.d.ts +42 -0
- package/dist/runtime/domain/external-permissions.d.ts +32 -0
- package/dist/runtime/domain/frozen-run-config.d.ts +2 -0
- package/dist/runtime/domain/index.d.ts +6 -2
- package/dist/runtime/domain/job-service-url.d.ts +3 -0
- package/dist/runtime/domain/job.d.ts +18 -0
- package/dist/runtime/domain/sandbox-policy.d.ts +30 -0
- package/dist/runtime/domain/todo.d.ts +4 -0
- package/dist/runtime/ports/approval-store.d.ts +39 -1
- package/dist/runtime/ports/external-permission-projector.d.ts +14 -0
- package/dist/runtime/ports/file-mutation-store.d.ts +1 -1
- package/dist/runtime/ports/host-mutation-protection.d.ts +7 -0
- package/dist/runtime/ports/index.d.ts +7 -1
- package/dist/runtime/ports/sandbox-port.d.ts +1 -0
- package/dist/runtime/protocol/index.d.ts +1 -0
- package/dist/runtime/protocol/recoverable-turn-view.d.ts +1 -1
- package/dist/runtime/protocol/run-config.d.ts +3 -0
- package/dist/runtime/protocol/work-preview-capability.d.ts +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
|
-
<!-- 本文件用于说明 npm Core 包的职责和公开入口。 -->
|
|
2
1
|
# @autopilot-agent/core
|
|
3
2
|
|
|
4
|
-
Autopilot Agent
|
|
3
|
+
Autopilot 的共享 Agent Runtime、工具执行、审批、会话和 RAG 核心。普通 CLI 用户只需安装 `autopilot-agent@0.2.0`;本包主要面向自行编写宿主或集成知识检索能力的开发者。
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
## 入口与能力
|
|
6
|
+
|
|
7
|
+
| 入口 / API | 用途 |
|
|
8
|
+
|---|---|
|
|
9
|
+
| createAgentRuntime | 装配 Runtime Facade;由宿主注入 RuntimePorts |
|
|
10
|
+
| runtime.turns / sessions / projects | Turn 执行、恢复、取消及会话/项目管理 |
|
|
11
|
+
| runtime.approvals / inbox / questions | 审批、持续输入及宿主结构化回答 |
|
|
12
|
+
| runtime.jobs / undo | 非 PTY 后台 Job 和受控文件撤销 |
|
|
13
|
+
| createRAGAgent / createAgent | 文档入库、检索与问答的兼容公开入口 |
|
|
14
|
+
| createDatabaseSnapshot / getDefaultDatabaseSource | 受控数据库快照和已注册源 |
|
|
15
|
+
| listWorkspaceFiles | 工作区文件索引与候选枚举 |
|
|
16
|
+
| @autopilot-agent/core/experimental | Kernel、采样器和工具工厂等不稳定接口 |
|
|
17
|
+
|
|
18
|
+
完整签名、参数、错误和示例见 [Core API 参考](https://github.com/C-Clay-W/autopilot/blob/main/agent/doc/Core-API.md)。默认入口是稳定公开边界,禁止把 core/internal/* 深层路径当作正式集成接口。开发文档以源码为准,可能先于 npm 0.2.0。
|
|
19
|
+
|
|
20
|
+
## 装配原则
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { createAgentRuntime, type RuntimePorts } from "@autopilot-agent/core";
|
|
24
|
+
|
|
25
|
+
/** 用受信宿主提供的存储、工作区、采样和系统能力创建 Runtime。 */
|
|
26
|
+
export function createHostRuntime(ports: RuntimePorts) {
|
|
27
|
+
return createAgentRuntime({ ports });
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Node 文件存储和工作区等实现由配套的 Adapters 提供。宿主负责受信路径、凭据解析、Trust、事件消费及退出时调用 runtime.shutdown;不要直接在浏览器客户端创建可访问本机文件的 Runtime,也不要把上述工厂当成无需配置即可执行模型任务的完整程序。
|
|
32
|
+
|
|
33
|
+
## RAG 与数据
|
|
34
|
+
|
|
35
|
+
Core 包含文档、Excel/PDF 解析,Embedding、向量空间校验、Rerank 和数据库快照能力。连接应由受信宿主提供,凭据延迟解析,不进入事件或浏览器。Embedding 模型和维度变化需要匹配或重建索引;PDF/OCR 的外部工具按需准备。
|
|
36
|
+
|
|
37
|
+
Core 支持这些能力不表示每个宿主都启用全部工具:npm CLI 不提供私有知识库 RAG,Web Chat / 知识服务按自身边界装配。数据库能力不接受浏览器任意传入 DSN 或 SQL 作为授权。
|
|
38
|
+
|
|
39
|
+
## 构建与验证
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm ci
|
|
43
|
+
npm run build -w packages/core
|
|
44
|
+
npm run typecheck -w packages/core
|
|
45
|
+
npm run test -w packages/core -- src/internal/tools/builtins/todo-write-tool.test.ts
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
从 monorepo 根运行。构建脚本使用 esbuild 生成 CJS/ESM 多入口,TypeScript 生成声明,并带上必需的 PDF Python 脚本。消费方读取 dist,修改后需重建。原生依赖在目标 OS 安装,不跨平台复制。
|
|
49
|
+
|
|
50
|
+
Trust、工具授权和沙箱各有职责。拒绝不支持的路径/协议不等于证明 OS 隔离成功;平台实机限制见主入口包手册。
|
|
51
|
+
|
|
52
|
+
## 0.2.0 版本
|
|
53
|
+
|
|
54
|
+
本包随 npm 0.2.0 发布,内部依赖使用匹配的精确版本。Windows 命令、后台 Job 与 host MCP 逐次审批后以当前用户权限直接执行,审批不提供 OS 隔离;macOS 继续使用 Seatbelt。实机与进程树生命周期仍需按实际验证确认。
|
|
55
|
+
|
|
56
|
+
## 许可证
|
|
57
|
+
|
|
58
|
+
公开源码采用 [MIT 许可证](https://github.com/C-Clay-W/autopilot/blob/main/LICENSE)。第三方依赖采用各自授权。
|