agentweaver 0.1.15 → 0.1.16

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 (94) hide show
  1. package/README.md +26 -9
  2. package/dist/artifact-manifest.js +219 -0
  3. package/dist/artifacts.js +15 -0
  4. package/dist/doctor/checks/env-diagnostics.js +25 -0
  5. package/dist/doctor/checks/flow-readiness.js +15 -18
  6. package/dist/flow-state.js +75 -15
  7. package/dist/index.js +391 -175
  8. package/dist/interactive/blessed-session.js +361 -0
  9. package/dist/interactive/controller.js +1293 -0
  10. package/dist/interactive/create-interactive-session.js +5 -0
  11. package/dist/interactive/ink/index.js +576 -0
  12. package/dist/interactive/progress.js +245 -0
  13. package/dist/interactive/selectors.js +14 -0
  14. package/dist/interactive/session.js +1 -0
  15. package/dist/interactive/state.js +34 -0
  16. package/dist/interactive/tree.js +155 -0
  17. package/dist/interactive/types.js +1 -0
  18. package/dist/interactive/view-model.js +1 -0
  19. package/dist/interactive-ui.js +159 -194
  20. package/dist/pipeline/context.js +1 -0
  21. package/dist/pipeline/declarative-flow-runner.js +212 -6
  22. package/dist/pipeline/declarative-flows.js +27 -0
  23. package/dist/pipeline/execution-routing-config.js +15 -0
  24. package/dist/pipeline/flow-catalog.js +19 -3
  25. package/dist/pipeline/flow-run-resume.js +29 -0
  26. package/dist/pipeline/flow-specs/auto-common.json +89 -360
  27. package/dist/pipeline/flow-specs/auto-golang.json +58 -363
  28. package/dist/pipeline/flow-specs/auto-simple.json +141 -0
  29. package/dist/pipeline/flow-specs/bugz/bug-analyze.json +2 -0
  30. package/dist/pipeline/flow-specs/bugz/bug-fix.json +1 -0
  31. package/dist/pipeline/flow-specs/design-review/design-review-loop.json +304 -0
  32. package/dist/pipeline/flow-specs/design-review.json +10 -0
  33. package/dist/pipeline/flow-specs/gitlab/gitlab-diff-review.json +11 -0
  34. package/dist/pipeline/flow-specs/gitlab/gitlab-review.json +2 -0
  35. package/dist/pipeline/flow-specs/gitlab/mr-description.json +1 -0
  36. package/dist/pipeline/flow-specs/go/run-go-linter-loop.json +2 -0
  37. package/dist/pipeline/flow-specs/go/run-go-tests-loop.json +2 -0
  38. package/dist/pipeline/flow-specs/implement.json +13 -6
  39. package/dist/pipeline/flow-specs/instant-task.json +177 -0
  40. package/dist/pipeline/flow-specs/normalize-task-source.json +311 -0
  41. package/dist/pipeline/flow-specs/plan-revise.json +7 -1
  42. package/dist/pipeline/flow-specs/plan.json +48 -70
  43. package/dist/pipeline/flow-specs/review/review-fix.json +24 -4
  44. package/dist/pipeline/flow-specs/review/review-loop.json +351 -45
  45. package/dist/pipeline/flow-specs/review/review-project-loop.json +590 -0
  46. package/dist/pipeline/flow-specs/review/review-project.json +12 -0
  47. package/dist/pipeline/flow-specs/review/review.json +37 -31
  48. package/dist/pipeline/flow-specs/task-describe.json +2 -0
  49. package/dist/pipeline/flow-specs/task-source/jira-fetch.json +70 -0
  50. package/dist/pipeline/flow-specs/task-source/manual-input.json +216 -0
  51. package/dist/pipeline/node-registry.js +41 -1
  52. package/dist/pipeline/node-runner.js +3 -2
  53. package/dist/pipeline/nodes/build-review-fix-prompt-node.js +5 -1
  54. package/dist/pipeline/nodes/clear-ready-to-merge-node.js +11 -0
  55. package/dist/pipeline/nodes/commit-message-form-node.js +8 -0
  56. package/dist/pipeline/nodes/design-review-verdict-node.js +36 -0
  57. package/dist/pipeline/nodes/ensure-summary-json-node.js +13 -2
  58. package/dist/pipeline/nodes/fetch-gitlab-diff-node.js +19 -2
  59. package/dist/pipeline/nodes/fetch-gitlab-review-node.js +19 -2
  60. package/dist/pipeline/nodes/flow-run-node.js +226 -7
  61. package/dist/pipeline/nodes/git-commit-form-node.js +8 -0
  62. package/dist/pipeline/nodes/gitlab-review-artifacts-node.js +19 -2
  63. package/dist/pipeline/nodes/jira-fetch-node.js +50 -4
  64. package/dist/pipeline/nodes/llm-prompt-node.js +32 -12
  65. package/dist/pipeline/nodes/planning-bundle-node.js +10 -0
  66. package/dist/pipeline/nodes/review-verdict-node.js +86 -0
  67. package/dist/pipeline/nodes/select-files-form-node.js +8 -0
  68. package/dist/pipeline/nodes/structured-summary-node.js +24 -0
  69. package/dist/pipeline/nodes/user-input-node.js +38 -3
  70. package/dist/pipeline/nodes/write-selection-file-node.js +20 -4
  71. package/dist/pipeline/prompt-registry.js +3 -1
  72. package/dist/pipeline/prompt-runtime.js +4 -1
  73. package/dist/pipeline/review-iteration.js +26 -0
  74. package/dist/pipeline/spec-compiler.js +2 -0
  75. package/dist/pipeline/spec-types.js +3 -0
  76. package/dist/pipeline/spec-validator.js +14 -0
  77. package/dist/pipeline/value-resolver.js +74 -1
  78. package/dist/prompts.js +36 -14
  79. package/dist/review-severity.js +45 -0
  80. package/dist/runtime/artifact-registry.js +402 -0
  81. package/dist/runtime/design-review-input-contract.js +17 -16
  82. package/dist/runtime/env-loader.js +3 -0
  83. package/dist/runtime/execution-routing-store.js +134 -0
  84. package/dist/runtime/execution-routing.js +227 -0
  85. package/dist/runtime/interactive-execution-routing.js +462 -0
  86. package/dist/runtime/plan-revise-input-contract.js +35 -32
  87. package/dist/runtime/planning-bundle.js +123 -0
  88. package/dist/runtime/ready-to-merge.js +22 -1
  89. package/dist/runtime/review-input-contract.js +100 -0
  90. package/dist/structured-artifact-schema-registry.js +9 -0
  91. package/dist/structured-artifact-schemas.json +140 -1
  92. package/dist/structured-artifacts.js +77 -6
  93. package/dist/user-input.js +70 -3
  94. package/package.json +6 -3
