@c4a/context 0.6.18 → 0.7.0

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 (130) hide show
  1. package/README.md +5 -5
  2. package/README.zh-CN.md +5 -5
  3. package/codeIndexPlan.d.ts +84 -0
  4. package/contracts.d.ts +2 -1
  5. package/docs/README.md +7 -0
  6. package/docs/README.zh-CN.md +5 -0
  7. package/docs/getting-started.md +12 -12
  8. package/docs/guides/agent-guide.md +18 -9
  9. package/docs/guides/code-indexer-skill-authoring.md +124 -0
  10. package/docs/guides/indexer-provider-and-customization.md +140 -0
  11. package/docs/guides/lark-resources.md +7 -0
  12. package/docs/guides/markdown-indexer-skill-authoring.md +118 -0
  13. package/docs/guides/package-outputs.md +3 -3
  14. package/docs/reference/code-extractors.md +7 -6
  15. package/docs/reference/indexer-provider-protocol.md +819 -0
  16. package/docs/reference/package-templates.md +18 -10
  17. package/docs/reference/project-api.md +49 -24
  18. package/index.d.ts +48 -2
  19. package/index.js +28239 -3948
  20. package/indexerAgentStepProtocol.d.ts +9391 -0
  21. package/indexerArtifactDependencies.d.ts +689 -0
  22. package/indexerArtifactPolicy.d.ts +335 -0
  23. package/indexerArtifactResult.d.ts +2010 -0
  24. package/indexerAuditFacts.d.ts +66 -0
  25. package/indexerAuditOverrideReadiness.d.ts +27 -0
  26. package/indexerAuditProtocol.d.ts +238 -0
  27. package/indexerAuditRevision.d.ts +726 -0
  28. package/indexerAuditRevisionActions.d.ts +236 -0
  29. package/indexerAuthoringFixture.d.ts +152 -0
  30. package/indexerBaseQuestionAmendment.d.ts +2403 -0
  31. package/indexerBenchmark.d.ts +1062 -0
  32. package/indexerCandidateCompile.d.ts +801 -0
  33. package/indexerCapabilityGroupEvidence.d.ts +129 -0
  34. package/indexerCatalogFallback.d.ts +1262 -0
  35. package/indexerCollectionMapping.d.ts +75 -0
  36. package/indexerContentLayers.d.ts +137 -0
  37. package/indexerControlledInvocation.d.ts +512 -0
  38. package/indexerControlledProgram.d.ts +12535 -0
  39. package/indexerCoreExports.d.ts +21 -0
  40. package/indexerCustomizationDraft.d.ts +13800 -0
  41. package/indexerCustomizationLadder.d.ts +103 -0
  42. package/indexerDependencyView.d.ts +1610 -0
  43. package/indexerEvidenceAdapterResult.d.ts +504 -0
  44. package/indexerExampleDecision.d.ts +1606 -0
  45. package/indexerExampleIdentity.d.ts +132 -0
  46. package/indexerExampleIdentityAudit.d.ts +70 -0
  47. package/indexerExampleLinkageAudit.d.ts +80 -0
  48. package/indexerGeneratedAuthoringAudit.d.ts +208 -0
  49. package/indexerIncrementalImpact.d.ts +221 -0
  50. package/indexerInventoryDisposition.d.ts +443 -0
  51. package/indexerLayerComposition.d.ts +1652 -0
  52. package/indexerLayoutChange.d.ts +329 -0
  53. package/indexerLayoutProposalSet.d.ts +447 -0
  54. package/indexerLayoutResolver.d.ts +342 -0
  55. package/indexerLayoutTransition.d.ts +247 -0
  56. package/indexerLifecycle.d.ts +53 -0
  57. package/indexerMainLifecycle.d.ts +258 -0
  58. package/indexerMainRunLedger.d.ts +888 -0
  59. package/indexerMainRunProtocol.d.ts +6471 -0
  60. package/indexerMainWorkset.d.ts +2141 -0
  61. package/indexerMaterialAnswer.d.ts +738 -0
  62. package/indexerMaterialAnswerActualization.d.ts +91 -0
  63. package/indexerMaterialAnswerExecutionPlan.d.ts +2887 -0
  64. package/indexerMaterialAnswerFlow.d.ts +63 -0
  65. package/indexerMaterialAnswerLayout.d.ts +76 -0
  66. package/indexerMaterialAnswerReview.d.ts +217 -0
  67. package/indexerMaterialAnswerReviewRoute.d.ts +6145 -0
  68. package/indexerMaterialAnswerRunLedger.d.ts +918 -0
  69. package/indexerMaterialAnswerRunProtocol.d.ts +1253 -0
  70. package/indexerMaterialGapLedger.d.ts +3111 -0
  71. package/indexerMaterialQuestionExclusion.d.ts +129 -0
  72. package/indexerMaterialQuestionWorkset.d.ts +508 -0
  73. package/indexerNavigationArtifactGraph.d.ts +5 -0
  74. package/indexerNavigationArtifactPlan.d.ts +39 -0
  75. package/indexerOverlayQuestionAmendment.d.ts +2551 -0
  76. package/indexerOverlayQuestionApplyProposal.d.ts +4697 -0
  77. package/indexerOverlayTrust.d.ts +1425 -0
  78. package/indexerParserCoordinate.d.ts +222 -0
  79. package/indexerParserFactView.d.ts +503 -0
  80. package/indexerPartitionConvergence.d.ts +496 -0
  81. package/indexerPartitionPlan.d.ts +919 -0
  82. package/indexerPartitionStrategyResolution.d.ts +594 -0
  83. package/indexerPhysicalArtifactAudit.d.ts +247 -0
  84. package/indexerPhysicalArtifactManifest.d.ts +449 -0
  85. package/indexerPlannedMaterialAnswer.d.ts +116 -0
  86. package/indexerPostAuthorComposition.d.ts +2000 -0
  87. package/indexerPostAuthorRunLedger.d.ts +1972 -0
  88. package/indexerPrimaryProjection.d.ts +262 -0
  89. package/indexerProfileContract.d.ts +3034 -0
  90. package/indexerProfileMetricAudit.d.ts +218 -0
  91. package/indexerProgramExecutionAuthorization.d.ts +227 -0
  92. package/indexerProgramRunProtocol.d.ts +7642 -0
  93. package/indexerProjectProposal.d.ts +2807 -0
  94. package/indexerProjectedArtifactFanOutAudit.d.ts +159 -0
  95. package/indexerProjectedArtifactPlan.d.ts +217 -0
  96. package/indexerProtocolCommon.d.ts +29 -0
  97. package/indexerProvider.d.ts +2573 -0
  98. package/indexerProviderComposition.d.ts +1357 -0
  99. package/indexerProviderContractReferences.d.ts +13 -0
  100. package/indexerProviderProfileResolution.d.ts +20 -0
  101. package/indexerProviderResolution.d.ts +752 -0
  102. package/indexerProviderResolutionAction.d.ts +678 -0
  103. package/indexerProviderRouting.d.ts +3909 -0
  104. package/indexerProviderSelectionProposal.d.ts +3311 -0
  105. package/indexerQuestionAuthority.d.ts +419 -0
  106. package/indexerReaderTargetInventory.d.ts +161 -0
  107. package/indexerReferenceOnlyAudit.d.ts +90 -0
  108. package/indexerRegistry.d.ts +3019 -0
  109. package/indexerRequirementComparison.d.ts +44 -0
  110. package/indexerRequirementConfirmation.d.ts +1193 -0
  111. package/indexerRequirementLifecycle.d.ts +3314 -0
  112. package/indexerRestrictedSelector.d.ts +63 -0
  113. package/indexerResultReconciliation.d.ts +6844 -0
  114. package/indexerResultReconciliationRun.d.ts +15 -0
  115. package/indexerRunEnvelope.d.ts +384 -0
  116. package/indexerRunProtocolCommon.d.ts +21 -0
  117. package/indexerSharedArtifactFingerprint.d.ts +33 -0
  118. package/indexerStructuredDeclaration.d.ts +513 -0
  119. package/indexerSubjectCatalog.d.ts +230 -0
  120. package/indexerSubjectIdentity.d.ts +19 -0
  121. package/indexerSubjectKeyAuthority.d.ts +785 -0
  122. package/indexerTemplateRendering.d.ts +485 -0
  123. package/indexerToolSnapshot.d.ts +431 -0
  124. package/indexerWorksetRead.d.ts +287 -0
  125. package/package.json +1 -1
  126. package/phases.d.ts +11 -9
  127. package/templates/package-templates/kb/AGENTS.md +1 -1
  128. package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +1 -1
  129. package/templates/package-templates.zh-CN/kb/AGENTS.md +1 -1
  130. package/templates/package-templates.zh-CN/kb/skills/knowledge-query/SKILL.md +1 -1
