@sweny-ai/core 0.1.176 → 0.1.178

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 (49) hide show
  1. package/dist/agent-env.d.ts +9 -0
  2. package/dist/agent-env.js +4 -0
  3. package/dist/cli/comment-output.js +4 -5
  4. package/dist/cli/config-file.d.ts +37 -2
  5. package/dist/cli/config-file.js +68 -3
  6. package/dist/cli/final-output.d.ts +4 -1
  7. package/dist/cli/final-output.js +6 -8
  8. package/dist/cli/main.d.ts +2 -1
  9. package/dist/cli/main.js +18 -10
  10. package/dist/cli/resume.js +1 -0
  11. package/dist/cli/run-history.d.ts +3 -7
  12. package/dist/cli/run-history.js +5 -12
  13. package/dist/cli/run-output.d.ts +16 -10
  14. package/dist/cli/run-output.js +30 -16
  15. package/dist/cli/ticket.js +3 -2
  16. package/dist/cli/try.js +2 -3
  17. package/dist/decider.d.ts +176 -64
  18. package/dist/decider.js +475 -155
  19. package/dist/executor.d.ts +55 -7
  20. package/dist/executor.js +511 -99
  21. package/dist/harness/acp.js +2 -2
  22. package/dist/harness/claude-code.js +6 -4
  23. package/dist/harness/codex.js +2 -2
  24. package/dist/harness/pi.js +2 -2
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +2 -2
  27. package/dist/journal.d.ts +34 -5
  28. package/dist/journal.js +42 -13
  29. package/dist/safe-file.d.ts +74 -0
  30. package/dist/safe-file.js +211 -0
  31. package/dist/safe-outputs.d.ts +7 -1
  32. package/dist/safe-outputs.js +7 -1
  33. package/dist/schema.d.ts +189 -241
  34. package/dist/schema.js +56 -36
  35. package/dist/skills/git-push.d.ts +99 -10
  36. package/dist/skills/git-push.js +413 -52
  37. package/dist/skills/github.d.ts +19 -15
  38. package/dist/skills/github.js +91 -15
  39. package/dist/startup-env.d.ts +30 -0
  40. package/dist/startup-env.js +48 -0
  41. package/dist/types.d.ts +86 -4
  42. package/dist/types.js +22 -0
  43. package/dist/when.d.ts +8 -1
  44. package/dist/when.js +8 -1
  45. package/dist/workflow-builder.js +3 -1
  46. package/dist/workflows/browser.js +2 -2
  47. package/dist/workflows/implement.yml +37 -5
  48. package/dist/workflows/triage.yml +40 -6
  49. package/package.json +1 -1
@@ -12,11 +12,10 @@
12
12
  *
13
13
  * This replaces ~8k lines of engine + recipe step code.
14
14
  */
15
- import type { Workflow, Skill, Tool, Claude, Observer, NodeResult, Logger, ExecutionResult } from "./types.js";
16
- import "./skills/git-push.js";
15
+ import type { Workflow, Node, Skill, Tool, Claude, Observer, NodeResult, Logger, ExecutionResult, JSONSchema } from "./types.js";
17
16
  import type { HarnessPolicyMode } from "./harness/policy.js";
18
17
  import type { AgentHarness } from "./harness/types.js";
19
- import type { DeciderMode } from "./decider.js";
18
+ import type { DeciderOperatorConfig } from "./decider.js";
20
19
  import type { Budget } from "./budget.js";
21
20
  import { type ActorInfo } from "./safe-outputs.js";
22
21
  import type { ExecutionJournal } from "./journal.js";
@@ -107,11 +106,13 @@ export interface ExecuteOptions {
107
106
  */
108
107
  harnessPolicy?: HarnessPolicyMode;
109
108
  /**
110
- * Override `workflow.decider.mode` (CLI `--decider`). `shadow` still needs
111
- * `decider.provider` in the workflow; there is no default URL. Default: the
112
- * workflow's own mode, else off (zero HTTP calls).
109
+ * Operator config for the decision model (#357): where it lives and its
110
+ * key. Only nodes with `route_by: decider` consult it. `false` turns it off
111
+ * for this run (CLI `--no-decider`). Undefined: no decider (those nodes are
112
+ * routed by the agent and the receipt says why). Never read from the
113
+ * workflow; the CLI builds it from `.sweny.yml` and SWENY_DECIDER_* env.
113
114
  */
114
- decider?: DeciderMode;
115
+ decider?: DeciderOperatorConfig | false;
115
116
  }
