@c4a/context 0.7.5 → 0.7.8

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.
Files changed (96) hide show
  1. package/README.md +12 -4
  2. package/README.zh-CN.md +11 -4
  3. package/docs/README.md +13 -1
  4. package/docs/README.zh-CN.md +13 -1
  5. package/docs/getting-started.md +95 -69
  6. package/docs/guides/agent-dialogue.md +19 -9
  7. package/docs/guides/agent-guide.md +42 -10
  8. package/docs/guides/code-indexer-skill-authoring.md +42 -11
  9. package/docs/guides/indexer-manifest-example.md +103 -0
  10. package/docs/guides/indexer-provider-and-customization.md +277 -13
  11. package/docs/guides/indexer-skill-creation.md +99 -0
  12. package/docs/guides/knowledge-updates.md +324 -0
  13. package/docs/guides/lark-resources.md +5 -1
  14. package/docs/guides/markdown-indexer-skill-authoring.md +16 -7
  15. package/docs/guides/note.md +37 -0
  16. package/docs/guides/package-outputs.md +22 -17
  17. package/docs/guides/sessions.md +50 -0
  18. package/docs/guides/workspace-commit.md +45 -0
  19. package/docs/guides/workspace-prepare.md +72 -0
  20. package/docs/guides/workspace-restore.md +59 -0
  21. package/docs/reference/code-extractors.md +23 -11
  22. package/docs/reference/indexer-provider-protocol.md +116 -22
  23. package/docs/reference/package-templates.md +10 -9
  24. package/docs/reference/project-api.md +47 -13
  25. package/docs/reference/template-variables.md +7 -7
  26. package/index.d.ts +11 -0
  27. package/index.js +1560 -572
  28. package/indexerAgentStepProtocol.d.ts +44 -0
  29. package/indexerApprovedKnowledge.d.ts +371 -0
  30. package/indexerArticlePlan.d.ts +83 -0
  31. package/indexerArtifact.d.ts +10 -7
  32. package/indexerArtifactDependencies.d.ts +5 -5
  33. package/indexerArtifactPolicy.d.ts +16 -16
  34. package/indexerArtifactResult.d.ts +76 -69
  35. package/indexerAuthoringFixture.d.ts +8 -8
  36. package/indexerAuthorizedWorksetView.d.ts +14 -14
  37. package/indexerBaseQuestionAmendment.d.ts +40 -0
  38. package/indexerCandidateCompile.d.ts +46 -36
  39. package/indexerCatalogFallback.d.ts +566 -48
  40. package/indexerContentLayers.d.ts +6 -4
  41. package/indexerContractDeclaration.d.ts +3 -0
  42. package/indexerControlledProgram.d.ts +1039 -238
  43. package/indexerCustomizationDraft.d.ts +188 -0
  44. package/indexerDependencyView.d.ts +17 -17
  45. package/indexerEffectiveArtifact.d.ts +26 -15
  46. package/indexerExampleFactDependencies.d.ts +17 -0
  47. package/indexerExampleIdentityAudit.d.ts +2 -2
  48. package/indexerInventoryDisposition.d.ts +44 -44
  49. package/indexerKnowledgeDependency.d.ts +46 -0
  50. package/indexerLayerComposition.d.ts +92 -54
  51. package/indexerLayoutChange.d.ts +8 -8
  52. package/indexerLayoutProposalSet.d.ts +15 -10
  53. package/indexerLayoutResolver.d.ts +15 -6
  54. package/indexerLayoutTransition.d.ts +8 -8
  55. package/indexerLifecycle.d.ts +1 -1
  56. package/indexerMainRunLedger.d.ts +3 -0
  57. package/indexerMainRunProtocol.d.ts +872 -196
  58. package/indexerMainWorkset.d.ts +50 -0
  59. package/indexerNavigationArtifactPlan.d.ts +2 -2
  60. package/indexerOverlayQuestionAmendment.d.ts +56 -16
  61. package/indexerOverlayQuestionApplyProposal.d.ts +98 -26
  62. package/indexerPartitionPlan.d.ts +585 -40
  63. package/indexerPhysicalArtifactAudit.d.ts +2 -2
  64. package/indexerPhysicalArtifactManifest.d.ts +24 -24
  65. package/indexerPostAuthorRunLedger.d.ts +60 -34
  66. package/indexerPrimaryProjection.d.ts +2 -2
  67. package/indexerProfileContract.d.ts +28 -28
  68. package/indexerProgramRunProtocol.d.ts +868 -194
  69. package/indexerProjectProposal.d.ts +36 -8
  70. package/indexerProjectedArtifactFanOutAudit.d.ts +2 -2
  71. package/indexerProvider.d.ts +72 -28
  72. package/indexerProviderComposition.d.ts +4 -4
  73. package/indexerProviderRouting.d.ts +52 -0
  74. package/indexerProviderSelectionProposal.d.ts +48 -0
  75. package/indexerPublicContractFacts.d.ts +7 -0
  76. package/indexerPublicContractTable.d.ts +11 -0
  77. package/indexerReaderTargetInventory.d.ts +6 -6
  78. package/indexerReferenceOnlyAudit.d.ts +2 -2
  79. package/indexerRegistry.d.ts +52 -0
  80. package/indexerRequirementConfirmation.d.ts +48 -16
  81. package/indexerRequirementLifecycle.d.ts +154 -42
  82. package/indexerResultReconciliation.d.ts +12 -11
  83. package/indexerSemanticInput.d.ts +27522 -3471
  84. package/{indexerGeneratedAuthoringAudit.d.ts → indexerStructuredClaims.d.ts} +0 -84
  85. package/indexerStructuredDeclaration.d.ts +8 -8
  86. package/indexerTemplateRendering.d.ts +7 -7
  87. package/indexerToolSnapshot.d.ts +16 -16
  88. package/managedSources.d.ts +15 -0
  89. package/package.json +1 -1
  90. package/phases.d.ts +0 -3
  91. package/processedScopes.d.ts +75 -0
  92. package/readingStructure.d.ts +188 -0
  93. package/sessionMetadata.d.ts +49 -0
  94. package/sources.d.ts +9 -3
  95. package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +15 -10
  96. package/templates/package-templates.zh-CN/kb/skills/knowledge-query/SKILL.md +8 -8
