@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.
Files changed (164) hide show
  1. package/LICENSE.md +17 -84
  2. package/README.md +4 -13
  3. package/dist/_virtual/rolldown_runtime.mjs +7 -0
  4. package/dist/afs.cjs +1330 -0
  5. package/dist/afs.d.cts +275 -0
  6. package/dist/afs.d.cts.map +1 -0
  7. package/dist/afs.d.mts +275 -0
  8. package/dist/afs.d.mts.map +1 -0
  9. package/dist/afs.mjs +1331 -0
  10. package/dist/afs.mjs.map +1 -0
  11. package/dist/capabilities/index.d.mts +2 -0
  12. package/dist/capabilities/types.d.cts +100 -0
  13. package/dist/capabilities/types.d.cts.map +1 -0
  14. package/dist/capabilities/types.d.mts +100 -0
  15. package/dist/capabilities/types.d.mts.map +1 -0
  16. package/dist/capabilities/world-mapping.cjs +20 -0
  17. package/dist/capabilities/world-mapping.d.cts +139 -0
  18. package/dist/capabilities/world-mapping.d.cts.map +1 -0
  19. package/dist/capabilities/world-mapping.d.mts +139 -0
  20. package/dist/capabilities/world-mapping.d.mts.map +1 -0
  21. package/dist/capabilities/world-mapping.mjs +20 -0
  22. package/dist/capabilities/world-mapping.mjs.map +1 -0
  23. package/dist/error.cjs +63 -0
  24. package/dist/error.d.cts +39 -0
  25. package/dist/error.d.cts.map +1 -0
  26. package/dist/error.d.mts +39 -0
  27. package/dist/error.d.mts.map +1 -0
  28. package/dist/error.mjs +59 -0
  29. package/dist/error.mjs.map +1 -0
  30. package/dist/index.cjs +72 -345
  31. package/dist/index.d.cts +18 -300
  32. package/dist/index.d.mts +20 -300
  33. package/dist/index.mjs +16 -342
  34. package/dist/loader/index.cjs +110 -0
  35. package/dist/loader/index.d.cts +48 -0
  36. package/dist/loader/index.d.cts.map +1 -0
  37. package/dist/loader/index.d.mts +48 -0
  38. package/dist/loader/index.d.mts.map +1 -0
  39. package/dist/loader/index.mjs +110 -0
  40. package/dist/loader/index.mjs.map +1 -0
  41. package/dist/meta/index.cjs +4 -0
  42. package/dist/meta/index.mjs +6 -0
  43. package/dist/meta/kind.cjs +161 -0
  44. package/dist/meta/kind.d.cts +134 -0
  45. package/dist/meta/kind.d.cts.map +1 -0
  46. package/dist/meta/kind.d.mts +134 -0
  47. package/dist/meta/kind.d.mts.map +1 -0
  48. package/dist/meta/kind.mjs +157 -0
  49. package/dist/meta/kind.mjs.map +1 -0
  50. package/dist/meta/path.cjs +116 -0
  51. package/dist/meta/path.d.cts +43 -0
  52. package/dist/meta/path.d.cts.map +1 -0
  53. package/dist/meta/path.d.mts +43 -0
  54. package/dist/meta/path.d.mts.map +1 -0
  55. package/dist/meta/path.mjs +112 -0
  56. package/dist/meta/path.mjs.map +1 -0
  57. package/dist/meta/type.d.cts +96 -0
  58. package/dist/meta/type.d.cts.map +1 -0
  59. package/dist/meta/type.d.mts +96 -0
  60. package/dist/meta/type.d.mts.map +1 -0
  61. package/dist/meta/validation.cjs +77 -0
  62. package/dist/meta/validation.d.cts +19 -0
  63. package/dist/meta/validation.d.cts.map +1 -0
  64. package/dist/meta/validation.d.mts +19 -0
  65. package/dist/meta/validation.d.mts.map +1 -0
  66. package/dist/meta/validation.mjs +77 -0
  67. package/dist/meta/validation.mjs.map +1 -0
  68. package/dist/meta/well-known-kinds.cjs +228 -0
  69. package/dist/meta/well-known-kinds.d.cts +52 -0
  70. package/dist/meta/well-known-kinds.d.cts.map +1 -0
  71. package/dist/meta/well-known-kinds.d.mts +52 -0
  72. package/dist/meta/well-known-kinds.d.mts.map +1 -0
  73. package/dist/meta/well-known-kinds.mjs +219 -0
  74. package/dist/meta/well-known-kinds.mjs.map +1 -0
  75. package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.cts +141 -0
  76. package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.cts.map +1 -0
  77. package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.mts +141 -0
  78. package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.mts.map +1 -0
  79. package/dist/path.cjs +255 -0
  80. package/dist/path.d.cts +93 -0
  81. package/dist/path.d.cts.map +1 -0
  82. package/dist/path.d.mts +93 -0
  83. package/dist/path.d.mts.map +1 -0
  84. package/dist/path.mjs +249 -0
  85. package/dist/path.mjs.map +1 -0
  86. package/dist/provider/base.cjs +425 -0
  87. package/dist/provider/base.d.cts +175 -0
  88. package/dist/provider/base.d.cts.map +1 -0
  89. package/dist/provider/base.d.mts +175 -0
  90. package/dist/provider/base.d.mts.map +1 -0
  91. package/dist/provider/base.mjs +426 -0
  92. package/dist/provider/base.mjs.map +1 -0
  93. package/dist/provider/decorators.cjs +268 -0
  94. package/dist/provider/decorators.d.cts +244 -0
  95. package/dist/provider/decorators.d.cts.map +1 -0
  96. package/dist/provider/decorators.d.mts +244 -0
  97. package/dist/provider/decorators.d.mts.map +1 -0
  98. package/dist/provider/decorators.mjs +256 -0
  99. package/dist/provider/decorators.mjs.map +1 -0
  100. package/dist/provider/index.cjs +19 -0
  101. package/dist/provider/index.d.cts +5 -0
  102. package/dist/provider/index.d.mts +5 -0
  103. package/dist/provider/index.mjs +5 -0
  104. package/dist/provider/router.cjs +185 -0
  105. package/dist/provider/router.d.cts +50 -0
  106. package/dist/provider/router.d.cts.map +1 -0
  107. package/dist/provider/router.d.mts +50 -0
  108. package/dist/provider/router.d.mts.map +1 -0
  109. package/dist/provider/router.mjs +185 -0
  110. package/dist/provider/router.mjs.map +1 -0
  111. package/dist/provider/types.d.cts +113 -0
  112. package/dist/provider/types.d.cts.map +1 -0
  113. package/dist/provider/types.d.mts +113 -0
  114. package/dist/provider/types.d.mts.map +1 -0
  115. package/dist/registry.cjs +358 -0
  116. package/dist/registry.d.cts +96 -0
  117. package/dist/registry.d.cts.map +1 -0
  118. package/dist/registry.d.mts +96 -0
  119. package/dist/registry.d.mts.map +1 -0
  120. package/dist/registry.mjs +360 -0
  121. package/dist/registry.mjs.map +1 -0
  122. package/dist/type.cjs +34 -0
  123. package/dist/type.d.cts +420 -0
  124. package/dist/type.d.cts.map +1 -0
  125. package/dist/type.d.mts +420 -0
  126. package/dist/type.d.mts.map +1 -0
  127. package/dist/type.mjs +33 -0
  128. package/dist/type.mjs.map +1 -0
  129. package/dist/utils/camelize.d.cts.map +1 -1
  130. package/dist/utils/camelize.d.mts.map +1 -1
  131. package/dist/utils/schema.cjs +129 -0
  132. package/dist/utils/schema.d.cts +65 -0
  133. package/dist/utils/schema.d.cts.map +1 -0
  134. package/dist/utils/schema.d.mts +65 -0
  135. package/dist/utils/schema.d.mts.map +1 -0
  136. package/dist/utils/schema.mjs +124 -0
  137. package/dist/utils/schema.mjs.map +1 -0
  138. package/dist/utils/type-utils.d.cts.map +1 -1
  139. package/dist/utils/type-utils.d.mts.map +1 -1
  140. package/dist/utils/uri-template.cjs +123 -0
  141. package/dist/utils/uri-template.d.cts +48 -0
  142. package/dist/utils/uri-template.d.cts.map +1 -0
  143. package/dist/utils/uri-template.d.mts +48 -0
  144. package/dist/utils/uri-template.d.mts.map +1 -0
  145. package/dist/utils/uri-template.mjs +120 -0
  146. package/dist/utils/uri-template.mjs.map +1 -0
  147. package/dist/utils/uri.cjs +49 -0
  148. package/dist/utils/uri.d.cts +34 -0
  149. package/dist/utils/uri.d.cts.map +1 -0
  150. package/dist/utils/uri.d.mts +34 -0
  151. package/dist/utils/uri.d.mts.map +1 -0
  152. package/dist/utils/uri.mjs +49 -0
  153. package/dist/utils/uri.mjs.map +1 -0
  154. package/dist/utils/zod.cjs +6 -8
  155. package/dist/utils/zod.d.cts +2 -2
  156. package/dist/utils/zod.d.cts.map +1 -1
  157. package/dist/utils/zod.d.mts +2 -2
  158. package/dist/utils/zod.d.mts.map +1 -1
  159. package/dist/utils/zod.mjs +6 -8
  160. package/dist/utils/zod.mjs.map +1 -1
  161. package/package.json +27 -4
  162. package/dist/index.d.cts.map +0 -1
  163. package/dist/index.d.mts.map +0 -1
  164. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,139 @@
