@farmslot/agent-runtime 0.11.0 → 0.13.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.
@@ -18,6 +18,7 @@ function usage(exitCode = 0) {
18
18
  ' --package-templates <path> [--package-id id] [--project-name name] [--domain d]',
19
19
  ' Run: [--run-mode m] — run mode used to match project default rules',
20
20
  ' Task: --title t [--task-text s | --task-file path] [--ticket key] [--source-ref url]',
21
+ ' [--acceptance "criterion"]... — one per criterion; position N becomes ledger id AC-N',
21
22
  ' Identity: [--surface s] [--project name] [--repo owner/name] [--attempt-id id]',
22
23
  ' Rendering: [--var KEY=VALUE]... [--task-dir-label label] [--mode-preamble text]',
23
24
  ' [--addendum-file path] [--mark-command "cmd"] [--json]',
@@ -43,6 +44,7 @@ function parseArgs(args) {
43
44
  taskFile: null,
44
45
  ticket: null,
45
46
  sourceRef: null,
47
+ acceptance: [],
46
48
  surface: 'cli',
47
49
  project: null,
48
50
  repo: null,
@@ -65,6 +67,7 @@ function parseArgs(args) {
65
67
  else if (arg === '--task-file') opts.taskFile = takeValue(args, i++, arg);
66
68
  else if (arg === '--ticket') opts.ticket = takeValue(args, i++, arg);
67
69
  else if (arg === '--source-ref') opts.sourceRef = takeValue(args, i++, arg);
70
+ else if (arg === '--acceptance') opts.acceptance.push(takeValue(args, i++, arg));
68
71
  else if (arg === '--surface') opts.surface = takeValue(args, i++, arg);
69
72
  else if (arg === '--project') opts.project = takeValue(args, i++, arg);
70
73
  else if (arg === '--repo') opts.repo = takeValue(args, i++, arg);
@@ -136,6 +139,7 @@ async function main() {
136
139
  title: opts.title,
137
140
  description,
138
141
  sourceKind: opts.taskFile ? 'file' : 'text',
142
+ ...(opts.acceptance.length > 0 ? { acceptanceCriteria: opts.acceptance } : {}),
139
143
  ...(opts.ticket ? { ticket: opts.ticket } : {}),
140
144
  ...(opts.sourceRef ? { sourceRef: opts.sourceRef } : {}),
141
145
  },
@@ -14,9 +14,20 @@
14
14
  * @property {boolean} [requireRecipeCoverage]
15
15
  */
16
16
 
17
+ /**
18
+ * Acceptance-ledger rules for a terminal mark (ADR-060). `require` is the opt-in
19
+ * that makes a missing or incomplete ledger block `complete`; it defaults to
20
+ * false so a project whose templates do not write one yet is unaffected.
21
+ * `allowWeak` lets a flow finish with `weak` or `missing` verdicts.
22
+ * @typedef {object} WorkerTerminalAcceptanceRules
23
+ * @property {boolean} [require]
24
+ * @property {boolean} [allowWeak]
25
+ */
26
+
17
27
  /**
18
28
  * @typedef {object} WorkerTerminalProjectConfig
19
29
  * @property {boolean} [requireSignal]
30
+ * @property {WorkerTerminalAcceptanceRules} [acceptance]
20
31
  * @property {Partial<Record<WorkerTerminalCommand, WorkerTerminalCommandSpec>>} [complete]
21
32
  * @property {Partial<Record<WorkerTerminalCommand, WorkerTerminalCommandSpec>>} [no-change]
22
33
  * @property {Partial<Record<WorkerTerminalCommand, WorkerTerminalCommandSpec>>} [blocked]
@@ -30,6 +41,7 @@
30
41
  * @property {string} flowType
31
42
  * @property {string} [mode]
32
43
  * @property {boolean} requireSignal
44
+ * @property {WorkerTerminalAcceptanceRules} [acceptance]
33
45
  * @property {Record<WorkerTerminalCommand, WorkerTerminalCommandSpec>} commands
34
46
  * @property {WorkerTerminalWhenPresentRule[]} whenPresent
35
47
  * @property {string} resolvedAt
@@ -224,11 +236,20 @@ function resolveWorkerTerminalContract(projectConfig, flowType, options = {}) {
224
236
  }))
225
237
  : DEFAULT_WHEN_PRESENT.map((rule) => ({ ...rule, alsoRequire: [...rule.alsoRequire] }));
226
238
 
239
+ const acceptance =
240
+ projectConfig?.acceptance && typeof projectConfig.acceptance === 'object'
241
+ ? {
242
+ ...(projectConfig.acceptance.require ? { require: true } : {}),
243
+ ...(projectConfig.acceptance.allowWeak ? { allowWeak: true } : {}),
244
+ }
245
+ : null;
246
+
227
247
  return {
228
248
  schemaVersion: 1,
229
249
  flowType: flowKey,
230
250
  ...(mode ? { mode } : {}),
231
251
  requireSignal,
252
+ ...(acceptance && Object.keys(acceptance).length > 0 ? { acceptance } : {}),
232
253
  commands,
233
254
  whenPresent,
234
255
  resolvedAt: now,