apcore-js 0.4.0 → 0.6.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.
Files changed (306) hide show
  1. package/dist/acl.d.ts +27 -0
  2. package/dist/acl.d.ts.map +1 -0
  3. package/dist/acl.js +175 -0
  4. package/dist/acl.js.map +1 -0
  5. package/dist/async-task.d.ts +90 -0
  6. package/dist/async-task.d.ts.map +1 -0
  7. package/dist/async-task.js +215 -0
  8. package/dist/async-task.js.map +1 -0
  9. package/dist/bindings.d.ts +12 -0
  10. package/dist/bindings.d.ts.map +1 -0
  11. package/dist/bindings.js +185 -0
  12. package/dist/bindings.js.map +1 -0
  13. package/dist/cancel.d.ts +14 -0
  14. package/dist/cancel.d.ts.map +1 -0
  15. package/dist/cancel.js +27 -0
  16. package/dist/cancel.js.map +1 -0
  17. package/dist/config.d.ts +9 -0
  18. package/dist/config.d.ts.map +1 -0
  19. package/dist/config.js +23 -0
  20. package/dist/config.js.map +1 -0
  21. package/dist/context.d.ts +50 -0
  22. package/dist/context.d.ts.map +1 -0
  23. package/dist/context.js +87 -0
  24. package/dist/context.js.map +1 -0
  25. package/dist/decorator.d.ts +57 -0
  26. package/dist/decorator.d.ts.map +1 -0
  27. package/dist/decorator.js +74 -0
  28. package/dist/decorator.js.map +1 -0
  29. package/dist/errors.d.ts +215 -0
  30. package/dist/errors.d.ts.map +1 -0
  31. package/dist/errors.js +246 -0
  32. package/dist/errors.js.map +1 -0
  33. package/dist/executor.d.ts +67 -0
  34. package/dist/executor.d.ts.map +1 -0
  35. package/dist/executor.js +372 -0
  36. package/dist/executor.js.map +1 -0
  37. package/dist/extensions.d.ts +58 -0
  38. package/dist/extensions.d.ts.map +1 -0
  39. package/dist/extensions.js +220 -0
  40. package/dist/extensions.js.map +1 -0
  41. package/{src/index.ts → dist/index.d.ts} +14 -59
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +43 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/middleware/adapters.d.ts +18 -0
  46. package/dist/middleware/adapters.d.ts.map +1 -0
  47. package/dist/middleware/adapters.js +25 -0
  48. package/dist/middleware/adapters.js.map +1 -0
  49. package/dist/middleware/base.d.ts +10 -0
  50. package/dist/middleware/base.d.ts.map +1 -0
  51. package/dist/middleware/base.js +15 -0
  52. package/dist/middleware/base.js.map +1 -0
  53. package/{src/middleware/index.ts → dist/middleware/index.d.ts} +1 -0
  54. package/dist/middleware/index.d.ts.map +1 -0
  55. package/dist/middleware/index.js +5 -0
  56. package/dist/middleware/index.js.map +1 -0
  57. package/dist/middleware/logging.d.ts +25 -0
  58. package/dist/middleware/logging.d.ts.map +1 -0
  59. package/dist/middleware/logging.js +64 -0
  60. package/dist/middleware/logging.js.map +1 -0
  61. package/dist/middleware/manager.d.ts +21 -0
  62. package/dist/middleware/manager.d.ts.map +1 -0
  63. package/dist/middleware/manager.js +77 -0
  64. package/dist/middleware/manager.js.map +1 -0
  65. package/dist/module.d.ts +31 -0
  66. package/dist/module.d.ts.map +1 -0
  67. package/dist/module.js +12 -0
  68. package/dist/module.js.map +1 -0
  69. package/dist/observability/context-logger.d.ts +54 -0
  70. package/dist/observability/context-logger.d.ts.map +1 -0
  71. package/dist/observability/context-logger.js +151 -0
  72. package/dist/observability/context-logger.js.map +1 -0
  73. package/{src/observability/index.ts → dist/observability/index.d.ts} +1 -0
  74. package/dist/observability/index.d.ts.map +1 -0
  75. package/dist/observability/index.js +4 -0
  76. package/dist/observability/index.js.map +1 -0
  77. package/dist/observability/metrics.d.ts +30 -0
  78. package/dist/observability/metrics.d.ts.map +1 -0
  79. package/dist/observability/metrics.js +177 -0
  80. package/dist/observability/metrics.js.map +1 -0
  81. package/dist/observability/tracing.d.ts +62 -0
  82. package/dist/observability/tracing.d.ts.map +1 -0
  83. package/dist/observability/tracing.js +184 -0
  84. package/dist/observability/tracing.js.map +1 -0
  85. package/dist/registry/dependencies.d.ts +6 -0
  86. package/dist/registry/dependencies.d.ts.map +1 -0
  87. package/dist/registry/dependencies.js +83 -0
  88. package/dist/registry/dependencies.js.map +1 -0
  89. package/dist/registry/entry-point.d.ts +6 -0
  90. package/dist/registry/entry-point.d.ts.map +1 -0
  91. package/dist/registry/entry-point.js +55 -0
  92. package/dist/registry/entry-point.js.map +1 -0
  93. package/{src/registry/index.ts → dist/registry/index.d.ts} +2 -0
  94. package/dist/registry/index.d.ts.map +1 -0
  95. package/dist/registry/index.js +8 -0
  96. package/dist/registry/index.js.map +1 -0
  97. package/dist/registry/metadata.d.ts +9 -0
  98. package/dist/registry/metadata.d.ts.map +1 -0
  99. package/dist/registry/metadata.js +105 -0
  100. package/dist/registry/metadata.js.map +1 -0
  101. package/dist/registry/registry.d.ts +102 -0
  102. package/dist/registry/registry.d.ts.map +1 -0
  103. package/dist/registry/registry.js +534 -0
  104. package/dist/registry/registry.js.map +1 -0
  105. package/dist/registry/scanner.d.ts +7 -0
  106. package/dist/registry/scanner.d.ts.map +1 -0
  107. package/dist/registry/scanner.js +164 -0
  108. package/dist/registry/scanner.js.map +1 -0
  109. package/dist/registry/schema-export.d.ts +9 -0
  110. package/dist/registry/schema-export.d.ts.map +1 -0
  111. package/dist/registry/schema-export.js +132 -0
  112. package/dist/registry/schema-export.js.map +1 -0
  113. package/dist/registry/types.d.ts +29 -0
  114. package/dist/registry/types.d.ts.map +1 -0
  115. package/dist/registry/types.js +5 -0
  116. package/dist/registry/types.js.map +1 -0
  117. package/dist/registry/validation.d.ts +9 -0
  118. package/dist/registry/validation.d.ts.map +1 -0
  119. package/dist/registry/validation.js +33 -0
  120. package/dist/registry/validation.js.map +1 -0
  121. package/dist/schema/annotations.d.ts +8 -0
  122. package/dist/schema/annotations.d.ts.map +1 -0
  123. package/dist/schema/annotations.js +52 -0
  124. package/dist/schema/annotations.js.map +1 -0
  125. package/dist/schema/exporter.d.ts +13 -0
  126. package/dist/schema/exporter.d.ts.map +1 -0
  127. package/dist/schema/exporter.js +71 -0
  128. package/dist/schema/exporter.js.map +1 -0
  129. package/dist/schema/index.d.ts +9 -0
  130. package/dist/schema/index.d.ts.map +1 -0
  131. package/{src/schema/index.ts → dist/schema/index.js} +1 -7
  132. package/dist/schema/index.js.map +1 -0
  133. package/dist/schema/loader.d.ts +30 -0
  134. package/dist/schema/loader.d.ts.map +1 -0
  135. package/dist/schema/loader.js +260 -0
  136. package/dist/schema/loader.js.map +1 -0
  137. package/dist/schema/ref-resolver.d.ts +19 -0
  138. package/dist/schema/ref-resolver.d.ts.map +1 -0
  139. package/dist/schema/ref-resolver.js +212 -0
  140. package/dist/schema/ref-resolver.js.map +1 -0
  141. package/dist/schema/strict.d.ts +7 -0
  142. package/dist/schema/strict.d.ts.map +1 -0
  143. package/dist/schema/strict.js +127 -0
  144. package/dist/schema/strict.js.map +1 -0
  145. package/dist/schema/types.d.ts +53 -0
  146. package/dist/schema/types.d.ts.map +1 -0
  147. package/dist/schema/types.js +31 -0
  148. package/dist/schema/types.js.map +1 -0
  149. package/dist/schema/validator.d.ts +16 -0
  150. package/dist/schema/validator.d.ts.map +1 -0
  151. package/dist/schema/validator.js +71 -0
  152. package/dist/schema/validator.js.map +1 -0
  153. package/dist/trace-context.d.ts +35 -0
  154. package/dist/trace-context.d.ts.map +1 -0
  155. package/dist/trace-context.js +86 -0
  156. package/dist/trace-context.js.map +1 -0
  157. package/dist/utils/index.d.ts +11 -0
  158. package/dist/utils/index.d.ts.map +1 -0
  159. package/dist/utils/index.js +32 -0
  160. package/dist/utils/index.js.map +1 -0
  161. package/dist/utils/pattern.d.ts +5 -0
  162. package/dist/utils/pattern.d.ts.map +1 -0
  163. package/dist/utils/pattern.js +31 -0
  164. package/dist/utils/pattern.js.map +1 -0
  165. package/package.json +8 -2
  166. package/.claude/settings.local.json +0 -12
  167. package/.github/workflows/ci.yml +0 -39
  168. package/.gitmessage +0 -60
  169. package/.pre-commit-config.yaml +0 -28
  170. package/CHANGELOG.md +0 -183
  171. package/CLAUDE.md +0 -68
  172. package/apcore-logo.svg +0 -79
  173. package/planning/acl-system/overview.md +0 -54
  174. package/planning/acl-system/plan.md +0 -92
  175. package/planning/acl-system/state.json +0 -76
  176. package/planning/acl-system/tasks/acl-core.md +0 -226
  177. package/planning/acl-system/tasks/acl-rule.md +0 -92
  178. package/planning/acl-system/tasks/conditional-rules.md +0 -259
  179. package/planning/acl-system/tasks/pattern-matching.md +0 -152
  180. package/planning/acl-system/tasks/yaml-loading.md +0 -271
  181. package/planning/core-executor/overview.md +0 -53
  182. package/planning/core-executor/plan.md +0 -88
  183. package/planning/core-executor/state.json +0 -76
  184. package/planning/core-executor/tasks/async-support.md +0 -106
  185. package/planning/core-executor/tasks/execution-pipeline.md +0 -113
  186. package/planning/core-executor/tasks/redaction.md +0 -85
  187. package/planning/core-executor/tasks/safety-checks.md +0 -65
  188. package/planning/core-executor/tasks/setup.md +0 -75
  189. package/planning/decorator-bindings/overview.md +0 -62
  190. package/planning/decorator-bindings/plan.md +0 -104
  191. package/planning/decorator-bindings/state.json +0 -87
  192. package/planning/decorator-bindings/tasks/binding-directory.md +0 -79
  193. package/planning/decorator-bindings/tasks/binding-loader.md +0 -148
  194. package/planning/decorator-bindings/tasks/explicit-schemas.md +0 -85
  195. package/planning/decorator-bindings/tasks/function-module.md +0 -127
  196. package/planning/decorator-bindings/tasks/module-factory.md +0 -89
  197. package/planning/decorator-bindings/tasks/schema-modes.md +0 -142
  198. package/planning/middleware-system/overview.md +0 -48
  199. package/planning/middleware-system/plan.md +0 -102
  200. package/planning/middleware-system/state.json +0 -65
  201. package/planning/middleware-system/tasks/adapters.md +0 -170
  202. package/planning/middleware-system/tasks/base.md +0 -115
  203. package/planning/middleware-system/tasks/logging-middleware.md +0 -304
  204. package/planning/middleware-system/tasks/manager.md +0 -313
  205. package/planning/observability/overview.md +0 -53
  206. package/planning/observability/plan.md +0 -119
  207. package/planning/observability/state.json +0 -98
  208. package/planning/observability/tasks/context-logger.md +0 -201
  209. package/planning/observability/tasks/exporters.md +0 -121
  210. package/planning/observability/tasks/metrics-collector.md +0 -162
  211. package/planning/observability/tasks/metrics-middleware.md +0 -141
  212. package/planning/observability/tasks/obs-logging-middleware.md +0 -179
  213. package/planning/observability/tasks/span-model.md +0 -120
  214. package/planning/observability/tasks/tracing-middleware.md +0 -179
  215. package/planning/overview.md +0 -81
  216. package/planning/registry-system/overview.md +0 -57
  217. package/planning/registry-system/plan.md +0 -114
  218. package/planning/registry-system/state.json +0 -109
  219. package/planning/registry-system/tasks/dependencies.md +0 -157
  220. package/planning/registry-system/tasks/entry-point.md +0 -148
  221. package/planning/registry-system/tasks/metadata.md +0 -198
  222. package/planning/registry-system/tasks/registry-core.md +0 -323
  223. package/planning/registry-system/tasks/scanner.md +0 -172
  224. package/planning/registry-system/tasks/schema-export.md +0 -261
  225. package/planning/registry-system/tasks/types.md +0 -124
  226. package/planning/registry-system/tasks/validation.md +0 -177
  227. package/planning/schema-system/overview.md +0 -56
  228. package/planning/schema-system/plan.md +0 -121
  229. package/planning/schema-system/state.json +0 -98
  230. package/planning/schema-system/tasks/exporter.md +0 -153
  231. package/planning/schema-system/tasks/loader.md +0 -106
  232. package/planning/schema-system/tasks/ref-resolver.md +0 -133
  233. package/planning/schema-system/tasks/strict-mode.md +0 -140
  234. package/planning/schema-system/tasks/typebox-generation.md +0 -133
  235. package/planning/schema-system/tasks/types-and-annotations.md +0 -160
  236. package/planning/schema-system/tasks/validator.md +0 -149
  237. package/src/acl.ts +0 -200
  238. package/src/bindings.ts +0 -207
  239. package/src/config.ts +0 -24
  240. package/src/context.ts +0 -78
  241. package/src/decorator.ts +0 -110
  242. package/src/errors.ts +0 -425
  243. package/src/executor.ts +0 -475
  244. package/src/middleware/adapters.ts +0 -54
  245. package/src/middleware/base.ts +0 -33
  246. package/src/middleware/logging.ts +0 -103
  247. package/src/middleware/manager.ts +0 -105
  248. package/src/module.ts +0 -43
  249. package/src/observability/context-logger.ts +0 -203
  250. package/src/observability/metrics.ts +0 -214
  251. package/src/observability/tracing.ts +0 -188
  252. package/src/registry/dependencies.ts +0 -99
  253. package/src/registry/entry-point.ts +0 -64
  254. package/src/registry/metadata.ts +0 -111
  255. package/src/registry/registry.ts +0 -360
  256. package/src/registry/scanner.ts +0 -168
  257. package/src/registry/schema-export.ts +0 -181
  258. package/src/registry/types.ts +0 -32
  259. package/src/registry/validation.ts +0 -38
  260. package/src/schema/annotations.ts +0 -68
  261. package/src/schema/exporter.ts +0 -90
  262. package/src/schema/loader.ts +0 -273
  263. package/src/schema/ref-resolver.ts +0 -244
  264. package/src/schema/strict.ts +0 -136
  265. package/src/schema/types.ts +0 -73
  266. package/src/schema/validator.ts +0 -82
  267. package/src/utils/index.ts +0 -5
  268. package/src/utils/pattern.ts +0 -30
  269. package/tests/helpers.ts +0 -30
  270. package/tests/integration/test-acl-safety.test.ts +0 -269
  271. package/tests/integration/test-binding-executor.test.ts +0 -194
  272. package/tests/integration/test-e2e-flow.test.ts +0 -117
  273. package/tests/integration/test-error-propagation.test.ts +0 -259
  274. package/tests/integration/test-middleware-chain.test.ts +0 -120
  275. package/tests/integration/test-observability-integration.test.ts +0 -438
  276. package/tests/observability/test-context-logger.test.ts +0 -123
  277. package/tests/observability/test-metrics.test.ts +0 -186
  278. package/tests/observability/test-tracing.test.ts +0 -131
  279. package/tests/registry/test-dependencies.test.ts +0 -70
  280. package/tests/registry/test-entry-point.test.ts +0 -133
  281. package/tests/registry/test-metadata.test.ts +0 -265
  282. package/tests/registry/test-registry.test.ts +0 -1008
  283. package/tests/registry/test-scanner.test.ts +0 -257
  284. package/tests/registry/test-schema-export.test.ts +0 -355
  285. package/tests/registry/test-validation.test.ts +0 -75
  286. package/tests/schema/test-annotations.test.ts +0 -137
  287. package/tests/schema/test-exporter.test.ts +0 -172
  288. package/tests/schema/test-loader.test.ts +0 -461
  289. package/tests/schema/test-ref-resolver.test.ts +0 -530
  290. package/tests/schema/test-strict.test.ts +0 -348
  291. package/tests/schema/test-validator.test.ts +0 -64
  292. package/tests/test-acl.test.ts +0 -423
  293. package/tests/test-bindings.test.ts +0 -227
  294. package/tests/test-config.test.ts +0 -76
  295. package/tests/test-context.test.ts +0 -151
  296. package/tests/test-decorator.test.ts +0 -173
  297. package/tests/test-errors.test.ts +0 -647
  298. package/tests/test-executor-stream.test.ts +0 -208
  299. package/tests/test-executor.test.ts +0 -252
  300. package/tests/test-logging-middleware.test.ts +0 -150
  301. package/tests/test-middleware-manager.test.ts +0 -185
  302. package/tests/test-middleware.test.ts +0 -86
  303. package/tests/utils/test-pattern.test.ts +0 -109
  304. package/tsconfig.build.json +0 -8
  305. package/tsconfig.json +0 -20
  306. package/vitest.config.ts +0 -18