116
117
  /**
117
118
  * Default workflow-level step budget. Counts total node executions across the
@@ -139,14 +140,61 @@ export declare class RouteEvaluationError extends Error {
139
140
  readonly node: string;
140
141
  constructor(node: string, message: string);
141
142
  }
143
+ /** A declared output field the decider may see: a number, an integer, a boolean or a string enum. */
144
+ type RoutableField = {
145
+ kind: "number" | "integer" | "boolean";
146
+ } | {
147
+ kind: "enum";
148
+ values: ReadonlySet<string>;
149
+ };
150
+ /**
151
+ * The routable fields a node declares: `output.properties` entries typed
152
+ * number, integer or boolean, or a string `enum`. Free-text strings, arrays,
153
+ * objects and anything untyped are never routable.
154
+ */
155
+ export declare function routableFields(node: Node | undefined): Map<string, RoutableField>;
156
+ /**
157
+ * The state the decision model sees (#357), or null when the decider must be
158
+ * skipped (`no_routable_state`): a condition reads `input.*` (never sent), the
159
+ * routed node declares no routable field, or a condition names a node that
160
+ * declares none. Otherwise: per prior node, its status, its routable declared
161
+ * fields projected to their declared types (successful nodes only) and its
162
+ * eval verdicts. Never the run input, free-text or undeclared data,
163
+ * summaries, tool calls, env or skill config. Redacted with the journal's
164
+ * redactor and fenced as untrusted data.
165
+ */
166
+ export declare function deciderRoutingState(workflow: Workflow, current: string, results: Map<string, NodeResult>, conditions: string[], secrets: string[]): string | null;
142
167
  /**
143
168
  * The bounded prompt context for one node: `input` plus its dependencies' entries.
144
169
  * Exported for the property tests only; not part of the package API (index.ts does not re-export it).
145
170
  * @internal
146
171
  */
147
172
  export declare function buildBoundedContext(workflow: Workflow, nodeId: string, results: Map<string, NodeResult>, input: unknown, instruction: string): Record<string, unknown>;
173
+ /** One way a node's emitted data breaks its declared output contract. */
174
+ export interface ContractProblem {
175
+ field: string;
176
+ kind: "missing" | "invalid";
177
+ problem: string;
178
+ }
179
+ /** Keyword on an integer output property: the count sweny cross-checks against an array in the same output. */
180
+ export declare const COUNT_OF_KEYWORD = "x-sweny-count-of";
181
+ /**
182
+ * Check emitted data against the declared output contract (#357): every
183
+ * `required` field present; every present top-level property of its declared
184
+ * `type` and inside its `enum`; and every `x-sweny-count-of` integer equal to
185
+ * the count it declares over its array. Not full JSON Schema: formats,
186
+ * nested shapes and additionalProperties stay the author's concern.
187
+ */
188
+ export declare function outputContractProblems(data: unknown, output: JSONSchema | undefined): ContractProblem[];
148
189
  /**
149
190
  * Dry-run tool gate (#380). Only an explicit `access: "read"` passes; a tool
150
191
  * with no `access` is treated as a write so new tools fail safe.
151
192
  */
152
193
  export declare function isReadTool(tool: Pick<Tool, "access">): boolean;
194
+ /**
195
+ * The tool dispatcher's staged-run gate: in a staged or dry run no write (or
196
+ * unclassified) tool handler runs, whatever reached the agent. Throws before
197
+ * any side effect.
198
+ */
199
+ export declare function guardStagedWrite(tool: Pick<Tool, "name" | "access">, staged: boolean): void;
200
+ export {};