@@ -33,6 +33,13 @@ resources remain explicit in the capture report. Unknown non-empty XML blocks
33
33
  stay auditable in the raw XML and receive a warning; the CLI does not infer
34
34
  their meaning.
35
35
 
36
+ Document and resource reads share one access identity. Context first uses the
37
+ user identity; it falls back to the bot identity only when user credentials
38
+ are unavailable, never when the source denies permission or reports missing
39
+ scopes. This prevents a capture from mixing document text read by one identity
40
+ with attachments read by another. A bot fallback is reported in the capture
41
+ result and remains subject to the bot's own access boundary.
42
+
36
43
  ## Storage lifecycle
37
44
 
38
45
  Resources have three distinct locations:
@@ -0,0 +1,118 @@
1
+ # Markdown Indexer Skill authoring
2
+
3
+ Markdown Providers use the same `context.indexer.provider/v1` manifest,
4
+ versioning, Bundle, requirement, trust, Result and customization contracts as
5
+ Code Providers. Read the shared
6
+ [Code Indexer author checklist](./code-indexer-skill-authoring.md) and
7
+ [Provider selection/customization guide](./indexer-provider-and-customization.md)
8
+ first. This page defines the Markdown-specific boundary.
9
+
10
+ ## Capture before semantics
11
+
12
+ Capture owns source authorization, retrieval, revision identity, complete bytes,
13
+ Markdown/MDX parsing and evidence spans. A Markdown Indexer starts only from a
14
+ current captured source report and authorized evidence view. URLs, titles,
15
+ filenames, headings and capture success are activation candidates, not semantic
16
+ classification or proof that the whole document was read.
17
+
18
+ The Provider cannot fetch the document again, follow new links, rewrite source
19
+ revisions or widen capture scope. Missing/unsupported capture capability is an
20
+ explicit unsupported result, never a prose fallback.
21
+
22
+ ## Activation and source roles
23
+
24
+ Declare document activation signals and map evidence-backed sources to declared
25
+ roles such as authoritative, explanatory, operational, decision or example
26
+ material. Keep role selection separate from collection placement. One document
27
+ may support multiple reader questions, but every consumed span retains its
28
+ source/revision identity and cannot be promoted to a stronger authority by an
29
+ instruction.
30
+
31
+ ## Section projection and collection mapping
32
+
33
+ Author Results propose logical Sections and their intent; they do not write
34
+ `knowledge/` paths. Each Section binds:
35
+
36
+ - the canonical SubjectKey/Node target or an explicit independent target;
37
+ - its reader-question refs and exact evidence spans;
38
+ - an Artifact kind and Section key stable across content-only changes;
39
+ - a projection intent describing purpose, not a physical filename;
40
+ - structured content layers and their digests.
41
+
42
+ Context owns the closed mapping from profile/Section intent to collection and
43
+ path. The layout resolver reuses an existing Artifact by stable identity,
44
+ detects add/remove/rename/split/merge/move changes and requests a human Gate
45
+ only for destructive or ambiguous existing-layout changes. A Provider cannot
46
+ avoid that Gate by emitting a path or relabeling the change.
47
+
48
+ ## Reusing Code Nodes
49
+
50
+ Use the supplied subject catalog and TargetResolutionView. Equal SubjectKeys use
51
+ the same NodeRef across Code and Markdown. `resolved` enriches the existing
52
+ Node; `absent` may create an explicitly independent subject or a material gap;
53
+ `ambiguous` fails before authoring. Titles, heading similarity and filenames
54
+ are never identity fallback. Unrelated catalog changes must not make a workset
55
+ stale.
56
+
57
+ ## Artifact and Section planning
58
+
59
+ One logical unit may produce an Artifact Bundle with multiple meaningful
60
+ Sections or semantic split Artifacts. Do not use fixed-count, ordinal or
61
+ alphabetic batches. Do not create one page per heading/member or inflate page
62
+ count to satisfy a metric. The CLI owns Artifact-policy eligibility, physical
63
+ fan-out audit, layout actualization and the final Candidate compile.
64
+
65
+ Each Section carries exact positive and negative dependency refs. Incremental
66
+ impact is Section/Artifact-local: a source membership, question denominator,
67
+ candidate pool, evidence span or run-envelope change invalidates only the
68
+ dependent scope. A Provider must not replace this with source-wide or
69
+ collection-wide recomputation.
70
+
71
+ ## Editorial policy
72
+
73
+ Editorial instructions may guide clarity, consolidation, ordering and
74
+ reader-facing terminology. They cannot alter facts, evidence, source role,
75
+ requirement scope, protected values, revision identity, collection authority or
76
+ hard metrics. Deterministic blocks render only registered facts; semantic prose
77
+ must cite consumed evidence. Placeholders, speculation, fabricated transitions
78
+ and “content unavailable” pages are invalid even when the structure looks rich.
79
+
80
+ ## Material questions and answers
81
+
82
+ When current material cannot answer a required canonical question, return the
83
+ exact material-question disposition for the supplied owner cell, question
84
+ contract and Subject target. Do not invent a new question contract or landing.
85
+ Context stores the retained `material_gap_ledger`, derives the
86
+ MaterialQuestionWorkset and schedules a separate `material-answer` operation.
87
+
88
+ A material-answer Result contains only the question revision and source/span/
89
+ content-digest claims allowed by the workset. It does not return reader prose,
90
+ future Artifact/Section identity or self-authored EvidenceItem refs. Context
91
+ canonicalizes evidence, reviews the answer binding, derives the planned answer
92
+ and actualizes it into an approved landing. Stale source, Provider, question,
93
+ binding or landing returns the ledger item to unresolved atomically.
94
+
95
+ The ledger, answer body, answer provenance and revision scratch pages do not
96
+ enter reader Markdown or `dist`. A blocking gap closes only through current
97
+ evidence or an explicit non-delegable requirement change.
98
+
99
+ ## Markdown author fixture checklist
100
+
101
+ Release fixtures should cover:
102
+
103
+ - complete Markdown and MDX capture plus unsupported parser/capture paths;
104
+ - authoritative reference, guide, runbook, FAQ, decision, incident, policy,
105
+ test and release/migration document shapes using anonymous content;
106
+ - per-Section projection into every supported collection intent;
107
+ - existing Code Node reuse, independent subject, ambiguity and material gap;
108
+ - content-only reuse plus add/remove/rename/split/merge/collection/path/Section
109
+ move in both directions;
110
+ - protected values, links, images/assets and source-span fidelity;
111
+ - editorial positives and placeholder/speculation/unsupported negatives;
112
+ - material-answer approval, stale/rebind/deletion recovery and no-output-leak;
113
+ - Section-local incremental invalidation, new membership/denominator/candidate
114
+ pool changes and unaffected Section reuse.
115
+
116
+ Source authorization, capture revision safety, canonical question/collection
117
+ contracts, layout confirmation, review and build remain Context authority and
118
+ cannot be replaced by the Skill.
@@ -105,8 +105,8 @@ capture reports are never distributed as reader assets. See
105
105
  [Lark Resource Materialization](./lark-resources.md).
