ds4-context-engine 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/PROJECT_KNOWLEDGE.md +3 -1
- package/package.json +2 -2
- package/src/extension/runtime.ts +36 -1
- package/src/pi-adapter/version.ts +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ bounded active context with provenance
|
|
|
16
16
|
Pi provider
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
> **Project status:** M0–M13 are implemented. The Pi adapter and standalone `ds4-context-core` package are version `0.1.
|
|
19
|
+
> **Project status:** M0–M13 are implemented. The Pi adapter and standalone `ds4-context-core` package are version `0.1.2`; the adapter targets Pi `0.84.3`.
|
|
20
20
|
|
|
21
21
|
## Why DS4
|
|
22
22
|
|
|
@@ -16,7 +16,9 @@ This is independent of global `project.enabled`: a global setting cannot overrid
|
|
|
16
16
|
|
|
17
17
|
## Discovery and exclusions
|
|
18
18
|
|
|
19
|
-
When Git is available, discovery combines tracked and non-ignored untracked files under `ctx.cwd`. Outside Git, DS4 walks the project tree deterministically. It never follows symbolic links and rejects paths outside the canonical project root.
|
|
19
|
+
When Git is available, discovery combines tracked and non-ignored untracked files under `ctx.cwd`. Outside Git, DS4 walks the project tree deterministically. Discovery stops as soon as the configured file bound is reached and also bounds visited directories. It never follows symbolic links and rejects paths outside the canonical project root.
|
|
20
|
+
|
|
21
|
+
DS4 skips project indexing when `ctx.cwd` is the filesystem root or the user's home directory. This prevents a normal Pi launch from recursively scanning an entire drive or user profile; start Pi inside the intended project directory to enable project knowledge.
|
|
20
22
|
|
|
21
23
|
Default bounds:
|
|
22
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ds4-context-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Non-destructive, provider-independent context management for Pi.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"ds4-context-core": "0.1.
|
|
53
|
+
"ds4-context-core": "0.1.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@earendil-works/pi-ai": "0.84.3",
|
package/src/extension/runtime.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { existsSync, realpathSync } from "node:fs";
|
|
3
|
-
import {
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { join, parse, resolve } from "node:path";
|
|
4
5
|
import type {
|
|
5
6
|
Api,
|
|
6
7
|
AssistantMessage,
|
|
@@ -118,6 +119,23 @@ export type RuntimePhase = "idle" | "initializing" | "disabled" | "observer" | "
|
|
|
118
119
|
|
|
119
120
|
const READ_ONLY_PROJECT_TOOLS = new Set(["read", "grep", "find", "ls"]);
|
|
120
121
|
|
|
122
|
+
function comparablePath(path: string): string {
|
|
123
|
+
let canonical: string;
|
|
124
|
+
try {
|
|
125
|
+
canonical = realpathSync(path);
|
|
126
|
+
} catch {
|
|
127
|
+
canonical = resolve(path);
|
|
128
|
+
}
|
|
129
|
+
return process.platform === "win32" ? canonical.toLowerCase() : canonical;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function isBroadProjectRoot(projectPath: string, homePath = homedir()): boolean {
|
|
133
|
+
const project = comparablePath(projectPath);
|
|
134
|
+
const home = comparablePath(homePath);
|
|
135
|
+
const filesystemRoot = comparablePath(parse(project).root);
|
|
136
|
+
return project === home || project === filesystemRoot;
|
|
137
|
+
}
|
|
138
|
+
|
|
121
139
|
export interface RuntimeDependencies {
|
|
122
140
|
agentDir: string;
|
|
123
141
|
configDirName: string;
|
|
@@ -1713,6 +1731,23 @@ export class Ds4ContextRuntime {
|
|
|
1713
1731
|
);
|
|
1714
1732
|
return;
|
|
1715
1733
|
}
|
|
1734
|
+
if (isBroadProjectRoot(ctx.cwd, this.dependencies.homeDir ?? homedir())) {
|
|
1735
|
+
this.lastProject = {
|
|
1736
|
+
...emptyProjectDiagnostics(
|
|
1737
|
+
"disabled",
|
|
1738
|
+
true,
|
|
1739
|
+
this.config.context.maxProjectTokens,
|
|
1740
|
+
this.config.project.maxResults,
|
|
1741
|
+
),
|
|
1742
|
+
projectPath: resolve(ctx.cwd),
|
|
1743
|
+
fallbackReason: "Project indexing is skipped for filesystem roots and the user home directory",
|
|
1744
|
+
};
|
|
1745
|
+
this.logger.warn("project_index.skipped", {
|
|
1746
|
+
reason: "broad-root",
|
|
1747
|
+
projectPath: resolve(ctx.cwd),
|
|
1748
|
+
});
|
|
1749
|
+
return;
|
|
1750
|
+
}
|
|
1716
1751
|
if (!this.database) return;
|
|
1717
1752
|
|
|
1718
1753
|
try {
|