@@ -0,0 +1,83 @@
1
+ import { z } from "zod";
2
+ import type { IndexerArtifactResult } from "./indexerArtifactResult.js";
3
+ /** Reader titles can change; these keys remain stable across revisions. */
4
+ export declare const indexerArticleKeySchema: z.ZodString;
5
+ export declare const indexerArticlePlanSchema: z.ZodObject<{
6
+ key: z.ZodString;
7
+ title: z.ZodString;
8
+ reader_task: z.ZodString;
9
+ artifact_intent: z.ZodString;
10
+ template_id: z.ZodOptional<z.ZodString>;
11
+ required: z.ZodBoolean;
12
+ sections: z.ZodArray<z.ZodObject<{
13
+ key: z.ZodString;
14
+ heading: z.ZodString;
15
+ required: z.ZodBoolean;
16
+ }, "strict", z.ZodTypeAny, {
17
+ key: string;
18
+ required: boolean;
19
+ heading: string;
20
+ }, {
21
+ key: string;
22
+ required: boolean;
23
+ heading: string;
24
+ }>, "many">;
25
+ question_targets: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
26
+ knowledge_dependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
27
+ artifact_ref: z.ZodString;
28
+ section_refs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
29
+ required: z.ZodDefault<z.ZodBoolean>;
30
+ }, "strict", z.ZodTypeAny, {
31
+ required: boolean;
32
+ artifact_ref: string;
33
+ section_refs: string[];
34
+ }, {
35
+ artifact_ref: string;
36
+ required?: boolean | undefined;
37
+ section_refs?: string[] | undefined;
38
+ }>, "many">>;
39
+ }, "strict", z.ZodTypeAny, {
40
+ title: string;
41
+ key: string;
42
+ required: boolean;
43
+ sections: {
44
+ key: string;
45
+ required: boolean;
46
+ heading: string;
47
+ }[];
48
+ reader_task: string;
49
+ artifact_intent: string;
50
+ question_targets: string[];
51
+ template_id?: string | undefined;
52
+ knowledge_dependencies?: {
53
+ required: boolean;
54
+ artifact_ref: string;
55
+ section_refs: string[];
56
+ }[] | undefined;
57
+ }, {
58
+ title: string;
59
+ key: string;
60
+ required: boolean;
61
+ sections: {
62
+ key: string;
63
+ required: boolean;
64
+ heading: string;
65
+ }[];
66
+ reader_task: string;
67
+ artifact_intent: string;
68
+ template_id?: string | undefined;
69
+ question_targets?: string[] | undefined;
70
+ knowledge_dependencies?: {
71
+ artifact_ref: string;
72
+ required?: boolean | undefined;
73
+ section_refs?: string[] | undefined;
74
+ }[] | undefined;
75
+ }>;
76
+ export type IndexerArticlePlan = z.infer<typeof indexerArticlePlanSchema>;
77
+ export declare function validateIndexerArticlePlan(articles: readonly IndexerArticlePlan[], targets?: readonly string[]): void;
78
+ export declare function indexerArticleSectionKey(article: string, section: string): string;
79
+ /** Applies to both semantic submissions and programmatic Providers. */
80
+ export declare function validateIndexerPlannedArticles(result: IndexerArtifactResult, articles: readonly IndexerArticlePlan[]): Array<{
81
+ code: string;
82
+ message: string;
83
+ }>;
@@ -94,6 +94,7 @@ export declare const indexerArtifactSchema: z.ZodDiscriminatedUnion<"representat
94
94
  artifact_policy_variant: string;
