ennodia 0.1.1 → 0.2.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.
Files changed (46) hide show
  1. package/CONTRIBUTING.md +60 -36
  2. package/README.md +74 -58
  3. package/bench/README.md +7 -5
  4. package/bench/bug-recall/run.ts +12 -4
  5. package/bin/ennodia +23 -2
  6. package/docs/assets/agents/mcp.svg +1 -1
  7. package/docs/assets/orchestration-pipeline.svg +4 -3
  8. package/docs/comparisons/agent-frameworks.md +15 -10
  9. package/docs/comparisons/autogen.md +20 -15
  10. package/docs/comparisons/chathub.md +15 -14
  11. package/docs/comparisons/index.md +30 -22
  12. package/docs/comparisons/langgraph.md +19 -12
  13. package/docs/comparisons/mixture-of-agents.md +20 -17
  14. package/docs/comparisons/model-merging.md +7 -5
  15. package/docs/comparisons/openrouter.md +30 -22
  16. package/docs/concepts/compositional-audits.md +16 -13
  17. package/docs/concepts/data-governance.md +31 -15
  18. package/docs/concepts/how-ennodia-works.md +48 -22
  19. package/docs/concepts/interfaces-and-core.md +19 -6
  20. package/docs/concepts/second-opinions.md +20 -20
  21. package/docs/getting-started.md +55 -27
  22. package/docs/guides/agent-skills.md +16 -13
  23. package/docs/guides/budgets-and-limits.md +30 -20
  24. package/docs/guides/running-better-audits.md +50 -44
  25. package/docs/index.md +60 -37
  26. package/docs/install.md +41 -32
  27. package/docs/reference/benchmarks.md +6 -4
  28. package/docs/reference/controlled-english.md +130 -0
  29. package/docs/reference/ennodia-io.md +28 -22
  30. package/docs/reference/mcp-tools.md +244 -87
  31. package/docs/reference/supported-harnesses.md +9 -9
  32. package/package.json +7 -5
  33. package/src/advisor.ts +685 -0
  34. package/src/budget.ts +25 -6
  35. package/src/cli.ts +1 -1
  36. package/src/compare.ts +248 -52
  37. package/src/compositional.ts +18 -0
  38. package/src/core.ts +547 -16
  39. package/src/harnesses.ts +33 -2
  40. package/src/index.ts +38 -0
  41. package/src/plan-advice.ts +601 -0
  42. package/src/runs.ts +74 -9
  43. package/src/server.ts +312 -46
  44. package/src/skills.ts +131 -11
  45. package/src/tasks.ts +192 -22
  46. package/src/version.ts +1 -1
package/src/harnesses.ts CHANGED
@@ -9,6 +9,21 @@ export type HarnessRunInput = {
9
9
  model?: string;
10
10
  timeoutMs?: number;
11
11
  skills?: Skill[];
12
+ /** Run the task against an ephemeral isolated copy of cwd instead of cwd
13
+ * itself, so concurrent tasks sharing a cwd cannot clobber each other's
14
+ * file writes. TaskManager refuses symbolic links in the copied tree and
15
+ * deletes the copy when the task becomes terminal. */
16
+ isolateCwd?: boolean;
17
+ /** Scratch file path an adapter can write its clean final message to,
18
+ * separate from the harness's raw stdout (which may include a full
19
+ * transcript). Populated by TaskManager; adapters opt in by referencing it. */
20
+ finalMessagePath?: string;
21
+ };
22
+
23
+ export type HarnessUsage = {
24
+ /** Best-effort, adapter-reported token count. Not guaranteed available or
25
+ * billing-accurate; parsed from each CLI's own text output where possible. */
26
+ tokensUsed?: number;
12
27
  };
13
28
 
14
29
  export type CommandSpec = {
@@ -29,6 +44,8 @@ export type HarnessAdapter = {
29
44
  capabilities: string[];
30
45
  notes?: string[];
31
46
  buildCommand?: (commandPath: string, input: HarnessRunInput) => CommandSpec;
47
+ /** Best-effort usage extraction from a finished task's captured output. */
48
+ extractUsage?: (stdout: string, stderr: string) => HarnessUsage | undefined;
32
49
  };
33
50
 
34
51
  export type HarnessDiscovery = {
@@ -116,9 +133,22 @@ export const harnessAdapters: HarnessAdapter[] = [
116
133
  args.push("--model", input.model);
117
134
  }
118
135
 
136
+ if (input.finalMessagePath) {
137
+ args.push("-o", input.finalMessagePath);
138
+ }
139
+
119
140
  args.push(input.prompt);
120
141
  return { command: commandPath, args, cwd: input.cwd };
121
142
  },
143
+ extractUsage: (stdout) => {
144
+ const match = /tokens used\s*\n\s*([\d,]+)/i.exec(stdout);
145
+ if (!match) {
146
+ return undefined;
147
+ }
148
+
149
+ const tokensUsed = Number(match[1].replace(/,/g, ""));
150
+ return Number.isFinite(tokensUsed) ? { tokensUsed } : undefined;
151
+ },
122
152
  },