1
+ import { AFSEntry, AFSModule } from "../type.mjs";
2
+
3
+ //#region src/capabilities/world-mapping.d.ts
4
+ /**
5
+ * Status information for loaded mapping configuration
6
+ */
7
+ interface MappingStatus {
8
+ /** Whether mapping is loaded */
9
+ loaded: boolean;
10
+ /** Time when mapping was last loaded */
11
+ loadedAt?: Date;
12
+ /** Path to the mapping configuration */
13
+ mappingPath?: string;
14
+ /** Whether mapping is successfully compiled */
15
+ compiled: boolean;
16
+ /** Error message if loading/compilation failed */
17
+ error?: string;
18
+ /** Statistics about the loaded mapping */
19
+ stats?: {
20
+ /** Number of route templates */routes: number; /** Number of supported operations */
21
+ operations: number;
22
+ };
23
+ }
24
+ /**
25
+ * Reference to an external system resource
26
+ */
27
+ interface ExternalRef {
28
+ /** Type of external system */
29
+ type: "http" | "graphql" | "mcp-tool" | "custom";
30
+ /** HTTP: URL, GraphQL: query, MCP: tool name */
31
+ target: string;
32
+ /** HTTP method or operation type */
33
+ method?: string;
34
+ /** Bound parameters */
35
+ params?: Record<string, unknown>;
36
+ /** Headers or metadata */
37
+ headers?: Record<string, string>;
38
+ }
39
+ /**
40
+ * Context for projecting external data to AFS entries
41
+ */
42
+ interface ProjectionContext {
43
+ /** Original AFS path */
44
+ path: string;
45
+ /** Matched path template */
46
+ template: string;
47
+ /** Extracted path parameters */
48
+ pathParams: Record<string, string>;
49
+ /** Current mapping rule (opaque to core, interpreted by provider) */
50
+ rule: unknown;
51
+ }
52
+ /**
53
+ * Types of mutation actions
54
+ */
55
+ type MutateAction = "create" | "update" | "delete" | "exec";
56
+ /**
57
+ * Result of a mutation operation
58
+ */
59
+ interface MutateResult {
60
+ /** Whether the operation succeeded */
61
+ success: boolean;
62
+ /** Result data from the operation */
63
+ data?: unknown;
64
+ /** Error message if operation failed */
65
+ error?: string;
66
+ }
67
+ /**
68
+ * World Mapping Capability Interface
69
+ *
70
+ * Providers implement this interface to support declarative path-to-API mapping.
71
+ * The mapping DSL defines how AFS paths map to external API calls.
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * class AFSGitHub implements AFSModule, AFSWorldMappingCapable {
76
+ * async loadMapping(mappingPath: string): Promise<void> {
77
+ * // Load and compile mapping from AFS
78
+ * }
79
+ *
80
+ * resolve(path: string): ExternalRef | null {
81
+ * // Match path against compiled routes
82
+ * }
83
+ *
84
+ * project(data: unknown, ctx: ProjectionContext): AFSEntry[] {
85
+ * // Transform API response to AFS entries
86
+ * }
87
+ * }
88
+ * ```
89
+ */
90
+ interface AFSWorldMappingCapable {
91
+ /**
92
+ * Load mapping configuration from AFS path
93
+ * @param mappingPath AFS path to mapping configuration file or directory
94
+ */
95
+ loadMapping(mappingPath: string): Promise<void>;
96
+ /**
97
+ * Reload mapping configuration (hot-reload)
98
+ * Should rollback to previous valid configuration on failure
99
+ */
100
+ reloadMapping(): Promise<void>;
101
+ /**
102
+ * Get current mapping status
103
+ */
104
+ getMappingStatus(): MappingStatus;
105
+ /**
106
+ * Resolve AFS path to external reference
107
+ * @param path AFS internal path
108
+ * @returns External system reference, or null if path doesn't match any route
109
+ */
110
+ resolve(path: string): ExternalRef | null;
111
+ /**
112
+ * Project external data to AFS entries
113
+ * @param externalData Data returned from external API
114
+ * @param context Resolution context (path, template, params, rule)
115
+ * @returns Array of AFS entries
116
+ */
117
+ project(externalData: unknown, context: ProjectionContext): AFSEntry[];
118
+ /**
119
+ * Execute mutation operation
120
+ * @param path AFS path
121
+ * @param action Mutation type
122
+ * @param payload Operation parameters
123
+ */
124
+ mutate(path: string, action: MutateAction, payload: unknown): Promise<MutateResult>;
125
+ }
126
+ /**
127
+ * Type guard to check if a module implements World Mapping capability
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * if (isWorldMappingCapable(provider)) {
132
+ * await provider.loadMapping("/config/mapping/github.yaml");
133
+ * }
134
+ * ```
135
+ */
136
+ declare function isWorldMappingCapable(module: AFSModule | null | undefined): module is AFSModule & AFSWorldMappingCapable;
137
+ //#endregion
138
+ export { AFSWorldMappingCapable, ExternalRef, MappingStatus, MutateAction, MutateResult, ProjectionContext, isWorldMappingCapable };
139
+ //# sourceMappingURL=world-mapping.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-mapping.d.mts","names":[],"sources":["../../src/capabilities/world-mapping.ts"],"mappings":";;;;;;UAkBiB,aAAA;EAgBH;EAdZ,MAAA;EAqB0B;EAnB1B,QAAA,GAAW,IAAA;EA6BK;EA3BhB,WAAA;EAqBA;EAnBA,QAAA;EAuBA;EArBA,KAAA;EAuBA;EArBA,KAAA;IAqBgB,gCAnBd,MAAA,UAyBa;IAvBb,UAAA;EAAA;AAAA;;;;UAOa,WAAA;EAwBf;EAtBA,IAAA;EAsBI;EApBJ,MAAA;EA0BsB;EAxBtB,MAAA;EAwBsB;EAtBtB,MAAA,GAAS,MAAA;EA2BM;EAzBf,OAAA,GAAU,MAAA;AAAA;;;;UAMK,iBAAA;EAyBV;EAvBL,IAAA;EAiDe;EA/Cf,QAAA;;EAEA,UAAA,EAAY,MAAA;EAwDK;EAtDjB,IAAA;AAAA;;;;KAMU,YAAA;;;;UAKK,YAAA;EAqCH;EAnCZ,OAAA;EAyCA;EAvCA,IAAA;EA4CA;EA1CA,KAAA;AAAA;;;;;;;;;;;;;;;;;AA8EF;;;;;;;UApDiB,sBAAA;EAqDP;;;;EAhDR,WAAA,CAAY,WAAA,WAAsB,OAAA;EAiDW;;;;EA3C7C,aAAA,IAAiB,OAAA;;;;EAKjB,gBAAA,IAAoB,aAAA;;;;;;EAOpB,OAAA,CAAQ,IAAA,WAAe,WAAA;;;;;;;EAQvB,OAAA,CAAQ,YAAA,WAAuB,OAAA,EAAS,iBAAA,GAAoB,QAAA;;;;;;;EAQ5D,MAAA,CAAO,IAAA,UAAc,MAAA,EAAQ,YAAA,EAAc,OAAA,YAAmB,OAAA,CAAQ,YAAA;AAAA;;;;;;;;;;;iBAaxD,qBAAA,CACd,MAAA,EAAQ,SAAA,sBACP,MAAA,IAAU,SAAA,GAAY,sBAAA"}
@@ -0,0 +1,20 @@
1
+ //#region src/capabilities/world-mapping.ts
2
+ /**
3
+ * Type guard to check if a module implements World Mapping capability
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * if (isWorldMappingCapable(provider)) {
8
+ * await provider.loadMapping("/config/mapping/github.yaml");
9
+ * }
10
+ * ```
11
+ */
12
+ function isWorldMappingCapable(module) {
13
+ if (!module) return false;
14
+ const m = module;
15
+ return typeof m.loadMapping === "function" && typeof m.reloadMapping === "function" && typeof m.getMappingStatus === "function" && typeof m.resolve === "function" && typeof m.project === "function" && typeof m.mutate === "function";
16
+ }
17
+
18
+ //#endregion
19
+ export { isWorldMappingCapable };
20
+ //# sourceMappingURL=world-mapping.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-mapping.mjs","names":[],"sources":["../../src/capabilities/world-mapping.ts"],"sourcesContent":["/**\n * World Mapping Capability\n *\n * Provider capability for declarative path-to-API mapping.\n * DSL is stored as data in AFS, execution happens at the provider boundary.\n *\n * Core principle:\n * - DSL is data (living in AFS)\n * - Execution is capability (living in provider)\n *\n * @see intent/specs/world-mapping-capability.md\n */\n\nimport type { AFSEntry, AFSModule } from \"../type.js\";\n\n/**\n * Status information for loaded mapping configuration\n */\nexport interface MappingStatus {\n /** Whether mapping is loaded */\n loaded: boolean;\n /** Time when mapping was last loaded */\n loadedAt?: Date;\n /** Path to the mapping configuration */\n mappingPath?: string;\n /** Whether mapping is successfully compiled */\n compiled: boolean;\n /** Error message if loading/compilation failed */\n error?: string;\n /** Statistics about the loaded mapping */\n stats?: {\n /** Number of route templates */\n routes: number;\n /** Number of supported operations */\n operations: number;\n };\n}\n\n/**\n * Reference to an external system resource\n */\nexport interface ExternalRef {\n /** Type of external system */\n type: \"http\" | \"graphql\" | \"mcp-tool\" | \"custom\";\n /** HTTP: URL, GraphQL: query, MCP: tool name */\n target: string;\n /** HTTP method or operation type */\n method?: string;\n /** Bound parameters */\n params?: Record<string, unknown>;\n /** Headers or metadata */\n headers?: Record<string, string>;\n}\n\n/**\n * Context for projecting external data to AFS entries\n */\nexport interface ProjectionContext {\n /** Original AFS path */\n path: string;\n /** Matched path template */\n template: string;\n /** Extracted path parameters */\n pathParams: Record<string, string>;\n /** Current mapping rule (opaque to core, interpreted by provider) */\n rule: unknown;\n}\n\n/**\n * Types of mutation actions\n */\nexport type MutateAction = \"create\" | \"update\" | \"delete\" | \"exec\";\n\n/**\n * Result of a mutation operation\n */\nexport interface MutateResult {\n /** Whether the operation succeeded */\n success: boolean;\n /** Result data from the operation */\n data?: unknown;\n /** Error message if operation failed */\n error?: string;\n}\n\n/**\n * World Mapping Capability Interface\n *\n * Providers implement this interface to support declarative path-to-API mapping.\n * The mapping DSL defines how AFS paths map to external API calls.\n *\n * @example\n * ```typescript\n * class AFSGitHub implements AFSModule, AFSWorldMappingCapable {\n * async loadMapping(mappingPath: string): Promise<void> {\n * // Load and compile mapping from AFS\n * }\n *\n * resolve(path: string): ExternalRef | null {\n * // Match path against compiled routes\n * }\n *\n * project(data: unknown, ctx: ProjectionContext): AFSEntry[] {\n * // Transform API response to AFS entries\n * }\n * }\n * ```\n */\nexport interface AFSWorldMappingCapable {\n /**\n * Load mapping configuration from AFS path\n * @param mappingPath AFS path to mapping configuration file or directory\n */\n loadMapping(mappingPath: string): Promise<void>;\n\n /**\n * Reload mapping configuration (hot-reload)\n * Should rollback to previous valid configuration on failure\n */\n reloadMapping(): Promise<void>;\n\n /**\n * Get current mapping status\n */\n getMappingStatus(): MappingStatus;\n\n /**\n * Resolve AFS path to external reference\n * @param path AFS internal path\n * @returns External system reference, or null if path doesn't match any route\n */\n resolve(path: string): ExternalRef | null;\n\n /**\n * Project external data to AFS entries\n * @param externalData Data returned from external API\n * @param context Resolution context (path, template, params, rule)\n * @returns Array of AFS entries\n */\n project(externalData: unknown, context: ProjectionContext): AFSEntry[];\n\n /**\n * Execute mutation operation\n * @param path AFS path\n * @param action Mutation type\n * @param payload Operation parameters\n */\n mutate(path: string, action: MutateAction, payload: unknown): Promise<MutateResult>;\n}\n\n/**\n * Type guard to check if a module implements World Mapping capability\n *\n * @example\n * ```typescript\n * if (isWorldMappingCapable(provider)) {\n * await provider.loadMapping(\"/config/mapping/github.yaml\");\n * }\n * ```\n */\nexport function isWorldMappingCapable(\n module: AFSModule | null | undefined,\n): module is AFSModule & AFSWorldMappingCapable {\n if (!module) return false;\n\n const m = module as unknown as Partial<AFSWorldMappingCapable>;\n return (\n typeof m.loadMapping === \"function\" &&\n typeof m.reloadMapping === \"function\" &&\n typeof m.getMappingStatus === \"function\" &&\n typeof m.resolve === \"function\" &&\n typeof m.project === \"function\" &&\n typeof m.mutate === \"function\"\n );\n}\n"],"mappings":";;;;;;;;;;;AAgKA,SAAgB,sBACd,QAC8C;AAC9C,KAAI,CAAC,OAAQ,QAAO;CAEpB,MAAM,IAAI;AACV,QACE,OAAO,EAAE,gBAAgB,cACzB,OAAO,EAAE,kBAAkB,cAC3B,OAAO,EAAE,qBAAqB,cAC9B,OAAO,EAAE,YAAY,cACrB,OAAO,EAAE,YAAY,cACrB,OAAO,EAAE,WAAW"}
package/dist/error.cjs ADDED
@@ -0,0 +1,63 @@
1
+
2
+ //#region src/error.ts
3
+ /**
4
+ * Base error class for all AFS errors.
5
+ */
6
+ var AFSError = class extends Error {
7
+ code;
8
+ constructor(message, code) {
9
+ super(message);
10
+ this.name = "AFSError";
11
+ this.code = code;
12
+ }
13
+ };
14
+ /**
15
+ * Error thrown when attempting write operations on a readonly AFS or module.
16
+ */
17
+ var AFSReadonlyError = class extends AFSError {
18
+ constructor(message) {
19
+ super(message, "AFS_READONLY");
20
+ this.name = "AFSReadonlyError";
21
+ }
22
+ };
23
+ /**
24
+ * Error thrown when a path does not exist.
25
+ */
26
+ var AFSNotFoundError = class extends AFSError {
27
+ path;
28
+ constructor(path, message) {
29
+ super(message || `Path not found: ${path}`, "AFS_NOT_FOUND");
30
+ this.name = "AFSNotFoundError";
31
+ this.path = path;
32
+ }
33
+ };
34
+ /**
35
+ * Error thrown when input validation fails.
36
+ * Used by AFS Core to validate exec inputs against inputSchema.
37
+ */
38
+ var AFSValidationError = class extends AFSError {
39
+ constructor(message) {
40
+ super(message, "AFS_VALIDATION_ERROR");
41
+ this.name = "AFSValidationError";
42
+ }
43
+ };
44
+ /**
45
+ * Error thrown when provider mount check fails.
46
+ */
47
+ var AFSMountError = class extends AFSError {
48
+ providerName;
49
+ step;
50
+ constructor(providerName, step, message) {
51
+ super(`Mount check failed for ${providerName} at ${step}: ${message}`, "AFS_MOUNT_FAILED");
52
+ this.name = "AFSMountError";
53
+ this.providerName = providerName;
54
+ this.step = step;
55
+ }
56
+ };
57
+
58
+ //#endregion
59
+ exports.AFSError = AFSError;
60
+ exports.AFSMountError = AFSMountError;
61
+ exports.AFSNotFoundError = AFSNotFoundError;
62
+ exports.AFSReadonlyError = AFSReadonlyError;
63
+ exports.AFSValidationError = AFSValidationError;
@@ -0,0 +1,39 @@
1
+ //#region src/error.d.ts
2
+ /**
3
+ * Base error class for all AFS errors.
4
+ */
5
+ declare class AFSError extends Error {
6
+ readonly code: string;
7
+ constructor(message: string, code: string);
8
+ }
9
+ /**
10
+ * Error thrown when attempting write operations on a readonly AFS or module.
11
+ */
12
+ declare class AFSReadonlyError extends AFSError {
13
+ constructor(message: string);
14
+ }
15
+ /**
16
+ * Error thrown when a path does not exist.
17
+ */
18
+ declare class AFSNotFoundError extends AFSError {
19
+ readonly path: string;
20
+ constructor(path: string, message?: string);
21
+ }
22
+ /**
23
+ * Error thrown when input validation fails.
24
+ * Used by AFS Core to validate exec inputs against inputSchema.
25
+ */
26
+ declare class AFSValidationError extends AFSError {
27
+ constructor(message: string);
28
+ }
29
+ /**
30
+ * Error thrown when provider mount check fails.
31
+ */
32
+ declare class AFSMountError extends AFSError {
33
+ readonly providerName: string;
34
+ readonly step: "stat" | "read" | "list";
35
+ constructor(providerName: string, step: AFSMountError["step"], message: string);
36
+ }
37
+ //#endregion
38
+ export { AFSError, AFSMountError, AFSNotFoundError, AFSReadonlyError, AFSValidationError };
39
+ //# sourceMappingURL=error.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.cts","names":[],"sources":["../src/error.ts"],"mappings":";;AAGA;;cAAa,QAAA,SAAiB,KAAA;EAAA,SACnB,IAAA;cAEG,OAAA,UAAiB,IAAA;AAAA;;;;cAUlB,gBAAA,SAAyB,QAAA;cACxB,OAAA;AAAA;;;;cASD,gBAAA,SAAyB,QAAA;EAAA,SAC3B,IAAA;cAEG,IAAA,UAAc,OAAA;AAAA;;AAH5B;;;cAca,kBAAA,SAA2B,QAAA;cAC1B,OAAA;AAAA;;;;cASD,aAAA,SAAsB,QAAA;EAAA,SACxB,YAAA;EAAA,SACA,IAAA;cAEG,YAAA,UAAsB,IAAA,EAAM,aAAA,UAAuB,OAAA;AAAA"}
@@ -0,0 +1,39 @@
1
+ //#region src/error.d.ts
2
+ /**
3
+ * Base error class for all AFS errors.
4
+ */
5
+ declare class AFSError extends Error {
6
+ readonly code: string;
7
+ constructor(message: string, code: string);
8
+ }
9
+ /**
10
+ * Error thrown when attempting write operations on a readonly AFS or module.
11
+ */
12
+ declare class AFSReadonlyError extends AFSError {
13
+ constructor(message: string);
14
+ }
15
+ /**
16
+ * Error thrown when a path does not exist.
17
+ */
18
+ declare class AFSNotFoundError extends AFSError {
19
+ readonly path: string;
20
+ constructor(path: string, message?: string);
21
+ }
22
+ /**
23
+ * Error thrown when input validation fails.
24
+ * Used by AFS Core to validate exec inputs against inputSchema.
25
+ */
26
+ declare class AFSValidationError extends AFSError {
27
+ constructor(message: string);
28
+ }
29
+ /**
30
+ * Error thrown when provider mount check fails.
31
+ */
32
+ declare class AFSMountError extends AFSError {
33
+ readonly providerName: string;
34
+ readonly step: "stat" | "read" | "list";
35
+ constructor(providerName: string, step: AFSMountError["step"], message: string);
36
+ }
37
+ //#endregion
38
+ export { AFSError, AFSMountError, AFSNotFoundError, AFSReadonlyError, AFSValidationError };
39
+ //# sourceMappingURL=error.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.mts","names":[],"sources":["../src/error.ts"],"mappings":";;AAGA;;cAAa,QAAA,SAAiB,KAAA;EAAA,SACnB,IAAA;cAEG,OAAA,UAAiB,IAAA;AAAA;;;;cAUlB,gBAAA,SAAyB,QAAA;cACxB,OAAA;AAAA;;;;cASD,gBAAA,SAAyB,QAAA;EAAA,SAC3B,IAAA;cAEG,IAAA,UAAc,OAAA;AAAA;;AAH5B;;;cAca,kBAAA,SAA2B,QAAA;cAC1B,OAAA;AAAA;;;;cASD,aAAA,SAAsB,QAAA;EAAA,SACxB,YAAA;EAAA,SACA,IAAA;cAEG,YAAA,UAAsB,IAAA,EAAM,aAAA,UAAuB,OAAA;AAAA"}
package/dist/error.mjs ADDED
@@ -0,0 +1,59 @@
1
+ //#region src/error.ts
2
+ /**
3
+ * Base error class for all AFS errors.
4
+ */
5
+ var AFSError = class extends Error {
6
+ code;
7
+ constructor(message, code) {
8
+ super(message);
9
+ this.name = "AFSError";
10
+ this.code = code;
11
+ }
12
+ };
13
+ /**
14
+ * Error thrown when attempting write operations on a readonly AFS or module.
15
+ */
16
+ var AFSReadonlyError = class extends AFSError {
17
+ constructor(message) {
18
+ super(message, "AFS_READONLY");
19
+ this.name = "AFSReadonlyError";
20
+ }
21
+ };
22
+ /**
23
+ * Error thrown when a path does not exist.
24
+ */
25
+ var AFSNotFoundError = class extends AFSError {
26
+ path;
27
+ constructor(path, message) {
28
+ super(message || `Path not found: ${path}`, "AFS_NOT_FOUND");
29
+ this.name = "AFSNotFoundError";
30
+ this.path = path;
31
+ }
32
+ };
33
+ /**
34
+ * Error thrown when input validation fails.
35
+ * Used by AFS Core to validate exec inputs against inputSchema.
36
+ */
37
+ var AFSValidationError = class extends AFSError {
38
+ constructor(message) {
39
+ super(message, "AFS_VALIDATION_ERROR");
40
+ this.name = "AFSValidationError";
41
+ }
42
+ };
43
+ /**
44
+ * Error thrown when provider mount check fails.
45
+ */
46
+ var AFSMountError = class extends AFSError {
47
+ providerName;
48
+ step;
49
+ constructor(providerName, step, message) {
50
+ super(`Mount check failed for ${providerName} at ${step}: ${message}`, "AFS_MOUNT_FAILED");
51
+ this.name = "AFSMountError";
52
+ this.providerName = providerName;
53
+ this.step = step;
54
+ }
55
+ };
56
+
57
+ //#endregion
58
+ export { AFSError, AFSMountError, AFSNotFoundError, AFSReadonlyError, AFSValidationError };
59
+ //# sourceMappingURL=error.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.mjs","names":[],"sources":["../src/error.ts"],"sourcesContent":["/**\n * Base error class for all AFS errors.\n */\nexport class AFSError extends Error {\n readonly code: string;\n\n constructor(message: string, code: string) {\n super(message);\n this.name = \"AFSError\";\n this.code = code;\n }\n}\n\n/**\n * Error thrown when attempting write operations on a readonly AFS or module.\n */\nexport class AFSReadonlyError extends AFSError {\n constructor(message: string) {\n super(message, \"AFS_READONLY\");\n this.name = \"AFSReadonlyError\";\n }\n}\n\n/**\n * Error thrown when a path does not exist.\n */\nexport class AFSNotFoundError extends AFSError {\n readonly path: string;\n\n constructor(path: string, message?: string) {\n super(message || `Path not found: ${path}`, \"AFS_NOT_FOUND\");\n this.name = \"AFSNotFoundError\";\n this.path = path;\n }\n}\n\n/**\n * Error thrown when input validation fails.\n * Used by AFS Core to validate exec inputs against inputSchema.\n */\nexport class AFSValidationError extends AFSError {\n constructor(message: string) {\n super(message, \"AFS_VALIDATION_ERROR\");\n this.name = \"AFSValidationError\";\n }\n}\n\n/**\n * Error thrown when provider mount check fails.\n */\nexport class AFSMountError extends AFSError {\n readonly providerName: string;\n readonly step: \"stat\" | \"read\" | \"list\";\n\n constructor(providerName: string, step: AFSMountError[\"step\"], message: string) {\n super(`Mount check failed for ${providerName} at ${step}: ${message}`, \"AFS_MOUNT_FAILED\");\n this.name = \"AFSMountError\";\n this.providerName = providerName;\n this.step = step;\n }\n}\n"],"mappings":";;;;AAGA,IAAa,WAAb,cAA8B,MAAM;CAClC,AAAS;CAET,YAAY,SAAiB,MAAc;AACzC,QAAM,QAAQ;AACd,OAAK,OAAO;AACZ,OAAK,OAAO;;;;;;AAOhB,IAAa,mBAAb,cAAsC,SAAS;CAC7C,YAAY,SAAiB;AAC3B,QAAM,SAAS,eAAe;AAC9B,OAAK,OAAO;;;;;;AAOhB,IAAa,mBAAb,cAAsC,SAAS;CAC7C,AAAS;CAET,YAAY,MAAc,SAAkB;AAC1C,QAAM,WAAW,mBAAmB,QAAQ,gBAAgB;AAC5D,OAAK,OAAO;AACZ,OAAK,OAAO;;;;;;;AAQhB,IAAa,qBAAb,cAAwC,SAAS;CAC/C,YAAY,SAAiB;AAC3B,QAAM,SAAS,uBAAuB;AACtC,OAAK,OAAO;;;;;;AAOhB,IAAa,gBAAb,cAAmC,SAAS;CAC1C,AAAS;CACT,AAAS;CAET,YAAY,cAAsB,MAA6B,SAAiB;AAC9E,QAAM,0BAA0B,aAAa,MAAM,KAAK,IAAI,WAAW,mBAAmB;AAC1F,OAAK,OAAO;AACZ,OAAK,eAAe;AACpB,OAAK,OAAO"}