@xemahq/dsl 0.8.0 → 0.8.2

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 (64) hide show
  1. package/dist/payload-codec/lib/blob-store.js +0 -0
  2. package/dist/payload-codec/lib/blob-store.js.map +1 -1
  3. package/package.json +3 -4
  4. package/src/deliverable-spec/index.ts +0 -19
  5. package/src/deliverable-spec/lib/schema.ts +0 -270
  6. package/src/deliverable-spec/lib/types.ts +0 -26
  7. package/src/payload-codec/index.ts +0 -44
  8. package/src/payload-codec/lib/blob-store.ts +0 -0
  9. package/src/payload-codec/lib/codec-context.ts +0 -38
  10. package/src/payload-codec/lib/codec.ts +0 -605
  11. package/src/payload-codec/lib/enums.ts +0 -58
  12. package/src/payload-codec/lib/errors.ts +0 -54
  13. package/src/payload-codec/lib/http-blob-store.ts +0 -267
  14. package/src/payload-codec/lib/lru-cache.ts +0 -81
  15. package/src/payload-codec/lib/payload.ts +0 -26
  16. package/src/payload-codec/temporal/index.ts +0 -36
  17. package/src/workflow/index.ts +0 -108
  18. package/src/workflow/lib/action-input-validator.ts +0 -160
  19. package/src/workflow/lib/compiler/action-shape.ts +0 -71
  20. package/src/workflow/lib/compiler/canonical-json.ts +0 -66
  21. package/src/workflow/lib/compiler/compile.ts +0 -1742
  22. package/src/workflow/lib/compiler/concurrency.ts +0 -223
  23. package/src/workflow/lib/compiler/dag.ts +0 -108
  24. package/src/workflow/lib/compiler/gate-defaults.ts +0 -153
  25. package/src/workflow/lib/compiler/index.ts +0 -11
  26. package/src/workflow/lib/compiler/inputs.ts +0 -254
  27. package/src/workflow/lib/compiler/installation-resource-validator.ts +0 -114
  28. package/src/workflow/lib/compiler/manifest-source.ts +0 -71
  29. package/src/workflow/lib/compiler/matrix.ts +0 -135
  30. package/src/workflow/lib/compiler/mount-plan.ts +0 -190
  31. package/src/workflow/lib/compiler/payload-reach-in.ts +0 -497
  32. package/src/workflow/lib/compiler/permissions.ts +0 -64
  33. package/src/workflow/lib/compiler/retry-timeout.ts +0 -105
  34. package/src/workflow/lib/compiler/review-step.ts +0 -548
  35. package/src/workflow/lib/compiler/types.ts +0 -172
  36. package/src/workflow/lib/compiler/variable-requirements.ts +0 -208
  37. package/src/workflow/lib/deliverable-spec-introspection-error.ts +0 -63
  38. package/src/workflow/lib/deliverable-spec-keys.ts +0 -147
  39. package/src/workflow/lib/deliverable-spec-source-scan.ts +0 -280
  40. package/src/workflow/lib/dispatch-inputs/index.ts +0 -160
  41. package/src/workflow/lib/dispatch-inputs/to-json-schema.ts +0 -60
  42. package/src/workflow/lib/duration.ts +0 -43
  43. package/src/workflow/lib/errors.ts +0 -37
  44. package/src/workflow/lib/expression/ast.ts +0 -108
  45. package/src/workflow/lib/expression/context.ts +0 -148
  46. package/src/workflow/lib/expression/evaluator.ts +0 -492
  47. package/src/workflow/lib/expression/index.ts +0 -28
  48. package/src/workflow/lib/expression/interpolation.ts +0 -84
  49. package/src/workflow/lib/expression/parser.ts +0 -264
  50. package/src/workflow/lib/expression/template.ts +0 -117
  51. package/src/workflow/lib/expression/tokenizer.ts +0 -200
  52. package/src/workflow/lib/expression/tokens.ts +0 -30
  53. package/src/workflow/lib/expression/walk-artifact-refs.ts +0 -232
  54. package/src/workflow/lib/installation-resource-kind.ts +0 -107
  55. package/src/workflow/lib/schemas-loader.ts +0 -64
  56. package/src/workflow/lib/serializer.ts +0 -30
  57. package/src/workflow/lib/types.ts +0 -417
  58. package/src/workflow/lib/validate.ts +0 -199
  59. package/src/workspace-manifest/index.ts +0 -27
  60. package/src/workspace-manifest/lib/compile.ts +0 -619
  61. package/src/workspace-manifest/lib/interpolate.ts +0 -166
  62. package/src/workspace-manifest/lib/resolve-extends.ts +0 -260
  63. package/src/workspace-manifest/lib/schema.ts +0 -692
  64. 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
- }