123
153
  {
124
154
  id: "opencode",
@@ -269,12 +299,13 @@ export const harnessAdapters: HarnessAdapter[] = [
269
299
  notes: [
270
300
  "Runs through the supported `agy` CLI surface.",
271
301
  "Defaults to Antigravity sandbox mode for Ennodia-launched tasks.",
272
- "Sends prompts through stdin because `agy --print` does not consume positional prompts.",
302
+ "Passes the prompt as the value of Antigravity's non-interactive `--print` option.",
273
303
  ],
274
304
  buildCommand: (commandPath, input) => {
275
305
  const args = [
276
306
  "--sandbox",
277
307
  "--print",
308
+ input.prompt,
278
309
  "--print-timeout",
279
310
  toGoDuration(input.timeoutMs),
280
311
  ];
@@ -287,7 +318,7 @@ export const harnessAdapters: HarnessAdapter[] = [
287
318
  args.push("--model", input.model);
288
319
  }
289
320
 
290
- return { command: commandPath, args, cwd: input.cwd, stdin: input.prompt };
321
+ return { command: commandPath, args, cwd: input.cwd };
291
322
  },
292
323
  },
293
324
  ];
package/src/index.ts CHANGED
@@ -8,6 +8,9 @@ export {
8
8
  createDefaultEnnodiaCore,
9
9
  type CompareStart,
10
10
  type CompareStartWithBudgetInput,
11
+ type AdvisedPlanStart,
12
+ type AdvisedPlanStartInput,
13
+ type AdvisedPlanTaskStart,
11
14
  type CompositionalEstimate,
12
15
  type CompositionalEstimateInput,
13
16
  type CompositionalStart,
@@ -16,6 +19,7 @@ export {
16
19
  type CompositionalTaskStart,
17
20
  type EnnodiaCoreOptions,
18
21
  type EnnodiaCoreShutdownOptions,
22
+ type PlanAdviceStartInput,
19
23
  type RunEstimate,
20
24
  type RunEstimateInput,
21
25
  type RunStartWithSkillIdsInput,
@@ -60,6 +64,37 @@ export {
60
64
  type CompositionalTaskSnapshot,
61
65
  type ResolvedCompositionalSlice,
62
66
  } from "./compositional";
67
+ export {
68
+ ADVISOR_PLAN_SCHEMA_VERSION,
69
+ AdvisorInventorySnapshotSchema,
70
+ AdvisorPlanProposalSchema,
71
+ buildPlanAdvisorPrompt,
72
+ compileAdvisorExecutionPlan,
73
+ digestAdvisorExecutionPlan,
74
+ parseAdvisorPlanProposal,
75
+ validateAdvisorPlanProposal,
76
+ type AdvisorExecutionPlan,
77
+ type AdvisorExecutionSlice,
78
+ type AdvisorInventorySnapshot,
79
+ type AdvisorModelSelection,
80
+ type AdvisorPlanCompilation,
81
+ type AdvisorPlanIssue,
82
+ type AdvisorPlanIssueCode,
83
+ type AdvisorPlanParseResult,
84
+ type AdvisorPlanProposal,
85
+ type AdvisorPlanValidation,
86
+ } from "./advisor";
87
+ export {
88
+ PlanAdviceManager,
89
+ type PlanAdviceEvent,
90
+ type PlanAdviceIssue,
91
+ type PlanAdviceManagerOptions,
92
+ type PlanAdviceManagerStartInput,
93
+ type PlanAdviceRevalidationContext,
94
+ type PlanAdviceStatus,
95
+ type PlanAdviceView,
96
+ type PlanAdviceViewOptions,
97
+ } from "./plan-advice";
63
98
  export {
64
99
  discoverHarnesses,
65
100
  findHarnessAdapter,
@@ -95,12 +130,15 @@ export {
95
130
  type RunViewOptions,
96
131
  } from "./runs";
97
132
  export {
133
+ AdvisorResultSchema,
98
134
  CompareAnalysisSchema,
99
135
  CompareManager,
136
+ buildAdvisorPrompt,
100
137
  buildJudgePrompt,
101
138
  buildSynthesizerPrompt,
102
139
  parseJudgeAnalysis,
103
140
  type CompareAnalysis,
141
+ type AdvisorResult,
104
142
  type CompareCandidate,
105
143
  type CompareCandidateInput,
106
144
  type CompareEvent,