@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.
Files changed (98) 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 +20 -9
  7. package/docs/guides/agent-guide.md +48 -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 +334 -15
  11. package/docs/guides/indexer-skill-creation.md +99 -0
  12. package/docs/guides/knowledge-updates.md +422 -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 +231 -60
  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 +135 -22
  23. package/docs/reference/package-templates.md +10 -9
  24. package/docs/reference/project-api.md +100 -13
  25. package/docs/reference/template-variables.md +7 -7
  26. package/index.d.ts +15 -0
  27. package/index.js +1708 -626
  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 +12 -12
  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/indexerProtocolHash.d.ts +2 -0
  72. package/indexerProvider.d.ts +102 -58
  73. package/indexerProviderComposition.d.ts +4 -4
  74. package/indexerProviderRouting.d.ts +52 -0
  75. package/indexerProviderSelectionProposal.d.ts +48 -0
  76. package/indexerPublicContractFacts.d.ts +7 -0
  77. package/indexerPublicContractTable.d.ts +11 -0
  78. package/indexerReaderTargetInventory.d.ts +6 -6
  79. package/indexerReferenceOnlyAudit.d.ts +2 -2
  80. package/indexerRegistry.d.ts +658 -0
  81. package/indexerRequirementConfirmation.d.ts +48 -16
  82. package/indexerRequirementLifecycle.d.ts +154 -42
  83. package/indexerResultReconciliation.d.ts +12 -11
  84. package/indexerSemanticInput.d.ts +27168 -3813
  85. package/{indexerGeneratedAuthoringAudit.d.ts → indexerStructuredClaims.d.ts} +0 -84
  86. package/indexerStructuredDeclaration.d.ts +8 -8
  87. package/indexerTemplateRendering.d.ts +7 -7
  88. package/indexerToolSnapshot.d.ts +16 -16
  89. package/knowledgeMap.d.ts +188 -0
  90. package/managedSources.d.ts +15 -0
  91. package/package.json +1 -1
  92. package/packageSite.d.ts +25 -0
  93. package/phases.d.ts +0 -3
  94. package/processedScopes.d.ts +75 -0
  95. package/sessionMetadata.d.ts +49 -0
  96. package/sources.d.ts +9 -3
  97. package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +15 -10
  98. package/templates/package-templates.zh-CN/kb/skills/knowledge-query/SKILL.md +8 -8
@@ -1,5 +1,4 @@
1
1
  import { z } from "zod";
2
- import type { IndexerArtifactResult } from "./indexerArtifactResult.js";
3
2
  declare const structuredClaimSchema: z.ZodObject<{
4
3
  claim_ref: z.ZodString;
5
4
  claim_kind: z.ZodEffects<z.ZodString, string, string>;
@@ -104,86 +103,7 @@ export declare const indexerStructuredClaimSetSchema: z.ZodObject<{
104
103
  }[];
105
104
  claims_digest: string;
106
105
  }>;
