@scarn/sdk 0.0.0 → 0.8.1

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 (55) hide show
  1. package/dist/{chunk-4361gxk0.js → chunk-0y2fy5en.js} +7 -7
  2. package/dist/{chunk-rq3q8vg7.js → chunk-102vfpw4.js} +74 -69
  3. package/dist/{chunk-91p9vzcs.js → chunk-3ctaaseb.js} +405 -402
  4. package/dist/{chunk-9s07v9r1.js → chunk-4ggr8af6.js} +8 -8
  5. package/dist/chunk-5zsavw98.js +91 -0
  6. package/dist/chunk-63f90zky.js +39 -0
  7. package/dist/{chunk-tfm5hjzm.js → chunk-700xe701.js} +9 -9
  8. package/dist/{chunk-njd6npf0.js → chunk-ar6hcj1r.js} +6 -6
  9. package/dist/chunk-cdanncng.js +74 -0
  10. package/dist/chunk-dp86pa6m.js +68 -0
  11. package/dist/chunk-e1h021kq.js +86 -0
  12. package/dist/{chunk-ny07ncb9.js → chunk-gds7w7zh.js} +35 -35
  13. package/dist/chunk-k4y5qt4y.js +14 -0
  14. package/dist/{chunk-eg1hcvhb.js → chunk-mz53r914.js} +16 -16
  15. package/dist/{chunk-631ffb6r.js → chunk-ngy1fdcx.js} +10 -10
  16. package/dist/chunk-p7yrcmqm.js +322 -0
  17. package/dist/{chunk-h9yxx0hd.js → chunk-rt9tq4j6.js} +7 -7
  18. package/dist/{chunk-dnn39qt4.js → chunk-skzxcba3.js} +2960 -2217
  19. package/dist/{chunk-ynk2bjae.js → chunk-vfeytkqx.js} +89 -88
  20. package/dist/{chunk-56e4kp0a.js → chunk-y2pv8d6a.js} +19 -19
  21. package/dist/chunk-y64skrwp.js +17 -0
  22. package/dist/{chunk-qpw5wt1p.js → chunk-zm72ksz0.js} +26 -27
  23. package/dist/client.js +53 -52
  24. package/dist/contracts/artifact-markers.js +12 -11
  25. package/dist/contracts/artifacts.js +23 -21
  26. package/dist/contracts/pipeline-document/index.js +94 -92
  27. package/dist/contracts/step-artifact-submissions.js +17 -20
  28. package/dist/defaults/index.js +140 -139
  29. package/dist/definitions/pipelines/index.js +22 -20
  30. package/dist/definitions/steps/index.js +70 -67
  31. package/dist/definitions/validation/index.js +15 -13
  32. package/dist/devcontainer-config-path.js +11 -9
  33. package/dist/env-vars.js +33 -31
  34. package/dist/eslint.js +2 -0
  35. package/dist/generated/types.gen.d.ts +7 -0
  36. package/dist/git-url/git-repo-identity.js +2 -0
  37. package/dist/health-checks.js +17 -15
  38. package/dist/index.js +280 -277
  39. package/dist/jsonc.js +8 -7
  40. package/dist/managed-runtimes.js +11 -9
  41. package/dist/opencode-mcp.js +27 -25
  42. package/dist/pipelines/index.js +78 -75
  43. package/dist/pipelines/nodes.d.ts +1 -0
  44. package/dist/push/code-step-lookup.js +8 -7
  45. package/dist/push/index.js +51 -52
  46. package/dist/repo-config.js +21 -19
  47. package/dist/scarn-config-parser.js +6 -5
  48. package/package.json +1 -1
  49. package/dist/chunk-4vehh3dq.js +0 -333
  50. package/dist/chunk-5mmj03ah.js +0 -1074
  51. package/dist/chunk-b21233rt.js +0 -78
  52. package/dist/chunk-g0rdnn0r.js +0 -95
  53. package/dist/chunk-p6kc9wq8.js +0 -97
  54. package/dist/chunk-s0gap8r8.js +0 -14
  55. package/dist/chunk-zpqyjgb4.js +0 -49
@@ -2,7 +2,7 @@
2
2
  // src/scarn-config-parser.ts
3
3
  import { access, readFile } from "fs/promises";
4
4
  import path from "path";