106
106
 
107
107
  The same inventory exposes `structure.relationship_coverage`. It records
108
- whether selected codegraph pages have current source-backed AST relationship
109
- metadata, how many codegraph views were selected, and how many package-visible
108
+ whether selected codeindex pages have current source-backed AST relationship
109
+ metadata, how many codeindex views were selected, and how many package-visible
110
110
  edges were emitted. An empty edge list is therefore explicit evidence of a
111
111
  coverage state, not permission to invent a dependency.
112
112
 
@@ -130,7 +130,7 @@ Current collection mapping:
130
130
 
131
131
  | Internal collection | Package path | Role |
132
132
  |---|---|---|
133
- | `codegraph` | `wikis/codegraph/` | Structured code entities and relationships. |
133
+ | `codeindex` | `wikis/codeindex/` | Source-backed code indexes with optional structured relationships. |
134
134
  | `business` | `wikis/business/` | Structured business entities and relationships. |
135
135
  | `product` | `wikis/product/` | Structured product entities, behavior, and relationships. |
136
136
  | `architecture` | `guides/architecture/` | Architecture explanations and design narratives. |
@@ -38,10 +38,10 @@ Current reusable capabilities are:
38
38
 
39
39
  | Source fact | Preferred capability | Lifecycle integration |
40
40
  |---|---|---|