107
- export declare const indexerGeneratedAuthoringAuditSchema: z.ZodObject<{
108
- protocol: z.ZodLiteral<"context.indexer.generated-authoring-audit/v1">;
109
- artifact_result_digest: z.ZodString;
110
- hard_findings: z.ZodArray<z.ZodObject<{
111
- code: z.ZodEnum<["generated-placeholder", "empty-required-section"]>;
112
- artifact_id: z.ZodEffects<z.ZodString, string, string>;
113
- section_key: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
114
- content_ref: z.ZodString;
115
- }, "strict", z.ZodTypeAny, {
116
- code: "generated-placeholder" | "empty-required-section";
117
- section_key: string | null;
118
- artifact_id: string;
119
- content_ref: string;
120
- }, {
121
- code: "generated-placeholder" | "empty-required-section";
122
- section_key: string | null;
123
- artifact_id: string;
124
- content_ref: string;
125
- }>, "many">;
126
- structured_claim_count: z.ZodNumber;
127
- evidence_covered_structured_claim_count: z.ZodNumber;
128
- semantic_prose_review_targets: z.ZodArray<z.ZodObject<{
129
- artifact_id: z.ZodEffects<z.ZodString, string, string>;
130
- section_key: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
131
- content_ref: z.ZodString;
132
- advisory_code: z.ZodLiteral<"semantic-prose-agent-review-required">;
133
- }, "strict", z.ZodTypeAny, {
134
- section_key: string | null;
135
- artifact_id: string;
136
- content_ref: string;
137
- advisory_code: "semantic-prose-agent-review-required";
138
- }, {
139
- section_key: string | null;
140
- artifact_id: string;
141
- content_ref: string;
142
- advisory_code: "semantic-prose-agent-review-required";
143
- }>, "many">;
144
- agent_review_required: z.ZodBoolean;
145
- audit_digest: z.ZodString;
146
- }, "strict", z.ZodTypeAny, {
147
- protocol: "context.indexer.generated-authoring-audit/v1";
148
- artifact_result_digest: string;
149
- hard_findings: {
150
- code: "generated-placeholder" | "empty-required-section";
151
- section_key: string | null;
152
- artifact_id: string;
153
- content_ref: string;
154
- }[];
155
- structured_claim_count: number;
156
- evidence_covered_structured_claim_count: number;
157
- semantic_prose_review_targets: {
158
- section_key: string | null;
159
- artifact_id: string;
160
- content_ref: string;
161
- advisory_code: "semantic-prose-agent-review-required";
162
- }[];
163
- agent_review_required: boolean;
164
- audit_digest: string;
165
- }, {
166
- protocol: "context.indexer.generated-authoring-audit/v1";
167
- artifact_result_digest: string;
168
- hard_findings: {
169
- code: "generated-placeholder" | "empty-required-section";
170
- section_key: string | null;
171
- artifact_id: string;
172
- content_ref: string;
173
- }[];
174
- structured_claim_count: number;
175
- evidence_covered_structured_claim_count: number;
176
- semantic_prose_review_targets: {
177
- section_key: string | null;
178
- artifact_id: string;
179
- content_ref: string;
180
- advisory_code: "semantic-prose-agent-review-required";
181
- }[];
182
- agent_review_required: boolean;
183
- audit_digest: string;
184
- }>;
185
106
  export type IndexerStructuredClaimSet = z.infer<typeof indexerStructuredClaimSetSchema>;
