@xemahq/dsl 0.8.1 → 0.8.3

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 (80) hide show
  1. package/dist/payload-codec/index.d.ts.map +1 -1
  2. package/dist/payload-codec/index.js.map +1 -1
  3. package/dist/payload-codec/lib/codec.d.ts.map +1 -1
  4. package/dist/payload-codec/lib/codec.js +2 -1
  5. package/dist/payload-codec/lib/codec.js.map +1 -1
  6. package/dist/payload-codec/lib/payload.d.ts.map +1 -1
  7. package/dist/schema/action.schema.json +205 -39
  8. package/dist/schema/workflow.schema.json +335 -88
  9. package/dist/workflow/index.d.ts.map +1 -1
  10. package/dist/workflow/index.js.map +1 -1
  11. package/dist/workflow/lib/compiler/compile.js +1 -1
  12. package/dist/workflow/lib/compiler/compile.js.map +1 -1
  13. package/package.json +2 -18
  14. package/schema/action.schema.json +205 -39
  15. package/schema/workflow.schema.json +335 -88
  16. package/dist/payload-codec/temporal/index.d.ts +0 -5
  17. package/dist/payload-codec/temporal/index.d.ts.map +0 -1
  18. package/dist/payload-codec/temporal/index.js +0 -7
  19. package/dist/payload-codec/temporal/index.js.map +0 -1
  20. package/src/deliverable-spec/index.ts +0 -19
  21. package/src/deliverable-spec/lib/schema.ts +0 -270
  22. package/src/deliverable-spec/lib/types.ts +0 -26
  23. package/src/payload-codec/index.ts +0 -44
  24. package/src/payload-codec/lib/blob-store.ts +0 -176
  25. package/src/payload-codec/lib/codec-context.ts +0 -38
  26. package/src/payload-codec/lib/codec.ts +0 -605
  27. package/src/payload-codec/lib/enums.ts +0 -58
  28. package/src/payload-codec/lib/errors.ts +0 -54
  29. package/src/payload-codec/lib/http-blob-store.ts +0 -267
  30. package/src/payload-codec/lib/lru-cache.ts +0 -81
  31. package/src/payload-codec/lib/payload.ts +0 -26
  32. package/src/payload-codec/temporal/index.ts +0 -36
  33. package/src/workflow/index.ts +0 -108
  34. package/src/workflow/lib/action-input-validator.ts +0 -160
  35. package/src/workflow/lib/compiler/action-shape.ts +0 -71
  36. package/src/workflow/lib/compiler/canonical-json.ts +0 -66
  37. package/src/workflow/lib/compiler/compile.ts +0 -1742
  38. package/src/workflow/lib/compiler/concurrency.ts +0 -223
  39. package/src/workflow/lib/compiler/dag.ts +0 -108
  40. package/src/workflow/lib/compiler/gate-defaults.ts +0 -153
  41. package/src/workflow/lib/compiler/index.ts +0 -11
  42. package/src/workflow/lib/compiler/inputs.ts +0 -254
  43. package/src/workflow/lib/compiler/installation-resource-validator.ts +0 -114
  44. package/src/workflow/lib/compiler/manifest-source.ts +0 -71
  45. package/src/workflow/lib/compiler/matrix.ts +0 -135
  46. package/src/workflow/lib/compiler/mount-plan.ts +0 -190
  47. package/src/workflow/lib/compiler/payload-reach-in.ts +0 -497
  48. package/src/workflow/lib/compiler/permissions.ts +0 -64
  49. package/src/workflow/lib/compiler/retry-timeout.ts +0 -105
  50. package/src/workflow/lib/compiler/review-step.ts +0 -548
  51. package/src/workflow/lib/compiler/types.ts +0 -172
  52. package/src/workflow/lib/compiler/variable-requirements.ts +0 -208
  53. package/src/workflow/lib/deliverable-spec-introspection-error.ts +0 -63
  54. package/src/workflow/lib/deliverable-spec-keys.ts +0 -147
  55. package/src/workflow/lib/deliverable-spec-source-scan.ts +0 -280
  56. package/src/workflow/lib/dispatch-inputs/index.ts +0 -160
  57. package/src/workflow/lib/dispatch-inputs/to-json-schema.ts +0 -60
  58. package/src/workflow/lib/duration.ts +0 -43
  59. package/src/workflow/lib/errors.ts +0 -37
  60. package/src/workflow/lib/expression/ast.ts +0 -108
  61. package/src/workflow/lib/expression/context.ts +0 -148
  62. package/src/workflow/lib/expression/evaluator.ts +0 -492
  63. package/src/workflow/lib/expression/index.ts +0 -28
  64. package/src/workflow/lib/expression/interpolation.ts +0 -84
  65. package/src/workflow/lib/expression/parser.ts +0 -264
  66. package/src/workflow/lib/expression/template.ts +0 -117
  67. package/src/workflow/lib/expression/tokenizer.ts +0 -200
  68. package/src/workflow/lib/expression/tokens.ts +0 -30
  69. package/src/workflow/lib/expression/walk-artifact-refs.ts +0 -232
  70. package/src/workflow/lib/installation-resource-kind.ts +0 -107
  71. package/src/workflow/lib/schemas-loader.ts +0 -64
  72. package/src/workflow/lib/serializer.ts +0 -30
  73. package/src/workflow/lib/types.ts +0 -417
  74. package/src/workflow/lib/validate.ts +0 -199
  75. package/src/workspace-manifest/index.ts +0 -27
  76. package/src/workspace-manifest/lib/compile.ts +0 -619
  77. package/src/workspace-manifest/lib/interpolate.ts +0 -166
  78. package/src/workspace-manifest/lib/resolve-extends.ts +0 -260
  79. package/src/workspace-manifest/lib/schema.ts +0 -692
  80. package/src/workspace-manifest/lib/types.ts +0 -446
