@principal-ai/subsystems-core

中文文档
0.51.3发布于 2026/11/02Apache-2.0TypeScriptESM + CJS

Subsystem model types and agent-session tooling for Principal AI

原始使用文档
文档目录5 节
  1. Entry points
  2. Schema
  3. Topic references
  4. Installation
  5. License

@principal-ai/subsystems-core

Subsystem model types/schema and agent-session tooling for Principal AI.

Entry points

ImportUse
@principal-ai/subsystems-coreBrowser-safe subsystem model/topic types, reference links + isSubsystemModelDocument
@principal-ai/subsystems-core/nodeOpenCode store, agent-session list/fetch/normalize, topic store, fixtures
@principal-ai/subsystems-core/pipelineBun-safe session normalize/accumulate (no better-sqlite3)

Schema

Portable document schema: schemas/subsystem-model.schema.json

Topic references

DraftTopic.references attaches local topics, C4 sketches, and drawings by ID:

import {
  formatTopicReferenceLink,
  parseTopicReferenceLink,
  type TopicReference,
} from '@principal-ai/subsystems-core';

const reference: TopicReference = { kind: 'c4-sketch', sketchId: 'c4s-123-abc' };
formatTopicReferenceLink(reference); // principal://c4-sketch/c4s-123-abc
parseTopicReferenceLink('principal://topic/topic-123-abc');
// { kind: 'topic', topicId: 'topic-123-abc' }
parseTopicReferenceLink('principal://drawing/0b6f7c1e');
// { kind: 'drawing', drawingId: '0b6f7c1e' }

A drawing ID is the file name, without extension, of a .excalidraw file in the host's drawings folder (the desktop app uses ~/.alexandria/drawings/). Titles come from the drawing file's appState.name and are resolved by the host.

Create/update accepts references; updates replace the whole array ([] clears it). Existing topics may omit the field. References are directional and local-only. Targets stay separate artifacts; deleting a target leaves a missing reference, not a cascading deletion. Existing subsystemModels associations are unchanged.

Markdown links such as [Architecture](principal://c4-sketch/c4s-123-abc), [Whiteboard](principal://drawing/0b6f7c1e), and [Related](principal://topic/topic-123-abc) use the same target shapes but are independent of attachments. Helpers only format/parse hrefs; hosts must allow the principal protocol in Markdown sanitizers and handle resolution, navigation, target validation, deduplication, and self-reference rejection. Sketch references do not turn authored hypotheses into evidence.

Installation

npm install @principal-ai/subsystems-core
# or
bun add @principal-ai/subsystems-core

Peer: @principal-ai/agent-monitoring (session pipeline / fixtures).

License

Apache-2.0

版本与发布记录

@principal-ai/subsystems-core 共发布 40 个版本,首次发布于 2026/09/08;过去 12 个月发布了 40 个版本。

版本发布日期距今
0.51.3latest2026/11/021 天前
0.51.22026/10/304 天前
0.51.12026/10/295 天前
0.52.02026/10/295 天前
0.51.02026/10/2311 天前
0.50.02026/10/2113 天前

关于 @principal-ai/subsystems-core 的常见问题

@principal-ai/subsystems-core 是什么?

主体AI的子系统模型类型和代理会话工具

如何安装 @principal-ai/subsystems-core?

在项目目录运行 npm install @principal-ai/subsystems-core,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@principal-ai/agent-monitoring(^0.3.43)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@principal-ai/subsystems-core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@principal-ai/subsystems-core 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@principal-ai/subsystems-core 可以商用吗?

@principal-ai/subsystems-core 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@principal-ai/subsystems-core 还在维护吗?

最新版本 0.51.3 发布于 2026/11/02(1 天前);至今共发布 40 个版本,其中过去 12 个月发布了 40 个;首次发布于 2026/09/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。