@planu/cli 8.7.3 → 8.9.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.
- package/CHANGELOG.md +13 -0
- package/README.md +11 -3
- package/dist/sdd-engine/canonical-tools.d.ts +57 -0
- package/dist/sdd-engine/canonical-tools.js +78 -0
- package/dist/sdd-engine/client-workspace.d.ts +8 -1
- package/dist/sdd-engine/client-workspace.js +168 -1
- package/dist/sdd-engine/contracts.d.ts +1 -23
- package/dist/sdd-engine/contracts.js +1 -18
- package/dist/sdd-engine/feature-manifest.js +1 -1
- package/dist/sdd-engine/host-rule-pack.d.ts +7 -3
- package/dist/sdd-engine/host-rule-pack.js +28 -52
- package/dist/sdd-engine/host-skill-reader.d.ts +12 -10
- package/dist/sdd-engine/host-skill-reader.js +252 -194
- package/dist/sdd-engine/source-descriptor.d.ts +3 -0
- package/dist/sdd-engine/source-descriptor.js +332 -0
- package/dist/sdd-engine/tools/execution-tools.d.ts +2 -1
- package/dist/sdd-engine/tools/execution-tools.js +70 -86
- package/dist/sdd-engine/tools/workspace-tools.d.ts +2 -1
- package/dist/sdd-engine/tools/workspace-tools.js +10 -20
- package/dist/sdd-engine/tools.js +4 -2
- package/dist/sdd-engine/trinity-structure.js +1 -1
- package/dist/sdd-engine/verification-receipts.d.ts +3 -2
- package/dist/sdd-engine/verification-receipts.js +50 -1
- package/dist/sdd-engine/workspace-root.d.ts +33 -7
- package/dist/sdd-engine/workspace-root.js +204 -139
- package/dist/types/completion.d.ts +20 -2
- package/dist/types/resume-views.d.ts +62 -0
- package/dist/types/sdd-engine.d.ts +23 -60
- package/dist/types/verification.d.ts +59 -0
- package/package.json +1 -1
- package/templates/AGENTS.md +4 -0
- package/templates/host/planu-sdd.md +4 -0
- package/templates/skills/preflight-guardian.md +4 -0
- package/templates/skills/spec-executor.md +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## [8.9.0]
|
|
2
|
+
|
|
3
|
+
- Add an opt-in bounded source view with strict UTF-8 and a cursor bound to the server, request and physical snapshot.
|
|
4
|
+
- Limit each request to 65,536 source bytes and 64 descriptor reads, at most 200 completed selected lines and an 8,192-byte UTF-8 JSON response.
|
|
5
|
+
- The snapshot digest is metadata-based, not a content checksum; a same-UID replacement after the final filesystem check is not transactionally excluded.
|
|
6
|
+
- Preserve the legacy default and nine tools. The cursor grants no permission, retry authority or verification time.
|
|
7
|
+
|
|
8
|
+
## [8.8.0]
|
|
9
|
+
|
|
10
|
+
- Add a version 1 server implementation capability descriptor to setup diagnostics for supported views and observations.
|
|
11
|
+
- Advertise read-only hints for four of the nine existing tools; preserve their input schemas and existing execution authority.
|
|
12
|
+
- Treat missing or unknown descriptor versions as unsupported, without mutation probes. Installed files do not verify the host catalogue; refreshing that catalogue is separate from restarting MCP.
|
|
13
|
+
|
|
1
14
|
## [8.7.3]
|
|
2
15
|
|
|
3
16
|
- Run the complete strict quality stage before build and tests in `validate`.
|
package/README.md
CHANGED
|
@@ -132,6 +132,8 @@ This is role guidance, not a runtime dispatcher or a guarantee that a host loads
|
|
|
132
132
|
|
|
133
133
|
Normal task verification still has a 180000 ms limit. An operator may authorize one pinned task in an isolated Darwin/Linux server with a strict startup-only budget of 180001–600000 ms. The grant binds the canonical workspace, feature, task, raw lock SHA-256 and exact command SHA-256. It is consumed before the first spawn, including failed attempts; uncertain cleanup or persistence quarantines that feature.
|
|
134
134
|
|
|
135
|
+
Before optional views or observations, inspect `sdd_list_features` setup diagnostics and require a recognized `engineCapabilities.version=1` and the relevant advertised value. An absent or unknown version means unsupported; never probe a mutation or fall back to lock/relock to discover support. The descriptor describes server implementation, not host catalogue activation, filesystem eligibility, a grant or certification. Host catalogue refresh remains separate from restarting MCP.
|
|
136
|
+
|
|
135
137
|
Explicit `verification_preflight` and `resume` views expose `budget.version=1` with admission, reason and effective timeout when available. This read-only observation is not a reservation: state may change, and completion revalidates and consumes any matching grant before spawning.
|
|
136
138
|
|
|
137
139
|
Completion can expose `verificationProcess` after a spawned verification, including timeout, cancellation, exit and cleanup evidence. Its `cleanupScope` is `owned_process_group`; `fixturePostconditions` remains `unknown`. Group cleanup does not prove fixture-owned state is safe. Reconcile uncertain attempts before retrying.
|
|
@@ -142,14 +144,18 @@ The reviewed operator procedure is in the repository guide `docs/verification-bu
|
|
|
142
144
|
|
|
143
145
|
## Read-only diagnostics
|
|
144
146
|
|
|
145
|
-
|
|
147
|
+
For an opt-in bounded source read, first require `engineCapabilities.version=1`, `views.sdd_read_file_slice` containing `bounded`, and `observations.sourceSlice=1` in setup diagnostics. Treat absent or unknown versions or capability values as unsupported; never probe a mutation. Request `sdd_read_file_slice` with `view="bounded"`, a path and line range, then follow each non-null `nextCursor` read-only on the same server instance with the same normalized path and range. The cursor binds the server, root, request and physical snapshot; the snapshot digest is not a checksum of file contents. The default legacy read remains unchanged.
|
|
148
|
+
|
|
149
|
+
Each request reads at most 65,536 source bytes in at most 64 descriptor read calls, completes at most 200 selected lines per page and returns a compact JSON text envelope of at most 8,192 UTF-8 bytes. A continuation grants no permission, retry authority or verification time. A same-UID replacement after the last filesystem check is not transactionally excluded.
|
|
150
|
+
|
|
151
|
+
The existing nine tools expose additive diagnostics since 8.4.0; 8.5.0 adds compact resume and history views, and 8.6.0 adds bounded execution views and explicit evidence checkpoints. 8.7.0 adds advisory budget observations and verification process evidence. 8.8.0 adds the server implementation capability descriptor version 1 to setup diagnostics. 8.9.0 adds the opt-in bounded source view. An ordinary `sdd_get_active_task` request keeps its previous response shape.
|
|
146
152
|
|
|
147
153
|
`sdd_list_features` includes `hostSkills`. For example, a missing installed role can produce this field (other installed files match the available bundled reference):
|
|
148
154
|
|
|
149
155
|
```json
|
|
150
156
|
{
|
|
151
157
|
"version": 1,
|
|
152
|
-
"bundledVersion": "8.
|
|
158
|
+
"bundledVersion": "8.9.0",
|
|
153
159
|
"baseline": "available",
|
|
154
160
|
"catalog": "unverified",
|
|
155
161
|
"issues": [{
|
|
@@ -309,6 +315,8 @@ Effective MODIFY (including CREATE with a nonempty search) requires a regular si
|
|
|
309
315
|
|
|
310
316
|
`sdd_init_workspace`, `sdd_list_features`, `sdd_create_feature`, `sdd_lock_spec`, `sdd_read_spec_artifact`, `sdd_read_file_slice`, `sdd_get_active_task`, `sdd_apply_file_patch`, `sdd_complete_task`
|
|
311
317
|
|
|
318
|
+
`tools/list` marks `sdd_list_features`, `sdd_read_spec_artifact`, `sdd_read_file_slice`, and `sdd_get_active_task` with `readOnlyHint: true`; the other five registrations have `readOnlyHint: false`. A hint describes the registration, not host catalogue activation or permission to read a particular file.
|
|
319
|
+
|
|
312
320
|
Deleted: `create_spec`, `challenge_spec`, `check_readiness`, `validate`, `planu_status`, `update_status`, `init_project`, `package_handoff`.
|
|
313
321
|
|
|
314
322
|
---
|
|
@@ -380,7 +388,7 @@ See the [Planu Proprietary Free-Use License](LICENSE) and [planu.dev/license](ht
|
|
|
380
388
|
"mcpServers": {
|
|
381
389
|
"planu": {
|
|
382
390
|
"command": "npx",
|
|
383
|
-
"args": ["-y", "@planu/cli@8.
|
|
391
|
+
"args": ["-y", "@planu/cli@8.9.0"],
|
|
384
392
|
"cwd": ".",
|
|
385
393
|
"env": {
|
|
386
394
|
"PLANU_WORKSPACE": "."
|
|
@@ -1,2 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { EngineCapabilitiesV1 } from '../types/resume-views.js';
|
|
1
3
|
export declare const CANONICAL_SDD_TOOL_NAMES: readonly ['sdd_init_workspace', 'sdd_list_features', 'sdd_create_feature', 'sdd_lock_spec', 'sdd_read_spec_artifact', 'sdd_read_file_slice', 'sdd_get_active_task', 'sdd_apply_file_patch', 'sdd_complete_task'];
|
|
4
|
+
export declare const ENGINE_CAPABILITIES: EngineCapabilitiesV1;
|
|
5
|
+
export declare const TOOL_ANNOTATIONS: Readonly<{
|
|
6
|
+
sdd_init_workspace: Readonly<{
|
|
7
|
+
readOnlyHint: false;
|
|
8
|
+
}>;
|
|
9
|
+
sdd_list_features: Readonly<{
|
|
10
|
+
readOnlyHint: true;
|
|
11
|
+
}>;
|
|
12
|
+
sdd_create_feature: Readonly<{
|
|
13
|
+
readOnlyHint: false;
|
|
14
|
+
}>;
|
|
15
|
+
sdd_lock_spec: Readonly<{
|
|
16
|
+
readOnlyHint: false;
|
|
17
|
+
}>;
|
|
18
|
+
sdd_read_spec_artifact: Readonly<{
|
|
19
|
+
readOnlyHint: true;
|
|
20
|
+
}>;
|
|
21
|
+
sdd_read_file_slice: Readonly<{
|
|
22
|
+
readOnlyHint: true;
|
|
23
|
+
}>;
|
|
24
|
+
sdd_get_active_task: Readonly<{
|
|
25
|
+
readOnlyHint: true;
|
|
26
|
+
}>;
|
|
27
|
+
sdd_apply_file_patch: Readonly<{
|
|
28
|
+
readOnlyHint: false;
|
|
29
|
+
}>;
|
|
30
|
+
sdd_complete_task: Readonly<{
|
|
31
|
+
readOnlyHint: false;
|
|
32
|
+
}>;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const ListFeaturesInputSchema: z.ZodObject<{
|
|
35
|
+
status_filter: z.ZodOptional<z.ZodEnum<{
|
|
36
|
+
all: "all";
|
|
37
|
+
done: "done";
|
|
38
|
+
executing: "executing";
|
|
39
|
+
planning: "planning";
|
|
40
|
+
}>>;
|
|
41
|
+
view: z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
setup_diagnostics: "setup_diagnostics";
|
|
43
|
+
}>>;
|
|
44
|
+
host: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
all: "all";
|
|
46
|
+
claude: "claude";
|
|
47
|
+
codex: "codex";
|
|
48
|
+
cursor: "cursor";
|
|
49
|
+
gemini: "gemini";
|
|
50
|
+
}>>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export declare const ReadFileSliceInputSchema: z.ZodObject<{
|
|
53
|
+
path: z.ZodString;
|
|
54
|
+
start_line: z.ZodNumber;
|
|
55
|
+
end_line: z.ZodNumber;
|
|
56
|
+
view: z.ZodOptional<z.ZodLiteral<"bounded">>;
|
|
57
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>;
|
|
2
59
|
//# sourceMappingURL=canonical-tools.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
export const CANONICAL_SDD_TOOL_NAMES = [
|
|
2
3
|
'sdd_init_workspace',
|
|
3
4
|
'sdd_list_features',
|
|
@@ -9,4 +10,81 @@ export const CANONICAL_SDD_TOOL_NAMES = [
|
|
|
9
10
|
'sdd_apply_file_patch',
|
|
10
11
|
'sdd_complete_task',
|
|
11
12
|
];
|
|
13
|
+
export const ENGINE_CAPABILITIES = Object.freeze({
|
|
14
|
+
version: 1,
|
|
15
|
+
scope: 'server_implementation',
|
|
16
|
+
readOnlyTools: Object.freeze([
|
|
17
|
+
'sdd_list_features',
|
|
18
|
+
'sdd_read_spec_artifact',
|
|
19
|
+
'sdd_read_file_slice',
|
|
20
|
+
'sdd_get_active_task',
|
|
21
|
+
]),
|
|
22
|
+
views: Object.freeze({
|
|
23
|
+
sdd_list_features: Object.freeze(['setup_diagnostics']),
|
|
24
|
+
sdd_read_file_slice: Object.freeze(['bounded']),
|
|
25
|
+
sdd_get_active_task: Object.freeze([
|
|
26
|
+
'verification_preflight',
|
|
27
|
+
'resume',
|
|
28
|
+
'relock_history',
|
|
29
|
+
'execution_window',
|
|
30
|
+
'execution_detail',
|
|
31
|
+
'evidence_history',
|
|
32
|
+
]),
|
|
33
|
+
}),
|
|
34
|
+
operations: Object.freeze({
|
|
35
|
+
sdd_lock_spec: Object.freeze(['lock', 'evidence_checkpoint']),
|
|
36
|
+
}),
|
|
37
|
+
observations: Object.freeze({
|
|
38
|
+
sourceSlice: 1,
|
|
39
|
+
setupDiagnostics: 1,
|
|
40
|
+
verificationPreflight: 1,
|
|
41
|
+
resume: 1,
|
|
42
|
+
relockHistory: 1,
|
|
43
|
+
executionWindow: 1,
|
|
44
|
+
executionDetail: 1,
|
|
45
|
+
evidenceHistory: 1,
|
|
46
|
+
evidenceCheckpoint: 1,
|
|
47
|
+
verificationBudget: 1,
|
|
48
|
+
verificationProcess: 1,
|
|
49
|
+
}),
|
|
50
|
+
limits: Object.freeze({
|
|
51
|
+
compactTextBytes: 8192,
|
|
52
|
+
defaultVerificationTimeoutMs: 180000,
|
|
53
|
+
sourceSliceBytes: 65536,
|
|
54
|
+
sourceSliceReadCalls: 64,
|
|
55
|
+
sourceSliceLines: 200,
|
|
56
|
+
sourceSliceCursorCharacters: 1024,
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
export const TOOL_ANNOTATIONS = Object.freeze({
|
|
60
|
+
sdd_init_workspace: Object.freeze({ readOnlyHint: false }),
|
|
61
|
+
sdd_list_features: Object.freeze({ readOnlyHint: true }),
|
|
62
|
+
sdd_create_feature: Object.freeze({ readOnlyHint: false }),
|
|
63
|
+
sdd_lock_spec: Object.freeze({ readOnlyHint: false }),
|
|
64
|
+
sdd_read_spec_artifact: Object.freeze({ readOnlyHint: true }),
|
|
65
|
+
sdd_read_file_slice: Object.freeze({ readOnlyHint: true }),
|
|
66
|
+
sdd_get_active_task: Object.freeze({ readOnlyHint: true }),
|
|
67
|
+
sdd_apply_file_patch: Object.freeze({ readOnlyHint: false }),
|
|
68
|
+
sdd_complete_task: Object.freeze({ readOnlyHint: false }),
|
|
69
|
+
});
|
|
70
|
+
export const ListFeaturesInputSchema = z
|
|
71
|
+
.object({
|
|
72
|
+
status_filter: z.enum(['all', 'planning', 'executing', 'done']).optional(),
|
|
73
|
+
view: z.enum(['setup_diagnostics'], { error: 'Invalid setup diagnostic view.' }).optional(),
|
|
74
|
+
host: z
|
|
75
|
+
.enum(['all', 'claude', 'cursor', 'codex', 'gemini'], {
|
|
76
|
+
error: 'Invalid setup diagnostic host.',
|
|
77
|
+
})
|
|
78
|
+
.optional(),
|
|
79
|
+
})
|
|
80
|
+
.refine((input) => input.host === undefined || input.view === 'setup_diagnostics', {
|
|
81
|
+
message: 'Host requires setup diagnostics view.',
|
|
82
|
+
});
|
|
83
|
+
export const ReadFileSliceInputSchema = z.object({
|
|
84
|
+
path: z.string().min(1),
|
|
85
|
+
start_line: z.number().int().min(1),
|
|
86
|
+
end_line: z.number().int().min(1),
|
|
87
|
+
view: z.literal('bounded').optional(),
|
|
88
|
+
cursor: z.string().optional(),
|
|
89
|
+
});
|
|
12
90
|
//# sourceMappingURL=canonical-tools.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SetupDiagnostics } from '../types/resume-views.js';
|
|
3
|
+
import type { ResolvedSddWorkspace, ResolveSddWorkspaceInput, SddFailure, SddWorkspaceHandle } from '../types/sdd-engine.js';
|
|
3
4
|
export declare class McpClientWorkspace implements SddWorkspaceHandle {
|
|
4
5
|
private readonly server;
|
|
5
6
|
private readonly pinnedRoot;
|
|
@@ -11,4 +12,10 @@ export declare class McpClientWorkspace implements SddWorkspaceHandle {
|
|
|
11
12
|
private ensureRootsListener;
|
|
12
13
|
private loadRootUris;
|
|
13
14
|
}
|
|
15
|
+
export declare function parseMcpRootUri(uri: string): string | null;
|
|
16
|
+
export declare function resolveSddWorkspaceRoot(startDir?: string, env?: NodeJS.ProcessEnv, mcpRootUris?: readonly string[]): string;
|
|
17
|
+
export declare function resolveSddWorkspace(input?: ResolveSddWorkspaceInput): ResolvedSddWorkspace;
|
|
18
|
+
export declare function isHomeFallbackWorkspace(resolved: ResolvedSddWorkspace, env?: NodeJS.ProcessEnv): boolean;
|
|
19
|
+
export declare function homeFallbackFailure(resolved: ResolvedSddWorkspace, trigger: string, env?: NodeJS.ProcessEnv): SddFailure | null;
|
|
20
|
+
export declare function clientInfo(value: unknown): Pick<SetupDiagnostics, 'client' | 'clientMetadataCause'>;
|
|
14
21
|
//# sourceMappingURL=client-workspace.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { RootsListChangedNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { dirname, join, resolve, sep } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
3
5
|
const LIST_ROOTS_TIMEOUT_MS = 2000;
|
|
4
6
|
export class McpClientWorkspace {
|
|
5
7
|
server;
|
|
@@ -54,4 +56,169 @@ export class McpClientWorkspace {
|
|
|
54
56
|
return this.rootUris;
|
|
55
57
|
}
|
|
56
58
|
}
|
|
59
|
+
const ERR_WORKSPACE_UNRESOLVED_MESSAGE = 'Resolved workspace is the user home directory without MCP roots or PLANU_WORKSPACE. Set the MCP server cwd to the project, advertise MCP roots, or set a per-process PLANU_WORKSPACE. Do not pin PLANU_WORKSPACE globally.';
|
|
60
|
+
export function parseMcpRootUri(uri) {
|
|
61
|
+
const trimmed = uri.trim();
|
|
62
|
+
if (!trimmed) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
if (trimmed.startsWith('file:')) {
|
|
67
|
+
return resolve(fileURLToPath(trimmed));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
if (trimmed.startsWith('/')) {
|
|
74
|
+
return resolve(trimmed);
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
export function resolveSddWorkspaceRoot(startDir = process.cwd(), env = process.env, mcpRootUris = []) {
|
|
79
|
+
return resolveSddWorkspace({ startDir, env, mcpRootUris }).workspaceRoot;
|
|
80
|
+
}
|
|
81
|
+
export function resolveSddWorkspace(input = {}) {
|
|
82
|
+
const env = input.env ?? process.env;
|
|
83
|
+
const startDir = resolve(input.startDir ?? process.cwd());
|
|
84
|
+
if (input.pinnedRoot?.trim()) {
|
|
85
|
+
return finish(resolve(input.pinnedRoot.trim()), 'pin');
|
|
86
|
+
}
|
|
87
|
+
const fromEnv = usablePlanuWorkspaceEnv(env);
|
|
88
|
+
if (fromEnv) {
|
|
89
|
+
return finish(fromEnv, 'env');
|
|
90
|
+
}
|
|
91
|
+
const mcpDirs = unique((input.mcpRootUris ?? [])
|
|
92
|
+
.map((uri) => parseMcpRootUri(uri))
|
|
93
|
+
.filter((dir) => dir !== null));
|
|
94
|
+
for (const dir of mcpDirs) {
|
|
95
|
+
const found = nearestProjectSdd(dir, env);
|
|
96
|
+
if (found) {
|
|
97
|
+
return finish(found, 'mcp_root');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const fromCwd = nearestProjectSdd(startDir, env);
|
|
101
|
+
if (fromCwd) {
|
|
102
|
+
return finish(fromCwd, 'cwd_walk');
|
|
103
|
+
}
|
|
104
|
+
if (mcpDirs[0]) {
|
|
105
|
+
return finish(mcpDirs[0], 'fallback');
|
|
106
|
+
}
|
|
107
|
+
return finish(startDir, 'fallback');
|
|
108
|
+
}
|
|
109
|
+
export function isHomeFallbackWorkspace(resolved, env = process.env) {
|
|
110
|
+
return resolved.source === 'fallback' && isHomeDirectory(resolved.workspaceRoot, env);
|
|
111
|
+
}
|
|
112
|
+
export function homeFallbackFailure(resolved, trigger, env = process.env) {
|
|
113
|
+
if (!isHomeFallbackWorkspace(resolved, env)) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
success: false,
|
|
118
|
+
error: {
|
|
119
|
+
code: 'ERR_WORKSPACE_UNRESOLVED',
|
|
120
|
+
message: ERR_WORKSPACE_UNRESOLVED_MESSAGE,
|
|
121
|
+
trigger,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function finish(workspaceRoot, source) {
|
|
126
|
+
const sddDir = join(workspaceRoot, '.sdd');
|
|
127
|
+
return {
|
|
128
|
+
workspaceRoot,
|
|
129
|
+
sddDir,
|
|
130
|
+
sddPresent: existsSync(sddDir),
|
|
131
|
+
source,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function nearestProjectSdd(startDir, env) {
|
|
135
|
+
let dir = resolve(startDir);
|
|
136
|
+
for (;;) {
|
|
137
|
+
if (existsSync(join(dir, '.sdd')) && !isHomeDirectory(dir, env)) {
|
|
138
|
+
return dir;
|
|
139
|
+
}
|
|
140
|
+
const parent = dirname(dir);
|
|
141
|
+
if (parent === dir) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
dir = parent;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function isHomeDirectory(dir, env) {
|
|
148
|
+
const home = env.HOME?.trim() ?? env.USERPROFILE?.trim();
|
|
149
|
+
if (!home) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
return resolve(dir) === resolve(home);
|
|
153
|
+
}
|
|
154
|
+
function usablePlanuWorkspaceEnv(env) {
|
|
155
|
+
const fromEnv = env.PLANU_WORKSPACE?.trim();
|
|
156
|
+
if (!fromEnv || fromEnv.includes('${')) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
const expanded = expandHomePrefix(fromEnv, env);
|
|
160
|
+
if (!expanded) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
const resolved = resolve(expanded);
|
|
164
|
+
if (resolved.includes(`${sep}~${sep}`) || resolved.endsWith(`${sep}~`)) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
if (isHomeDirectory(resolved, env)) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
return resolved;
|
|
171
|
+
}
|
|
172
|
+
function expandHomePrefix(raw, env) {
|
|
173
|
+
if (raw === '~' || raw.startsWith('~/') || raw.startsWith('~\\')) {
|
|
174
|
+
const home = env.HOME?.trim() ?? env.USERPROFILE?.trim();
|
|
175
|
+
if (!home) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
if (raw === '~') {
|
|
179
|
+
return home;
|
|
180
|
+
}
|
|
181
|
+
return join(home, raw.slice(2));
|
|
182
|
+
}
|
|
183
|
+
return raw;
|
|
184
|
+
}
|
|
185
|
+
function unique(values) {
|
|
186
|
+
const seen = new Set();
|
|
187
|
+
const out = [];
|
|
188
|
+
for (const value of values) {
|
|
189
|
+
if (seen.has(value)) {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
seen.add(value);
|
|
193
|
+
out.push(value);
|
|
194
|
+
}
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
export function clientInfo(value) {
|
|
198
|
+
if (value === undefined || value === null) {
|
|
199
|
+
return { client: null, clientMetadataCause: 'unavailable' };
|
|
200
|
+
}
|
|
201
|
+
if (typeof value !== 'object' ||
|
|
202
|
+
!('name' in value) ||
|
|
203
|
+
!('version' in value) ||
|
|
204
|
+
typeof value.name !== 'string' ||
|
|
205
|
+
typeof value.version !== 'string' ||
|
|
206
|
+
Array.from(value.name + value.version).some((char) => {
|
|
207
|
+
const code = char.codePointAt(0) ?? 0;
|
|
208
|
+
return code < 32 || (code >= 127 && code <= 159);
|
|
209
|
+
})) {
|
|
210
|
+
return { client: null, clientMetadataCause: 'invalid' };
|
|
211
|
+
}
|
|
212
|
+
if (Buffer.byteLength(value.name) > 128 || Buffer.byteLength(value.version) > 128) {
|
|
213
|
+
return { client: null, clientMetadataCause: 'over_limit' };
|
|
214
|
+
}
|
|
215
|
+
return {
|
|
216
|
+
client: {
|
|
217
|
+
name: value.name,
|
|
218
|
+
version: value.version,
|
|
219
|
+
source: 'initialize',
|
|
220
|
+
provenance: 'client_reported',
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
}
|
|
57
224
|
//# sourceMappingURL=client-workspace.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { ListFeaturesInputSchema, ReadFileSliceInputSchema } from './canonical-tools.js';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import type { EvidenceCheckpointInput } from '../types/sdd-engine.js';
|
|
3
4
|
export type { ArtifactType, FilePermission, ErrorCode, SddErrorDetails, SddSuccess, SddFailure, SddResult, InitWorkspaceInput, ListFeaturesInput, CreateFeatureInput, LockSpecInput, ReadSpecArtifactInput, ReadFileSliceInput, GetActiveTaskInput, ApplyFilePatchInput, CompleteTaskInput, ParsedManifest, ActiveTaskDetails, ActiveTaskResult, CompleteTaskResult, FeatureSummary, } from '../types/sdd-engine.js';
|
|
@@ -37,24 +38,6 @@ export declare const InitWorkspaceInputSchema: z.ZodObject<{
|
|
|
37
38
|
}>;
|
|
38
39
|
force: z.ZodOptional<z.ZodBoolean>;
|
|
39
40
|
}, z.core.$strip>;
|
|
40
|
-
export declare const ListFeaturesInputSchema: z.ZodObject<{
|
|
41
|
-
status_filter: z.ZodOptional<z.ZodEnum<{
|
|
42
|
-
all: "all";
|
|
43
|
-
done: "done";
|
|
44
|
-
executing: "executing";
|
|
45
|
-
planning: "planning";
|
|
46
|
-
}>>;
|
|
47
|
-
view: z.ZodOptional<z.ZodEnum<{
|
|
48
|
-
setup_diagnostics: "setup_diagnostics";
|
|
49
|
-
}>>;
|
|
50
|
-
host: z.ZodOptional<z.ZodEnum<{
|
|
51
|
-
all: "all";
|
|
52
|
-
claude: "claude";
|
|
53
|
-
codex: "codex";
|
|
54
|
-
cursor: "cursor";
|
|
55
|
-
gemini: "gemini";
|
|
56
|
-
}>>;
|
|
57
|
-
}, z.core.$strip>;
|
|
58
41
|
export declare const CreateFeatureInputSchema: z.ZodObject<{
|
|
59
42
|
id: z.ZodOptional<z.ZodString>;
|
|
60
43
|
title: z.ZodString;
|
|
@@ -211,11 +194,6 @@ export declare const ReadSpecArtifactInputSchema: z.ZodObject<{
|
|
|
211
194
|
tasks: "tasks";
|
|
212
195
|
}>;
|
|
213
196
|
}, z.core.$strip>;
|
|
214
|
-
export declare const ReadFileSliceInputSchema: z.ZodObject<{
|
|
215
|
-
path: z.ZodString;
|
|
216
|
-
start_line: z.ZodNumber;
|
|
217
|
-
end_line: z.ZodNumber;
|
|
218
|
-
}, z.core.$strip>;
|
|
219
197
|
export declare const ApplyFilePatchInputSchema: z.ZodObject<{
|
|
220
198
|
feature_id: z.ZodString;
|
|
221
199
|
path: z.ZodString;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { ListFeaturesInputSchema, ReadFileSliceInputSchema } from './canonical-tools.js';
|
|
1
2
|
import { ExecutionCursorInputSchema, EvidenceCursorInputSchema } from './resume-history.js';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
export const FeatureIdSchema = z
|
|
@@ -29,19 +30,6 @@ export const InitWorkspaceInputSchema = z.object({
|
|
|
29
30
|
scope: z.enum(['global', 'project']),
|
|
30
31
|
force: z.boolean().optional(),
|
|
31
32
|
});
|
|
32
|
-
export const ListFeaturesInputSchema = z
|
|
33
|
-
.object({
|
|
34
|
-
status_filter: z.enum(['all', 'planning', 'executing', 'done']).optional(),
|
|
35
|
-
view: z.enum(['setup_diagnostics'], { error: 'Invalid setup diagnostic view.' }).optional(),
|
|
36
|
-
host: z
|
|
37
|
-
.enum(['all', 'claude', 'cursor', 'codex', 'gemini'], {
|
|
38
|
-
error: 'Invalid setup diagnostic host.',
|
|
39
|
-
})
|
|
40
|
-
.optional(),
|
|
41
|
-
})
|
|
42
|
-
.refine((input) => input.host === undefined || input.view === 'setup_diagnostics', {
|
|
43
|
-
message: 'Host requires setup diagnostics view.',
|
|
44
|
-
});
|
|
45
33
|
export const CreateFeatureInputSchema = z.object({
|
|
46
34
|
id: FeatureIdSchema.optional(),
|
|
47
35
|
title: z.string().min(3),
|
|
@@ -243,11 +231,6 @@ export const ReadSpecArtifactInputSchema = z.object({
|
|
|
243
231
|
feature_id: FeatureIdSchema,
|
|
244
232
|
artifact: ArtifactTypeSchema,
|
|
245
233
|
});
|
|
246
|
-
export const ReadFileSliceInputSchema = z.object({
|
|
247
|
-
path: z.string().min(1),
|
|
248
|
-
start_line: z.number().int().min(1),
|
|
249
|
-
end_line: z.number().int().min(1),
|
|
250
|
-
});
|
|
251
234
|
export const ApplyFilePatchInputSchema = z.object({
|
|
252
235
|
feature_id: FeatureIdSchema,
|
|
253
236
|
path: z.string().min(1),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { countTaskIds, dueTaskOrdinals, hasReceiptDirective, receiptCommand, taskBlocks, } from './task-content.js';
|
|
3
|
-
import { featureIdPattern, gateIdPattern, importReceiptPublicKey, maxVerificationReceipts, sha256Schema, taskIdPattern, } from './
|
|
3
|
+
import { featureIdPattern, gateIdPattern, importReceiptPublicKey, maxVerificationReceipts, sha256Schema, taskIdPattern, } from './receipt-assessment.js';
|
|
4
4
|
import { disjointPaths, isEvidencePath } from './feature-authority.js';
|
|
5
5
|
import { candidateCreationIssue, invalidTask, invalidCandidate, candidateIssue, manifestEntries, policyIssueLine, policyText, toPosixPath, } from './trinity-structure.js';
|
|
6
6
|
export { assessTrinityCompleteness, parseManifestContent, toPosixPath, } from './trinity-structure.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import * as compact from './tools/compact-result.js';
|
|
3
|
+
import type { HostSkillDiagnostics, SddWorkspaceHandle } from '../types/sdd-engine.js';
|
|
3
4
|
export declare const MISSING_SDD_HINT = "No .sdd directory in the client project. Call sdd_init_workspace with scope=project. MCP hosts should advertise roots; do not pin PLANU_WORKSPACE globally.";
|
|
4
5
|
export declare function isStaleV6HostDoc(content: string): boolean;
|
|
5
6
|
export declare function copyGlobalRules(workspaceRoot: string, force?: boolean): Promise<'preserved' | 'replaced' | 'created'>;
|
|
@@ -8,9 +9,12 @@ export declare function inspectHostSkillPackDetailed(workspaceRoot: string, bund
|
|
|
8
9
|
hostSkills: HostSkillDiagnostics;
|
|
9
10
|
hint?: string;
|
|
10
11
|
}>;
|
|
11
|
-
export declare function inspectSetupDiagnostics(root: string, version: string, selectedHost: SetupHost | 'all', client: unknown): Promise<SetupDiagnostics>;
|
|
12
12
|
export declare function copySkillTemplates(skillsDir: string): Promise<void>;
|
|
13
13
|
export declare function installHostSkillPack(workspaceRoot: string): Promise<string[]>;
|
|
14
14
|
export declare function installCursorGuard(workspaceRoot: string): Promise<string[]>;
|
|
15
15
|
export declare function installHostRulePack(workspaceRoot: string): Promise<string[]>;
|
|
16
|
+
export declare function setupDiagnosticResult(server: McpServer, workspace: SddWorkspaceHandle, version: string | undefined, args: {
|
|
17
|
+
view?: string;
|
|
18
|
+
host?: string;
|
|
19
|
+
}): Promise<ReturnType<typeof compact.formatCompactResult>>;
|
|
16
20
|
//# sourceMappingURL=host-rule-pack.d.ts.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as compact from './tools/compact-result.js';
|
|
2
|
+
import { homeFallbackFailure } from './workspace-root.js';
|
|
3
|
+
import { CANONICAL_SDD_TOOL_NAMES, ENGINE_CAPABILITIES } from './canonical-tools.js';
|
|
3
4
|
import * as fs from 'node:fs/promises';
|
|
4
5
|
import * as path from 'node:path';
|
|
5
6
|
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import { scanPack, legacyIssue,
|
|
7
|
+
import { scanPack, legacyIssue, diagnosticRow, clientInfo, readTextInsideWorkspaceDetailed, } from './host-skill-reader.js';
|
|
7
8
|
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
8
9
|
const TEMPLATES_ROOT = path.resolve(moduleDir, '..', '..', 'templates');
|
|
9
10
|
export const MISSING_SDD_HINT = 'No .sdd directory in the client project. Call sdd_init_workspace with scope=project. MCP hosts should advertise roots; do not pin PLANU_WORKSPACE globally.';
|
|
@@ -17,6 +18,10 @@ After the local client has registered the MCP server and the intended project is
|
|
|
17
18
|
|
|
18
19
|
## Read-only diagnostics
|
|
19
20
|
|
|
21
|
+
For an opt-in bounded source read, first require \`engineCapabilities.version=1\`, \`views.sdd_read_file_slice\` containing \`bounded\`, and \`observations.sourceSlice=1\` in setup diagnostics. Treat an absent or unknown descriptor version or capability value as unsupported; do not probe a mutation. Use \`sdd_read_file_slice\` with \`view="bounded"\` and the required path and line range. Follow a non-null \`nextCursor\` read-only on the same server instance, repeating the same normalized path and range; the cursor is bound to that server, root, request and physical snapshot. Stop when \`nextCursor\` is null. The physical snapshot digest is not a content checksum. A same-UID replacement after the last filesystem check is not transactionally excluded. This view and its cursor grant no permission, retry authority or verification time. The default legacy read remains unchanged.
|
|
22
|
+
|
|
23
|
+
Before optional views or observations, inspect setup diagnostics and require a recognized \`engineCapabilities.version=1\` and the relevant advertised value. An absent or unknown version means unsupported; never probe a mutation or fall back to lock/relock to discover support. This describes server implementation only: host catalogues remain unverified, and a host catalogue refresh is separate from restarting MCP.
|
|
24
|
+
|
|
20
25
|
Use \`sdd_list_features.hostSkills\` to identify fixed installed role paths, causes and the bundled reference version. \`catalog\` stays \`unverified\` even when files match. An unavailable baseline requires inspecting the installation; unsafe paths require inspection before authorized setup. Project setup and client catalogue reload are explicit, separate actions.
|
|
21
26
|
|
|
22
27
|
For a rejected \`sdd_lock_spec\`, inspect \`error.details.issues\` for artifact, stable rule and optional 1-based original source line. Missing or ambiguous locations omit the line. Existing rejection codes and legacy details remain authoritative; rejection writes no lock. Do not automatically relock.
|
|
@@ -153,54 +158,6 @@ export async function inspectHostSkillPackDetailed(workspaceRoot, bundledVersion
|
|
|
153
158
|
};
|
|
154
159
|
}
|
|
155
160
|
const HOSTS = ['claude', 'cursor', 'codex', 'gemini'];
|
|
156
|
-
function diagnosticRow(row, version) {
|
|
157
|
-
const host = { '.claude': 'claude', '.cursor': 'cursor', '.agents': 'codex', '.gemini': 'gemini' }[row.relative.split(path.sep)[0]];
|
|
158
|
-
const base = {
|
|
159
|
-
host,
|
|
160
|
-
role: row.slug,
|
|
161
|
-
path: row.relative.split(path.sep).join('/'),
|
|
162
|
-
referenceVersion: version,
|
|
163
|
-
referenceSha256: row.referenceSha256,
|
|
164
|
-
installedSha256: row.installedSha256,
|
|
165
|
-
installedVersion: 'unverified',
|
|
166
|
-
};
|
|
167
|
-
const disposition = hostDisposition(row);
|
|
168
|
-
const proposedAction = {
|
|
169
|
-
match: 'none',
|
|
170
|
-
missing: 'create_on_authorized_setup',
|
|
171
|
-
different: 'replace_on_authorized_setup',
|
|
172
|
-
unreadable: 'inspect_path',
|
|
173
|
-
reference_unavailable: 'inspect_installation',
|
|
174
|
-
};
|
|
175
|
-
return { ...base, ...disposition, proposedAction: proposedAction[disposition.status] };
|
|
176
|
-
}
|
|
177
|
-
function clientInfo(value) {
|
|
178
|
-
if (value === undefined || value === null) {
|
|
179
|
-
return { client: null, clientMetadataCause: 'unavailable' };
|
|
180
|
-
}
|
|
181
|
-
if (typeof value !== 'object' ||
|
|
182
|
-
!('name' in value) ||
|
|
183
|
-
!('version' in value) ||
|
|
184
|
-
typeof value.name !== 'string' ||
|
|
185
|
-
typeof value.version !== 'string' ||
|
|
186
|
-
Array.from(value.name + value.version).some((char) => {
|
|
187
|
-
const code = char.codePointAt(0) ?? 0;
|
|
188
|
-
return code < 32 || (code >= 127 && code <= 159);
|
|
189
|
-
})) {
|
|
190
|
-
return { client: null, clientMetadataCause: 'invalid' };
|
|
191
|
-
}
|
|
192
|
-
if (Buffer.byteLength(value.name) > 128 || Buffer.byteLength(value.version) > 128) {
|
|
193
|
-
return { client: null, clientMetadataCause: 'over_limit' };
|
|
194
|
-
}
|
|
195
|
-
return {
|
|
196
|
-
client: {
|
|
197
|
-
name: value.name,
|
|
198
|
-
version: value.version,
|
|
199
|
-
source: 'initialize',
|
|
200
|
-
provenance: 'client_reported',
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
161
|
function hostSummary(host, rows, available) {
|
|
205
162
|
const own = rows.filter((row) => row.host === host);
|
|
206
163
|
const count = (status) => own.filter((row) => row.status === status).length;
|
|
@@ -220,11 +177,12 @@ function hostSummary(host, rows, available) {
|
|
|
220
177
|
: 'none',
|
|
221
178
|
};
|
|
222
179
|
}
|
|
223
|
-
|
|
180
|
+
async function inspectSetupDiagnostics(root, version, selectedHost, client) {
|
|
224
181
|
const { available, rows: scanned } = await scanPack(root, TEMPLATES_ROOT, Object.keys(HOST_SKILL_DESCRIPTIONS).sort(), hostSkillTargets, toHostSkillMarkdown, readTextInsideWorkspaceDetailed);
|
|
225
182
|
const rows = scanned.map((row) => diagnosticRow(row, version));
|
|
226
183
|
return {
|
|
227
184
|
version: 1,
|
|
185
|
+
engineCapabilities: ENGINE_CAPABILITIES,
|
|
228
186
|
server: { version, tools: CANONICAL_SDD_TOOL_NAMES, count: 9, scope: 'server_registration' },
|
|
229
187
|
...clientInfo(client),
|
|
230
188
|
effectiveMcpCatalogue: 'unverified',
|
|
@@ -351,4 +309,22 @@ ${body}`;
|
|
|
351
309
|
}
|
|
352
310
|
return written;
|
|
353
311
|
}
|
|
312
|
+
export async function setupDiagnosticResult(server, workspace, version, args) {
|
|
313
|
+
try {
|
|
314
|
+
const resolved = await workspace.resolve();
|
|
315
|
+
const homeError = homeFallbackFailure(resolved, 'sdd_list_features');
|
|
316
|
+
if (homeError) {
|
|
317
|
+
return compact.formatCompactResult(homeError);
|
|
318
|
+
}
|
|
319
|
+
const setupDiagnostics = await inspectSetupDiagnostics(resolved.workspaceRoot, version ?? 'unknown', (args.host ?? 'all'), server.server.getClientVersion());
|
|
320
|
+
return compact.formatCompactResult({ success: true, data: { setupDiagnostics } });
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
const failure = compact.compactFailure('artifact_unavailable');
|
|
324
|
+
if (!failure.success) {
|
|
325
|
+
failure.error.trigger = 'sdd_list_features';
|
|
326
|
+
}
|
|
327
|
+
return compact.formatCompactResult(failure);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
354
330
|
//# sourceMappingURL=host-rule-pack.js.map
|