41
- | TypeScript/TSX package or file scope | `extractTs()` | Context-owned phase |
41
+ | TypeScript/JavaScript package or TSX/JSX file scope | `extractTs()` | Context-owned phase |
42
42
  | Go declarations, imports, calls, and common HTTP routes | `@c4a/extract-go` | call from `extractCustom()` |
43
43
  | Rush workspace packages, tags, dependencies, entries, and owners | `@c4a/extract-rush` | call from `extractCustom()`; may complement a language extractor |
44
- | React Router route declarations | `extractReactRouterRoutes()` from `@c4a/extract-ts` | call from `extractCustom()`; complements TypeScript symbols |
44
+ | React Router route declarations | `extractReactRouterRoutes()` from `@c4a/extract-ts` | call from `extractCustom()`; complements ECMAScript symbols |
45
45
  | Rust, Python, Java/JVM, or an unsupported framework/protocol | no assumed built-in parser | project-owned `extractCustom()` adapter |
46
46
 
47
47
  The custom extraction preview verifies this selection mechanically. Context
@@ -98,7 +98,7 @@ configuration problem, not a Review decision.
98
98
 
99
99
  If no current capability can parse the source reliably, stop at configuration
100
100
  and report the missing generic capability. Do not silently emit an empty
101
- codegraph or reuse an unrelated parser.
101
+ codeindex or reuse an unrelated parser.
102
102
 
