apcore-js 0.15.1 → 0.16.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 (59) hide show
  1. package/README.md +1 -1
  2. package/dist/acl-handlers.d.ts +42 -0
  3. package/dist/acl-handlers.d.ts.map +1 -0
  4. package/dist/acl-handlers.js +128 -0
  5. package/dist/acl-handlers.js.map +1 -0
  6. package/dist/acl.d.ts +11 -0
  7. package/dist/acl.d.ts.map +1 -1
  8. package/dist/acl.js +148 -37
  9. package/dist/acl.js.map +1 -1
  10. package/dist/builtin-steps.d.ts +144 -0
  11. package/dist/builtin-steps.d.ts.map +1 -0
  12. package/dist/builtin-steps.js +582 -0
  13. package/dist/builtin-steps.js.map +1 -0
  14. package/dist/config.d.ts +39 -1
  15. package/dist/config.d.ts.map +1 -1
  16. package/dist/config.js +174 -24
  17. package/dist/config.js.map +1 -1
  18. package/dist/context-key.d.ts +25 -0
  19. package/dist/context-key.d.ts.map +1 -0
  20. package/dist/context-key.js +37 -0
  21. package/dist/context-key.js.map +1 -0
  22. package/dist/context-keys.d.ts +11 -0
  23. package/dist/context-keys.d.ts.map +1 -0
  24. package/dist/context-keys.js +13 -0
  25. package/dist/context-keys.js.map +1 -0
  26. package/dist/context.d.ts +28 -3
  27. package/dist/context.d.ts.map +1 -1
  28. package/dist/context.js +60 -21
  29. package/dist/context.js.map +1 -1
  30. package/dist/errors.d.ts +4 -0
  31. package/dist/errors.d.ts.map +1 -1
  32. package/dist/errors.js +7 -0
  33. package/dist/errors.js.map +1 -1
  34. package/dist/executor.d.ts +24 -0
  35. package/dist/executor.d.ts.map +1 -1
  36. package/dist/executor.js +100 -0
  37. package/dist/executor.js.map +1 -1
  38. package/dist/generated/version.d.ts +1 -1
  39. package/dist/generated/version.js +1 -1
  40. package/dist/index.d.ts +8 -2
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +8 -2
  43. package/dist/index.js.map +1 -1
  44. package/dist/module.d.ts +22 -6
  45. package/dist/module.d.ts.map +1 -1
  46. package/dist/module.js +73 -0
  47. package/dist/module.js.map +1 -1
  48. package/dist/pipeline.d.ts +118 -0
  49. package/dist/pipeline.d.ts.map +1 -0
  50. package/dist/pipeline.js +222 -0
  51. package/dist/pipeline.js.map +1 -0
  52. package/dist/schema/annotations.d.ts.map +1 -1
  53. package/dist/schema/annotations.js +1 -0
  54. package/dist/schema/annotations.js.map +1 -1
  55. package/dist/sys-modules/toggle.d.ts +5 -0
  56. package/dist/sys-modules/toggle.d.ts.map +1 -1
  57. package/dist/sys-modules/toggle.js +5 -0
  58. package/dist/sys-modules/toggle.js.map +1 -1
  59. package/package.json +1 -1
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Built-in pipeline steps extracted from the executor's hardcoded logic.
3
+ *
4
+ * Each class implements the Step interface and wraps one phase of the
5
+ * execution pipeline. Dependencies are injected via the constructor so
6
+ * that each step is independently testable.
7
+ */
8
+ import type { ACL } from './acl.js';
9
+ import type { ApprovalHandler } from './approval.js';
10
+ import type { Config } from './config.js';
11
+ import { MiddlewareManager } from './middleware/manager.js';
12
+ import type { Registry } from './registry/registry.js';
13
+ import type { Step, StepResult, PipelineContext } from './pipeline.js';
14
+ import { ExecutionStrategy } from './pipeline.js';
15
+ /** Creates or inherits execution Context and sets the global deadline. */
16
+ export declare class BuiltinContextCreation implements Step {
17
+ readonly name = "builtin.context_creation";
18
+ readonly description = "Create or inherit execution context and set global deadline";
19
+ readonly removable = false;
20
+ readonly replaceable = false;
21
+ private _globalTimeout;
22
+ constructor(config: Config | null);
23
+ execute(ctx: PipelineContext): Promise<StepResult>;
24
+ }
25
+ /** Validates call chain depth, repeat limits, and cancel token. */
26
+ export declare class BuiltinSafetyCheck implements Step {
27
+ readonly name = "builtin.safety_check";
28
+ readonly description = "Call chain guard: depth, repeat limits, cancel token";
29
+ readonly removable = true;
30
+ readonly replaceable = true;
31
+ private _maxCallDepth;
32
+ private _maxModuleRepeat;
33
+ constructor(config: Config | null);
34
+ execute(ctx: PipelineContext): Promise<StepResult>;
35
+ }
36
+ /** Resolves the module from the registry and sets ctx.module. */
37
+ export declare class BuiltinModuleLookup implements Step {
38
+ readonly name = "builtin.module_lookup";
39
+ readonly description = "Resolve module from registry";
40
+ readonly removable = false;
41
+ readonly replaceable = false;
42
+ private _registry;
43
+ constructor(registry: Registry);
44
+ execute(ctx: PipelineContext): Promise<StepResult>;
45
+ }
46
+ /** Enforces access control via the ACL provider. */
47
+ export declare class BuiltinACLCheck implements Step {
48
+ readonly name = "builtin.acl_check";
49
+ readonly description = "Access control list enforcement";
50
+ readonly removable = true;
51
+ readonly replaceable = true;
52
+ private _acl;
53
+ constructor(acl: ACL | null);
54
+ execute(ctx: PipelineContext): Promise<StepResult>;
55
+ }
56
+ /** Handles approval flow for modules that require explicit approval. */
57
+ export declare class BuiltinApprovalGate implements Step {
58
+ readonly name = "builtin.approval_gate";
59
+ readonly description = "Approval handler flow";
60
+ readonly removable = true;
61
+ readonly replaceable = true;
62
+ private _handler;
63
+ constructor(handler: ApprovalHandler | null);
64
+ execute(ctx: PipelineContext): Promise<StepResult>;
65
+ }
66
+ /** Validates inputs against module schema and redacts sensitive fields. */
67
+ export declare class BuiltinInputValidation implements Step {
68
+ readonly name = "builtin.input_validation";
69
+ readonly description = "Schema validation and redaction for inputs";
70
+ readonly removable = true;
71
+ readonly replaceable = true;
72
+ execute(ctx: PipelineContext): Promise<StepResult>;
73
+ }
74
+ /** Executes before-middleware chain via MiddlewareManager. */
75
+ export declare class BuiltinMiddlewareBefore implements Step {
76
+ readonly name = "builtin.middleware_before";
77
+ readonly description = "Execute before-middleware chain";
78
+ readonly removable = true;
79
+ readonly replaceable = false;
80
+ private _middlewareManager;
81
+ constructor(middlewares: MiddlewareManager);
82
+ execute(ctx: PipelineContext): Promise<StepResult>;
83
+ }
84
+ /** Executes the module with timeout enforcement. Sets ctx.output. */
85
+ export declare class BuiltinExecute implements Step {
86
+ readonly name = "builtin.execute";
87
+ readonly description = "Execute module with timeout";
88
+ readonly removable = false;
89
+ readonly replaceable = true;
90
+ private _defaultTimeout;
91
+ constructor(config: Config | null);
92
+ execute(ctx: PipelineContext): Promise<StepResult>;
93
+ }
94
+ /** Validates output against module schema and redacts sensitive fields. */
95
+ export declare class BuiltinOutputValidation implements Step {
96
+ readonly name = "builtin.output_validation";
97
+ readonly description = "Schema validation and redaction for output";
98
+ readonly removable = true;
99
+ readonly replaceable = true;
100
+ execute(ctx: PipelineContext): Promise<StepResult>;
101
+ }
102
+ /** Executes after-middleware chain via MiddlewareManager. */
103
+ export declare class BuiltinMiddlewareAfter implements Step {
104
+ readonly name = "builtin.middleware_after";
105
+ readonly description = "Execute after-middleware chain";
106
+ readonly removable = true;
107
+ readonly replaceable = false;
108
+ private _middlewareManager;
109
+ constructor(middlewares: MiddlewareManager);
110
+ execute(ctx: PipelineContext): Promise<StepResult>;
111
+ }
112
+ /** Finalizes the pipeline result. Output is already on ctx.output. */
113
+ export declare class BuiltinReturnResult implements Step {
114
+ readonly name = "builtin.return_result";
115
+ readonly description = "Finalize pipeline result";
116
+ readonly removable = false;
117
+ readonly replaceable = false;
118
+ execute(_ctx: PipelineContext): Promise<StepResult>;
119
+ }
120
+ export interface StandardStrategyDeps {
121
+ config: Config | null;
122
+ registry: Registry;
123
+ acl: ACL | null;
124
+ approvalHandler: ApprovalHandler | null;
125
+ middlewareManager: MiddlewareManager;
126
+ }
127
+ /** Build the standard 11-step execution strategy matching the current Executor. */
128
+ export declare function buildStandardStrategy(deps: StandardStrategyDeps): ExecutionStrategy;
129
+ /**
130
+ * Build an internal-only strategy: skips ACL and approval gates.
131
+ * Suitable for trusted internal service-to-service calls.
132
+ */
133
+ export declare function buildInternalStrategy(deps: StandardStrategyDeps): ExecutionStrategy;
134
+ /**
135
+ * Build a testing strategy: minimal pipeline with only lookup, execute, and return.
136
+ * No middleware, no validation, no ACL, no approval. Fast and predictable for tests.
137
+ */
138
+ export declare function buildTestingStrategy(deps: StandardStrategyDeps): ExecutionStrategy;
139
+ /**
140
+ * Build a performance strategy: skips approval gate and output validation.
141
+ * Retains ACL, input validation, and middleware for correctness where it matters.
142
+ */
143
+ export declare function buildPerformanceStrategy(deps: StandardStrategyDeps): ExecutionStrategy;
144
+ //# sourceMappingURL=builtin-steps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-steps.d.ts","sourceRoot":"","sources":["../src/builtin-steps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAmC,MAAM,eAAe,CAAC;AAEtF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAc1C,OAAO,EAAwB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAIlF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAmElD,0EAA0E;AAC1E,qBAAa,sBAAuB,YAAW,IAAI;IACjD,QAAQ,CAAC,IAAI,8BAA8B;IAC3C,QAAQ,CAAC,WAAW,iEAAiE;IACrF,QAAQ,CAAC,SAAS,SAAS;IAC3B,QAAQ,CAAC,WAAW,SAAS;IAE7B,OAAO,CAAC,cAAc,CAAS;gBAEnB,MAAM,EAAE,MAAM,GAAG,IAAI;IAQ3B,OAAO,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;CAazD;AAMD,mEAAmE;AACnE,qBAAa,kBAAmB,YAAW,IAAI;IAC7C,QAAQ,CAAC,IAAI,0BAA0B;IACvC,QAAQ,CAAC,WAAW,0DAA0D;IAC9E,QAAQ,CAAC,SAAS,QAAQ;IAC1B,QAAQ,CAAC,WAAW,QAAQ;IAE5B,OAAO,CAAC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