186
- export type IndexerGeneratedAuthoringAudit = z.infer<typeof indexerGeneratedAuthoringAuditSchema>;
187
107
  export declare function buildIndexerStructuredClaimSet(input: {
188
108
  author_workset_digest: string;
189
109
  logical_unit_ref: string;
@@ -201,8 +121,4 @@ export declare function validateIndexerStructuredClaimSet(input: {
201
121
  evidence_refs: readonly string[];
202
122
  }[];
203
123
  }): IndexerStructuredClaimSet;
204
- export declare function containsIndexerControlledAuthoringPlaceholder(markdown: string): boolean;
205
- export declare function buildIndexerGeneratedAuthoringAudit(result: IndexerArtifactResult): IndexerGeneratedAuthoringAudit;
206
- export declare function validateIndexerGeneratedAuthoringAudit(value: unknown): IndexerGeneratedAuthoringAudit;
207
- export declare function assertIndexerGeneratedAuthoringAuditClear(audit: IndexerGeneratedAuthoringAudit): void;
208
124
  export {};
@@ -207,7 +207,7 @@ declare const declarationPayloadSchema: z.ZodObject<{
207
207
  module_ref: string | null;
208
208
  carrier_kind: "manifest" | "indexer-result" | "catalog" | "section-evidence";
209
209
  carrier_ref: string;
210
- declaration_kind: "locator" | "handler" | "entry" | "directory" | "method" | "store";
210
+ declaration_kind: "locator" | "handler" | "method" | "entry" | "directory" | "store";
211
211
  target: {
212
212
  normalized_path: string;
213
213
  target_type: "directory";
@@ -228,7 +228,7 @@ declare const declarationPayloadSchema: z.ZodObject<{
228
228
  module_ref: string | null;
229
229
  carrier_kind: "manifest" | "indexer-result" | "catalog" | "section-evidence";
230
230
  carrier_ref: string;
231
- declaration_kind: "locator" | "handler" | "entry" | "directory" | "method" | "store";
231
+ declaration_kind: "locator" | "handler" | "method" | "entry" | "directory" | "store";
232
232
  target: {
233
233
  normalized_path: string;
234
234
  target_type: "directory";
@@ -299,7 +299,7 @@ export declare const indexerStructuredDeclarationSchema: z.ZodObject<{
299
299
  module_ref: string | null;
300
300
  carrier_kind: "manifest" | "indexer-result" | "catalog" | "section-evidence";
301
301
  carrier_ref: string;
302
- declaration_kind: "locator" | "handler" | "entry" | "directory" | "method" | "store";
302
+ declaration_kind: "locator" | "handler" | "method" | "entry" | "directory" | "store";
303
303
  target: {
304
304
  normalized_path: string;
305
305
  target_type: "directory";
@@ -321,7 +321,7 @@ export declare const indexerStructuredDeclarationSchema: z.ZodObject<{
321
321
  module_ref: string | null;
322
322
  carrier_kind: "manifest" | "indexer-result" | "catalog" | "section-evidence";
323
323
  carrier_ref: string;
324
- declaration_kind: "locator" | "handler" | "entry" | "directory" | "method" | "store";
324
+ declaration_kind: "locator" | "handler" | "method" | "entry" | "directory" | "store";
325
325
  target: {
326
326
  normalized_path: string;
327
327
  target_type: "directory";
@@ -396,7 +396,7 @@ export declare const indexerStructuredDeclarationSetSchema: z.ZodObject<{
396
396
  module_ref: string | null;
397
397
  carrier_kind: "manifest" | "indexer-result" | "catalog" | "section-evidence";
398
398
  carrier_ref: string;
399
- declaration_kind: "locator" | "handler" | "entry" | "directory" | "method" | "store";
399
+ declaration_kind: "locator" | "handler" | "method" | "entry" | "directory" | "store";
400
400
  target: {
401
401
  normalized_path: string;
402
402
  target_type: "directory";
@@ -418,7 +418,7 @@ export declare const indexerStructuredDeclarationSetSchema: z.ZodObject<{
418
418
  module_ref: string | null;
419
419
  carrier_kind: "manifest" | "indexer-result" | "catalog" | "section-evidence";
420
420
  carrier_ref: string;
421
- declaration_kind: "locator" | "handler" | "entry" | "directory" | "method" | "store";
421
+ declaration_kind: "locator" | "handler" | "method" | "entry" | "directory" | "store";
422
422
  target: {
423
423
  normalized_path: string;
424
424
  target_type: "directory";
@@ -445,7 +445,7 @@ export declare const indexerStructuredDeclarationSetSchema: z.ZodObject<{
445
445
  module_ref: string | null;
446
446
  carrier_kind: "manifest" | "indexer-result" | "catalog" | "section-evidence";
447
447
  carrier_ref: string;
448
- declaration_kind: "locator" | "handler" | "entry" | "directory" | "method" | "store";
448
+ declaration_kind: "locator" | "handler" | "method" | "entry" | "directory" | "store";
449
449
  target: {
450
450
  normalized_path: string;
451
451
  target_type: "directory";
@@ -472,7 +472,7 @@ export declare const indexerStructuredDeclarationSetSchema: z.ZodObject<{
472
472
  module_ref: string | null;
473
473
  carrier_kind: "manifest" | "indexer-result" | "catalog" | "section-evidence";
474
474
  carrier_ref: string;
475
- declaration_kind: "locator" | "handler" | "entry" | "directory" | "method" | "store";
475
+ declaration_kind: "locator" | "handler" | "method" | "entry" | "directory" | "store";
476
476
  target: {
477
477
  normalized_path: string;
478
478
  target_type: "directory";
@@ -57,15 +57,15 @@ export declare const indexerTemplateContractSchema: z.ZodEffects<z.ZodObject<{
57
57
  }>, "many">;
58
58
  deterministic_blocks: z.ZodArray<z.ZodObject<{
59
59
  id: z.ZodEffects<z.ZodString, string, string>;
60
- renderer: z.ZodEnum<["bullet-list", "key-value-table", "json-code-block"]>;
60
+ renderer: z.ZodEnum<["bullet-list", "key-value-table", "multi-column-table", "public-contract-table", "json-code-block"]>;
61
61
  source_variable_id: z.ZodEffects<z.ZodString, string, string>;
62
62
  }, "strict", z.ZodTypeAny, {
63
63
  id: string;
64
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
64
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
65
65
  source_variable_id: string;
66
66
  }, {
67
67
  id: string;
68
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
68
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
69
69
  source_variable_id: string;
70
70
  }>, "many">;
71
71
  sections: z.ZodArray<z.ZodEffects<z.ZodObject<{
@@ -173,7 +173,7 @@ export declare const indexerTemplateContractSchema: z.ZodEffects<z.ZodObject<{
173
173
  };
174
174
  deterministic_blocks: {
175
175
  id: string;
176
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
176
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
177
177
  source_variable_id: string;
178
178
  }[];
179
179
  page_policy: {
@@ -217,7 +217,7 @@ export declare const indexerTemplateContractSchema: z.ZodEffects<z.ZodObject<{
217
217
  };
218
218
  deterministic_blocks: {
219
219
  id: string;
220
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
220
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
221
221
  source_variable_id: string;
222
222
  }[];
223
223
  page_policy: {
@@ -261,7 +261,7 @@ export declare const indexerTemplateContractSchema: z.ZodEffects<z.ZodObject<{
261
261
  };
262
262
  deterministic_blocks: {
263
263
  id: string;
264
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
264
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
265
265
  source_variable_id: string;
266
266
  }[];
267
267
  page_policy: {
@@ -305,7 +305,7 @@ export declare const indexerTemplateContractSchema: z.ZodEffects<z.ZodObject<{
305
305
  };
306
306
  deterministic_blocks: {
307
307
  id: string;
308
- renderer: "bullet-list" | "key-value-table" | "json-code-block";
308
+ renderer: "bullet-list" | "key-value-table" | "multi-column-table" | "public-contract-table" | "json-code-block";
309
309
  source_variable_id: string;
310
310
  }[];
311
311
  page_policy: {
@@ -145,6 +145,10 @@ export declare const indexerToolSnapshotSchema: z.ZodEffects<z.ZodObject<{
145
145
  item_count: number;
146
146
  response_digest: string;
147
147
  }[];
148
+ location: {
149
+ site: string;
150
+ region: string | null;
151
+ };
148
152
  tool: {
149
153
  id: string;
150
154
  version: string;
@@ -159,10 +163,6 @@ export declare const indexerToolSnapshotSchema: z.ZodEffects<z.ZodObject<{
159
163
  endpoint_type: string;
160
164
  resolved_revision: string;
161
165
  };
162
- location: {
163
- site: string;
164
- region: string | null;
165
- };
166
166
  query: {
167
167
  operation: string;
168
168
  arguments_digest: string;
@@ -190,6 +190,10 @@ export declare const indexerToolSnapshotSchema: z.ZodEffects<z.ZodObject<{
190
190
  item_count: number;
191
191
  response_digest: string;
192
192
  }[];
193
+ location: {
194
+ site: string;
195
+ region: string | null;
196
+ };
193
197
  tool: {
194
198
  id: string;
195
199
  version: string;
@@ -204,10 +208,6 @@ export declare const indexerToolSnapshotSchema: z.ZodEffects<z.ZodObject<{
204
208
  endpoint_type: string;
205
209
  resolved_revision: string;
206
210
  };
207
- location: {
208
- site: string;
209
- region: string | null;
210
- };
211
211
  query: {
212
212
  operation: string;
213
213
  arguments_digest: string;
@@ -235,6 +235,10 @@ export declare const indexerToolSnapshotSchema: z.ZodEffects<z.ZodObject<{
235
235
  item_count: number;
236
236
  response_digest: string;
237
237
  }[];
238
+ location: {
239
+ site: string;
240
+ region: string | null;
241
+ };
238
242
  tool: {
239
243
  id: string;
240
244
  version: string;
@@ -249,10 +253,6 @@ export declare const indexerToolSnapshotSchema: z.ZodEffects<z.ZodObject<{
249
253
  endpoint_type: string;
250
254
  resolved_revision: string;
251
255
  };
252
- location: {
253
- site: string;
254
- region: string | null;
255
- };
256
256
  query: {
257
257
  operation: string;
258
258
  arguments_digest: string;
@@ -280,6 +280,10 @@ export declare const indexerToolSnapshotSchema: z.ZodEffects<z.ZodObject<{
280
280
  item_count: number;
281
281
  response_digest: string;
282
282
  }[];
283
+ location: {
284
+ site: string;
285
+ region: string | null;
286
+ };
283
287
  tool: {
284
288
  id: string;
285
289
  version: string;
@@ -294,10 +298,6 @@ export declare const indexerToolSnapshotSchema: z.ZodEffects<z.ZodObject<{
294
298
  endpoint_type: string;
295
299
  resolved_revision: string;
296
300
  };
297
- location: {
298
- site: string;
299
- region: string | null;
300
- };
301
301
  query: {
302
302
  operation: string;
303
303
  arguments_digest: string;
@@ -0,0 +1,188 @@
1
+ import { z } from "zod";
2
+ /** Reader organization is independent of collections, source ownership and outputs. */
3
+ export declare const knowledgeMapEntrySchema: z.ZodObject<{
4
+ key: z.ZodString;
5
+ parent: z.ZodNullable<z.ZodString>;
6
+ title: z.ZodString;
7
+ order: z.ZodDefault<z.ZodNumber>;
8
+ target: z.ZodOptional<z.ZodObject<{
9
+ artifact_ref: z.ZodString;
10
+ section_key: z.ZodOptional<z.ZodString>;
11
+ }, "strict", z.ZodTypeAny, {
12
+ artifact_ref: string;
13
+ section_key?: string | undefined;
14
+ }, {
15
+ artifact_ref: string;
16
+ section_key?: string | undefined;
17
+ }>>;
18
+ }, "strict", z.ZodTypeAny, {
19
+ title: string;
20
+ key: string;
21
+ order: number;
22
+ parent: string | null;
23
+ target?: {
24
+ artifact_ref: string;
25
+ section_key?: string | undefined;
26
+ } | undefined;
27
+ }, {
28
+ title: string;
29
+ key: string;
30
+ parent: string | null;
31
+ target?: {
32
+ artifact_ref: string;
33
+ section_key?: string | undefined;
34
+ } | undefined;
35
+ order?: number | undefined;
36
+ }>;
37
+ export declare const knowledgeMapUpdateSchema: z.ZodObject<{
38
+ expected_revision: z.ZodNullable<z.ZodString>;
39
+ upsert: z.ZodDefault<z.ZodArray<z.ZodObject<{
40
+ key: z.ZodString;
41
+ parent: z.ZodNullable<z.ZodString>;
42
+ title: z.ZodString;
43
+ order: z.ZodDefault<z.ZodNumber>;
44
+ target: z.ZodOptional<z.ZodObject<{
45
+ artifact_ref: z.ZodString;
46
+ section_key: z.ZodOptional<z.ZodString>;
47
+ }, "strict", z.ZodTypeAny, {
48
+ artifact_ref: string;
49
+ section_key?: string | undefined;
50
+ }, {
51
+ artifact_ref: string;
52
+ section_key?: string | undefined;
53
+ }>>;
54
+ }, "strict", z.ZodTypeAny, {
55
+ title: string;
56
+ key: string;
57
+ order: number;
58
+ parent: string | null;
59
+ target?: {
60
+ artifact_ref: string;
61
+ section_key?: string | undefined;
62
+ } | undefined;
63
+ }, {
64
+ title: string;
65
+ key: string;
66
+ parent: string | null;
67
+ target?: {
68
+ artifact_ref: string;
69
+ section_key?: string | undefined;
70
+ } | undefined;
71
+ order?: number | undefined;
72
+ }>, "many">>;
73
+ remove: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
74
+ }, "strict", z.ZodTypeAny, {
75
+ expected_revision: string | null;
76
+ upsert: {
77
+ title: string;
78
+ key: string;
79
+ order: number;
80
+ parent: string | null;
81
+ target?: {
82
+ artifact_ref: string;
83
+ section_key?: string | undefined;
84
+ } | undefined;
85
+ }[];
86
+ remove: string[];
87
+ }, {
88
+ expected_revision: string | null;
89
+ upsert?: {
90
+ title: string;
91
+ key: string;
92
+ parent: string | null;
93
+ target?: {
94
+ artifact_ref: string;
95
+ section_key?: string | undefined;
96
+ } | undefined;
97
+ order?: number | undefined;
98
+ }[] | undefined;
99
+ remove?: string[] | undefined;
100
+ }>;
101
+ export declare const knowledgeMapSchema: z.ZodObject<{
102
+ protocol: z.ZodLiteral<"context.knowledge-map/v1">;
103
+ revision: z.ZodString;
104
+ entries: z.ZodArray<z.ZodObject<{
105
+ key: z.ZodString;
106
+ parent: z.ZodNullable<z.ZodString>;
107
+ title: z.ZodString;
108
+ order: z.ZodDefault<z.ZodNumber>;
109
+ target: z.ZodOptional<z.ZodObject<{
110
+ artifact_ref: z.ZodString;
111
+ section_key: z.ZodOptional<z.ZodString>;
112
+ }, "strict", z.ZodTypeAny, {
113
+ artifact_ref: string;
114
+ section_key?: string | undefined;
115
+ }, {
116
+ artifact_ref: string;
117
+ section_key?: string | undefined;
118
+ }>>;
119
+ }, "strict", z.ZodTypeAny, {
120
+ title: string;
121
+ key: string;
122
+ order: number;
123
+ parent: string | null;
124
+ target?: {
125
+ artifact_ref: string;
126
+ section_key?: string | undefined;
127
+ } | undefined;
128
+ }, {
129
+ title: string;
130
+ key: string;
131
+ parent: string | null;
132
+ target?: {
133
+ artifact_ref: string;
134
+ section_key?: string | undefined;
135
+ } | undefined;
136
+ order?: number | undefined;
137
+ }>, "many">;
138
+ }, "strict", z.ZodTypeAny, {
139
+ entries: {
140
+ title: string;
141
+ key: string;
142
+ order: number;
143
+ parent: string | null;
144
+ target?: {
145
+ artifact_ref: string;
146
+ section_key?: string | undefined;
147
+ } | undefined;
148
+ }[];
149
+ protocol: "context.knowledge-map/v1";
150
+ revision: string;
151
+ }, {
152
+ entries: {
153
+ title: string;
154
+ key: string;
155
+ parent: string | null;
156
+ target?: {
157
+ artifact_ref: string;
158
+ section_key?: string | undefined;
159
+ } | undefined;
160
+ order?: number | undefined;
161
+ }[];
162
+ protocol: "context.knowledge-map/v1";
163
+ revision: string;
164
+ }>;
165
+ export type KnowledgeMap = z.infer<typeof knowledgeMapSchema>;
166
+ export type KnowledgeMapUpdate = z.infer<typeof knowledgeMapUpdateSchema>;
167
+ export declare function validateKnowledgeMap(value: unknown): KnowledgeMap;
168
+ export declare function updateKnowledgeMap(current: KnowledgeMap | undefined, value: unknown): KnowledgeMap;
169
+ export interface ProjectedKnowledgeMapEntry {
170
+ key: string;
171
+ title: string;
172
+ href?: string;
173
+ children: ProjectedKnowledgeMapEntry[];
174
+ }
175
+ /** Target availability belongs to each channel. Omit pending/excluded entries and
176
+ * empty groups without mutating shared organization or another channel's map. */
177
+ export declare function projectKnowledgeMap(structure: KnowledgeMap, targets: ReadonlyMap<string, string>): {
178
+ entries: ProjectedKnowledgeMapEntry[];
179
+ warnings: {
180
+ entry: string;
181
+ code: "knowledge-map-target-unavailable";
182
+ target: string;
183
+ }[];
184
+ };
185
+ export declare function knowledgeMapTargetKey(target: {
186
+ artifact_ref: string;
187
+ section_key?: string | undefined;
188
+ }): string;
@@ -0,0 +1,15 @@
1
+ import { type SessionChange } from "./sessionMetadata.js";
2
+ export type ManagedDocumentSourceType = "note" | "sessions";
3
+ export interface ManagedDocumentSourceEntry {
4
+ id: string;
5
+ name: string;
6
+ namespace: string;
7
+ module: string;
8
+ materializedAt: string;
9
+ changes?: SessionChange[];
10
+ }
11
+ /** A readable dated filename is the identity; no registry or content hash is
12
+ * added to the name. Paths are deliberately limited to these managed roots. */
13
+ export declare function assertManagedDocumentName(name: string): void;
14
+ export declare function assertManagedDocumentPath(rootDir: string, type: ManagedDocumentSourceType, name: string): Promise<string>;
15
+ export declare function discoverManagedDocuments(rootDir: string, type: ManagedDocumentSourceType): Promise<ManagedDocumentSourceEntry[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/context",
3
- "version": "0.7.5",
3
+ "version": "0.7.9",
4
4
  "type": "module",
5
5
  "description": "Declarative SDK for Context knowledge sources, workflows, review, and package outputs",
6
6
  "license": "MIT",
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ /** Static website in a sibling dist/<name-without-trailing-kb>-site directory. */
3
+ export declare const packageSiteSchema: z.ZodObject<{
4
+ title: z.ZodOptional<z.ZodString>;
5
+ description: z.ZodOptional<z.ZodString>;
6
+ lang: z.ZodDefault<z.ZodString>;
7
+ base: z.ZodDefault<z.ZodString>;
8
+ }, "strict", z.ZodTypeAny, {
9
+ lang: string;
10
+ base: string;
11
+ title?: string | undefined;
12
+ description?: string | undefined;
13
+ }, {
14
+ title?: string | undefined;
15
+ description?: string | undefined;
16
+ lang?: string | undefined;
17
+ base?: string | undefined;
18
+ }>;
19
+ export type PackageSiteDefinition = z.input<typeof packageSiteSchema>;
20
+ export declare function normalizePackageSite(value: PackageSiteDefinition | undefined): {
21
+ lang: string;
22
+ base: string;
23
+ title?: string | undefined;
24
+ description?: string | undefined;
25
+ } | undefined;
package/phases.d.ts CHANGED
@@ -17,9 +17,6 @@ export type PhaseResourceReference = {
17
17
  kind: "knowledge.approved";
18
18
  path: "knowledge";
19
19
  select?: PackageSelectDefinition;
20
- } | {
21
- kind: "knowledge.decisions";
22
- path: "knowledge/decisions.json";
23
20
  } | {
24
21
  kind: "package.template";
25
22
  path: string;
@@ -0,0 +1,75 @@
1
+ import { z } from "zod";
2
+ /** The latest completed input for one requirement and source scope, not a
3
+ * page revision or an acquisition receipt. An absent module list means the
4
+ * whole source within that requirement. */
5
+ export declare const processedScopeSchema: z.ZodEffects<z.ZodObject<{
6
+ requirement_ref: z.ZodEffects<z.ZodString, string, string>;
7
+ source_ref: z.ZodEffects<z.ZodString, string, string>;
8
+ processed_version: z.ZodEffects<z.ZodString, string, string>;
9
+ module_refs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
10
+ }, "strict", z.ZodTypeAny, {
11
+ source_ref: string;
12
+ requirement_ref: string;
13
+ processed_version: string;
14
+ module_refs?: string[] | undefined;
15
+ }, {
16
+ source_ref: string;
17
+ requirement_ref: string;
18
+ processed_version: string;
19
+ module_refs?: string[] | undefined;
20
+ }>, {
21
+ source_ref: string;
22
+ requirement_ref: string;
23
+ processed_version: string;
24
+ module_refs?: string[] | undefined;
25
+ }, {
26
+ source_ref: string;
27
+ requirement_ref: string;
28
+ processed_version: string;
29
+ module_refs?: string[] | undefined;
30
+ }>;
31
+ export type ProcessedScope = z.infer<typeof processedScopeSchema>;
32
+ export declare function processedScopeKey(scope: Pick<ProcessedScope, "requirement_ref" | "source_ref" | "module_refs">): string;
33
+ export declare const processedScopesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodObject<{
34
+ requirement_ref: z.ZodEffects<z.ZodString, string, string>;
35
+ source_ref: z.ZodEffects<z.ZodString, string, string>;
36
+ processed_version: z.ZodEffects<z.ZodString, string, string>;
37
+ module_refs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
38
+ }, "strict", z.ZodTypeAny, {
39
+ source_ref: string;
40
+ requirement_ref: string;
41
+ processed_version: string;
42
+ module_refs?: string[] | undefined;
43
+ }, {
44
+ source_ref: string;
45
+ requirement_ref: string;
46
+ processed_version: string;
47
+ module_refs?: string[] | undefined;
48
+ }>, {
49
+ source_ref: string;
50
+ requirement_ref: string;
51
+ processed_version: string;
52
+ module_refs?: string[] | undefined;
53
+ }, {
54
+ source_ref: string;
55
+ requirement_ref: string;
56
+ processed_version: string;
57
+ module_refs?: string[] | undefined;
58
+ }>, "many">, {
59
+ source_ref: string;
60
+ requirement_ref: string;
61
+ processed_version: string;
62
+ module_refs?: string[] | undefined;
63
+ }[], {
64
+ source_ref: string;
65
+ requirement_ref: string;
66
+ processed_version: string;
67
+ module_refs?: string[] | undefined;
68
+ }[]>;
69
+ /** Missing metadata is unknown, never inferred from current source versions. */
70
+ export declare function readProcessedScopes(structure: Record<string, unknown> | null): ProcessedScope[];
71
+ /** A narrower completed scope cannot advance its containing source scope. */
72
+ export declare function mergeProcessedScopes(previous: readonly ProcessedScope[], completed: readonly ProcessedScope[]): ProcessedScope[];
73
+ /** Overlapping incomparable scopes with different versions are unknown; string
74
+ * ordering of commit hashes is never a chronology. */
75
+ export declare function processedVersionForScope(scopes: readonly ProcessedScope[], scope: Pick<ProcessedScope, "requirement_ref" | "source_ref" | "module_refs">): string | undefined;