103
103
  ## Plan Before Parsing
104
104
 
@@ -108,7 +108,7 @@ application, adapter, CLI/tool, monorepo container, derived source,
108
108
  authoritative contract source, or unknown.
109
109
  A hybrid module may declare several `moduleTypes` and several behavior `facets`;
110
110
  keep one primary `moduleType` for concise reports. Record inspected paths in
111
- `moduleTypeEvidence`, then read all matching Route-recommended files below
111
+ `moduleTypeEvidence`, record every Markdown file actually read in `documents`, then read all matching Route-recommended files below
112
112
  `resources/semantic/code-index/templates/` and combine them into one plan.
113
113
  After that, choose exactly one closed output profile: `module-map`,
114
114
  `application-map`, `protocol-index`, `service-boundary`, `runtime-map`,
@@ -130,8 +130,9 @@ selected symbol and permits one owning index unit per source. Use it for an
130
130
  intentional granular public reference. Use `extractCustom()` for module-level
131
131
  aggregation, registries, protocol indexes, cross-module flows, or multiple
132
132
  candidate owners over one source; each candidate declares its `module` and
133
- evidence-scoped `sections`. Each section's typed coverage and exact evidence is
134
- checked against the output profile during preview. Resolve repositories from
133
+ at least one evidence-scoped `section`; there is no page-level Markdown
134
+ fallback. Each section's typed coverage and exact evidence is checked against
135
+ the output profile during preview. Resolve repositories from
135
136
  the extractor context's `sources[].absolutePath`, never from a
136
137
  machine-specific checkout path. Cross-module flow output must also emit
137
138
  source-backed structured edges. Generated clients/models, mirrored sources, legacy