@@ -19,6 +19,69 @@ export function defaultValueForField(field) {
19
19
  export function buildInitialUserInputValues(fields) {
20
20
  return Object.fromEntries(fields.map((field) => [field.id, defaultValueForField(field)]));
21
21
  }
22
+ export function applyInitialUserInputValues(fields, initialValues) {
23
+ if (!initialValues) {
24
+ return fields;
25
+ }
26
+ return fields.map((field) => {
27
+ const initialValue = initialValues[field.id];
28
+ if (initialValue === undefined) {
29
+ return field;
30
+ }
31
+ if (field.type === "boolean" && typeof initialValue === "boolean") {
32
+ return { ...field, default: initialValue };
33
+ }
34
+ if (field.type === "text" && typeof initialValue === "string") {
35
+ return { ...field, default: initialValue };
36
+ }
37
+ if (field.type === "single-select" && typeof initialValue === "string") {
38
+ return { ...field, default: initialValue };
39
+ }
40
+ if (field.type === "multi-select"
41
+ && Array.isArray(initialValue)
42
+ && initialValue.every((item) => typeof item === "string")) {
43
+ return { ...field, default: [...initialValue] };
44
+ }
45
+ return field;
46
+ });
47
+ }
48
+ function defaultSelectValue(field) {
49
+ if (field.type === "single-select") {
50
+ return field.default ?? field.options[0]?.value ?? "";
51
+ }
52
+ return [...(field.default ?? [])];
53
+ }
54
+ export function resolveFieldOptions(field, values) {
55
+ return field.optionsFromValues?.(values) ?? field.options;
56
+ }
57
+ export function resolveFieldDefinition(field, values) {
58
+ if (field.type !== "single-select" && field.type !== "multi-select") {
59
+ return field;
60
+ }
61
+ return {
62
+ ...field,
63
+ options: resolveFieldOptions(field, values),
64
+ };
65
+ }
66
+ export function normalizeUserInputFieldValue(field, values) {
67
+ if (field.type !== "single-select" && field.type !== "multi-select") {
68
+ return;
69
+ }
70
+ const allowedValues = new Set(resolveFieldOptions(field, values).map((option) => option.value));
71
+ if (field.type === "single-select") {
72
+ const currentValue = typeof values[field.id] === "string" ? String(values[field.id]) : "";
73
+ if (!allowedValues.has(currentValue)) {
74
+ const fallback = defaultSelectValue(resolveFieldDefinition(field, values));
75
+ values[field.id] = typeof fallback === "string" ? fallback : "";
76
+ }
77
+ return;
78
+ }
79
+ const currentValue = values[field.id];
80
+ const currentValues = Array.isArray(currentValue)
81
+ ? currentValue.filter((item) => typeof item === "string")
82
+ : [];
83
+ values[field.id] = currentValues.filter((item) => typeof item === "string" && allowedValues.has(item));
84
+ }
22
85
  export function validateUserInputValues(form, values) {
23
86
  for (const field of form.fields) {
24
87
  const value = values[field.id];
@@ -38,24 +101,26 @@ export function validateUserInputValues(form, values) {
38
101
  continue;
39
102
  }
40
103
  if (field.type === "single-select") {
104
+ const options = resolveFieldOptions(field, values);
41
105
  if (typeof value !== "string") {
42
106
  throw new TaskRunnerError(`Field '${field.label}' must be a string.`);
43
107
  }
44
108
  if (field.required && normalizeText(value).length === 0) {
45
109
  throw new TaskRunnerError(`Field '${field.label}' is required.`);
46
110
  }
47
- if (value && !field.options.some((option) => option.value === value)) {
111
+ if (value && !options.some((option) => option.value === value)) {
48
112
  throw new TaskRunnerError(`Field '${field.label}' contains an unknown option '${value}'.`);
49
113
  }
50
114
  continue;
51
115
  }
116
+ const options = resolveFieldOptions(field, values);
52
117
  if (!Array.isArray(value) || value.some((item) => typeof item !== "string")) {
53
118
  throw new TaskRunnerError(`Field '${field.label}' must be a string array.`);
54
119
  }
55
120
  if (field.required && value.length === 0) {
56
121
  throw new TaskRunnerError(`Field '${field.label}' requires at least one selected option.`);
57
122
  }
58
- const allowed = new Set(field.options.map((option) => option.value));
123
+ const allowed = new Set(options.map((option) => option.value));
59
124
  for (const item of value) {
60
125
  if (!allowed.has(item)) {
61
126
  throw new TaskRunnerError(`Field '${field.label}' contains an unknown option '${item}'.`);
@@ -113,7 +178,9 @@ export async function requestUserInputInTerminal(form) {
113
178
  process.stdout.write(`${form.description.trim()}\n`);
114
179
  }
115
180
  const values = buildInitialUserInputValues(form.fields);
116
- for (const field of form.fields) {
181
+ for (const rawField of form.fields) {
182
+ normalizeUserInputFieldValue(rawField, values);
183
+ const field = resolveFieldDefinition(rawField, values);
117
184
  if (field.type === "boolean") {
118
185
  while (true) {
119
186
  const current = values[field.id];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentweaver",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "CLI orchestrator for Jira/Codex engineering workflows",
5
5
  "keywords": [
6
6
  "agent",
@@ -51,13 +51,16 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "^20.17.30",
54
+ "@types/react": "^18.3.12",
54
55
  "@types/semver": "^7.7.1",
55
56
  "ts-node": "^10.9.2",
56
- "typescript": "^5.8.3"
57
+ "typescript": "^5.8.3",
58
+ "vitest": "^4.1.4"
57
59
  },
58
60
  "dependencies": {
61
+ "ink": "^5.2.1",
59
62
  "markdown-it": "^14.1.1",
60
- "neo-blessed": "^0.2.0",
63
+ "react": "^18.3.1",
61
64
  "semver": "^7.7.4"
62
65
  }
63
66
  }