@ agentskit/ 交叉平台
简介 : concise-package
AgentsKit生态系统中OS和运行时可移植性的一个位置:产卵过程,处理路径,行尾和在Windows,macOS和Linux上同样的方式,在Node,Bun和Deno下.
标记 : agentskit • 妇女 ai-agents • 妇女 cross-platform • 妇女 windows • 妇女 spawn • 妇女 bun • 妇女 deno • 妇女 node
已核实的证据
- 软件包元数据、单元测试和运行时间烟雾测试现场直播
packages/cross-platform/。 。 。 . - CI 矩阵: Linux、 macOS 和 Windows × 节点、 Bun 和 Deno ()
.github/workflows/cross-platform.yml) (中文(简体) ). - 决定记录: AR-0036 (英语)。 。 。 .
- 稳定地图: 文件/服务.md
如何适应生态系统
每个 AgentsKit 寄存器都用来手工修正相同的 Windows 错误 : .cmd shims 失败与 ENOENT在第一道新线被切断时, \ 对 / 在路径中,CRLF 打破散列, EBUSY 重新命名,孤儿过程. @agentskit/cross-platform 拥有这些修饰, 以及它们背后的图书馆, 所以其他的生态系统 进口一个包 而不是重新实施它们.
- 探员Kit数字 :
@agentskit/cli, (中文(简体) ),@agentskit/adapters, (中文(简体) ),@agentskit/tools财务报告和审定财务报表@agentskit/sandbox产卵穿过它. - 书记官处: 随时可以使用的代理和模板 登记. agentskit.io。 。 。 .
- 游戏本: 生产模式 游戏本. agentskit.io。 。 。 .
安装
npm install @agentskit/cross-platform
快速实例
import { runCommand, splitLines, toPosix } from '@agentskit/cross-platform'
// `npx` is `npx.cmd` on Windows: resolved without `shell: true`.
// The multi-line prompt goes through stdin, so cmd.exe cannot truncate it.
const result = await runCommand('npx', ['--yes', 'prettier', '--stdin-filepath', 'notes.md'], {
input: '# Notes\n\n* formatted on any OS and any runtime\n',
timeoutMs: 60_000,
})
console.log(splitLines(result.stdout).length, 'lines')
console.log(toPosix('C:\\repo\\src\\index.ts'))
特征
| 区域 | API 密码 | 替换 |
|---|---|---|
| 进程 | spawnProcess, (中文(简体) ), runCommand, (中文(简体) ), spawnShell, (中文(简体) ), runShell, (中文(简体) ), spawnNodeChild, (中文(简体) ), killProcessTree, (中文(简体) ), findExecutable, (中文(简体) ), commandExists, (中文(简体) ), safeEnv | child_process + 键 shell: process.platform === 'win32'{\fn黑体\fs22\bord1\shad0\3ahbe\4ah00\fscx67\fscy66\2chffffff\3ch808080}我马上要离开, child.kill() 留下孙子孙女, process.kill(-pid) |
| 路径 | toPosix, (中文(简体) ), relativePosix, (中文(简体) ), joinPosix, (中文(简体) ), samePath, (中文(简体) ), isPathInside, (中文(简体) ), fileUrlToPath, (中文(简体) ), moduleDir, (中文(简体) ), isMainModule | replace(/\\/g, '/') 副本, new URL(import.meta.url).pathname |
| 文本 | normalizeEol, (中文(简体) ), splitLines, (中文(简体) ), splitFrontmatter, (中文(简体) ), hashText | split('\n'), (中文(简体) ), /^---\n/,在下方有差异的散列 core.autocrlf |
| 文件系统 | removePath, (中文(简体) ), renamePath, (中文(简体) ), writeFileAtomic, (中文(简体) ), createSymlink, (中文(简体) ), copyPath, (中文(简体) ), setFileMode | EBUSY编号 :EPERM 重试循环, EXDEV 临时文件, 符号链接权限错误 |
| 运行时间 | getRuntimeInfo, (中文(简体) ), isWindows, (中文(简体) ), isBun, (中文(简体) ), isDeno | 特设 process.platform 检查 |
| 护卫 | agentskit-cross-platform check | 只在 Windows 笔记本电脑上找到 Windows 回归 |
- 每个运行时间的原生适配器数字 :
node:child_process在节点上,Bun.spawn在邦顿上,Deno.Command在Deno. stdout/stderr为网络ReadableStream到处都是. - 浏览器/ 边缘子集数字 :
@agentskit/cross-platform/pure(路径、文本、运行时间检测)没有node:进口. - Deno 权限: 缺失
--allow-*升起旗帜AK_PLATFORM_PERMISSION_DENIED命名旗帜。 它从不引起. - 建造在数字 :
cross-spawn(Windows命令解析和cmd.exe逃跑),tree-kill, (中文(简体) ),pathe, (中文(简体) ),std-env, (中文(简体) ),graceful-fs, (中文(简体) ),which。 。 。 .
测试助手
导入 createFetchStub, (中文(简体) ), jsonResponse,以及 withTempDir 从
@agentskit/cross-platform/testing子路径没有测试者依赖;
withTempDir 使用此软件包的OS 临时指令检查并重试清理.
护卫
npx agentskit-cross-platform check --init # record today's findings as a baseline
npx agentskit-cross-platform check # fail on any new finding
npx agentskit-cross-platform check --update # lower the baseline after a fix
基线是鼠标:只计算下。 允许有正当理由的例外,但 cross-platform-ignore: <reason> 在上行或上行注释。 A 类 <rule-id>-ignore: <reason> 注释只压制该规则.
仓库护栏可以再利用出口的 runCli 带有自定义 rules 和可选 filter 将共享扫描和基线逻辑应用到更窄的源集.
生态系统
| 软件包 | 作用 |
|---|---|
| @ agentskit/ 核心 | AgentsKitError基础 CrossPlatformError |
| @ agentskit/ 适应器 | CLI 提供者( Claude, 代码x) |
| @ agentskit/ sandbox (英语) | 本地进程运行时间 |
贡献者
许可证
麻省理工学院——见 自由主义。 。 。 .
文档
成熟性和相容性
- 稳定性: β 语录 看到了吗 文件/服务.md没有1.0.
- 节点.js 20+ (20.19+), (中文(简体) ), 1.2分贝, (中文(简体) ), 德诺 2+,以及 类型脚本 严格模式
- 窗口、 macOS 和 Linux
- 发表于
@agentskit/cross-platform