@c4a/context 0.7.43 → 0.7.55
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/docs/README.md +1 -0
- package/docs/README.zh-CN.md +1 -0
- package/docs/guides/imports.md +84 -0
- package/docs/guides/knowledge-updates.md +24 -0
- package/docs/guides/package-outputs.md +13 -0
- package/docs/guides/repo-content.md +71 -0
- package/imports.d.ts +81 -0
- package/index.d.ts +14 -0
- package/index.js +85 -3
- package/indexerSemanticInput.d.ts +266 -266
- package/package.json +1 -1
- package/repoContent.d.ts +87 -0
- package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +16 -3
- package/templates/package-templates.zh-CN/kb/skills/knowledge-query/SKILL.md +10 -2
- package/templates/project-skills/maintain-project-knowledge/SKILL.md +7 -0
- package/templates/project-skills.zh-CN/maintain-project-knowledge/SKILL.md +5 -0
package/docs/README.md
CHANGED
|
@@ -22,6 +22,7 @@ preload the whole manual set.
|
|
|
22
22
|
|
|
23
23
|
| Current need | Read |
|
|
24
24
|
|---|---|
|
|
25
|
+
| Associate external knowledge, Skills or plugins without copying them | [External associations](./guides/imports.md) |
|
|
25
26
|
| Customize website pages, homepage slots or a floating chat widget | [Page Content Customization](./guides/page-customization.md) |
|
|
26
27
|
| Understand the whole knowledge-project shape | [Getting Started](./getting-started.md) |
|
|
27
28
|
| Know what the Agent may decide or change | [Agent Guide](./guides/agent-guide.md) and [Agent Dialogue](./guides/agent-dialogue.md) |
|
package/docs/README.zh-CN.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
| 当前需要 | 阅读内容 |
|
|
15
15
|
|---|---|
|
|
16
|
+
| 关联外部知识、Skill 或插件,不复制内容 | [外部关联](./guides/imports.md) |
|
|
16
17
|
| 理解完整知识项目的形态 | [Getting Started](./getting-started.md) |
|
|
17
18
|
| 判断 Agent 可以决定或修改什么 | [Agent Guide](./guides/agent-guide.md) 和 [Agent Dialogue](./guides/agent-dialogue.md) |
|
|
18
19
|
| 配置来源、采集、Indexer 或产物 | [Project API](./reference/project-api.md) |
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# External associations
|
|
2
|
+
|
|
3
|
+
Workspace-root `imports.yaml` declares external entrances without downloading,
|
|
4
|
+
installing or capturing their contents. Maintain it through the Context entry when
|
|
5
|
+
the task requests a lasting association. Temporary query reads do not register
|
|
6
|
+
dependencies. Same-repository authored documents and Skills use
|
|
7
|
+
[repo-content](repo-content.md) instead.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
protocol: context.imports/v1
|
|
11
|
+
imports:
|
|
12
|
+
engineering-guide:
|
|
13
|
+
kind: knowledge
|
|
14
|
+
url: https://docs.example.org/engineering/
|
|
15
|
+
description: Engineering conventions
|
|
16
|
+
release-check:
|
|
17
|
+
kind: skill
|
|
18
|
+
url: https://github.com/example/skills/tree/v1/skills/release-check
|
|
19
|
+
path: skills/release-check
|
|
20
|
+
version: v1
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The stable ID and `url` are required. `kind`, `format`, `title`, `description`,
|
|
24
|
+
`path` and `version` are optional. Kind and format are open strings; versions are
|
|
25
|
+
opaque hints, not necessarily SemVer. Paths are source-relative without traversal.
|
|
26
|
+
Reader URLs must be HTTP(S), without credentials or whitespace; this is local
|
|
27
|
+
syntax validation, not a provider whitelist or availability check. Do not put
|
|
28
|
+
access tokens in query strings. The SDK exports `importsRegistrySchema` for local
|
|
29
|
+
validation. Unknown providers and offline operation do not cause network checks.
|
|
30
|
+
|
|
31
|
+
Use a new ID when replacing the source identity. A declaration is neither proof
|
|
32
|
+
of reading nor an installation record. Do not expand transitive imports or infer
|
|
33
|
+
permission from a readable service. Only relevant originals are read through
|
|
34
|
+
existing host tools. Installed capability identity belongs to the host, not a
|
|
35
|
+
Context lock file.
|
|
36
|
+
|
|
37
|
+
## Entrances and evidence
|
|
38
|
+
|
|
39
|
+
An import is a reader entrance, not recorded evidence. It adds no entry to
|
|
40
|
+
`knowledge/structure.yaml` `references[]`, produces no review hint and has no
|
|
41
|
+
`import:` reference format. When an article's conclusion must be traceable or
|
|
42
|
+
tracked for change, register the needed external content as a source and capture
|
|
43
|
+
it; the import can remain as the reader entrance.
|
|
44
|
+
|
|
45
|
+
The CLI never contacts providers or compares versions. When asked to update or
|
|
46
|
+
check imports, the Agent observes current versions with existing authorized host
|
|
47
|
+
tools and compares them with `version`. Unreachable, unauthorized or failed checks
|
|
48
|
+
are reported as "version unknown" and are never treated as a change.
|
|
49
|
+
|
|
50
|
+
## Links and output
|
|
51
|
+
|
|
52
|
+
`[Engineering guide](context:import/engineering-guide)` in an article projects to
|
|
53
|
+
the declared URL. Build never guesses a provider-specific URL, appends `path` or
|
|
54
|
+
rewrites the version. Use an entrance that already opens the intended target.
|
|
55
|
+
Missing IDs keep the reader label as non-clickable text and produce a build link
|
|
56
|
+
warning. An invalid or unreadable declaration skips the optional directory and
|
|
57
|
+
degrades affected links the same way; unrelated outputs still build. Correct
|
|
58
|
+
`imports.yaml` or the article link to restore navigation. Merely registering
|
|
59
|
+
entries emits no page.
|
|
60
|
+
|
|
61
|
+
For an optional declaration-only directory:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
kbPackage({
|
|
65
|
+
name: "handbook",
|
|
66
|
+
template: { path: "src/package-templates/kb" },
|
|
67
|
+
importsPage: true,
|
|
68
|
+
})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This generates `wikis/imports.md` and includes it in package navigation. With an
|
|
72
|
+
existing `site` configuration, `importsPage: { site: true }` also adds a website
|
|
73
|
+
navigation item. `false` or omission disables generation. Initialization enables
|
|
74
|
+
the package directory when a valid `imports.yaml` already exists. An invalid
|
|
75
|
+
declaration is preserved with a warning; initialization continues without enabling
|
|
76
|
+
that directory. When first configuring
|
|
77
|
+
a new workspace's KB later, enable it if the declaration is present; preserve
|
|
78
|
+
existing settings and explicit user choices. The directory contains only declared metadata,
|
|
79
|
+
not approved article bodies or installation commands. Check audience suitability
|
|
80
|
+
before exposing private entrances.
|
|
81
|
+
|
|
82
|
+
Navigation links are not source evidence. Imports declaration support alone does
|
|
83
|
+
not authorize fabricated `import:` fragment references or advancement of article
|
|
84
|
+
evidence baselines.
|
|
@@ -18,6 +18,30 @@ actual behavior, a confirmed decision, and a proposal that is not implemented.
|
|
|
18
18
|
|
|
19
19
|
## Keep planning local to the change
|
|
20
20
|
|
|
21
|
+
Same-repository originals use `repo-content.yaml` rather than another capture.
|
|
22
|
+
For editing/registering them, use the `context-repo-content` Skill without
|
|
23
|
+
starting production. An explicitly requested source update can select
|
|
24
|
+
`repo-content:<entry-id>` in its confirmed requirement and update scope. The
|
|
25
|
+
prepared update includes current local changes and chapter impact candidates.
|
|
26
|
+
Docs compare cited regions; Skills compare the whole owning Skill directory,
|
|
27
|
+
including untracked additions. Missing historical objects are unknown, not an
|
|
28
|
+
empty diff. Inspect/edit does not advance references; delivery or an explicit
|
|
29
|
+
no-impact outcome settles the selected scope. Historical locators always store
|
|
30
|
+
the real repository path at the cited commit, not today's registration path.
|
|
31
|
+
|
|
32
|
+
External associations in `imports.yaml` are entrances, not recorded evidence:
|
|
33
|
+
they create no `references[]` and no review hints, and the CLI never checks
|
|
34
|
+
their versions. When the user asks to update or check external associations,
|
|
35
|
+
use existing authorized Host tools (for example `git ls-remote`, a package
|
|
36
|
+
manager or a web read) to observe each selected entry's current version and
|
|
37
|
+
compare it with its optional `version`. If it differs, read only what the
|
|
38
|
+
linked articles rely on, report whether they need revision and update
|
|
39
|
+
`version` once settled. Unreachable, unauthorized or failed checks are
|
|
40
|
+
"version unknown": report them, keep `version` unchanged, and never treat them
|
|
41
|
+
as changed. When an article's conclusion must trace or track external content,
|
|
42
|
+
register the needed part as a source and capture it; do not cite the
|
|
43
|
+
association itself as evidence.
|
|
44
|
+
|
|
21
45
|
Before starting production, compare the proposed content with the workspace's
|
|
22
46
|
reader purpose. For clearly unrelated anecdotes or personal rankings, briefly
|
|
23
47
|
recommend leaving them out of the formal manual or saving them separately because
|
|
@@ -17,6 +17,19 @@ package index, and section fingerprint rebuilds are not current close output.
|
|
|
17
17
|
|
|
18
18
|
## Default New-Workspace Outputs: Knowledge Base + Website
|
|
19
19
|
|
|
20
|
+
Same-repository originals have an optional [repository entrance](repo-content.md):
|
|
21
|
+
`repoContentPage: true` in a KB declaration projects README and Skill summaries,
|
|
22
|
+
not the full document tree. It does not expose that page on a configured website;
|
|
23
|
+
use `repoContentPage: { site: true }` to opt in. Existing declarations are kept.
|
|
24
|
+
|
|
25
|
+
External associations have an optional [directory](imports.md): `importsPage: true`
|
|
26
|
+
generates `wikis/imports.md` from declarations only; `{ site: true }` also exposes
|
|
27
|
+
it on a configured website. Neither option downloads or installs external content.
|
|
28
|
+
|
|
29
|
+
When first declaring a KB for a new workspace, enable `repoContentPage: true`
|
|
30
|
+
if `repo-content.yaml` exists and `importsPage: true` if `imports.yaml` exists.
|
|
31
|
+
Keep existing package settings and explicit user choices; website exposure stays opt-in.
|
|
32
|
+
|
|
20
33
|
Output channels support multiple selection. In a new workspace without explicit
|
|
21
34
|
preferences, the Agent proposes and configures KB + website as the default. Honor
|
|
22
35
|
user feedback, session authority and existing workspace declarations; LLMS is an
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Same-repository content
|
|
2
|
+
|
|
3
|
+
Keep project documentation and authored Skills at their original locations.
|
|
4
|
+
Context registers an entrance without copying their bodies to knowledge or
|
|
5
|
+
source snapshots. For selection and editing use `context-repo-content`.
|
|
6
|
+
|
|
7
|
+
At the Context workspace root, create `repo-content.yaml`:
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
protocol: context.repo-content/v1
|
|
11
|
+
entries:
|
|
12
|
+
docs:
|
|
13
|
+
kind: docs
|
|
14
|
+
path: docs
|
|
15
|
+
tools:
|
|
16
|
+
kind: skills
|
|
17
|
+
path: .agents/skills
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Paths are Git-root-relative, not workspace-relative. Kinds are `docs`,
|
|
21
|
+
`document`, `skills`, and `skill`. Optional `group` is one module level;
|
|
22
|
+
`mount` overrides the default `[group/]<basename>`. Optional `exclude` globs
|
|
23
|
+
are relative to the entry; they are not access control. Overlapping entries,
|
|
24
|
+
outside targets, nested repositories and cycles are rejected.
|
|
25
|
+
|
|
26
|
+
`context source ensure repo-content --format json` maintains relative symlinks
|
|
27
|
+
in `repo-content/`; `source inspect repo-content` and `status` inspect without
|
|
28
|
+
repairing. Ordinary files are not overwritten. With disabled symlinks, search
|
|
29
|
+
real paths from the registry rather than reading Git placeholders. No Git
|
|
30
|
+
configuration or index is changed. Registry and relative links can be committed
|
|
31
|
+
by the user; originals remain the only authoring location.
|
|
32
|
+
|
|
33
|
+
Invalid registration is advisory in `status` and automatic pre-operation link
|
|
34
|
+
maintenance: correct `repo-content.yaml`; existing links are left unchanged.
|
|
35
|
+
The repair command is suggested only for missing or misdirected symlinks, not
|
|
36
|
+
invalid registration, missing targets, ordinary-file conflicts or disabled
|
|
37
|
+
symlinks. Fix those reported conditions rather than repeatedly running ensure.
|
|
38
|
+
Explicit repository-content updates and `context build` require valid
|
|
39
|
+
registration. An invalid registry stops build before replacing existing package
|
|
40
|
+
outputs; it is not treated as an empty registry. Missing source files and
|
|
41
|
+
unavailable Git objects follow the documented fallback behavior instead.
|
|
42
|
+
|
|
43
|
+
Article navigation uses `[Guide](context:repo/docs/guide.md)`. Build projects
|
|
44
|
+
this to an upstream link when available, otherwise a plain location. Evidence
|
|
45
|
+
instead records `repo-content:docs@<full-commit>` plus real historical path,
|
|
46
|
+
line range and content digest. Uncommitted evidence uses `<commit>+worktree`.
|
|
47
|
+
The evidence Wasm supports these references without treating their existence
|
|
48
|
+
as proof that the source was read in the current query.
|
|
49
|
+
|
|
50
|
+
## Optional entrance page
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
kbPackage({
|
|
54
|
+
name: "project-kb",
|
|
55
|
+
template: { path: "src/package-templates/kb" },
|
|
56
|
+
repoContentPage: true,
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
SDK default is off. New initialization with an existing nonempty registry
|
|
61
|
+
creates a KB declaration with the entrance enabled; existing declarations are
|
|
62
|
+
preserved. It projects a group's README and Skill names/descriptions under
|
|
63
|
+
`wikis/repo-content.md` and optional group pages, not all docs or Skill scripts.
|
|
64
|
+
HEAD objects are preferred without network fetching, with declared worktree
|
|
65
|
+
fallback when unavailable. Review README sensitivity before exposing it.
|
|
66
|
+
With a configured website, `{ site: true }` opts into a top-level site entrance;
|
|
67
|
+
plain `true` keeps these pages out of the site.
|
|
68
|
+
|
|
69
|
+
Other repositories and externally installed Skills are not same-repository
|
|
70
|
+
content. Registering an entrance does not imply installation, execution,
|
|
71
|
+
production or publication authority.
|
package/imports.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Validate a portable reader entrance, never contact its provider. */
|
|
3
|
+
export declare const importUrlSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
4
|
+
export declare const importIdSchema: z.ZodString;
|
|
5
|
+
export declare const importEntrySchema: z.ZodObject<{
|
|
6
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
7
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
8
|
+
format: z.ZodOptional<z.ZodString>;
|
|
9
|
+
title: z.ZodOptional<z.ZodString>;
|
|
10
|
+
description: z.ZodOptional<z.ZodString>;
|
|
11
|
+
path: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
12
|
+
version: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
url: string;
|
|
15
|
+
path?: string | undefined;
|
|
16
|
+
title?: string | undefined;
|
|
17
|
+
description?: string | undefined;
|
|
18
|
+
kind?: string | undefined;
|
|
19
|
+
version?: string | undefined;
|
|
20
|
+
format?: string | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
url: string;
|
|
23
|
+
path?: string | undefined;
|
|
24
|
+
title?: string | undefined;
|
|
25
|
+
description?: string | undefined;
|
|
26
|
+
kind?: string | undefined;
|
|
27
|
+
version?: string | undefined;
|
|
28
|
+
format?: string | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const importsRegistrySchema: z.ZodObject<{
|
|
31
|
+
protocol: z.ZodLiteral<"context.imports/v1">;
|
|
32
|
+
imports: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
33
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
34
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
35
|
+
format: z.ZodOptional<z.ZodString>;
|
|
36
|
+
title: z.ZodOptional<z.ZodString>;
|
|
37
|
+
description: z.ZodOptional<z.ZodString>;
|
|
38
|
+
path: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
39
|
+
version: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, "strict", z.ZodTypeAny, {
|
|
41
|
+
url: string;
|
|
42
|
+
path?: string | undefined;
|
|
43
|
+
title?: string | undefined;
|
|
44
|
+
description?: string | undefined;
|
|
45
|
+
kind?: string | undefined;
|
|
46
|
+
version?: string | undefined;
|
|
47
|
+
format?: string | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
url: string;
|
|
50
|
+
path?: string | undefined;
|
|
51
|
+
title?: string | undefined;
|
|
52
|
+
description?: string | undefined;
|
|
53
|
+
kind?: string | undefined;
|
|
54
|
+
version?: string | undefined;
|
|
55
|
+
format?: string | undefined;
|
|
56
|
+
}>>;
|
|
57
|
+
}, "strict", z.ZodTypeAny, {
|
|
58
|
+
protocol: "context.imports/v1";
|
|
59
|
+
imports: Record<string, {
|
|
60
|
+
url: string;
|
|
61
|
+
path?: string | undefined;
|
|
62
|
+
title?: string | undefined;
|
|
63
|
+
description?: string | undefined;
|
|
64
|
+
kind?: string | undefined;
|
|
65
|
+
version?: string | undefined;
|
|
66
|
+
format?: string | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
}, {
|
|
69
|
+
protocol: "context.imports/v1";
|
|
70
|
+
imports: Record<string, {
|
|
71
|
+
url: string;
|
|
72
|
+
path?: string | undefined;
|
|
73
|
+
title?: string | undefined;
|
|
74
|
+
description?: string | undefined;
|
|
75
|
+
kind?: string | undefined;
|
|
76
|
+
version?: string | undefined;
|
|
77
|
+
format?: string | undefined;
|
|
78
|
+
}>;
|
|
79
|
+
}>;
|
|
80
|
+
export type ImportEntry = z.infer<typeof importEntrySchema>;
|
|
81
|
+
export type ImportsRegistry = z.infer<typeof importsRegistrySchema>;
|
package/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { PackageNavigationDefinition, PackageSelectDefinition } from "./con
|
|
|
5
5
|
import type { PhaseDefinition, PhaseResourceReference } from "./phases.js";
|
|
6
6
|
import type { ProjectSourceDefinition } from "./sources.js";
|
|
7
7
|
export * from "./indexerCoreExports.js";
|
|
8
|
+
export { importsRegistrySchema, importEntrySchema, importUrlSchema, importIdSchema, type ImportEntry, type ImportsRegistry } from "./imports.js";
|
|
9
|
+
export { repoContentRegistrySchema, repoContentEntrySchema, repoContentPathSchema, repoContentMount, parseRepoContentRef, repoContentScopeMatches, type RepoContentEntry, type RepoContentRegistry } from "./repoContent.js";
|
|
8
10
|
export { indexerComposerContractSchema, indexerComposerDeclarationSchema, indexerExecutionSchema, indexerProviderLayerFragmentSchema, indexerProviderManifestSchema, indexerProviderOperationSchema, indexerToolSourceDeclarationSchema, isIndexerLayerFragmentKind, isIndexerProviderProtocol, loadIndexerProviderManifest, parseIndexerProviderManifest, } from "./indexerProvider.js";
|
|
9
11
|
export type { IndexerComposerContract, IndexerComposerDeclaration, IndexerExecution, IndexerProviderLayerFragment, IndexerProviderManifest, IndexerProviderOperation, IndexerToolSourceDeclaration, } from "./indexerProvider.js";
|
|
10
12
|
export { canonicalOwnerCellRef, indexRequirementSchema, indexRequirementSetSchema, indexerRegistryDigests, indexerDistributionSchema, indexerRegistryEntrySchema, indexerRegistrySchema, loadIndexerRegistry, parseIndexerRegistry, requirementSetFromRegistry, validateFinalizedIndexerRegistry, } from "./indexerRegistry.js";
|
|
@@ -109,6 +111,12 @@ export type KbPackageDefinition = BasePackageDefinition & {
|
|
|
109
111
|
distribution?: PackageDistributionDefinition;
|
|
110
112
|
assets?: PackageAssetDefinition;
|
|
111
113
|
site?: PackageSiteDefinition;
|
|
114
|
+
repoContentPage?: boolean | {
|
|
115
|
+
site: true;
|
|
116
|
+
};
|
|
117
|
+
importsPage?: boolean | {
|
|
118
|
+
site: true;
|
|
119
|
+
};
|
|
112
120
|
};
|
|
113
121
|
export type LlmsPackageDefinition = BasePackageDefinition & {
|
|
114
122
|
kind: "package.llms";
|
|
@@ -132,6 +140,12 @@ export declare const kbPackage: (definition: {
|
|
|
132
140
|
distribution?: PackageDistributionDefinition;
|
|
133
141
|
assets?: PackageAssetDefinition;
|
|
134
142
|
site?: PackageSiteDefinition;
|
|
143
|
+
repoContentPage?: boolean | {
|
|
144
|
+
site: true;
|
|
145
|
+
};
|
|
146
|
+
importsPage?: boolean | {
|
|
147
|
+
site: true;
|
|
148
|
+
};
|
|
135
149
|
}) => KbPackageDefinition;
|
|
136
150
|
export declare const llmsPackage: (definition: {
|
|
137
151
|
name: string;
|
package/index.js
CHANGED
|
@@ -22134,6 +22134,64 @@ function validateCurrentIndexerBenchmarkReport(input) {
|
|
|
22134
22134
|
}
|
|
22135
22135
|
return report;
|
|
22136
22136
|
}
|
|
22137
|
+
// src/repoContent.ts
|
|
22138
|
+
var repoContentPathSchema = exports_external.string().min(1).refine((value) => !/[\\\u0000-\u001f\u007f:]/u.test(value) && value.split("/").every((part) => part !== "" && part !== "." && part !== ".." && part.toLowerCase() !== ".git"), "Use a repository-relative path without traversal or .git components");
|
|
22139
|
+
var segment = exports_external.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u);
|
|
22140
|
+
var repoContentEntrySchema = exports_external.object({
|
|
22141
|
+
kind: exports_external.enum(["docs", "skills", "document", "skill"]),
|
|
22142
|
+
path: repoContentPathSchema,
|
|
22143
|
+
exclude: exports_external.array(exports_external.string().min(1)).optional(),
|
|
22144
|
+
group: segment.optional(),
|
|
22145
|
+
mount: repoContentPathSchema.optional(),
|
|
22146
|
+
title: exports_external.string().min(1).optional(),
|
|
22147
|
+
description: exports_external.string().optional()
|
|
22148
|
+
}).strict();
|
|
22149
|
+
var repoContentRegistrySchema = exports_external.object({
|
|
22150
|
+
protocol: exports_external.literal("context.repo-content/v1"),
|
|
22151
|
+
entries: exports_external.record(segment, repoContentEntrySchema)
|
|
22152
|
+
}).strict();
|
|
22153
|
+
function repoContentMount(entry) {
|
|
22154
|
+
return entry.mount ?? [entry.group, entry.path.split("/").at(-1)].filter(Boolean).join("/");
|
|
22155
|
+
}
|
|
22156
|
+
function parseRepoContentRef(value) {
|
|
22157
|
+
const match = /^repo-content:([A-Za-z0-9][A-Za-z0-9._-]*)(?:@([a-fA-F0-9]{40}(?:[a-fA-F0-9]{24})?)(\+worktree)?)?$/u.exec(value);
|
|
22158
|
+
if (!match)
|
|
22159
|
+
return;
|
|
22160
|
+
return { id: match[1], ...match[2] ? { commit: match[2] } : {}, worktree: !!match[3] };
|
|
22161
|
+
}
|
|
22162
|
+
function repoContentScopeMatches(scope, reference) {
|
|
22163
|
+
if (scope === reference)
|
|
22164
|
+
return true;
|
|
22165
|
+
const selected = parseRepoContentRef(scope);
|
|
22166
|
+
const cited = parseRepoContentRef(reference);
|
|
22167
|
+
return !!selected && !selected.commit && !!cited && selected.id === cited.id;
|
|
22168
|
+
}
|
|
22169
|
+
|
|
22170
|
+
// src/imports.ts
|
|
22171
|
+
var importUrlSchema = exports_external.string().min(1).refine((value) => {
|
|
22172
|
+
if (!/^https?:\/\/[^/?#\\]/iu.test(value) || /[\s\u0000-\u001f\u007f<>\\]/u.test(value))
|
|
22173
|
+
return false;
|
|
22174
|
+
try {
|
|
22175
|
+
const url = new URL(value);
|
|
22176
|
+
return ["https:", "http:"].includes(url.protocol) && !!url.hostname && !url.username && !url.password;
|
|
22177
|
+
} catch {
|
|
22178
|
+
return false;
|
|
22179
|
+
}
|
|
22180
|
+
}, "Use an absolute http:// or https:// entrance without credentials, whitespace or backslashes");
|
|
22181
|
+
var importIdSchema = exports_external.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u);
|
|
22182
|
+
var importEntrySchema = exports_external.object({
|
|
22183
|
+
url: importUrlSchema,
|
|
22184
|
+
kind: exports_external.string().min(1).optional(),
|
|
22185
|
+
format: exports_external.string().min(1).optional(),
|
|
22186
|
+
title: exports_external.string().min(1).optional(),
|
|
22187
|
+
description: exports_external.string().optional(),
|
|
22188
|
+
path: repoContentPathSchema.optional(),
|
|
22189
|
+
version: exports_external.string().min(1).optional()
|
|
22190
|
+
}).strict();
|
|
22191
|
+
var importsRegistrySchema = exports_external.object({
|
|
22192
|
+
protocol: exports_external.literal("context.imports/v1"),
|
|
22193
|
+
imports: exports_external.record(importIdSchema, importEntrySchema)
|
|
22194
|
+
}).strict();
|
|
22137
22195
|
// src/indexerRequirementComparison.ts
|
|
22138
22196
|
function setRelation(oldValues, newValues) {
|
|
22139
22197
|
const oldContained = [...oldValues].every((value) => newValues.has(value));
|
|
@@ -32170,7 +32228,7 @@ var normalizePackageDistribution = (distribution) => {
|
|
|
32170
32228
|
}
|
|
32171
32229
|
const knowledgeNamespace = distribution.knowledgeNamespace.trim();
|
|
32172
32230
|
const segments = knowledgeNamespace.split("/");
|
|
32173
|
-
if (knowledgeNamespace.length > PACKAGE_KNOWLEDGE_NAMESPACE_MAX_LENGTH || segments.length === 0 || segments.some((
|
|
32231
|
+
if (knowledgeNamespace.length > PACKAGE_KNOWLEDGE_NAMESPACE_MAX_LENGTH || segments.length === 0 || segments.some((segment2) => segment2.length > PACKAGE_KNOWLEDGE_NAMESPACE_SEGMENT_MAX_LENGTH || !PACKAGE_KNOWLEDGE_NAMESPACE_SEGMENT_PATTERN.test(segment2))) {
|
|
32174
32232
|
throw new TypeError(`Package distribution.knowledgeNamespace must contain safe lowercase path segments using letters, numbers, hyphens, or dots, separated by "/", and be at most ${PACKAGE_KNOWLEDGE_NAMESPACE_MAX_LENGTH} characters: ${distribution.knowledgeNamespace}`);
|
|
32175
32233
|
}
|
|
32176
32234
|
return { knowledgeNamespace };
|
|
@@ -32238,7 +32296,7 @@ var createPackageDefinitionBase = (kind, definition) => {
|
|
|
32238
32296
|
}
|
|
32239
32297
|
const select = normalizeSelect(definition.select);
|
|
32240
32298
|
const acronymSegments = new Set(["ai", "api", "cli", "db", "id", "kb", "llm", "llms", "sdk", "ui"]);
|
|
32241
|
-
const defaultDisplayName = definition.name.replace(/[._-]+/gu, " ").trim().replace(/\b[a-z0-9]+\b/gu, (
|
|
32299
|
+
const defaultDisplayName = definition.name.replace(/[._-]+/gu, " ").trim().replace(/\b[a-z0-9]+\b/gu, (segment2) => acronymSegments.has(segment2) ? segment2.toUpperCase() : `${segment2.slice(0, 1).toUpperCase()}${segment2.slice(1)}`);
|
|
32242
32300
|
const builtInVars = {
|
|
32243
32301
|
displayName: defaultDisplayName.length > 0 ? defaultDisplayName : definition.name,
|
|
32244
32302
|
packageName: definition.name,
|
|
@@ -32274,13 +32332,27 @@ var kbPackage = (definition) => {
|
|
|
32274
32332
|
const distribution = normalizePackageDistribution(definition.distribution);
|
|
32275
32333
|
const assets = normalizePackageAssets(definition.assets);
|
|
32276
32334
|
const site = normalizePackageSite(definition.site);
|
|
32335
|
+
if (definition.importsPage !== undefined && typeof definition.importsPage !== "boolean" && (!definition.importsPage || typeof definition.importsPage !== "object" || definition.importsPage.site !== true || Object.keys(definition.importsPage).some((key) => key !== "site"))) {
|
|
32336
|
+
throw new TypeError("importsPage must be a boolean or { site: true }");
|
|
32337
|
+
}
|
|
32338
|
+
if (typeof definition.importsPage === "object" && !site) {
|
|
32339
|
+
throw new TypeError("importsPage.site requires a configured site");
|
|
32340
|
+
}
|
|
32341
|
+
if (definition.repoContentPage !== undefined && typeof definition.repoContentPage !== "boolean" && (!definition.repoContentPage || typeof definition.repoContentPage !== "object" || definition.repoContentPage.site !== true || Object.keys(definition.repoContentPage).some((key) => key !== "site"))) {
|
|
32342
|
+
throw new TypeError("repoContentPage must be a boolean or { site: true }");
|
|
32343
|
+
}
|
|
32344
|
+
if (typeof definition.repoContentPage === "object" && !site) {
|
|
32345
|
+
throw new TypeError("repoContentPage.site requires a configured site");
|
|
32346
|
+
}
|
|
32277
32347
|
return {
|
|
32278
32348
|
kind: "package.kb",
|
|
32279
32349
|
...base,
|
|
32280
32350
|
navigation: normalizePackageNavigation(definition.navigation),
|
|
32281
32351
|
...distribution === undefined ? {} : { distribution },
|
|
32282
32352
|
assets,
|
|
32283
|
-
...site === undefined ? {} : { site }
|
|
32353
|
+
...site === undefined ? {} : { site },
|
|
32354
|
+
...definition.repoContentPage === undefined ? {} : { repoContentPage: definition.repoContentPage },
|
|
32355
|
+
...definition.importsPage === undefined ? {} : { importsPage: definition.importsPage }
|
|
32284
32356
|
};
|
|
32285
32357
|
};
|
|
32286
32358
|
var llmsPackage = (definition) => ({
|
|
@@ -32452,6 +32524,11 @@ export {
|
|
|
32452
32524
|
resolveEffectiveIndexerComposers,
|
|
32453
32525
|
requirementSetFromRegistry,
|
|
32454
32526
|
requirementRef,
|
|
32527
|
+
repoContentScopeMatches,
|
|
32528
|
+
repoContentRegistrySchema,
|
|
32529
|
+
repoContentPathSchema,
|
|
32530
|
+
repoContentMount,
|
|
32531
|
+
repoContentEntrySchema,
|
|
32455
32532
|
renderIndexerDeterministicFacts,
|
|
32456
32533
|
relocateUnchangedArticleRegion,
|
|
32457
32534
|
relevantResults,
|
|
@@ -32470,6 +32547,7 @@ export {
|
|
|
32470
32547
|
processedScopeSchema,
|
|
32471
32548
|
processedScopeKey,
|
|
32472
32549
|
planIndexerPostAuthorComposition,
|
|
32550
|
+
parseRepoContentRef,
|
|
32473
32551
|
parseLarkSourcesRegistry,
|
|
32474
32552
|
parseIndexerRegistry,
|
|
32475
32553
|
parseIndexerProviderManifest,
|
|
@@ -32816,6 +32894,10 @@ export {
|
|
|
32816
32894
|
indexerActivationRequestSchema,
|
|
32817
32895
|
indexRequirementSetSchema,
|
|
32818
32896
|
indexRequirementSchema,
|
|
32897
|
+
importsRegistrySchema,
|
|
32898
|
+
importUrlSchema,
|
|
32899
|
+
importIdSchema,
|
|
32900
|
+
importEntrySchema,
|
|
32819
32901
|
failIndexerPostAuthorRun,
|
|
32820
32902
|
failIndexerMainRun,
|
|
32821
32903
|
expectedProviderResolutionFromAction,
|