@aigne/afs 1.11.0-beta → 1.11.0-beta.10
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/LICENSE.md +17 -84
- package/README.md +4 -13
- package/dist/_virtual/rolldown_runtime.mjs +7 -0
- package/dist/afs.cjs +1330 -0
- package/dist/afs.d.cts +275 -0
- package/dist/afs.d.cts.map +1 -0
- package/dist/afs.d.mts +275 -0
- package/dist/afs.d.mts.map +1 -0
- package/dist/afs.mjs +1331 -0
- package/dist/afs.mjs.map +1 -0
- package/dist/capabilities/index.d.mts +2 -0
- package/dist/capabilities/types.d.cts +100 -0
- package/dist/capabilities/types.d.cts.map +1 -0
- package/dist/capabilities/types.d.mts +100 -0
- package/dist/capabilities/types.d.mts.map +1 -0
- package/dist/capabilities/world-mapping.cjs +20 -0
- package/dist/capabilities/world-mapping.d.cts +139 -0
- package/dist/capabilities/world-mapping.d.cts.map +1 -0
- package/dist/capabilities/world-mapping.d.mts +139 -0
- package/dist/capabilities/world-mapping.d.mts.map +1 -0
- package/dist/capabilities/world-mapping.mjs +20 -0
- package/dist/capabilities/world-mapping.mjs.map +1 -0
- package/dist/error.cjs +63 -0
- package/dist/error.d.cts +39 -0
- package/dist/error.d.cts.map +1 -0
- package/dist/error.d.mts +39 -0
- package/dist/error.d.mts.map +1 -0
- package/dist/error.mjs +59 -0
- package/dist/error.mjs.map +1 -0
- package/dist/index.cjs +72 -345
- package/dist/index.d.cts +18 -300
- package/dist/index.d.mts +20 -300
- package/dist/index.mjs +16 -342
- package/dist/loader/index.cjs +110 -0
- package/dist/loader/index.d.cts +48 -0
- package/dist/loader/index.d.cts.map +1 -0
- package/dist/loader/index.d.mts +48 -0
- package/dist/loader/index.d.mts.map +1 -0
- package/dist/loader/index.mjs +110 -0
- package/dist/loader/index.mjs.map +1 -0
- package/dist/meta/index.cjs +4 -0
- package/dist/meta/index.mjs +6 -0
- package/dist/meta/kind.cjs +161 -0
- package/dist/meta/kind.d.cts +134 -0
- package/dist/meta/kind.d.cts.map +1 -0
- package/dist/meta/kind.d.mts +134 -0
- package/dist/meta/kind.d.mts.map +1 -0
- package/dist/meta/kind.mjs +157 -0
- package/dist/meta/kind.mjs.map +1 -0
- package/dist/meta/path.cjs +116 -0
- package/dist/meta/path.d.cts +43 -0
- package/dist/meta/path.d.cts.map +1 -0
- package/dist/meta/path.d.mts +43 -0
- package/dist/meta/path.d.mts.map +1 -0
- package/dist/meta/path.mjs +112 -0
- package/dist/meta/path.mjs.map +1 -0
- package/dist/meta/type.d.cts +96 -0
- package/dist/meta/type.d.cts.map +1 -0
- package/dist/meta/type.d.mts +96 -0
- package/dist/meta/type.d.mts.map +1 -0
- package/dist/meta/validation.cjs +77 -0
- package/dist/meta/validation.d.cts +19 -0
- package/dist/meta/validation.d.cts.map +1 -0
- package/dist/meta/validation.d.mts +19 -0
- package/dist/meta/validation.d.mts.map +1 -0
- package/dist/meta/validation.mjs +77 -0
- package/dist/meta/validation.mjs.map +1 -0
- package/dist/meta/well-known-kinds.cjs +228 -0
- package/dist/meta/well-known-kinds.d.cts +52 -0
- package/dist/meta/well-known-kinds.d.cts.map +1 -0
- package/dist/meta/well-known-kinds.d.mts +52 -0
- package/dist/meta/well-known-kinds.d.mts.map +1 -0
- package/dist/meta/well-known-kinds.mjs +219 -0
- package/dist/meta/well-known-kinds.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.cts +141 -0
- package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.mts +141 -0
- package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.mts.map +1 -0
- package/dist/path.cjs +255 -0
- package/dist/path.d.cts +93 -0
- package/dist/path.d.cts.map +1 -0
- package/dist/path.d.mts +93 -0
- package/dist/path.d.mts.map +1 -0
- package/dist/path.mjs +249 -0
- package/dist/path.mjs.map +1 -0
- package/dist/provider/base.cjs +425 -0
- package/dist/provider/base.d.cts +175 -0
- package/dist/provider/base.d.cts.map +1 -0
- package/dist/provider/base.d.mts +175 -0
- package/dist/provider/base.d.mts.map +1 -0
- package/dist/provider/base.mjs +426 -0
- package/dist/provider/base.mjs.map +1 -0
- package/dist/provider/decorators.cjs +268 -0
- package/dist/provider/decorators.d.cts +244 -0
- package/dist/provider/decorators.d.cts.map +1 -0
- package/dist/provider/decorators.d.mts +244 -0
- package/dist/provider/decorators.d.mts.map +1 -0
- package/dist/provider/decorators.mjs +256 -0
- package/dist/provider/decorators.mjs.map +1 -0
- package/dist/provider/index.cjs +19 -0
- package/dist/provider/index.d.cts +5 -0
- package/dist/provider/index.d.mts +5 -0
- package/dist/provider/index.mjs +5 -0
- package/dist/provider/router.cjs +185 -0
- package/dist/provider/router.d.cts +50 -0
- package/dist/provider/router.d.cts.map +1 -0
- package/dist/provider/router.d.mts +50 -0
- package/dist/provider/router.d.mts.map +1 -0
- package/dist/provider/router.mjs +185 -0
- package/dist/provider/router.mjs.map +1 -0
- package/dist/provider/types.d.cts +113 -0
- package/dist/provider/types.d.cts.map +1 -0
- package/dist/provider/types.d.mts +113 -0
- package/dist/provider/types.d.mts.map +1 -0
- package/dist/registry.cjs +358 -0
- package/dist/registry.d.cts +96 -0
- package/dist/registry.d.cts.map +1 -0
- package/dist/registry.d.mts +96 -0
- package/dist/registry.d.mts.map +1 -0
- package/dist/registry.mjs +360 -0
- package/dist/registry.mjs.map +1 -0
- package/dist/type.cjs +34 -0
- package/dist/type.d.cts +420 -0
- package/dist/type.d.cts.map +1 -0
- package/dist/type.d.mts +420 -0
- package/dist/type.d.mts.map +1 -0
- package/dist/type.mjs +33 -0
- package/dist/type.mjs.map +1 -0
- package/dist/utils/camelize.d.cts.map +1 -1
- package/dist/utils/camelize.d.mts.map +1 -1
- package/dist/utils/schema.cjs +129 -0
- package/dist/utils/schema.d.cts +65 -0
- package/dist/utils/schema.d.cts.map +1 -0
- package/dist/utils/schema.d.mts +65 -0
- package/dist/utils/schema.d.mts.map +1 -0
- package/dist/utils/schema.mjs +124 -0
- package/dist/utils/schema.mjs.map +1 -0
- package/dist/utils/type-utils.d.cts.map +1 -1
- package/dist/utils/type-utils.d.mts.map +1 -1
- package/dist/utils/uri-template.cjs +123 -0
- package/dist/utils/uri-template.d.cts +48 -0
- package/dist/utils/uri-template.d.cts.map +1 -0
- package/dist/utils/uri-template.d.mts +48 -0
- package/dist/utils/uri-template.d.mts.map +1 -0
- package/dist/utils/uri-template.mjs +120 -0
- package/dist/utils/uri-template.mjs.map +1 -0
- package/dist/utils/uri.cjs +49 -0
- package/dist/utils/uri.d.cts +34 -0
- package/dist/utils/uri.d.cts.map +1 -0
- package/dist/utils/uri.d.mts +34 -0
- package/dist/utils/uri.d.mts.map +1 -0
- package/dist/utils/uri.mjs +49 -0
- package/dist/utils/uri.mjs.map +1 -0
- package/dist/utils/zod.cjs +6 -8
- package/dist/utils/zod.d.cts +2 -2
- package/dist/utils/zod.d.cts.map +1 -1
- package/dist/utils/zod.d.mts +2 -2
- package/dist/utils/zod.d.mts.map +1 -1
- package/dist/utils/zod.mjs +6 -8
- package/dist/utils/zod.mjs.map +1 -1
- package/package.json +27 -4
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/type.d.cts
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { JSONSchema7 } from "./node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.cjs";
|
|
2
|
+
import { AFSExplainResult, KindSchema, MetaPathInfo, NodeConstraint, NodesConstraints, ValidationError, ValidationResult } from "./meta/type.cjs";
|
|
3
|
+
import { ZodType, z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/type.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Abstract auth context interface for collecting credentials.
|
|
8
|
+
* Implementations:
|
|
9
|
+
* - CLI: terminal prompt / masked input / open command
|
|
10
|
+
* - MCP: elicitation form mode / URL mode
|
|
11
|
+
*/
|
|
12
|
+
interface AuthContext {
|
|
13
|
+
/** Step 2 resolved fields (env/store/config), so auth() can skip already-resolved fields */
|
|
14
|
+
readonly resolved: Record<string, unknown>;
|
|
15
|
+
/**
|
|
16
|
+
* Collect fields from the user.
|
|
17
|
+
* Implementation auto-selects secure channel based on `sensitive` markers in schema:
|
|
18
|
+
* - All non-sensitive → MCP form mode / CLI prompt
|
|
19
|
+
* - Contains sensitive → MCP URL mode (local HTTP form) / CLI masked input
|
|
20
|
+
*
|
|
21
|
+
* @param schema - JSON Schema describing fields to collect (from z.toJSONSchema() or manifest)
|
|
22
|
+
* @returns collected values, or null if user declined/cancelled
|
|
23
|
+
*/
|
|
24
|
+
collect(schema: JSONSchema7): Promise<Record<string, unknown> | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Create a localhost callback server for OAuth redirect_uri flows.
|
|
27
|
+
* Provider uses callbackURL to construct auth URL, then waitForCallback() for the result.
|
|
28
|
+
*/
|
|
29
|
+
createCallbackServer(): Promise<CallbackServer>;
|
|
30
|
+
/**
|
|
31
|
+
* Request the client to open a URL (MCP: URL mode elicitation, CLI: open command).
|
|
32
|
+
* Only opens — does not wait for data.
|
|
33
|
+
*/
|
|
34
|
+
requestOpenURL(url: string, message: string): Promise<"accepted" | "declined" | "cancelled">;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Localhost callback server for OAuth flows.
|
|
38
|
+
* Created by AuthContext.createCallbackServer().
|
|
39
|
+
*/
|
|
40
|
+
interface CallbackServer {
|
|
41
|
+
/** Callback address, e.g. http://127.0.0.1:{port}/callback */
|
|
42
|
+
callbackURL: string;
|
|
43
|
+
/** Wait for a callback request. Returns query params, or null on timeout/cancel. */
|
|
44
|
+
waitForCallback(options?: {
|
|
45
|
+
timeout?: number;
|
|
46
|
+
}): Promise<Record<string, string> | null>;
|
|
47
|
+
/** Close the callback server. Idempotent. */
|
|
48
|
+
close(): void;
|
|
49
|
+
}
|
|
50
|
+
/** AFS change record — pure data, zero external dependencies */
|
|
51
|
+
interface AFSChangeRecord {
|
|
52
|
+
kind: "write" | "delete" | "mount" | "unmount" | "rename";
|
|
53
|
+
path: string;
|
|
54
|
+
/** Module name (for mount/unmount events) */
|
|
55
|
+
moduleName?: string;
|
|
56
|
+
/** Namespace (for mount/unmount events) */
|
|
57
|
+
namespace?: string | null;
|
|
58
|
+
timestamp: number;
|
|
59
|
+
/** Optional metadata — AFS passes through without interpretation */
|
|
60
|
+
meta?: Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
/** Change listener — injected by AOS, called by AFS */
|
|
63
|
+
type AFSChangeListener = (event: AFSChangeRecord) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Access mode for AFS modules and root.
|
|
66
|
+
* - "readonly": Only read operations are allowed (list, read, search)
|
|
67
|
+
* - "readwrite": All operations are allowed
|
|
68
|
+
*/
|
|
69
|
+
type AFSAccessMode = "readonly" | "readwrite";
|
|
70
|
+
/**
|
|
71
|
+
* Zod schema for access mode validation.
|
|
72
|
+
* Can be reused across modules that support access mode configuration.
|
|
73
|
+
*/
|
|
74
|
+
declare const accessModeSchema: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
readonly: "readonly";
|
|
76
|
+
readwrite: "readwrite";
|
|
77
|
+
}>>;
|
|
78
|
+
interface AFSOperationOptions {
|
|
79
|
+
context?: any;
|
|
80
|
+
}
|
|
81
|
+
interface AFSListOptions extends AFSOperationOptions {
|
|
82
|
+
filter?: {
|
|
83
|
+
agentId?: string;
|
|
84
|
+
userId?: string;
|
|
85
|
+
sessionId?: string;
|
|
86
|
+
before?: string;
|
|
87
|
+
after?: string;
|
|
88
|
+
};
|
|
89
|
+
maxDepth?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Number of entries to skip (pagination offset)
|
|
92
|
+
* @default 0
|
|
93
|
+
*/
|
|
94
|
+
offset?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Maximum number of entries to return
|
|
97
|
+
* @default 1000
|
|
98
|
+
*/
|
|
99
|
+
limit?: number;
|
|
100
|
+
orderBy?: [string, "asc" | "desc"][];
|
|
101
|
+
maxChildren?: number;
|
|
102
|
+
onOverflow?: "truncate";
|
|
103
|
+
/**
|
|
104
|
+
* Whether to disable .gitignore files when listing files.
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
107
|
+
disableGitignore?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Glob pattern to filter entries by path.
|
|
110
|
+
* Examples: "*.ts", "**\/*.js", "src/**\/*.{ts,tsx}"
|
|
111
|
+
*/
|
|
112
|
+
pattern?: string;
|
|
113
|
+
}
|
|
114
|
+
interface AFSListResult {
|
|
115
|
+
data: AFSEntry[];
|
|
116
|
+
message?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Total count of entries (optional)
|
|
119
|
+
* - If present: indicates complete dataset size (data may be a subset)
|
|
120
|
+
* - If absent (undefined): data IS the complete result, total === data.length
|
|
121
|
+
*/
|
|
122
|
+
total?: number;
|
|
123
|
+
}
|
|
124
|
+
interface AFSSearchOptions extends AFSOperationOptions {
|
|
125
|
+
limit?: number;
|
|
126
|
+
caseSensitive?: boolean;
|
|
127
|
+
}
|
|
128
|
+
interface AFSSearchResult {
|
|
129
|
+
data: AFSEntry[];
|
|
130
|
+
message?: string;
|
|
131
|
+
}
|
|
132
|
+
interface AFSReadOptions extends AFSOperationOptions {
|
|
133
|
+
filter?: AFSListOptions["filter"];
|
|
134
|
+
}
|
|
135
|
+
interface AFSReadResult {
|
|
136
|
+
data?: AFSEntry;
|
|
137
|
+
message?: string;
|
|
138
|
+
}
|
|
139
|
+
interface AFSDeleteOptions extends AFSOperationOptions {
|
|
140
|
+
recursive?: boolean;
|
|
141
|
+
}
|
|
142
|
+
interface AFSDeleteResult {
|
|
143
|
+
message?: string;
|
|
144
|
+
}
|
|
145
|
+
interface AFSRenameOptions extends AFSOperationOptions {
|
|
146
|
+
overwrite?: boolean;
|
|
147
|
+
}
|
|
148
|
+
interface AFSRenameResult {
|
|
149
|
+
message?: string;
|
|
150
|
+
}
|
|
151
|
+
interface AFSWriteOptions extends AFSOperationOptions {
|
|
152
|
+
append?: boolean;
|
|
153
|
+
}
|
|
154
|
+
interface AFSWriteResult {
|
|
155
|
+
data: AFSEntry;
|
|
156
|
+
message?: string;
|
|
157
|
+
}
|
|
158
|
+
interface AFSWriteEntryPayload extends Omit<AFSEntry, "id" | "path"> {}
|
|
159
|
+
interface AFSExecOptions extends AFSOperationOptions {}
|
|
160
|
+
interface AFSExecResult extends AFSActionResult {}
|
|
161
|
+
/**
|
|
162
|
+
* Summary information for an action available on a node.
|
|
163
|
+
* Used in AFSEntry.actions to describe available actions.
|
|
164
|
+
*/
|
|
165
|
+
interface ActionSummary {
|
|
166
|
+
/** The action name (e.g., "refresh", "export", "delete") */
|
|
167
|
+
name: string;
|
|
168
|
+
/** Human-readable description of what the action does */
|
|
169
|
+
description?: string;
|
|
170
|
+
/** JSON Schema for input parameters */
|
|
171
|
+
inputSchema?: JSONSchema7;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Result from executing an action via the Action System.
|
|
175
|
+
* Actions return structured results with success/failure status.
|
|
176
|
+
*/
|
|
177
|
+
interface AFSActionResult {
|
|
178
|
+
/** Whether the action completed successfully */
|
|
179
|
+
success: boolean;
|
|
180
|
+
/** Data returned by the action on success */
|
|
181
|
+
data?: Record<string, unknown>;
|
|
182
|
+
/** Error information when success is false */
|
|
183
|
+
error?: {
|
|
184
|
+
/** Error code (e.g., "VALIDATION_ERROR", "NOT_FOUND") */code: string; /** Human-readable error message */
|
|
185
|
+
message: string; /** Additional error details */
|
|
186
|
+
details?: Record<string, unknown>;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
interface AFSStatOptions extends AFSOperationOptions {}
|
|
190
|
+
/**
|
|
191
|
+
* Result from stat operation.
|
|
192
|
+
* The data field follows AFSEntry structure but without content.
|
|
193
|
+
*/
|
|
194
|
+
interface AFSStatResult {
|
|
195
|
+
data?: Omit<AFSEntry, "content">;
|
|
196
|
+
message?: string;
|
|
197
|
+
}
|
|
198
|
+
interface AFSExplainOptions extends AFSOperationOptions {
|
|
199
|
+
format?: "markdown" | "text";
|
|
200
|
+
}
|
|
201
|
+
interface AFSModule {
|
|
202
|
+
readonly name: string;
|
|
203
|
+
readonly description?: string;
|
|
204
|
+
/**
|
|
205
|
+
* The complete source URI for this provider instance (including query params).
|
|
206
|
+
* Set by ProviderRegistry factories after creating the provider.
|
|
207
|
+
* Used by loadProvider injection to persist mount configuration.
|
|
208
|
+
*/
|
|
209
|
+
readonly uri?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Access mode for this module.
|
|
212
|
+
* - "readonly": Only read operations are allowed
|
|
213
|
+
* - "readwrite": All operations are allowed
|
|
214
|
+
* Default behavior is implementation-specific.
|
|
215
|
+
*/
|
|
216
|
+
readonly accessMode?: AFSAccessMode;
|
|
217
|
+
/**
|
|
218
|
+
* Enable automatic agent skill scanning for this module.
|
|
219
|
+
* When set to true, the system will scan this module for agent skills.
|
|
220
|
+
* @default false
|
|
221
|
+
*/
|
|
222
|
+
readonly agentSkills?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Timeout in milliseconds for provider operations.
|
|
225
|
+
* Currently used for mount check.
|
|
226
|
+
* If not specified, uses the default value (10s).
|
|
227
|
+
* Remote providers (MCP, HTTP) may need longer timeouts.
|
|
228
|
+
*/
|
|
229
|
+
readonly timeout?: number;
|
|
230
|
+
onMount?(root: AFSRoot, mountPath?: string): void;
|
|
231
|
+
symlinkToPhysical?(path: string): Promise<void>;
|
|
232
|
+
list?(path: string, options?: AFSListOptions): Promise<AFSListResult>;
|
|
233
|
+
read?(path: string, options?: AFSReadOptions): Promise<AFSReadResult>;
|
|
234
|
+
write?(path: string, content: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<AFSWriteResult>;
|
|
235
|
+
delete?(path: string, options?: AFSDeleteOptions): Promise<AFSDeleteResult>;
|
|
236
|
+
rename?(oldPath: string, newPath: string, options?: AFSRenameOptions): Promise<AFSRenameResult>;
|
|
237
|
+
search?(path: string, query: string, options?: AFSSearchOptions): Promise<AFSSearchResult>;
|
|
238
|
+
exec?(path: string, args: Record<string, any>, options: AFSExecOptions): Promise<AFSExecResult>;
|
|
239
|
+
stat?(path: string, options?: AFSStatOptions): Promise<AFSStatResult>;
|
|
240
|
+
explain?(path: string, options?: AFSExplainOptions): Promise<AFSExplainResult>;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Parameters for loading a module from configuration.
|
|
244
|
+
*/
|
|
245
|
+
interface AFSModuleLoadParams {
|
|
246
|
+
/**
|
|
247
|
+
* Base path for resolving relative paths in configuration.
|
|
248
|
+
* Typically the directory containing the configuration file.
|
|
249
|
+
*/
|
|
250
|
+
basePath?: string;
|
|
251
|
+
/**
|
|
252
|
+
* Parsed configuration object.
|
|
253
|
+
* The caller is responsible for parsing YAML/JSON/TOML into this object.
|
|
254
|
+
*/
|
|
255
|
+
config?: object;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Mount configuration for a single provider.
|
|
259
|
+
* Used by ProviderRegistry and provider factories at runtime.
|
|
260
|
+
* The validated Zod schema version lives in @aigne/afs-cli (config file validation).
|
|
261
|
+
*/
|
|
262
|
+
interface MountConfig {
|
|
263
|
+
/** Mount path */
|
|
264
|
+
path: string;
|
|
265
|
+
/** Provider URI (e.g., fs:///path, git:///repo?branch=main) */
|
|
266
|
+
uri: string;
|
|
267
|
+
/** Namespace for this mount */
|
|
268
|
+
namespace?: string;
|
|
269
|
+
/** Human/LLM readable description */
|
|
270
|
+
description?: string;
|
|
271
|
+
/** Access mode: readonly or readwrite */
|
|
272
|
+
access_mode?: AFSAccessMode;
|
|
273
|
+
/** Authentication string */
|
|
274
|
+
auth?: string;
|
|
275
|
+
/** Authorization token */
|
|
276
|
+
token?: string;
|
|
277
|
+
/** Provider-specific options */
|
|
278
|
+
options?: Record<string, unknown>;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Provider manifest — self-description of a provider's URI template, schema, and metadata.
|
|
282
|
+
*
|
|
283
|
+
* Declared via `static manifest()` on Provider class.
|
|
284
|
+
* Schema contains ALL provider parameters (path vars + options + sensitive).
|
|
285
|
+
* Parameter source is determined by rules:
|
|
286
|
+
* - Field in uriTemplate {} → extracted from URI body
|
|
287
|
+
* - Field with sensitive: true in schema → credential store
|
|
288
|
+
* - Everything else → config/query params
|
|
289
|
+
*/
|
|
290
|
+
interface ProviderManifest {
|
|
291
|
+
/** Provider name */
|
|
292
|
+
name: string;
|
|
293
|
+
/** Human-readable description */
|
|
294
|
+
description: string;
|
|
295
|
+
/** URI template, e.g. "s3://{bucket}/{prefix+?}" */
|
|
296
|
+
uriTemplate: string;
|
|
297
|
+
/** Category (storage, database, cloud, compute, integration, ...) */
|
|
298
|
+
category: string;
|
|
299
|
+
/** Zod schema containing ALL parameters (path vars + options + sensitive) */
|
|
300
|
+
schema: ZodType;
|
|
301
|
+
/** Tags for discovery */
|
|
302
|
+
tags?: string[];
|
|
303
|
+
/** Use case descriptions */
|
|
304
|
+
useCases?: string[];
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Interface for module classes that support schema validation and loading from configuration.
|
|
308
|
+
* This describes the static part of a module class.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```typescript
|
|
312
|
+
* class MyModule implements AFSModule {
|
|
313
|
+
* static schema() { return mySchema; }
|
|
314
|
+
* static async load(params: AFSModuleLoadParams) { ... }
|
|
315
|
+
* // ...
|
|
316
|
+
* }
|
|
317
|
+
*
|
|
318
|
+
* // Type check
|
|
319
|
+
* const _check: AFSModuleClass<MyModule, MyModuleOptions> = MyModule;
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
interface AFSModuleClass<T extends AFSModule = AFSModule, O extends object = object> {
|
|
323
|
+
/**
|
|
324
|
+
* Returns the Zod schema for validating module configuration.
|
|
325
|
+
* @deprecated Use `manifest()` instead — the manifest includes the schema
|
|
326
|
+
* along with URI template, category, and tags for unified provider loading.
|
|
327
|
+
*/
|
|
328
|
+
schema(): ZodType<O>;
|
|
329
|
+
/**
|
|
330
|
+
* Returns provider manifest(s) describing URI template, schema, and metadata.
|
|
331
|
+
* Single manifest for most providers; array for multi-scheme providers (e.g., MCP).
|
|
332
|
+
*/
|
|
333
|
+
manifest?(): ProviderManifest | ProviderManifest[];
|
|
334
|
+
/** Loads a module instance from configuration file path and parsed config */
|
|
335
|
+
load(params: AFSModuleLoadParams): Promise<T>;
|
|
336
|
+
/**
|
|
337
|
+
* Optional: Custom authentication flow for this provider.
|
|
338
|
+
* When present, called instead of the default schema-based collection.
|
|
339
|
+
* The context provides resolved fields and primitives (collect, createCallbackServer, requestOpenURL).
|
|
340
|
+
*
|
|
341
|
+
* @returns all collected fields (both sensitive and non-sensitive), or null if user declined
|
|
342
|
+
*/
|
|
343
|
+
auth?(context: AuthContext): Promise<Record<string, unknown> | null>;
|
|
344
|
+
/** Constructor */
|
|
345
|
+
new (options: O): T;
|
|
346
|
+
}
|
|
347
|
+
interface AFSRoot extends AFSModule {
|
|
348
|
+
list(path: string, options?: AFSListOptions): Promise<AFSListResult>;
|
|
349
|
+
search(path: string, query: string, options?: AFSSearchOptions): Promise<AFSSearchResult>;
|
|
350
|
+
initializePhysicalPath(): Promise<string>;
|
|
351
|
+
cleanupPhysicalPath(): Promise<void>;
|
|
352
|
+
}
|
|
353
|
+
interface AFSEntryMetadata extends Record<string, any> {
|
|
354
|
+
/** Kind identifier (e.g., "afs:node", "chamber:project") */
|
|
355
|
+
kind?: string;
|
|
356
|
+
/**
|
|
357
|
+
* Kind inheritance chain, from most specific to most general.
|
|
358
|
+
* First element should match the `kind` field.
|
|
359
|
+
*
|
|
360
|
+
* Example: MCP tool has `kinds: ["mcp:tool", "afs:executable", "afs:node"]`
|
|
361
|
+
* Use for capability detection: `kinds.includes("afs:executable")`
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* ```typescript
|
|
365
|
+
* // Check if node is executable
|
|
366
|
+
* const isExecutable = metadata.kinds?.includes("afs:executable") ?? false;
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
kinds?: string[];
|
|
370
|
+
/**
|
|
371
|
+
* Number of children this node has.
|
|
372
|
+
* - undefined: leaf node / file (no children possible)
|
|
373
|
+
* - 0: directory with no children (empty container)
|
|
374
|
+
* - N (N > 0): directory with exactly N children
|
|
375
|
+
* - -1: directory with children, but count unknown (lazy loading)
|
|
376
|
+
*
|
|
377
|
+
* Note: This is a runtime value computed by Provider. There is no file/directory
|
|
378
|
+
* distinction in AFS — all nodes can potentially have children.
|
|
379
|
+
*
|
|
380
|
+
* Design: undefined defaults to "leaf" for safety — if a developer forgets
|
|
381
|
+
* to set childrenCount, the node is treated as a leaf (safe failure).
|
|
382
|
+
* Directory nodes whose children count is not yet known should use -1.
|
|
383
|
+
*/
|
|
384
|
+
childrenCount?: number;
|
|
385
|
+
/** File size in bytes (for content nodes) */
|
|
386
|
+
size?: number;
|
|
387
|
+
/** Human-readable description */
|
|
388
|
+
description?: string;
|
|
389
|
+
}
|
|
390
|
+
interface AFSEntry<T = any> {
|
|
391
|
+
id: string;
|
|
392
|
+
createdAt?: Date;
|
|
393
|
+
updatedAt?: Date;
|
|
394
|
+
path: string;
|
|
395
|
+
agentId?: string | null;
|
|
396
|
+
userId?: string | null;
|
|
397
|
+
sessionId?: string | null;
|
|
398
|
+
summary?: string | null;
|
|
399
|
+
meta?: AFSEntryMetadata | null;
|
|
400
|
+
linkTo?: string | null;
|
|
401
|
+
content?: T;
|
|
402
|
+
/**
|
|
403
|
+
* Available actions for this entry.
|
|
404
|
+
* Actions can be executed via the `/.actions/<action-name>` path.
|
|
405
|
+
* Each action uses `afs:executable` kind.
|
|
406
|
+
*/
|
|
407
|
+
actions?: ActionSummary[];
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Zod schema for ActionSummary validation.
|
|
411
|
+
*/
|
|
412
|
+
declare const actionSummarySchema: z.ZodObject<{
|
|
413
|
+
name: z.ZodString;
|
|
414
|
+
description: z.ZodOptional<z.ZodString>;
|
|
415
|
+
inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
416
|
+
}, z.core.$strip>;
|
|
417
|
+
declare const afsEntrySchema: ZodType<AFSEntry>;
|
|
418
|
+
//#endregion
|
|
419
|
+
export { AFSAccessMode, AFSActionResult, AFSChangeListener, AFSChangeRecord, AFSDeleteOptions, AFSDeleteResult, AFSEntry, AFSEntryMetadata, AFSExecOptions, AFSExecResult, AFSExplainOptions, AFSListOptions, AFSListResult, AFSModule, AFSModuleClass, AFSModuleLoadParams, AFSOperationOptions, AFSReadOptions, AFSReadResult, AFSRenameOptions, AFSRenameResult, AFSRoot, AFSSearchOptions, AFSSearchResult, AFSStatOptions, AFSStatResult, AFSWriteEntryPayload, AFSWriteOptions, AFSWriteResult, ActionSummary, AuthContext, CallbackServer, MountConfig, ProviderManifest, accessModeSchema, actionSummarySchema, afsEntrySchema };
|
|
420
|
+
//# sourceMappingURL=type.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.cts","names":[],"sources":["../src/type.ts"],"mappings":";;;;;;;;AAaA;;;UAAiB,WAAA;EAaC;EAAA,SAXP,QAAA,EAAU,MAAA;EAWW;;;;;;;;;EAA9B,OAAA,CAAQ,MAAA,EAAQ,WAAA,GAAc,OAAA,CAAQ,MAAA;EAA9B;;;;EAMR,oBAAA,IAAwB,OAAA,CAAQ,cAAA;EAAA;;;;EAMhC,cAAA,CAAe,GAAA,UAAa,OAAA,WAAkB,OAAA;AAAA;;AAOhD;;;UAAiB,cAAA;EAEf;EAAA,WAAA;EAG4B;EAA5B,eAAA,CAAgB,OAAA;IAAY,OAAA;EAAA,IAAq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