95
95
  }>, z.ZodObject<{
96
96
  representation: z.ZodLiteral<"sections">;
97
+ template_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
97
98
  sections: z.ZodArray<z.ZodObject<{
98
99
  section_key: z.ZodEffects<z.ZodString, string, string>;
99
100
  owner_indexer_id: z.ZodEffects<z.ZodString, string, string>;
@@ -104,17 +105,17 @@ export declare const indexerArtifactSchema: z.ZodDiscriminatedUnion<"representat
104
105
  blocks: z.ZodArray<z.ZodDiscriminatedUnion<"layer", [z.ZodObject<{
105
106
  block_id: z.ZodEffects<z.ZodString, string, string>;
106
107
  layer: z.ZodLiteral<"deterministic-block">;
107
- renderer: z.ZodEnum<["bullet-list", "key-value-table", "json-code-block"]>;
108
+ renderer: z.ZodEnum<["bullet-list", "key-value-table", "multi-column-table", "public-contract-table", "json-code-block"]>;
108
109
  fact_refs: z.ZodArray<z.ZodString, "many">;
109
110
  }, "strict", z.ZodTypeAny, {
110
111
  block_id: string;
111
112
  layer: "deterministic-block";
112
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
113
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
113
114
  fact_refs: string[];
114
115
  }, {
115
116
  block_id: string;
116
117
  layer: "deterministic-block";
117
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
118
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
118
119
  fact_refs: string[];
119
120
  }>, z.ZodObject<{
120
121
  block_id: z.ZodEffects<z.ZodString, string, string>;
@@ -141,7 +142,7 @@ export declare const indexerArtifactSchema: z.ZodDiscriminatedUnion<"representat
141
142
  blocks: ({
142
143
  block_id: string;
143
144
  layer: "deterministic-block";
144
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
145
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
145
146
  fact_refs: string[];
146
147
  } | {
147
148
  evidence_refs: string[];
@@ -158,7 +159,7 @@ export declare const indexerArtifactSchema: z.ZodDiscriminatedUnion<"representat
158
159
  blocks: ({
159
160
  block_id: string;
160
161
  layer: "deterministic-block";
161
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
162
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
162
163
  fact_refs: string[];
163
164
  } | {
164
165
  evidence_refs: string[];
@@ -184,7 +185,7 @@ export declare const indexerArtifactSchema: z.ZodDiscriminatedUnion<"representat
184
185
  blocks: ({
185
186
  block_id: string;
186
187
  layer: "deterministic-block";
187
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
188
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
188
189
  fact_refs: string[];
189
190
  } | {
190
191
  evidence_refs: string[];
@@ -193,6 +194,7 @@ export declare const indexerArtifactSchema: z.ZodDiscriminatedUnion<"representat
193
194
  markdown: string;
194
195
  })[];
195
196
  }[];
197
+ template_id?: string | undefined;
196
198
  }, {
197
199
  artifact_kind: string;
198
200
  representation: "sections";
@@ -207,7 +209,7 @@ export declare const indexerArtifactSchema: z.ZodDiscriminatedUnion<"representat
207
209
  blocks: ({
208
210
  block_id: string;
209
211
  layer: "deterministic-block";
210
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
212
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
211
213
  fact_refs: string[];
212
214
  } | {
213
215
  evidence_refs: string[];
@@ -216,6 +218,7 @@ export declare const indexerArtifactSchema: z.ZodDiscriminatedUnion<"representat
216
218
  markdown: string;
217
219
  })[];
218
220
  }[];
221
+ template_id?: string | undefined;
219
222
  }>]>;
220
223
  export type IndexerArtifact = z.infer<typeof indexerArtifactSchema>;
221
224
  export type IndexerArtifactSectionProjection = z.infer<typeof indexerArtifactSectionProjectionSchema>;
@@ -256,7 +256,7 @@ export declare const indexerArtifactDependencySetSchema: z.ZodObject<{
256
256
  group_projection_digest: string;
257
257
  dependency_ref: string;
258
258
  }>, z.ZodObject<{
259
- kind: z.ZodEnum<["template-policy-fragment", "contract-metric"]>;
259
+ kind: z.ZodEnum<["template-policy-fragment", "contract-metric", "approved-knowledge"]>;
260
260
  target_ref: z.ZodString;
261
261
  content_digest: z.ZodString;
262
262
  targets: z.ZodArray<z.ZodDiscriminatedUnion<"level", [z.ZodObject<{
@@ -292,7 +292,7 @@ export declare const indexerArtifactDependencySetSchema: z.ZodObject<{
292
292
  } & {
293
293
  dependency_ref: z.ZodString;
294
294
  }, "strict", z.ZodTypeAny, {
295
- kind: "template-policy-fragment" | "contract-metric";
295
+ kind: "template-policy-fragment" | "contract-metric" | "approved-knowledge";
296
296
  targets: ({
297
297
  level: "logical-unit";
298
298
  } | {
@@ -308,7 +308,7 @@ export declare const indexerArtifactDependencySetSchema: z.ZodObject<{
308
308
  node_ref: string;
309
309
  dependency_ref: string;
310
310
  }, {
311
- kind: "template-policy-fragment" | "contract-metric";
311
+ kind: "template-policy-fragment" | "contract-metric" | "approved-knowledge";
312
312
  targets: ({
313
313
  level: "logical-unit";
314
314
  } | {
@@ -521,7 +521,7 @@ export declare const indexerArtifactDependencySetSchema: z.ZodObject<{
521
521
  group_projection_digest: string;
522
522
  dependency_ref: string;
523
523
  } | {
524
- kind: "template-policy-fragment" | "contract-metric";
524
+ kind: "template-policy-fragment" | "contract-metric" | "approved-knowledge";
525
525
  targets: ({
526
526
  level: "logical-unit";
527
527
  } | {
@@ -634,7 +634,7 @@ export declare const indexerArtifactDependencySetSchema: z.ZodObject<{
634
634
  group_projection_digest: string;
635
635
  dependency_ref: string;
636
636
  } | {
637
- kind: "template-policy-fragment" | "contract-metric";
637
+ kind: "template-policy-fragment" | "contract-metric" | "approved-knowledge";
638
638
  targets: ({
639
639
  level: "logical-unit";
640
640
  } | {
@@ -10,11 +10,11 @@ export declare const indexerArtifactPolicyEligibilitySchema: z.ZodObject<{
10
10
  path: z.ZodString;
11
11
  value: z.ZodType<IndexerJson, z.ZodTypeDef, IndexerJson>;
12
12
  }, "strict", z.ZodTypeAny, {
13
- value: IndexerJson;
14
13
  path: string;
15
- }, {
16
14
  value: IndexerJson;
15
+ }, {
17
16
  path: string;
17
+ value: IndexerJson;
18
18
  }>, "many">;
19
19
  provider_supported_variants: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
20
20
  eligible_variants: z.ZodArray<z.ZodObject<{
@@ -71,8 +71,8 @@ export declare const indexerArtifactPolicyEligibilitySchema: z.ZodObject<{
71
71
  profile_id: string;
72
72
  profile_contract_digest: string;
73
73
  canonical_facts: {
74
- value: IndexerJson;
75
74
  path: string;
75
+ value: IndexerJson;
76
76
  }[];
77
77
  provider_supported_variants: string[];
78
78
  eligible_variants: {
@@ -94,8 +94,8 @@ export declare const indexerArtifactPolicyEligibilitySchema: z.ZodObject<{
94
94
  profile_id: string;
95
95
  profile_contract_digest: string;
96
96
  canonical_facts: {
97
- value: IndexerJson;
98
97
  path: string;
98
+ value: IndexerJson;
99
99
  }[];
100
100
  provider_supported_variants: string[];
101
101
  eligible_variants: {
@@ -133,16 +133,16 @@ declare const artifactBundleEntrySchema: z.ZodUnion<[z.ZodObject<{
133
133
  reader_question_refs: z.ZodArray<z.ZodString, "many">;
134
134
  evidence_refs: z.ZodArray<z.ZodString, "many">;
135
135
  }, "strict", z.ZodTypeAny, {
136
+ purpose: "required" | "discretionary";
136
137
  evidence_refs: string[];
137
138
  artifact_kind: string;
138
139
  artifact_id: string;
139
- purpose: "required" | "discretionary";
140
140
  reader_question_refs: string[];
141
141
  }, {
142
+ purpose: "required" | "discretionary";
142
143
  evidence_refs: string[];
143
144
  artifact_kind: string;
144
145
  artifact_id: string;
145
- purpose: "required" | "discretionary";
146
146
  reader_question_refs: string[];
147
147
  }>, z.ZodObject<{
148
148
  artifact_id: z.ZodEffects<z.ZodString, string, string>;
@@ -165,10 +165,10 @@ declare const artifactBundleEntrySchema: z.ZodUnion<[z.ZodObject<{
165
165
  end_key: string;
166
166
  }>;
167
167
  }, "strict", z.ZodTypeAny, {
168
+ purpose: "semantic-split";
168
169
  evidence_refs: string[];
169
170
  artifact_kind: string;
170
171
  artifact_id: string;
171
- purpose: "semantic-split";
172
172
  reader_question_refs: string[];
173
173
  split_of: string;
174
174
  boundary: {
@@ -177,10 +177,10 @@ declare const artifactBundleEntrySchema: z.ZodUnion<[z.ZodObject<{
177
177
  end_key: string;
178
178
  };
179
179
  }, {
180
+ purpose: "semantic-split";
180
181
  evidence_refs: string[];
181
182
  artifact_kind: string;
182
183
  artifact_id: string;
183
- purpose: "semantic-split";
184
184
  reader_question_refs: string[];
185
185
  split_of: string;
186
186
  boundary: {
@@ -200,16 +200,16 @@ export declare const indexerArtifactBundleSchema: z.ZodObject<{
200
200
  reader_question_refs: z.ZodArray<z.ZodString, "many">;
201
201
  evidence_refs: z.ZodArray<z.ZodString, "many">;
202
202
  }, "strict", z.ZodTypeAny, {
203
+ purpose: "required" | "discretionary";
203
204
  evidence_refs: string[];
204
205
  artifact_kind: string;
205
206
  artifact_id: string;
206
- purpose: "required" | "discretionary";
207
207
  reader_question_refs: string[];
208
208
  }, {
209
+ purpose: "required" | "discretionary";
209
210
  evidence_refs: string[];
210
211
  artifact_kind: string;
211
212
  artifact_id: string;
212
- purpose: "required" | "discretionary";
213
213
  reader_question_refs: string[];
214
214
  }>, z.ZodObject<{
215
215
  artifact_id: z.ZodEffects<z.ZodString, string, string>;
@@ -232,10 +232,10 @@ export declare const indexerArtifactBundleSchema: z.ZodObject<{
232
232
  end_key: string;
233
233
  }>;
234
234
  }, "strict", z.ZodTypeAny, {
235
+ purpose: "semantic-split";
235
236
  evidence_refs: string[];
236
237
  artifact_kind: string;
237
238
  artifact_id: string;
238
- purpose: "semantic-split";
239
239
  reader_question_refs: string[];
240
240
  split_of: string;
241
241
  boundary: {
@@ -244,10 +244,10 @@ export declare const indexerArtifactBundleSchema: z.ZodObject<{
244
244
  end_key: string;
245
245
  };
246
246
  }, {
247
+ purpose: "semantic-split";
247
248
  evidence_refs: string[];
248
249
  artifact_kind: string;
249
250
  artifact_id: string;
250
- purpose: "semantic-split";
251
251
  reader_question_refs: string[];
252
252
  split_of: string;
253
253
  boundary: {
@@ -264,16 +264,16 @@ export declare const indexerArtifactBundleSchema: z.ZodObject<{
264
264
  protocol: "context.indexer.artifact-bundle/v1";
265
265
  artifact_policy_variant: string;
266
266
  artifacts: ({
267
+ purpose: "required" | "discretionary";
267
268
  evidence_refs: string[];
268
269
  artifact_kind: string;
269
270
  artifact_id: string;
270
- purpose: "required" | "discretionary";
271
271
  reader_question_refs: string[];
272
272
  } | {
273
+ purpose: "semantic-split";
273
274
  evidence_refs: string[];
274
275
  artifact_kind: string;
275
276
  artifact_id: string;
276
- purpose: "semantic-split";
277
277
  reader_question_refs: string[];
278
278
  split_of: string;
279
279
  boundary: {
@@ -290,16 +290,16 @@ export declare const indexerArtifactBundleSchema: z.ZodObject<{
290
290
  protocol: "context.indexer.artifact-bundle/v1";
291
291
  artifact_policy_variant: string;
292
292
  artifacts: ({
293
+ purpose: "required" | "discretionary";
293
294
  evidence_refs: string[];
294
295
  artifact_kind: string;
295
296
  artifact_id: string;
296
- purpose: "required" | "discretionary";
297
297
  reader_question_refs: string[];
298
298
  } | {
299
+ purpose: "semantic-split";
299
300
  evidence_refs: string[];
300
301
  artifact_kind: string;
301
302
  artifact_id: string;
302
- purpose: "semantic-split";
303
303
  reader_question_refs: string[];
304
304
  split_of: string;
305
305
  boundary: {