@c4a/context 0.7.5 → 0.7.9
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 +12 -4
- package/README.zh-CN.md +11 -4
- package/docs/README.md +13 -1
- package/docs/README.zh-CN.md +13 -1
- package/docs/getting-started.md +95 -69
- package/docs/guides/agent-dialogue.md +20 -9
- package/docs/guides/agent-guide.md +48 -10
- package/docs/guides/code-indexer-skill-authoring.md +42 -11
- package/docs/guides/indexer-manifest-example.md +103 -0
- package/docs/guides/indexer-provider-and-customization.md +334 -15
- package/docs/guides/indexer-skill-creation.md +99 -0
- package/docs/guides/knowledge-updates.md +422 -0
- package/docs/guides/lark-resources.md +5 -1
- package/docs/guides/markdown-indexer-skill-authoring.md +16 -7
- package/docs/guides/note.md +37 -0
- package/docs/guides/package-outputs.md +231 -60
- package/docs/guides/sessions.md +50 -0
- package/docs/guides/workspace-commit.md +45 -0
- package/docs/guides/workspace-prepare.md +72 -0
- package/docs/guides/workspace-restore.md +59 -0
- package/docs/reference/code-extractors.md +23 -11
- package/docs/reference/indexer-provider-protocol.md +135 -22
- package/docs/reference/package-templates.md +10 -9
- package/docs/reference/project-api.md +100 -13
- package/docs/reference/template-variables.md +7 -7
- package/index.d.ts +15 -0
- package/index.js +1708 -626
- package/indexerAgentStepProtocol.d.ts +44 -0
- package/indexerApprovedKnowledge.d.ts +371 -0
- package/indexerArticlePlan.d.ts +83 -0
- package/indexerArtifact.d.ts +10 -7
- package/indexerArtifactDependencies.d.ts +5 -5
- package/indexerArtifactPolicy.d.ts +12 -12
- package/indexerArtifactResult.d.ts +76 -69
- package/indexerAuthoringFixture.d.ts +8 -8
- package/indexerAuthorizedWorksetView.d.ts +14 -14
- package/indexerBaseQuestionAmendment.d.ts +40 -0
- package/indexerCandidateCompile.d.ts +46 -36
- package/indexerCatalogFallback.d.ts +566 -48
- package/indexerContentLayers.d.ts +6 -4
- package/indexerContractDeclaration.d.ts +3 -0
- package/indexerControlledProgram.d.ts +1039 -238
- package/indexerCustomizationDraft.d.ts +188 -0
- package/indexerDependencyView.d.ts +17 -17
- package/indexerEffectiveArtifact.d.ts +26 -15
- package/indexerExampleFactDependencies.d.ts +17 -0
- package/indexerExampleIdentityAudit.d.ts +2 -2
- package/indexerInventoryDisposition.d.ts +44 -44
- package/indexerKnowledgeDependency.d.ts +46 -0
- package/indexerLayerComposition.d.ts +92 -54
- package/indexerLayoutChange.d.ts +8 -8
- package/indexerLayoutProposalSet.d.ts +15 -10
- package/indexerLayoutResolver.d.ts +15 -6
- package/indexerLayoutTransition.d.ts +8 -8
- package/indexerLifecycle.d.ts +1 -1
- package/indexerMainRunLedger.d.ts +3 -0
- package/indexerMainRunProtocol.d.ts +872 -196
- package/indexerMainWorkset.d.ts +50 -0
- package/indexerNavigationArtifactPlan.d.ts +2 -2
- package/indexerOverlayQuestionAmendment.d.ts +56 -16
- package/indexerOverlayQuestionApplyProposal.d.ts +98 -26
- package/indexerPartitionPlan.d.ts +585 -40
- package/indexerPhysicalArtifactAudit.d.ts +2 -2
- package/indexerPhysicalArtifactManifest.d.ts +24 -24
- package/indexerPostAuthorRunLedger.d.ts +60 -34
- package/indexerPrimaryProjection.d.ts +2 -2
- package/indexerProfileContract.d.ts +28 -28
- package/indexerProgramRunProtocol.d.ts +868 -194
- package/indexerProjectProposal.d.ts +36 -8
- package/indexerProjectedArtifactFanOutAudit.d.ts +2 -2
- package/indexerProtocolHash.d.ts +2 -0
- package/indexerProvider.d.ts +102 -58
- package/indexerProviderComposition.d.ts +4 -4
- package/indexerProviderRouting.d.ts +52 -0
- package/indexerProviderSelectionProposal.d.ts +48 -0
- package/indexerPublicContractFacts.d.ts +7 -0
- package/indexerPublicContractTable.d.ts +11 -0
- package/indexerReaderTargetInventory.d.ts +6 -6
- package/indexerReferenceOnlyAudit.d.ts +2 -2
- package/indexerRegistry.d.ts +658 -0
- package/indexerRequirementConfirmation.d.ts +48 -16
- package/indexerRequirementLifecycle.d.ts +154 -42
- package/indexerResultReconciliation.d.ts +12 -11
- package/indexerSemanticInput.d.ts +27168 -3813
- package/{indexerGeneratedAuthoringAudit.d.ts → indexerStructuredClaims.d.ts} +0 -84
- package/indexerStructuredDeclaration.d.ts +8 -8
- package/indexerTemplateRendering.d.ts +7 -7
- package/indexerToolSnapshot.d.ts +16 -16
- package/knowledgeMap.d.ts +188 -0
- package/managedSources.d.ts +15 -0
- package/package.json +1 -1
- package/packageSite.d.ts +25 -0
- package/phases.d.ts +0 -3
- package/processedScopes.d.ts +75 -0
- package/sessionMetadata.d.ts +49 -0
- package/sources.d.ts +9 -3
- package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +15 -10
- package/templates/package-templates.zh-CN/kb/skills/knowledge-query/SKILL.md +8 -8
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Associations are supplied by the caller, not proof of implementation or approval. */
|
|
3
|
+
export declare const sessionChangeSchema: z.ZodEffects<z.ZodObject<{
|
|
4
|
+
repository: z.ZodOptional<z.ZodString>;
|
|
5
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
6
|
+
mr: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
repository?: string | undefined;
|
|
9
|
+
commit?: string | undefined;
|
|
10
|
+
mr?: string | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
repository?: string | undefined;
|
|
13
|
+
commit?: string | undefined;
|
|
14
|
+
mr?: string | undefined;
|
|
15
|
+
}>, {
|
|
16
|
+
repository?: string | undefined;
|
|
17
|
+
commit?: string | undefined;
|
|
18
|
+
mr?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
repository?: string | undefined;
|
|
21
|
+
commit?: string | undefined;
|
|
22
|
+
mr?: string | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const sessionChangesSchema: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
25
|
+
repository: z.ZodOptional<z.ZodString>;
|
|
26
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
27
|
+
mr: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
28
|
+
}, "strict", z.ZodTypeAny, {
|
|
29
|
+
repository?: string | undefined;
|
|
30
|
+
commit?: string | undefined;
|
|
31
|
+
mr?: string | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
repository?: string | undefined;
|
|
34
|
+
commit?: string | undefined;
|
|
35
|
+
mr?: string | undefined;
|
|
36
|
+
}>, {
|
|
37
|
+
repository?: string | undefined;
|
|
38
|
+
commit?: string | undefined;
|
|
39
|
+
mr?: string | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
repository?: string | undefined;
|
|
42
|
+
commit?: string | undefined;
|
|
43
|
+
mr?: string | undefined;
|
|
44
|
+
}>, "many">;
|
|
45
|
+
export type SessionChange = z.infer<typeof sessionChangeSchema>;
|
|
46
|
+
export declare function readSessionChanges(markdown: string): SessionChange[] | undefined;
|
|
47
|
+
/** Omitted changes preserve inline metadata. Explicit [] removes associations.
|
|
48
|
+
* Only the source header is serialized; the summary body is never rewritten. */
|
|
49
|
+
export declare function writeSessionChanges(markdown: string, changes?: readonly SessionChange[]): string;
|
package/sources.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
1
|
+
import { type ManagedDocumentSourceEntry, type ManagedDocumentSourceType } from "./managedSources.js";
|
|
2
|
+
export type SourceType = "repo" | "file" | "lark" | "note" | "sessions";
|
|
3
|
+
export type DocumentSourceType = Exclude<SourceType, "repo">;
|
|
3
4
|
export declare const DEFAULT_REPO_SOURCES_REGISTRY_PATH = "sources/repo/index.yaml";
|
|
4
5
|
export declare const DEFAULT_FILE_SOURCES_REGISTRY_PATH = "sources/file/index.yaml";
|
|
5
6
|
export declare const DEFAULT_LARK_SOURCES_REGISTRY_PATH = "sources/lark/index.yaml";
|
|
@@ -60,7 +61,7 @@ export type SourceReference<TType extends SourceType = SourceType> = TypedSource
|
|
|
60
61
|
export type RepoSourceReference = RegistrySourceReference | TypedSourceReference<"repo">;
|
|
61
62
|
export type FileSourceReference = RegistrySourceReference | TypedSourceReference<"file">;
|
|
62
63
|
export type LarkSourceReference = RegistrySourceReference | TypedSourceReference<"lark">;
|
|
63
|
-
export type DocumentSourceReference = FileSourceReference | LarkSourceReference
|
|
64
|
+
export type DocumentSourceReference = FileSourceReference | LarkSourceReference | TypedSourceReference<ManagedDocumentSourceType>;
|
|
64
65
|
export type SourceCollectionReference<TType extends SourceType = SourceType> = {
|
|
65
66
|
kind: "source.collection";
|
|
66
67
|
type: TType;
|
|
@@ -123,6 +124,8 @@ export type SourcesRegistry = {
|
|
|
123
124
|
repos: readonly RepoSourceRegistryEntry[];
|
|
124
125
|
files: readonly FileSourceRegistryEntry[];
|
|
125
126
|
larks: readonly LarkSourceRegistryEntry[];
|
|
127
|
+
notes: readonly ManagedDocumentSourceEntry[];
|
|
128
|
+
sessions: readonly ManagedDocumentSourceEntry[];
|
|
126
129
|
};
|
|
127
130
|
export type LoadSourcesRegistryOptions = {
|
|
128
131
|
rootDir?: string;
|
|
@@ -135,6 +138,9 @@ export type SourceDefinition = RepoSourceDefinition | FileSourceDefinition | Lar
|
|
|
135
138
|
export type DocumentSourceDefinition = FileSourceDefinition | LarkSourceDefinition | DocumentSourceReference;
|
|
136
139
|
export type RepoProjectSourceDefinition = RepoSourceDefinition | RepoSourceReference | SourceCollectionReference<"repo">;
|
|
137
140
|
export type ProjectSourceDefinition = SourceDefinition | SourceCollectionReference;
|
|
141
|
+
export declare function source(name: string, options: {
|
|
142
|
+
type: ManagedDocumentSourceType;
|
|
143
|
+
}): TypedSourceReference<ManagedDocumentSourceType>;
|
|
138
144
|
export declare function source(name: string): RegistrySourceReference;
|
|
139
145
|
export declare function source(namespace: string, module: string): RepoSourceReference;
|
|
140
146
|
export declare function source(namespace: string, module: string, options: {
|
|
@@ -46,7 +46,7 @@ was not selected into this package.
|
|
|
46
46
|
| Architecture, procedure, FAQ, decision, or incident | Start from `{{guidesRoot}}/index.md`. |
|
|
47
47
|
| Standard, constraint, acceptance, or test question | Start from `{{rulesRoot}}/index.md`. |
|
|
48
48
|
| Relationship or impact | Inspect typed edges, then read both endpoint pages. |
|
|
49
|
-
| Detail inside a known page | Read the relevant
|
|
49
|
+
| Detail inside a known page | Read the relevant Markdown heading and its body. |
|
|
50
50
|
| Coverage, gap, or inventory | Inspect the root indexes and `context-build-inventory.json`. |
|
|
51
51
|
|
|
52
52
|
## Evidence Contract
|
|
@@ -56,15 +56,20 @@ Use each opened page or package artifact as an evidence card:
|
|
|
56
56
|
| Evidence | Valid use |
|
|
57
57
|
|---|---|
|
|
58
58
|
| Page path | Page identity and citation handle. |
|
|
59
|
-
| Frontmatter title, description,
|
|
60
|
-
|
|
|
59
|
+
| Frontmatter title, description, and tags | Navigation and scope selection only. |
|
|
60
|
+
| Markdown headings | Locate and cite a section within its page. |
|
|
61
61
|
| Reader-visible section body | Primary support for factual claims. |
|
|
62
62
|
| `context-build-inventory.json` edge records | Typed relationship evidence. |
|
|
63
63
|
| Root indexes and build inventory | Package scope and coverage evidence. |
|
|
64
64
|
|
|
65
|
-
Do not infer a relationship from page co-occurrence.
|
|
66
|
-
|
|
67
|
-
and do not
|
|
65
|
+
Do not infer a relationship from page co-occurrence. Published pages do not need
|
|
66
|
+
production identifiers or source bookkeeping to be usable. Cite their readable
|
|
67
|
+
paths and headings; do not search for missing technical metadata or ask users
|
|
68
|
+
to supply it. Open the build inventory only for relationship or coverage questions,
|
|
69
|
+
or when a maintainer needs to locate the original approved page via
|
|
70
|
+
`dist_path` → `approved_path`. Original source attribution belongs to that
|
|
71
|
+
workspace's `knowledge/`, not to the published page. If the original material is
|
|
72
|
+
not bundled, answer only from the visible approved content and state its limits.
|
|
68
73
|
|
|
69
74
|
## Search Fallback
|
|
70
75
|
|
|
@@ -96,8 +101,7 @@ Use compact citations tied to claims:
|
|
|
96
101
|
|
|
97
102
|
```text
|
|
98
103
|
Page: <claim> [<root>/path/page.md]
|
|
99
|
-
Section: <claim> [<root>/path/page.md
|
|
100
|
-
Source-bound: <claim> [<root>/path/page.md#section-id, source_ref]
|
|
104
|
+
Section: <claim> [<root>/path/page.md, heading: <visible heading>]
|
|
101
105
|
Relationship: <claim> [context-build-inventory.json#structure.edge_records edge:<type>]
|
|
102
106
|
Coverage: <claim> [context-build-inventory.json]
|
|
103
107
|
```
|
|
@@ -107,7 +111,7 @@ When evidence is missing, return:
|
|
|
107
111
|
```text
|
|
108
112
|
Gap: this package does not contain evidence for <missing point>.
|
|
109
113
|
Checked: <indexes, pages, or artifacts>.
|
|
110
|
-
Next useful source: <source
|
|
114
|
+
Next useful source: <source document or page if known>.
|
|
111
115
|
```
|
|
112
116
|
|
|
113
117
|
Distinguish “not evidenced by this package” from “not true.” Do not fill gaps
|
|
@@ -123,7 +127,7 @@ from memory, previous conversations, or source files outside the package.
|
|
|
123
127
|
|
|
124
128
|
Approved knowledge files: `{{knowledgeCount}}`
|
|
125
129
|
|
|
126
|
-
|
|
130
|
+
{{!-- Template author guidance (not part of the published query Skill):
|
|
127
131
|
|
|
128
132
|
This is a complete generic query Skill, but package authors should replace or
|
|
129
133
|
edit it before publishing when the package has project-specific terminology,
|
|
@@ -131,3 +135,4 @@ common user intents, preferred entry pages, known limits, or task workflows.
|
|
|
131
135
|
Update the description, routing table, and package-boundary guidance to match
|
|
132
136
|
the actual package. If the generic behavior is intentionally sufficient,
|
|
133
137
|
explicitly accept the unchanged default during Context package-template review.
|
|
138
|
+
--}}
|
|
@@ -36,7 +36,7 @@ description: 查询 {{displayName}} 中经过审核、可追溯来源的知识
|
|
|
36
36
|
| 架构、流程、FAQ、决策或故障 | 从 `{{guidesRoot}}/index.md` 开始。 |
|
|
37
37
|
| 标准、约束、验收或测试 | 从 `{{rulesRoot}}/index.md` 开始。 |
|
|
38
38
|
| 关系或影响范围 | 检查类型化边,再读取两端页面。 |
|
|
39
|
-
| 已知页面中的细节 |
|
|
39
|
+
| 已知页面中的细节 | 读取相关 Markdown 标题及其正文。 |
|
|
40
40
|
| 覆盖范围或缺口 | 检查根索引和 `context-build-inventory.json`。 |
|
|
41
41
|
|
|
42
42
|
## 证据契约
|
|
@@ -44,13 +44,13 @@ description: 查询 {{displayName}} 中经过审核、可追溯来源的知识
|
|
|
44
44
|
| 证据 | 可支持的内容 |
|
|
45
45
|
|---|---|
|
|
46
46
|
| 页面路径 | 页面身份和引用位置。 |
|
|
47
|
-
| frontmatter
|
|
48
|
-
|
|
|
47
|
+
| frontmatter 的标题、描述和标签 | 导航和范围选择。 |
|
|
48
|
+
| Markdown 标题 | 定位和引用页面中的章节。 |
|
|
49
49
|
| 读者可见的章节正文 | 事实结论的主要依据。 |
|
|
50
50
|
| `context-build-inventory.json` 的边记录 | 类型化关系证据。 |
|
|
51
51
|
| 根索引和构建清单 | 包的范围和覆盖情况。 |
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
不要根据页面同时出现来推断关系。发布页不需要生产标识或来源记账字段才能使用,直接引用可读路径和标题;不要寻找已经移除的技术元数据,也不要要求用户补齐。关系、覆盖问题,或维护者需要通过 `dist_path` → `approved_path` 定位原批准页时,才读取构建清单。原始来源归因留在生产工作区的 `knowledge/`,不要求写入发布页。原始材料未随包分发时,只根据已批准的可见正文回答并说明边界。
|
|
54
54
|
|
|
55
55
|
## 搜索兜底
|
|
56
56
|
|
|
@@ -70,8 +70,7 @@ node <当前 knowledge-query Skill 目录>/scripts/search.mjs --query '<关键
|
|
|
70
70
|
|
|
71
71
|
```text
|
|
72
72
|
页面: <结论> [<root>/path/page.md]
|
|
73
|
-
章节: <结论> [<root>/path/page.md
|
|
74
|
-
来源绑定: <结论> [<root>/path/page.md#section-id, source_ref]
|
|
73
|
+
章节: <结论> [<root>/path/page.md, 标题:<可见标题>]
|
|
75
74
|
关系: <结论> [context-build-inventory.json#structure.edge_records edge:<type>]
|
|
76
75
|
覆盖: <结论> [context-build-inventory.json]
|
|
77
76
|
```
|
|
@@ -81,7 +80,7 @@ node <当前 knowledge-query Skill 目录>/scripts/search.mjs --query '<关键
|
|
|
81
80
|
```text
|
|
82
81
|
缺口:本知识包没有包含 <缺失点> 的证据。
|
|
83
82
|
已检查:<索引、页面或构建产物>。
|
|
84
|
-
|
|
83
|
+
下一步来源:<已知时填写来源文档或页面>。
|
|
85
84
|
```
|
|
86
85
|
|
|
87
86
|
“本包没有证据”不等于“事实不成立”。禁止使用模型记忆、旧对话或包外源码填补缺口。
|
|
@@ -94,6 +93,7 @@ node <当前 knowledge-query Skill 目录>/scripts/search.mjs --query '<关键
|
|
|
94
93
|
|
|
95
94
|
已批准知识文件:`{{knowledgeCount}}`
|
|
96
95
|
|
|
97
|
-
|
|
96
|
+
{{!-- 模板作者建议(不进入分发的查询 Skill):
|
|
98
97
|
|
|
99
98
|
这是可直接工作的通用查询 Skill。正式发布前,如果知识包存在专用术语、常见用户意图、推荐入口、已知边界或固定任务流程,作者应修改 description、路由表和包边界说明;如果通用行为已经足够,应在 Context 的包模板 Review 中明确接受未修改模板。
|
|
99
|
+
--}}
|