package/.gitmessage DELETED
@@ -1,60 +0,0 @@
1
- # <type>(<scope>): <subject>
2
- #
3
- # <body>
4
- #
5
- # <footer>
6
-
7
- # Type must be one of the following:
8
- # feat: A new feature
9
- # fix: A bug fix
10
- # docs: Documentation only changes
11
- # style: Changes that do not affect the meaning of the code
12
- # refactor: A code change that neither fixes a bug nor adds a feature
13
- # perf: A code change that improves performance
14
- # test: Adding missing tests or correcting existing tests
15
- # chore: Changes to the build process or auxiliary tools
16
- # ci: Changes to CI configuration files and scripts
17
-
18
- # Scope is optional and can be anything specifying the place of the commit change.
19
- # Examples: api, core, storage, cli, stdio, etc.
20
-
21
- # Subject should be:
22
- # - Use imperative, present tense: "change" not "changed" nor "changes"
23
- # - Don't capitalize first letter
24
- # - No dot (.) at the end
25
- # - Maximum 72 characters
26
-
27
- # Body should include:
28
- # - Motivation for the change and contrast with previous behavior
29
- # - What changed and why
30
- # - Any breaking changes
31
-
32
- # Footer should contain:
33
- # - Breaking changes (start with BREAKING CHANGE:)
34
- # - Issue references (Closes #123, Fixes #456)
35
-
36
- # Examples:
37
- # feat(stdio): add stdio executor for process execution
38
- #
39
- # Implement a new stdio executor that allows executing system commands
40
- # and processes via stdin/stdout communication, similar to MCP stdio
41
- # transport mode. This enables flexible task execution through shell
42
- # commands and Python scripts.
43
- #
44
- # - Add StdioExecutor class with command execution support
45
- # - Add system resource monitoring (CPU, memory, disk)
46
- # - Support async process communication
47
- # - Add comprehensive error handling and logging
48
- #
49
- # Closes #123
50
-
51
- # refactor(core): extract shared types to core.types module
52
- #
53
- # Move common type definitions from various modules to a centralized
54
- # core.types module to avoid circular dependencies and improve code
55
- # organization.
56
- #
57
- # - Add TaskPreHook and TaskPostHook type aliases
58
- # - Move TaskStatus enum to core.types
59
- # - Update imports across affected modules
60
-
@@ -1,28 +0,0 @@
1
- repos:
2
-
3
- # apdev-js hooks
4
- - repo: local
5
- hooks:
6
- - id: check-chars
7
- name: apdev-js check-chars
8
- entry: npx apdev-js check-chars
9
- language: system
10
- types_or: [text, ts, javascript]
11
-
12
- - id: check-imports
13
- name: apdev-js check-imports
14
- entry: npx apdev-js check-imports --package apcore-js
15
- language: system
16
- pass_filenames: false
17
- always_run: true
18
-
19
- # TypeScript type checking
20
- - repo: local
21
- hooks:
22
- - id: typecheck
23
- name: tsc --noEmit
24
- entry: npx tsc --noEmit
25
- language: system
26
- pass_filenames: false
27
- always_run: true
28
- files: \.(ts|tsx)$
package/CHANGELOG.md DELETED
@@ -1,183 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [0.4.0] - 2026-02-22
9
-
10
- ### Changed
11
- - Improved performance of `Executor.stream()` with optimized buffering.
12
-
13
- ### Added
14
- - Introduced `ModuleAnnotations.batchProcessing` for enhanced batch processing capabilities.
15
- - Added new logging features for better observability in the execution pipeline.
16
-
17
- ### Fixed
18
- - Resolved issues with error handling in `context.ts`.
19
-
20
- ### Co-Authors
21
- - Claude Opus 4.6 <noreply@anthropic.com>
22
- - New Contributor <newcontributor@example.com>
23
-
24
- ### Added
25
-
26
- - **Error classes and constants**
27
- - `ModuleExecuteError` — New error class for module execution failures
28
- - `InternalError` — New error class for general internal errors
29
- - `ErrorCodes` — Frozen object with all 26 error code strings for consistent error code usage
30
- - `ErrorCode` — Type definition for all error codes
31
- - **Registry constants**
32
- - `REGISTRY_EVENTS` — Frozen object with standard event names (`register`, `unregister`)
33
- - `MODULE_ID_PATTERN` — Regex pattern enforcing lowercase/digits/underscores/dots for module IDs (no hyphens allowed to ensure bijective MCP tool name normalization)
34
- - **Executor methods**
35
- - `Executor.callAsync()` — Alias for `call()` for compatibility with MCP bridge packages
36
-
37
- ### Changed
38
-
39
- - **Module ID validation** — Registry now validates module IDs against `MODULE_ID_PATTERN` on registration, rejecting IDs with hyphens or invalid characters
40
- - **Event handling** — Registry event validation now uses `REGISTRY_EVENTS` constants instead of hardcoded strings
41
- - **Test updates** — Updated tests to use underscore-separated module IDs instead of hyphens (e.g., `math.add_ten` instead of `math.addTen`, `ctx_test` instead of `ctx-test`)
42
-
43
- ### Fixed
44
-
45
- - **String literals in Registry** — Replaced hardcoded `'register'` and `'unregister'` strings with `REGISTRY_EVENTS.REGISTER` and `REGISTRY_EVENTS.UNREGISTER` constants in event triggers for consistency
46
-
47
- ## [0.3.0] - 2026-02-20
48
-
49
- ### Changed
50
- - Use shallow merge for `stream()` accumulation instead of last-chunk.
51
-
52
- ### Added
53
- - Add `Executor.stream()` async generator and `ModuleAnnotations.streaming` for streaming support in the core execution pipeline.
54
-
55
- ### Co-Authors
56
- - Claude Opus 4.6 <noreply@anthropic.com>
57
-
58
- ### Added
59
-
60
- - **Error classes and constants**
61
- - `ModuleExecuteError` — New error class for module execution failures
62
- - `InternalError` — New error class for general internal errors
63
- - `ErrorCodes` — Frozen object with all 26 error code strings for consistent error code usage
64
- - `ErrorCode` — Type definition for all error codes
65
- - **Registry constants**
66
- - `REGISTRY_EVENTS` — Frozen object with standard event names (`register`, `unregister`)
67
- - `MODULE_ID_PATTERN` — Regex pattern enforcing lowercase/digits/underscores/dots for module IDs (no hyphens allowed to ensure bijective MCP tool name normalization)
68
- - **Executor methods**
69
- - `Executor.callAsync()` — Alias for `call()` for compatibility with MCP bridge packages
70
-
71
- ### Changed
72
-
73
- - **Module ID validation** — Registry now validates module IDs against `MODULE_ID_PATTERN` on registration, rejecting IDs with hyphens or invalid characters
74
- - **Event handling** — Registry event validation now uses `REGISTRY_EVENTS` constants instead of hardcoded strings
75
- - **Test updates** — Updated tests to use underscore-separated module IDs instead of hyphens (e.g., `math.add_ten` instead of `math.addTen`, `ctx_test` instead of `ctx-test`)
76
-
77
- ### Fixed
78
-
79
- - **String literals in Registry** — Replaced hardcoded `'register'` and `'unregister'` strings with `REGISTRY_EVENTS.REGISTER` and `REGISTRY_EVENTS.UNREGISTER` constants in event triggers for consistency
80
-
81
- ## [0.2.0] - 2026-02-20
82
-
83
- ### Added
84
-
85
- - **Error classes and constants**
86
- - `ModuleExecuteError` — New error class for module execution failures
87
- - `InternalError` — New error class for general internal errors
88
- - `ErrorCodes` — Frozen object with all 26 error code strings for consistent error code usage
89
- - `ErrorCode` — Type definition for all error codes
90
- - **Registry constants**
91
- - `REGISTRY_EVENTS` — Frozen object with standard event names (`register`, `unregister`)
92
- - `MODULE_ID_PATTERN` — Regex pattern enforcing lowercase/digits/underscores/dots for module IDs (no hyphens allowed to ensure bijective MCP tool name normalization)
93
- - **Executor methods**
94
- - `Executor.callAsync()` — Alias for `call()` for compatibility with MCP bridge packages
95
-
96
- ### Changed
97
-
98
- - **Module ID validation** — Registry now validates module IDs against `MODULE_ID_PATTERN` on registration, rejecting IDs with hyphens or invalid characters
99
- - **Event handling** — Registry event validation now uses `REGISTRY_EVENTS` constants instead of hardcoded strings
100
- - **Test updates** — Updated tests to use underscore-separated module IDs instead of hyphens (e.g., `math.add_ten` instead of `math.addTen`, `ctx_test` instead of `ctx-test`)
101
-
102
- ### Fixed
103
-
104
- - **String literals in Registry** — Replaced hardcoded `'register'` and `'unregister'` strings with `REGISTRY_EVENTS.REGISTER` and `REGISTRY_EVENTS.UNREGISTER` constants in event triggers for consistency
105
-
106
- ## [0.1.2] - 2026-02-18
107
-
108
- ### Fixed
109
-
110
- - **Timer leak in executor** — `_executeWithTimeout` now calls `clearTimeout` in `.finally()` to prevent timer leak on normal completion
111
- - **Path traversal protection** — `resolveTarget` in binding loader rejects module paths containing `..` segments before dynamic `import()`
112
- - **Bare catch blocks** — 6 silent `catch {}` blocks in registry and middleware manager now log warnings with `[apcore:<subsystem>]` prefix
113
- - **Python-style error messages** — Fixed `FuncMissingTypeHintError` and `FuncMissingReturnTypeError` to use TypeScript syntax (`: string`, `: Record<string, unknown>`)
114
- - **Console.log in production** — Replaced `console.log` with `console.info` in logging middleware and `process.stdout.write` in tracing exporter
115
-
116
- ### Changed
117
-
118
- - **Long method decomposition** — Broke up 4 oversized methods to meet ≤50 line guideline:
119
- - `Executor.call()` (108 → 6 private helpers)
120
- - `Registry.discover()` (110 → 7 private helpers)
121
- - `ACL.load()` (71 → extracted `parseAclRule`)
122
- - `jsonSchemaToTypeBox()` (80 → 5 converter helpers)
123
- - **Deeply readonly callChain** — `Context.callChain` type narrowed from `readonly string[]` to `readonly (readonly string[])` preventing mutation via push/splice
124
- - **Consolidated `deepCopy`** — Removed 4 duplicate `deepCopy` implementations; single shared version now lives in `src/utils/index.ts`
125
-
126
- ### Added
127
-
128
- - **42 new tests** for previously uncovered modules:
129
- - `tests/schema/test-annotations.test.ts` — 16 tests for `mergeAnnotations`, `mergeExamples`, `mergeMetadata`
130
- - `tests/schema/test-exporter.test.ts` — 14 tests for `SchemaExporter` across all 4 export profiles
131
- - `tests/test-logging-middleware.test.ts` — 12 tests for `LoggingMiddleware` before/after/onError
132
-
133
- ## [0.1.1] - 2026-02-17
134
-
135
- ### Fixed
136
-
137
- - Updated logo URL in README
138
-
139
- ### Changed
140
-
141
- - Renamed package from `apcore` to `apcore-js`
142
- - Updated installation instructions
143
-
144
- ## [0.1.0] - 2026-02-16
145
-
146
- ### Added
147
-
148
- - **Core executor** — 10-step async execution pipeline with timeout support via `Promise.race`
149
- - **Context system** — Execution context with trace IDs, call chains, identity, and redacted inputs
150
- - **Config** — Dot-path configuration accessor
151
- - **Registry system**
152
- - File-based module discovery (`scanExtensions`, `scanMultiRoot`)
153
- - Dynamic entry point resolution with duck-type validation
154
- - YAML metadata loading and merging (code values + YAML overrides)
155
- - Dependency parsing with topological sort (Kahn's algorithm) and cycle detection
156
- - ID map support for custom module IDs
157
- - Schema export in JSON/YAML with strict and compact modes
158
- - **FunctionModule** — Schema-driven module wrapper with TypeBox schemas
159
- - **Binding loader** — YAML-based module registration with three schema modes (inline, external ref, permissive fallback)
160
- - **ACL (Access Control List)**
161
- - Pattern-based rules with glob matching
162
- - Identity type and role-based conditions
163
- - Call depth conditions
164
- - Dynamic rule management (`addRule`, `removeRule`, `reload`)
165
- - YAML configuration loading
166
- - **Middleware system**
167
- - Onion-model execution (before forward, after reverse)
168
- - Error recovery via `onError` hooks
169
- - `BeforeMiddleware` and `AfterMiddleware` adapters
170
- - `LoggingMiddleware` for structured execution logging
171
- - **Observability**
172
- - **Tracing** — Span creation, `InMemoryExporter`, `StdoutExporter`, `TracingMiddleware` with sampling strategies (full, off, proportional, error_first)
173
- - **Metrics** — `MetricsCollector` with counters, histograms, Prometheus text format export, `MetricsMiddleware`
174
- - **Logging** — `ContextLogger` with JSON/text formats, level filtering, `_secret_` field redaction, `ObsLoggingMiddleware`
175
- - **Schema system**
176
- - JSON Schema to TypeBox conversion
177
- - `$ref` resolution
178
- - Schema validation
179
- - Strict transforms (`additionalProperties: false`)
180
- - LLM description injection and extension stripping
181
- - **Error hierarchy** — 20+ typed error classes with error codes, details, trace IDs, and timestamps
182
- - **Pattern matching** — Glob-style pattern matching for ACL rules and module targeting
183
- - **Comprehensive test suite** — 385 tests across 29 test files
package/CLAUDE.md DELETED
@@ -1,68 +0,0 @@
1
- # High-Quality Code Specification – Simplicity, Readability, and Maintainability First
2
-
3
- ## Project Overview
4
- The core of `apcore` is **task orchestration and execution specifications**. It provides a unified task orchestration framework that supports execution of multiple task types.
5
-
6
- ## Core Principles
7
- - Prioritize **simplicity, readability, and maintainability** above all.
8
- - Avoid premature abstraction, optimization, or over-engineering.
9
- - Code should be understandable in ≤10 seconds; favor straightforward over clever.
10
- - Always follow: Understand → Plan → Implement minimally → Test/Validate → Commit.
11
-
12
- ## TypeScript Code Quality
13
-
14
- ### Readability
15
- - Use precise, full-word names (standard abbreviations only when conventional).
16
- - Functions ≤50 lines, single responsibility, verb-named.
17
- - Avoid obscure tricks, excessive generics, or unnecessary abstraction layers.
18
- - Break complex logic into small, well-named helpers.
19
-
20
- ### Types (Mandatory)
21
- - Full type annotations on all public APIs and function signatures.
22
- - Avoid `any` except for dynamic/external data; prefer `unknown` with narrowing.
23
- - Prefer `interface` for object shapes, `type` for unions/intersections.
24
- - Use `readonly` for immutable data structures.
25
-
26
- ### Design
27
- - Favor functional style + plain objects; minimize class inheritance.
28
- - Composition > inheritance; use `interface` only for true contracts.
29
- - No circular imports.
30
- - Dependency injection for config, logging, external services, etc.
31
-
32
- ### Errors & Resources
33
- - Explicit error handling; no bare `catch {}` that swallows errors silently.
34
- - Use `try/finally` or equivalent cleanup patterns for resources.
35
- - Validate/sanitize all public inputs.
36
-
37
- ### Logging
38
- - Use `console.warn` for warnings in library code.
39
- - Prefix log messages with `[apcore:<subsystem>]` for traceability.
40
- - No `console.log` in production code paths.
41
-
42
- ### Testing
43
- - Unit tests in `tests/`, ≥90% coverage on core logic.
44
- - Test files named: `test-<unit>.test.ts`.
45
- - Test cases named descriptively: `it('throws X when Y', ...)`.
46
- - Never change production code without updating tests.
47
- - Use `vitest` as test runner.
48
-
49
- ### Build & Checks
50
- - After changes, always run:
51
- - `npx tsc --noEmit` (type checking)
52
- - `npx vitest run` (tests)
53
- - Zero errors before commit.
54
-
55
- ### Module System
56
- - ESM only (`"type": "module"` in package.json).
57
- - All imports must use `.js` extension (NodeNext resolution).
58
- - Use `@sinclair/typebox` for runtime schema definitions.
59
-
60
- ### Security & Performance
61
- - Never hardcode secrets; use env/config.
62
- - Validate/sanitize inputs at system boundaries.
63
- - Avoid unjustified quadratic+ complexity in hot paths.
64
-
65
- ## General Guidelines
66
- - English ONLY for comments, JSDoc, logs, errors, commit messages.
67
- - Fully understand surrounding code before changes.
68
- - Do not generate unnecessary documentation, examples, or stubs unless explicitly requested.
package/apcore-logo.svg DELETED
@@ -1,79 +0,0 @@
1
- <svg width="512" height="512" viewBox="46 70 420 420" xmlns="http://www.w3.org/2000/svg">
2
- <!-- apcore jellyfish logo - cartoon ocean mascot -->
3
-
4
- <defs>
5
- <!-- Bell radial gradient: bright center → deep indigo edge -->
6
- <radialGradient id="bellGrad" cx="50%" cy="45%" r="50%">
7
- <stop offset="0%" stop-color="#818CF8"/>
8
- <stop offset="100%" stop-color="#4338CA"/>
9
- </radialGradient>
10
-
11
- <!-- Bioluminescence glow -->
12
- <radialGradient id="glowGrad" cx="50%" cy="50%" r="50%">
13
- <stop offset="0%" stop-color="#67E8F9" stop-opacity="0.4"/>
14
- <stop offset="100%" stop-color="#67E8F9" stop-opacity="0"/>
15
- </radialGradient>
16
-
17
- <!-- Tentacle gradients (top solid → bottom fade) -->
18
- <linearGradient id="tentGrad1" x1="0" y1="0" x2="0" y2="1">
19
- <stop offset="0%" stop-color="#6366F1"/>
20
- <stop offset="100%" stop-color="#4F46E5" stop-opacity="0"/>
21
- </linearGradient>
22
- <linearGradient id="tentGrad2" x1="0" y1="0" x2="0" y2="1">
23
- <stop offset="0%" stop-color="#818CF8"/>
24
- <stop offset="100%" stop-color="#6366F1" stop-opacity="0"/>
25
- </linearGradient>
26
- </defs>
27
-
28
- <!-- Tentacles (behind bell) - 6 flowing tentacles -->
29
- <!-- Outer left tentacle -->
30
- <path d="M 175,300 C 160,350 145,390 155,430 Q 162,455 150,470"
31
- stroke="url(#tentGrad1)" stroke-width="8" fill="none" stroke-linecap="round"/>
32
- <!-- Inner left tentacle -->
33
- <path d="M 210,310 C 200,360 188,400 195,445 Q 200,465 190,480"
34
- stroke="url(#tentGrad2)" stroke-width="7" fill="none" stroke-linecap="round"/>
35
- <!-- Center left tentacle -->
36
- <path d="M 245,310 C 240,365 235,410 242,455 Q 248,475 240,490"
37
- stroke="url(#tentGrad1)" stroke-width="6" fill="none" stroke-linecap="round"/>
38
- <!-- Center right tentacle -->
39
- <path d="M 267,310 C 272,365 277,410 270,455 Q 264,475 272,490"
40
- stroke="url(#tentGrad1)" stroke-width="6" fill="none" stroke-linecap="round"/>
41
- <!-- Inner right tentacle -->
42
- <path d="M 302,310 C 312,360 324,400 317,445 Q 312,465 322,480"
43
- stroke="url(#tentGrad2)" stroke-width="7" fill="none" stroke-linecap="round"/>
44
- <!-- Outer right tentacle -->
45
- <path d="M 337,300 C 352,350 367,390 357,430 Q 350,455 362,470"
46
- stroke="url(#tentGrad1)" stroke-width="8" fill="none" stroke-linecap="round"/>
47
-
48
- <!-- Bell (dome body) -->
49
- <path d="M 130,290 C 130,150 190,80 256,80 C 322,80 382,150 382,290 Q 382,310 256,310 Q 130,310 130,290 Z"
50
- fill="url(#bellGrad)"/>
51
-
52
- <!-- Bell rim / ruffle -->
53
- <path d="M 130,290 Q 150,318 175,298 Q 200,318 225,298 Q 250,318 268,298 Q 290,318 312,298 Q 335,318 355,298 Q 375,318 382,290"
54
- fill="#4338CA" opacity="0.6"/>
55
-
56
- <!-- Bioluminescence glow overlay -->
57
- <ellipse cx="256" cy="210" rx="100" ry="90" fill="url(#glowGrad)"/>
58
-
59
- <!-- Bell highlight (specular) -->
60
- <ellipse cx="230" cy="160" rx="55" ry="35" fill="#A5B4FC" opacity="0.3"/>
61
-
62
- <!-- Eyes -->
63
- <ellipse cx="222" cy="215" rx="22" ry="24" fill="white"/>
64
- <ellipse cx="290" cy="215" rx="22" ry="24" fill="white"/>
65
- <!-- Pupils -->
66
- <circle cx="228" cy="220" r="13" fill="#1E1B4B"/>
67
- <circle cx="296" cy="220" r="13" fill="#1E1B4B"/>
68
- <!-- Eye highlights -->
69
- <circle cx="233" cy="212" r="6" fill="white"/>
70
- <circle cx="301" cy="212" r="6" fill="white"/>
71
-
72
- <!-- Smile -->
73
- <path d="M 240,252 Q 256,268 272,252"
74
- stroke="#312E81" stroke-width="3.5" fill="none" stroke-linecap="round"/>
75
-
76
- <!-- Cheek blush -->
77
- <ellipse cx="205" cy="242" rx="14" ry="9" fill="#C4B5FD" opacity="0.45"/>
78
- <ellipse cx="307" cy="242" rx="14" ry="9" fill="#C4B5FD" opacity="0.45"/>
79
- </svg>
@@ -1,54 +0,0 @@
1
- # Feature: ACL System
2
-
3
- ## Overview
4
-
5
- The ACL (Access Control List) system provides pattern-based access control for apcore module calls. It evaluates caller-to-target permissions using a first-match-wins strategy over an ordered rule list. Each rule specifies caller patterns, target patterns, an effect (allow/deny), and optional conditions (identity types, roles, call depth). The `ACL` class supports runtime rule mutation (`addRule`, `removeRule`), YAML-based configuration loading via a static `load()` factory, and live `reload()` for configuration hot-swapping. Pattern matching uses a wildcard algorithm (Algorithm A08) that supports `*` globs in module IDs.
6
-
7
- ## Scope
8
-
9
- ### Included
10
-
11
- - `ACLRule` interface defining the structure of access control rules (callers, targets, effect, description, conditions)
12
- - `ACL` class with `check()` for first-match-wins evaluation, `addRule()` for prepending rules, `removeRule()` for removal by caller/target match via `JSON.stringify` comparison
13
- - Static `ACL.load()` factory for loading rules from YAML configuration files with strict validation
14
- - `reload()` method for hot-reloading YAML-based configuration without reconstructing the ACL instance
15
- - `matchPattern()` wildcard utility (Algorithm A08) for glob-style module ID matching
16
- - Special caller tokens: `@external` (null caller substitution), `@system` (identity type check)
17
- - Conditional rule evaluation: `identity_types`, `roles`, `max_call_depth` with AND logic
18
- - Error types: `ACLDeniedError` (thrown by executor on denial), `ACLRuleError` (invalid rules/config), `ConfigNotFoundError` (missing YAML)
19
-
20
- ### Excluded
21
-
22
- - Executor integration (the executor consumes `ACL.check()` as a dependency)
23
- - Thread locking or concurrency guards (Node.js single-threaded event loop eliminates the need)
24
- - Debug logging (identified gap vs. Python implementation; not included in current scope)
25
- - Role or identity management (consumed from `Context.identity`)
26
-
27
- ## Technology Stack
28
-
29
- - **TypeScript 5.5+** with strict mode
30
- - **js-yaml** for YAML configuration parsing
31
- - **Node.js >= 18.0.0** with ES Module support (`node:fs` for file I/O)
32
- - **vitest** for unit and integration testing
33
-
34
- ## Task Execution Order
35
-
36
- | # | Task File | Description | Status |
37
- |---|-----------|-------------|--------|
38
- | 1 | [acl-rule](./tasks/acl-rule.md) | ACLRule interface definition | completed |
39
- | 2 | [acl-core](./tasks/acl-core.md) | ACL class with check(), addRule(), removeRule(), default effect | completed |
40
- | 3 | [pattern-matching](./tasks/pattern-matching.md) | matchPattern() wildcard matching (Algorithm A08) | completed |
41
- | 4 | [yaml-loading](./tasks/yaml-loading.md) | ACL.load() from YAML with strict validation, reload() support | completed |
42
- | 5 | [conditional-rules](./tasks/conditional-rules.md) | _checkConditions() with identity_types, roles, max_call_depth | completed |
43
-
44
- ## Progress
45
-
46
- | Total | Completed | In Progress | Pending |
47
- |-------|-----------|-------------|---------|
48
- | 5 | 5 | 0 | 0 |
49
-
50
- ## Reference Documents
51
-
52
- - `src/acl.ts` -- ACL class and ACLRule interface (~188 lines)
53
- - `src/utils/pattern.ts` -- matchPattern wildcard utility (~30 lines)
54
- - `src/errors.ts` -- ACLDeniedError, ACLRuleError, ConfigNotFoundError
@@ -1,92 +0,0 @@
1
- # Implementation Plan: ACL System
2
-
3
- ## Goal
4
-
5
- Implement a pattern-based access control list that evaluates caller-to-target module permissions using first-match-wins semantics, supporting wildcard patterns, conditional rules, YAML-based configuration, and runtime rule mutation.
6
-
7
- ## Architecture Design
8
-
9
- ### Component Structure
10
-
11
- - **ACL** (`acl.ts`, ~188 lines) -- Main access control class. Holds an ordered array of `ACLRule` objects and a `_defaultEffect` (default `'deny'`). Provides `check(callerId, targetId, context?)` for permission evaluation, `addRule(rule)` to prepend a rule, `removeRule(callers, targets)` to remove by JSON-stringified comparison, and `reload()` for hot-swapping YAML-loaded rules. Static `load(yamlPath)` factory parses and validates YAML configuration files.
12
-
13
- - **ACLRule** (`acl.ts`) -- Interface defining a single access control rule: `callers` (string array of patterns), `targets` (string array of patterns), `effect` (`'allow'` or `'deny'`), `description` (string), and optional `conditions` record. Conditions are evaluated with AND logic across all present keys.
14
-
15
- - **matchPattern** (`utils/pattern.ts`, ~30 lines) -- Standalone wildcard pattern matcher implementing Algorithm A08. Splits the pattern on `*` delimiters and verifies each segment appears in order within the module ID string. Handles edge cases: bare `*` matches everything, no `*` means exact match.
16
-
17
- - **Error Types** (`errors.ts`) -- `ACLDeniedError` (raised by executor when `check()` returns `false`), `ACLRuleError` (invalid rule structure, bad YAML, missing keys), `ConfigNotFoundError` (YAML file does not exist). All extend `ModuleError` base class.
18
-
19
- ### Data Flow
20
-
21
- The `check()` method evaluates permissions through this pipeline:
22
-
23
- 1. **Caller Normalization** -- `null` caller is replaced with `'@external'`
24
- 2. **Rule Snapshot** -- Shallow copy of `_rules` array (safe iteration)
25
- 3. **First-Match-Wins Scan** -- Iterate rules in order:
26
- a. **Caller Pattern Match** -- `rule.callers.some(p => _matchPattern(p, caller, context))`
27
- b. **Target Pattern Match** -- `rule.targets.some(p => _matchPattern(p, target, context))`
28
- c. **Condition Evaluation** -- If `rule.conditions != null`, apply `_checkConditions()`
29
- d. **Effect Return** -- If all checks pass, return `rule.effect === 'allow'`
30
- 4. **Default Effect** -- If no rule matches, return `_defaultEffect === 'allow'`
31
-
32
- Pattern matching handles three special patterns:
33
- - `'@external'` -- Exact match against the `@external` sentinel
34
- - `'@system'` -- Checks `context.identity.type === 'system'`
35
- - Wildcard patterns -- Delegated to `matchPattern()` from `utils/pattern.ts`
36
-
37
- ### Technical Choices and Rationale
38
-
39
- - **First-match-wins over priority scores**: Simpler mental model; rule ordering in YAML is explicit and deterministic. No conflict resolution needed.
40
- - **`JSON.stringify` for rule comparison in `removeRule()`**: Pragmatic approach for comparing string arrays without deep-equal dependencies. Suitable since callers/targets are always `string[]`.
41
- - **No thread locking**: Node.js single-threaded event loop means no concurrent mutation of the rules array. The shallow copy in `check()` guards against mid-iteration `addRule`/`removeRule` calls from synchronous code, but no mutex is needed.
42
- - **Synchronous YAML loading via `readFileSync`**: ACL configuration is loaded at startup or explicit reload. Synchronous I/O is appropriate for initialization-time config loading.
43
- - **AND logic for conditions**: All present condition keys must pass for the rule to match. This provides a restrictive-by-default composition model (conditions narrow access rather than broaden it).
44
- - **No debug logging**: Identified gap vs. Python implementation. The TypeScript ACL omits `debug` flag logging to keep the implementation lean. Can be added later via middleware or observability hooks.
45
-
46
- ## Task Breakdown
47
-
48
- ```mermaid
49
- graph TD
50
- T1[acl-rule] --> T2[acl-core]
51
- T1 --> T5[conditional-rules]
52
- T3[pattern-matching] --> T2
53
- T2 --> T4[yaml-loading]
54
- T5 --> T2
55
- ```
56
-
57
- | Task ID | Title | Estimated Time | Dependencies |
58
- |---------|-------|---------------|--------------|
59
- | acl-rule | ACLRule interface definition | 1h | none |
60
- | acl-core | ACL class with check, addRule, removeRule | 3h | acl-rule, pattern-matching, conditional-rules |
61
- | pattern-matching | matchPattern() wildcard matching (Algorithm A08) | 2h | none |
62
- | yaml-loading | ACL.load() from YAML, reload() support | 2h | acl-core |
63
- | conditional-rules | _checkConditions() with identity_types, roles, max_call_depth | 2h | acl-rule |
64
-
65
- ## Risks and Considerations
66
-
67
- - **Rule ordering sensitivity**: First-match-wins means a broadly-scoped rule placed early can shadow more specific rules. Documentation should emphasize that more specific rules should appear before general rules.
68
- - **`JSON.stringify` ordering dependency**: `removeRule` relies on `JSON.stringify` producing identical output for identical arrays. This holds for simple `string[]` but would break for arrays containing objects with non-deterministic key order. Current usage is safe since callers/targets are always string arrays.
69
- - **Synchronous file I/O in `load()`/`reload()`**: Blocks the event loop during YAML parsing. Acceptable for startup configuration but could be problematic if `reload()` is called frequently with large config files.
70
- - **No validation of condition values at load time**: Condition values (e.g., `identity_types` expected as `string[]`) are validated at match time via type assertions, not at YAML load time. Malformed conditions will only surface when a rule is evaluated.
71
- - **Debug flag exists but is unused**: The `debug` property is declared on the `ACL` class but no logging is wired up, representing a gap from the Python implementation.
72
-
73
- ## Acceptance Criteria
74
-
75
- - [x] `ACLRule` interface defines callers, targets, effect, description, and optional conditions
76
- - [x] `ACL.check()` implements first-match-wins evaluation returning `boolean`
77
- - [x] Null caller is normalized to `'@external'`
78
- - [x] `@system` pattern checks `context.identity.type === 'system'`
79
- - [x] `matchPattern()` handles exact, wildcard, prefix, suffix, and multi-segment patterns
80
- - [x] `ACL.load()` parses YAML, validates structure, and returns configured ACL instance
81
- - [x] `reload()` re-reads YAML and replaces rules in-place; throws `ACLRuleError` if not loaded from YAML
82
- - [x] `addRule()` prepends rules; `removeRule()` finds and removes by JSON-stringified caller/target match
83
- - [x] Conditions (`identity_types`, `roles`, `max_call_depth`) are evaluated with AND logic
84
- - [x] `ACLRuleError` thrown for invalid config structure; `ConfigNotFoundError` for missing YAML files
85
- - [x] All tests pass with `vitest`; zero errors from `tsc --noEmit`
86
-
87
- ## References
88
-
89
- - `src/acl.ts` -- ACL class and ACLRule interface
90
- - `src/utils/pattern.ts` -- matchPattern wildcard utility
91
- - `src/errors.ts` -- ACLDeniedError, ACLRuleError, ConfigNotFoundError
92
- - `src/context.ts` -- Context and Identity types (consumed by ACL)
@@ -1,76 +0,0 @@
1
- {
2
- "feature": "acl-system",
3
- "created": "2026-02-16T00:00:00Z",
4
- "updated": "2026-02-16T00:00:00Z",
5
- "status": "completed",
6
- "execution_order": [
7
- "acl-rule",
8
- "pattern-matching",
9
- "conditional-rules",
10
- "acl-core",
11
- "yaml-loading"
12
- ],
13
- "progress": {
14
- "total_tasks": 5,
15
- "completed": 5,
16
- "in_progress": 0,
17
- "pending": 0
18
- },
19
- "tasks": [
20
- {
21
- "id": "acl-rule",
22
- "file": "tasks/acl-rule.md",
23
- "title": "ACLRule Interface Definition",
24
- "status": "completed",
25
- "started_at": "2026-02-16T08:00:00Z",
26
- "completed_at": "2026-02-16T08:45:00Z",
27
- "assignee": null,
28
- "commits": []
29
- },
30
- {
31
- "id": "pattern-matching",
32
- "file": "tasks/pattern-matching.md",
33
- "title": "matchPattern() Wildcard Matching (Algorithm A08)",
34
- "status": "completed",
35
- "started_at": "2026-02-16T08:45:00Z",
36
- "completed_at": "2026-02-16T10:15:00Z",
37
- "assignee": null,
38
- "commits": []
39
- },
40
- {
41
- "id": "conditional-rules",
42
- "file": "tasks/conditional-rules.md",
43
- "title": "Conditional Rule Evaluation (identity_types, roles, max_call_depth)",
44
- "status": "completed",
45
- "started_at": "2026-02-16T10:15:00Z",
46
- "completed_at": "2026-02-16T11:45:00Z",
47
- "assignee": null,
48
- "commits": []
49
- },
50
- {
51
- "id": "acl-core",
52
- "file": "tasks/acl-core.md",
53
- "title": "ACL Class with check(), addRule(), removeRule()",
54
- "status": "completed",
55
- "started_at": "2026-02-16T11:45:00Z",
56
- "completed_at": "2026-02-16T14:00:00Z",
57
- "assignee": null,
58
- "commits": []
59
- },
60
- {
61
- "id": "yaml-loading",
62
- "file": "tasks/yaml-loading.md",
63
- "title": "ACL.load() from YAML and reload() Support",
64
- "status": "completed",
65
- "started_at": "2026-02-16T14:00:00Z",
66
- "completed_at": "2026-02-16T15:30:00Z",
67
- "assignee": null,
68
- "commits": []
69
- }
70
- ],
71
- "metadata": {
72
- "source_doc": "planning/features/acl-system.md",
73
- "created_by": "code-forge",
74
- "version": "1.0"
75
- }
76
- }