5
- var SCARN_CONFIG_RELATIVE_PATH2 = ".scarn/scarn.jsonc";
5
+ var SCARN_CONFIG_RELATIVE_PATH = ".scarn/scarn.jsonc";
6
6
  var stripJsoncComments = (content) => {
7
7
  let result = "";
8
8
  let inString = false;
@@ -90,12 +90,12 @@ var stripTrailingCommas = (content) => {
90
90
  if (character === ",") {
91
91
  let lookaheadIndex = index + 1;
92
92
  while (lookaheadIndex < content.length) {
93
- const lookaheadCharacter = content.charAt(lookaheadIndex);
94
- if (/\s/u.test(lookaheadCharacter)) {
93
+ const lookaheadCharacter2 = content.charAt(lookaheadIndex);
94
+ if (/\s/u.test(lookaheadCharacter2)) {
95
95
  lookaheadIndex += 1;
96
96
  continue;
97
97
  }
98
- if (lookaheadCharacter === "}" || lookaheadCharacter === "]") {
98
+ if (lookaheadCharacter2 === "}" || lookaheadCharacter2 === "]") {
99
99
  break;
100
100
  }
101
101
  result += character;
@@ -146,8 +146,8 @@ var parseServices = (raw) => {
146
146
  };
147
147
  });
148
148
  };
149
- async function parseScarnConfig2(workspacePath) {
150
- const filePath = path.join(workspacePath, SCARN_CONFIG_RELATIVE_PATH2);
149
+ async function parseScarnConfig(workspacePath) {
150
+ const filePath = path.join(workspacePath, SCARN_CONFIG_RELATIVE_PATH);
151
151
  const exists = await access(filePath).then(() => true).catch(() => false);
152
152
  if (!exists) {
153
153
  return { found: false };
@@ -163,4 +163,4 @@ async function parseScarnConfig2(workspacePath) {
163
163
  };
164
164
  }
165
165
 
166
- export { SCARN_CONFIG_RELATIVE_PATH2, parseScarnConfig2 };
166
+ export { SCARN_CONFIG_RELATIVE_PATH, parseScarnConfig };
@@ -1,33 +1,33 @@
1
1
  // @bun
2
2
  import {
3
- captureSite,
4
- PipelineBuildError2,
3
+ jsonPointer
4
+ } from "./chunk-p7yrcmqm.js";
5
+ import {
5
6
  AuthoringError,
7
+ PipelineBuildError,
8
+ bareStepHandle,
9
+ captureSite,
10
+ chainOf,
11
+ eachOf,
12
+ nodeOf,
6
13
  pendingChains,
14
+ registerEach,
7
15
  registerNode,
8
16
  registerTarget,
9
- registerEach,
10
- nodeOf,
11
- targetOf,
12
- eachOf,
13
- chainOf,
14
17
  requireNode,
15
- waitHandle,
16
- bareStepHandle
17
- } from "./chunk-eg1hcvhb.js";
18
- import {
19
- jsonPointer2
20
- } from "./chunk-4vehh3dq.js";
18
+ targetOf,
19
+ waitHandle
20
+ } from "./chunk-mz53r914.js";
21
21
  import {
22
- decisionResultSchema2,
23
- REPLY_RESULT_SCHEMA2,
24
- CONVERSATION_RESULT_SCHEMA2,
25
- REPLY_INPUT_SCHEMA2,
26
- ERROR_SCHEMA2
27
- } from "./chunk-5mmj03ah.js";
22
+ CONVERSATION_RESULT_SCHEMA,
23
+ ERROR_SCHEMA,
24
+ REPLY_INPUT_SCHEMA,
25
+ REPLY_RESULT_SCHEMA,
26
+ decisionResultSchema
27
+ } from "./chunk-dp86pa6m.js";
28
28
  import {
29
29
  toJSONSchema
30
- } from "./chunk-dnn39qt4.js";
30
+ } from "./chunk-skzxcba3.js";
31
31
 
32
32
  // src/pipelines/refs.ts
33
33
  var REF = Symbol("scarn.ref");
@@ -392,17 +392,17 @@ function newState() {
392
392
  };
393
393
  }
394
394
  function issue(state, site, pointer, message) {
395
- state.issues.push({ site, pointer: jsonPointer2(pointer), message });
395
+ state.issues.push({ site, pointer: jsonPointer(pointer), message });
396
396
  }
397
397
  function mapSource(state, pointer, site) {
398
- const key = jsonPointer2(pointer);
398
+ const key = jsonPointer(pointer);
399
399
  if (site !== null && state.sourceMap[key] === undefined) {
400
400
  state.sourceMap[key] = site;
401
401
  }
402
402
  }
403
403
  function attempt(state, pointer, site, run) {
404
404
  const previous = state.tracker.pointer;
405
- setTrackerPointer(jsonPointer2(pointer));
405
+ setTrackerPointer(jsonPointer(pointer));
406
406
  try {
407
407
  return run();
408
408
  } catch (error) {
@@ -439,7 +439,7 @@ function place(state, def, site, pointer) {
439
439
  function schemaOf(node, source) {
440
440
  if (node.kind === "step") {
441
441
  if (source === "result" && node.conversation) {
442
- return CONVERSATION_RESULT_SCHEMA2;
442
+ return CONVERSATION_RESULT_SCHEMA;
443
443
  }
444
444
  return (source === "result" ? node.resultSchema : node.inputSchema) ?? undefined;
445
445
  }
@@ -475,7 +475,7 @@ function makeContext(node, kind) {
475
475
  });
476
476
  } else {
477
477
  Object.defineProperties(context, {
478
- error: owned("error", ERROR_SCHEMA2),
478
+ error: owned("error", ERROR_SCHEMA),
479
479
  input: owned("input", schemaOf(node, "input"))
480
480
  });
481
481
  }
@@ -611,8 +611,8 @@ function wireBody(state, chain, json) {
611
611
  }
612
612
  const catches = chain.catch.map((entry, index) => {
613
613
  const pointer = ["nodes", id, "catch", index];
614
- const context = makeContext(chain.node, "catch");
615
- const target = compileTransition(state, entry.target, context, pointer, entry.site, "catch");
614
+ const context2 = makeContext(chain.node, "catch");
615
+ const target = compileTransition(state, entry.target, context2, pointer, entry.site, "catch");
616
616
  return { on: [...entry.on], ...target };
617
617
  });
618
618
  if (catches.length > 0) {
@@ -627,9 +627,9 @@ function wireBody(state, chain, json) {
627
627
  mapSource(state, pointer, next.site);
628
628
  const entry = {};
629
629
  if (when !== undefined) {
630
- const compiled = attempt(state, [...pointer, "when"], next.site, () => withOwners([context], () => compileCondition(conditionData(when(context)))));
631
- if (compiled !== undefined) {
632
- entry["when"] = compiled;
630
+ const compiled2 = attempt(state, [...pointer, "when"], next.site, () => withOwners([context], () => compileCondition(conditionData(when(context)))));
631
+ if (compiled2 !== undefined) {
632
+ entry["when"] = compiled2;
633
633
  }
634
634
  }
635
635
  const compiled = compileTransition(state, target, context, pointer, next.site, "next");
@@ -817,7 +817,7 @@ function compile(config, site) {
817
817
  const fields = workItemFields(state);
818
818
  const warnings = unusedChainWarnings(state);
819
819
  if (state.issues.length > 0 || start === undefined) {
820
- throw new PipelineBuildError2(config.key, state.issues);
820
+ throw new PipelineBuildError(config.key, state.issues);
821
821
  }
822
822
  const nodes = {};
823
823
  for (const [id, placed] of orderedNodes(state)) {
@@ -843,14 +843,14 @@ function compile(config, site) {
843
843
  warnings
844
844
  };
845
845
  }
846
- function definePipeline2(config) {
846
+ function definePipeline(config) {
847
847
  return compile(config, captureSite());
848
848
  }
849
849
  // src/pipelines/nodes.ts
850
850
  function inputSchemaJson(input) {
851
851
  return input === undefined ? null : toJSONSchema(input);
852
852
  }
853
- function decision2(id, options) {
853
+ function decision(id, options) {
854
854
  const actions = Object.entries(options.actions).map(([key, action]) => ({
855
855
  key,
856
856
  label: action.label,
@@ -862,11 +862,11 @@ function decision2(id, options) {
862
862
  for: "decision",
863
863
  actions,
864
864
  inputSchema: inputSchemaJson(options.input),
865
- resultSchema: decisionResultSchema2(actions),
865
+ resultSchema: decisionResultSchema(actions),
866
866
  site: captureSite()
867
867
  });
868
868
  }
869
- function reply2(id) {
869
+ function reply(id) {
870
870
  return waitHandle({
871
871
  kind: "wait",
872
872
  id,
@@ -874,10 +874,10 @@ function reply2(id) {
874
874
  actions: null,
875
875
  inputSchema: {
876
876
  type: "object",
877
- properties: { questions: REPLY_INPUT_SCHEMA2 },
877
+ properties: { questions: REPLY_INPUT_SCHEMA },
878
878
  required: ["questions"]
879
879
  },
880
- resultSchema: REPLY_RESULT_SCHEMA2,
880
+ resultSchema: REPLY_RESULT_SCHEMA,
881
881
  site: captureSite()
882
882
  });
883
883
  }
@@ -891,7 +891,7 @@ function terminal(node) {
891
891
  site: node.site
892
892
  });
893
893
  }
894
- function succeed2(id, options = {}) {
894
+ function succeed(id, options = {}) {
895
895
  return terminal({
896
896
  kind: "succeed",
897
897
  id,
@@ -900,7 +900,7 @@ function succeed2(id, options = {}) {
900
900
  site: captureSite()
901
901
  });
902
902
  }
903
- function fail2(id, options = {}) {
903
+ function fail(id, options = {}) {
904
904
  return terminal({
905
905
  kind: "fail",
906
906
  id,
@@ -911,23 +911,28 @@ function fail2(id, options = {}) {
911
911
  site: captureSite()
912
912
  });
913
913
  }
914
- function stepRef2(key) {
914
+ function stepRef(key) {
915
915
  return bareStepHandle({ key, inputSchemaJson: null, resultSchemaJson: null, errors: [] }, false);
916
916
  }
917
- var workItem2 = {
917
+ var workItem = {
918
918
  get title() {
919
919
  return rootPlaceholder("workItem.title", {
920
920
  type: "string"
921
921
  });
922
+ },
923
+ get description() {
924
+ return rootPlaceholder("workItem.description", {
925
+ type: ["string", "null"]
926
+ });
922
927
  }
923
928
  };
924
- function workItemField2(alias, label) {
929
+ function workItemField(alias, label) {
925
930
  return rootPlaceholder(`workItem.fields.${alias}`, undefined, {
926
931
  field: { alias, label }
927
932
  });
928
933
  }
929
934
  // src/pipelines/each.ts
930
- function each2(over, second, third) {
935
+ function each(over, second, third) {
931
936
  const data = refData(over);
932
937
  if (data === undefined) {
933
938
  throw new AuthoringError("each needs an array reference to iterate over");
@@ -975,55 +980,55 @@ function compare(op, left, value) {
975
980
  right: value === NO_RIGHT ? { kind: "none" } : right(value)
976
981
  }));
977
982
  }
978
- function equal2(left, value) {
983
+ function equal(left, value) {
979
984
  return compare("equal", left, value);
980
985
  }
981
- function notEqual2(left, value) {
986
+ function notEqual(left, value) {
982
987
  return compare("notEqual", left, value);
983
988
  }
984
- function lessThan2(left, value) {
989
+ function lessThan(left, value) {
985
990
  return compare("lessThan", left, value);
986
991
  }
987
- function lessThanInclusive2(left, value) {
992
+ function lessThanInclusive(left, value) {
988
993
  return compare("lessThanInclusive", left, value);
989
994
  }
990
- function greaterThan2(left, value) {
995
+ function greaterThan(left, value) {
991
996
  return compare("greaterThan", left, value);
992
997
  }
993
- function greaterThanInclusive2(left, value) {
998
+ function greaterThanInclusive(left, value) {
994
999
  return compare("greaterThanInclusive", left, value);
995
1000
  }
996
- function exists2(left) {
1001
+ function exists(left) {
997
1002
  return compare("exists", left, NO_RIGHT);
998
1003
  }
999
- function isEmpty2(left) {
1004
+ function isEmpty(left) {
1000
1005
  return compare("isEmpty", left, NO_RIGHT);
1001
1006
  }
1002
- function contains2(left, value) {
1007
+ function contains(left, value) {
1003
1008
  return compare("contains", left, value);
1004
1009
  }
1005
- function startsWith2(left, value) {
1010
+ function startsWith(left, value) {
1006
1011
  return compare("startsWith", left, value);
1007
1012
  }
1008
- function endsWith2(left, value) {
1013
+ function endsWith(left, value) {
1009
1014
  return compare("endsWith", left, value);
1010
1015
  }
1011
- function matches2(left, pattern) {
1016
+ function matches(left, pattern) {
1012
1017
  return compare("matches", left, pattern);
1013
1018
  }
1014
- function before2(left, date) {
1019
+ function before(left, date) {
1015
1020
  return compare("before", left, date);
1016
1021
  }
1017
- function after2(left, date) {
1022
+ function after(left, date) {
1018
1023
  return compare("after", left, date);
1019
1024
  }
1020
- function all2(...conditions) {
1025
+ function all(...conditions) {
1021
1026
  return toCondition(new ConditionData({ kind: "all", items: conditions.map(conditionData) }));
1022
1027
  }
1023
- function any2(...conditions) {
1028
+ function any(...conditions) {
1024
1029
  return toCondition(new ConditionData({ kind: "any", items: conditions.map(conditionData) }));
1025
1030
  }
1026
- function not2(condition) {
1031
+ function not(condition) {
1027
1032
  return toCondition(new ConditionData({ kind: "not", item: conditionData(condition) }));
1028
1033
  }
1029
1034
  function element(list) {
@@ -1043,13 +1048,13 @@ function list(op, over, where) {
1043
1048
  where: conditionData(where(item))
1044
1049
  }));
1045
1050
  }
1046
- function some2(over, where) {
1051
+ function some(over, where) {
1047
1052
  return list("some", over, where);
1048
1053
  }
1049
- function every2(over, where) {
1054
+ function every(over, where) {
1050
1055
  return list("every", over, where);
1051
1056
  }
1052
- function none2(over, where) {
1057
+ function none(over, where) {
1053
1058
  return list("none", over, where);
1054
1059
  }
1055
1060
  function reduce(fn, source, field, weights) {
@@ -1067,19 +1072,19 @@ function reduce(fn, source, field, weights) {
1067
1072
  field: requireRef(select(field, element(data)), `the field of "${fn}"`)
1068
1073
  }));
1069
1074
  }
1070
- function sum2(source, field) {
1075
+ function sum(source, field) {
1071
1076
  return reduce("sum", source, field);
1072
1077
  }
1073
- function avg2(source, second) {
1078
+ function avg(source, second) {
1074
1079
  return typeof second === "function" ? reduce("avg", source, second) : reduce("avg", source, undefined, second?.weights);
1075
1080
  }
1076
- function min2(source, field) {
1081
+ function min(source, field) {
1077
1082
  return reduce("min", source, field);
1078
1083
  }
1079
- function max2(source, field) {
1084
+ function max(source, field) {
1080
1085
  return reduce("max", source, field);
1081
1086
  }
1082
- function count2(source, where) {
1087
+ function count(source, where) {
1083
1088
  if (Array.isArray(source)) {
1084
1089
  const refs = source.map((value) => requireRef(value, 'each value of "count"'));
1085
1090
  return toComputed(new ComputedData({ fn: "count", refs }));
@@ -1091,4 +1096,4 @@ function count2(source, where) {
1091
1096
  where: conditionData(select(where, element(data)))
1092
1097
  }));
1093
1098
  }
1094
- export { definePipeline2, decision2, reply2, succeed2, fail2, stepRef2, workItem2, workItemField2, each2, equal2, notEqual2, lessThan2, lessThanInclusive2, greaterThan2, greaterThanInclusive2, exists2, isEmpty2, contains2, startsWith2, endsWith2, matches2, before2, after2, all2, any2, not2, some2, every2, none2, sum2, avg2, min2, max2, count2 };
1099
+ export { definePipeline, decision, reply, succeed, fail, stepRef, workItem, workItemField, each, equal, notEqual, lessThan, lessThanInclusive, greaterThan, greaterThanInclusive, exists, isEmpty, contains, startsWith, endsWith, matches, before, after, all, any, not, some, every, none, sum, avg, min, max, count };