@blokjs/capabilities 2.2.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/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # `@blokjs/capabilities`
2
+
3
+ Trusted, bounded adapters for effectful operations used by the Blok harness.
4
+
5
+ `WorkspaceFilesystemCapability` is the H3-01 filesystem boundary. It accepts
6
+ only registered, canonical workspace roots and workspace-relative paths. It
7
+ does not expose host paths, follows no symlinks, rejects hard-linked regular
8
+ files and special files, and returns stable, bounded results. Reads, searches,
9
+ writes, patches, and watches carry separate `fs.workspace.*` capabilities and
10
+ filesystem/read, filesystem/write, or filesystem/streaming effects in the
11
+ shared v1 capability-manifest vocabulary.
12
+
13
+ Agent-originated callers should provide the H0-03 policy provider and complete
14
+ policy context through `WorkspaceFilesystemOptions.policy`. A policy provider
15
+ does not grant filesystem authority by itself: the requested operation must
16
+ remain in the existing `CapabilityAuthority`, and only an `allow` decision for
17
+ the configured policy version proceeds.
18
+
19
+ Writes require an expected content version when replacing a file. Replacement
20
+ is performed with a same-directory temporary file and atomic rename; a changed
21
+ version or a target appearing during a create is rejected.
22
+
23
+ This package deliberately does not implement Git, process execution, shell
24
+ commands, graph indexing, or a desktop-specific host protocol.
@@ -0,0 +1,35 @@
1
+ import { type CapabilityAuthority, type CapabilityManifestV1 } from "@blokjs/shared";
2
+ import type { WorkspaceFileMetadata, WorkspaceFilesystemLimits, WorkspaceFilesystemOperation, WorkspaceFilesystemOptions, WorkspaceListInput, WorkspaceListResult, WorkspaceMetadataInput, WorkspacePatchInput, WorkspaceReadInput, WorkspaceReadResult, WorkspaceRoot, WorkspaceSearchInput, WorkspaceSearchResult, WorkspaceWatchEvent, WorkspaceWatchInput, WorkspaceWriteInput, WorkspaceWriteResult } from "./contracts.js";
3
+ export declare function workspaceFilesystemManifest(operation: WorkspaceFilesystemOperation, limits?: WorkspaceFilesystemLimits): CapabilityManifestV1;
4
+ export declare function workspaceFilesystemAuthority(operation: WorkspaceFilesystemOperation, workspaceId?: string): CapabilityAuthority;
5
+ export declare function workspaceRelativePath(value: string): string;
6
+ export declare class WorkspaceFilesystemCapability {
7
+ readonly roots: readonly WorkspaceRoot[];
8
+ readonly limits: Required<WorkspaceFilesystemLimits>;
9
+ private readonly rootById;
10
+ private readonly options;
11
+ constructor(options: WorkspaceFilesystemOptions);
12
+ metadata(input: WorkspaceMetadataInput): Promise<WorkspaceFileMetadata>;
13
+ list(input: WorkspaceListInput): Promise<WorkspaceListResult>;
14
+ read(input: WorkspaceReadInput): Promise<WorkspaceReadResult>;
15
+ search(input: WorkspaceSearchInput): Promise<WorkspaceSearchResult>;
16
+ write(input: WorkspaceWriteInput): Promise<WorkspaceWriteResult>;
17
+ patch(input: WorkspacePatchInput): Promise<WorkspaceWriteResult>;
18
+ watch(input: WorkspaceWatchInput): AsyncIterable<WorkspaceWatchEvent>;
19
+ private run;
20
+ private duration;
21
+ private resolveInput;
22
+ private resolveTarget;
23
+ private pathFromAbsolute;
24
+ private authorize;
25
+ private scopeAllows;
26
+ private secureStat;
27
+ private readSecure;
28
+ private metadataInternal;
29
+ private statVersion;
30
+ private makeArtifact;
31
+ private selectLines;
32
+ private writeInternal;
33
+ private directoriesForWatch;
34
+ private watchEvent;
35
+ }