@@ -1,64 +0,0 @@
1
- import {
2
- PermissionResource,
3
- PermissionScope,
4
- WorkflowErrorCode,
5
- } from '@xemahq/kernel-contracts/workflow';
6
- import { WorkflowDslError } from '../errors';
7
- import type { WorkflowPermissions } from '../types';
8
-
9
- /** Scope strength ordering: stronger scopes dominate weaker ones. */
10
- const SCOPE_RANK: Readonly<Record<PermissionScope, number>> = Object.freeze({
11
- [PermissionScope.NONE]: 0,
12
- [PermissionScope.READ]: 1,
13
- [PermissionScope.LIMITED]: 2,
14
- [PermissionScope.WRITE]: 3,
15
- });
16
-
17
- /** Zero permissions — the platform-safe default when nothing is authored. */
18
- export const ZERO_PERMISSIONS: Readonly<Record<PermissionResource, PermissionScope>> =
19
- Object.freeze({
20
- [PermissionResource.REPOS]: PermissionScope.NONE,
21
- [PermissionResource.KB]: PermissionScope.NONE,
22
- [PermissionResource.BACKLOG]: PermissionScope.NONE,
23
- [PermissionResource.INTEGRATIONS]: PermissionScope.NONE,
24
- [PermissionResource.ARTIFACTS]: PermissionScope.NONE,
25
- [PermissionResource.MEMORY]: PermissionScope.NONE,
26
- });
27
-
28
- /** Fill an authored permission map with explicit NONE values for unset resources. */
29
- export function normalizePermissions(
30
- authored: WorkflowPermissions | undefined,
31
- ): Readonly<Record<PermissionResource, PermissionScope>> {
32
- const base: Record<PermissionResource, PermissionScope> = { ...ZERO_PERMISSIONS };
33
- if (!authored) return base;
34
- for (const resource of Object.values(PermissionResource)) {
35
- const scope = authored[resource];
36
- if (scope !== undefined) {
37
- base[resource] = scope;
38
- }
39
- }
40
- return base;
41
- }
42
-
43
- /**
44
- * Verify that `job` does not request stronger permissions than `workflow`.
45
- * Fails fast with DSL_PERMISSION_ESCALATION on any escalation — rule 9
46
- * (clean architecture), rule 2 (fail-fast).
47
- */
48
- export function assertJobPermissionsFit(
49
- jobPermissions: Readonly<Record<PermissionResource, PermissionScope>>,
50
- workflowPermissions: Readonly<Record<PermissionResource, PermissionScope>>,
51
- jobKey: string,
52
- ): void {
53
- for (const resource of Object.values(PermissionResource)) {
54
- const jobScope = jobPermissions[resource];
55
- const workflowScope = workflowPermissions[resource];
56
- if (SCOPE_RANK[jobScope] > SCOPE_RANK[workflowScope]) {
57
- throw new WorkflowDslError(
58
- WorkflowErrorCode.DSL_PERMISSION_ESCALATION,
59
- `Job '${jobKey}' requests ${jobScope} on ${resource} but workflow grants only ${workflowScope}.`,
60
- { jobKey, resource, jobScope, workflowScope },
61
- );
62
- }
63
- }
64
- }
@@ -1,105 +0,0 @@
1
- import type {
2
- CompiledDefaults,
3
- CompiledRetryPolicy,
4
- } from '@xemahq/kernel-contracts/workflow';
5
- import type {
6
- ActionManifestRetryDefaults,
7
- ActionManifestTimeoutDefaults,
8
- WorkflowDefaults,
9
- WorkflowRetryDeclaration,
10
- } from '../types';
11
- import { parseDurationMs } from '../duration';
12
-
13
- // Default retry applied when neither the workflow nor the action declares
14
- // one. Deliberately conservative — one attempt, no backoff — so authors
15
- // opt into retry explicitly.
16
- const PLATFORM_DEFAULT_RETRY: CompiledRetryPolicy = {
17
- maxAttempts: 1,
18
- initialIntervalMs: 1_000,
19
- backoffCoefficient: 2.0,
20
- maximumIntervalMs: 60_000,
21
- nonRetryableErrorTypes: [],
22
- };
23
-
24
- // Default job timeout: 1 hour. Agent activities that need more declare it
25
- // explicitly in their action manifest or in the job's timeout field.
26
- const PLATFORM_DEFAULT_TIMEOUT_MS = 3_600_000;
27
-
28
- /** Merge workflow-level defaults against platform baseline. */
29
- export function resolveWorkflowDefaults(
30
- authored: WorkflowDefaults | undefined,
31
- ): CompiledDefaults {
32
- return {
33
- retry: resolveRetry(authored?.retry, PLATFORM_DEFAULT_RETRY),
34
- timeoutMs: authored?.timeout !== undefined
35
- ? parseDurationMs(authored.timeout)
36
- : PLATFORM_DEFAULT_TIMEOUT_MS,
37
- };
38
- }
39
-
40
- /**
41
- * Merge job-level retry against workflow-level + action-manifest-level
42
- * defaults. Merge order: action manifest → workflow → job (most specific
43
- * wins). Explicit; no "if null, skip" silent fallbacks.
44
- */
45
- export function resolveJobRetry(
46
- workflowDefault: CompiledRetryPolicy,
47
- actionDefault: ActionManifestRetryDefaults | null,
48
- jobOverride: WorkflowRetryDeclaration | undefined,
49
- ): CompiledRetryPolicy {
50
- const actionBaseline = actionDefault
51
- ? fromActionManifestRetry(actionDefault)
52
- : workflowDefault;
53
-
54
- return resolveRetry(jobOverride, actionBaseline);
55
- }
56
-
57
- /**
58
- * Resolve job-level timeout. Merge order: action manifest → workflow → job.
59
- */
60
- export function resolveJobTimeout(
61
- workflowDefaultMs: number,
62
- actionDefault: ActionManifestTimeoutDefaults | null,
63
- jobOverride: string | undefined,
64
- ): number {
65
- if (jobOverride !== undefined) {
66
- return parseDurationMs(jobOverride);
67
- }
68
- if (actionDefault) {
69
- return parseDurationMs(actionDefault.startToClose);
70
- }
71
- return workflowDefaultMs;
72
- }
73
-
74
- function resolveRetry(
75
- override: WorkflowRetryDeclaration | undefined,
76
- baseline: CompiledRetryPolicy,
77
- ): CompiledRetryPolicy {
78
- if (!override) return baseline;
79
- return {
80
- maxAttempts: override.maxAttempts ?? baseline.maxAttempts,
81
- initialIntervalMs:
82
- override.initialInterval !== undefined
83
- ? parseDurationMs(override.initialInterval)
84
- : baseline.initialIntervalMs,
85
- backoffCoefficient:
86
- override.backoffCoefficient ?? baseline.backoffCoefficient,
87
- maximumIntervalMs:
88
- override.maximumInterval !== undefined
89
- ? parseDurationMs(override.maximumInterval)
90
- : baseline.maximumIntervalMs,
91
- nonRetryableErrorTypes: override.nonRetryableErrorTypes !== undefined
92
- ? [...override.nonRetryableErrorTypes]
93
- : [...baseline.nonRetryableErrorTypes],
94
- };
95
- }
96
-
97
- function fromActionManifestRetry(retry: ActionManifestRetryDefaults): CompiledRetryPolicy {
98
- return {
99
- maxAttempts: retry.maxAttempts,
100
- initialIntervalMs: parseDurationMs(retry.initialInterval),
101
- backoffCoefficient: retry.backoffCoefficient,
102
- maximumIntervalMs: parseDurationMs(retry.maximumInterval),
103
- nonRetryableErrorTypes: retry.nonRetryableErrorTypes !== undefined ? [...retry.nonRetryableErrorTypes] : [],
104
- };
105
- }