@inflexa-ai/harness 0.41.0 → 0.41.2

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 (72) hide show
  1. package/dist/contracts/report-blocks.d.ts +10 -10
  2. package/dist/contracts/report-reference.d.ts +4 -4
  3. package/dist/memory/message-backfill.d.ts +8 -2
  4. package/dist/prompts/briefing.d.ts +28 -1
  5. package/dist/prompts/briefing.js +44 -1
  6. package/dist/prompts/compaction.d.ts +2 -2
  7. package/dist/prompts/compaction.js +9 -5
  8. package/dist/prompts/conversation.d.ts +1 -1
  9. package/dist/prompts/conversation.js +12 -0
  10. package/dist/prompts/sandbox-standards.d.ts +1 -1
  11. package/dist/prompts/sandbox-standards.js +4 -0
  12. package/dist/report-model/authoring-grammar.d.ts +4 -4
  13. package/dist/runtime/assemble.d.ts +4 -2
  14. package/dist/runtime/assemble.js +8 -1
  15. package/dist/runtime/boot.d.ts +2 -2
  16. package/dist/runtime/boot.js +3 -3
  17. package/dist/schemas/file-metadata.js +9 -9
  18. package/dist/schemas/plan-schemas.d.ts +3 -3
  19. package/dist/state/init.d.ts +7 -6
  20. package/dist/state/init.js +51 -672
  21. package/dist/state/migrations/20260927120000_baseline.d.ts +11 -0
  22. package/dist/state/migrations/20260927120000_baseline.js +675 -0
  23. package/dist/state/migrations/index.d.ts +10 -0
  24. package/dist/state/migrations/index.js +13 -0
  25. package/dist/tools/ad-hoc-router.js +9 -4
  26. package/dist/tools/bio/chembl.js +8 -5
  27. package/dist/tools/bio/comptox.js +4 -4
  28. package/dist/tools/bio/drug-gene-interactions.js +5 -4
  29. package/dist/tools/bio/gene-disease-evidence.js +4 -4
  30. package/dist/tools/bio/lookup-annotation.js +7 -3
  31. package/dist/tools/bio/opentargets.js +8 -6
  32. package/dist/tools/bio/pubchem.js +4 -2
  33. package/dist/tools/bio/pubmed.d.ts +1 -1
  34. package/dist/tools/bio/pubmed.js +10 -6
  35. package/dist/tools/bio/search-clinical-trials.js +2 -1
  36. package/dist/tools/bio/search-gene.js +2 -1
  37. package/dist/tools/bio/search-interactions.js +8 -4
  38. package/dist/tools/bio/target-safety.js +2 -1
  39. package/dist/tools/display/show-user.js +7 -5
  40. package/dist/tools/execute-analysis.js +14 -4
  41. package/dist/tools/lib/opentargets-client.d.ts +8 -3
  42. package/dist/tools/lib/opentargets-client.js +12 -3
  43. package/dist/tools/read-tool-output.js +7 -4
  44. package/dist/tools/report-authoring/authoring-tools.js +22 -15
  45. package/dist/tools/report-session/derive-table.js +5 -1
  46. package/dist/tools/report-session/examine-page.js +5 -4
  47. package/dist/tools/report-session/preview-report.js +6 -1
  48. package/dist/tools/report-session/record-version.js +2 -1
  49. package/dist/tools/research/context7-docs.js +8 -2
  50. package/dist/tools/research/generate-analogy-report.js +15 -15
  51. package/dist/tools/research/generate-plan.js +12 -7
  52. package/dist/tools/research/inspect-data-profile.js +7 -5
  53. package/dist/tools/research/inspect-run.js +6 -2
  54. package/dist/tools/research/literature-reviewer.js +11 -6
  55. package/dist/tools/research/search-arxiv.js +2 -1
  56. package/dist/tools/research/search-github-repos.js +9 -3
  57. package/dist/tools/sandbox/list-available-refs.js +3 -2
  58. package/dist/tools/sandbox/report-blocker.js +6 -1
  59. package/dist/tools/sandbox/skills.js +4 -2
  60. package/dist/tools/start-report-session.js +4 -1
  61. package/dist/tools/workspace/edit-file.js +4 -3
  62. package/dist/tools/workspace/execute-command.js +6 -5
  63. package/dist/tools/workspace/grep.js +9 -7
  64. package/dist/tools/workspace/list-files.js +1 -1
  65. package/dist/tools/workspace/read-file.js +2 -1
  66. package/dist/tools/workspace/scan-inputs.js +3 -1
  67. package/dist/tools/workspace/show-file.js +6 -3
  68. package/dist/tools/workspace/workspace-search.js +3 -1
  69. package/dist/tools/workspace/write-file.js +5 -3
  70. package/dist/workflows/execute-analysis.d.ts +28 -5
  71. package/dist/workflows/execute-analysis.js +34 -10
  72. package/package.json +2 -1
@@ -82,7 +82,7 @@ import { unwrapOrThrow } from "../lib/result.js";
82
82
  import { countArtifactsForRun, insertStepExecution, loadDataProfileStatus, queryActiveRun, queryStepArtifactPaths, queryStepsByRun, seedStepExecutions, setRunSynthesisOutcome, suspendAnalysis as suspendAnalysisQuery, sweepPendingStepExecutions, updateRunStatus, updateStepExecution, } from "../state/index.js";
83
83
  import { addChatUsage, hasReportedUsage } from "../loop/metrics.js";
84
84
  import { SYNTHESIS_AGENT_ID, loadStepSummariesFromDisk } from "../execution/run-synthesis.js";
85
- import { MAX_UPSTREAM_ARTIFACTS, composeStepBriefing } from "../prompts/briefing.js";
85
+ import { MAX_UPSTREAM_ARTIFACTS, composeStepBriefing, emptyStepMemory } from "../prompts/briefing.js";
86
86
  import { SYNTHESIS_STEP_ID, runDir, runStepDir, stepSubdir, stepWritePrefix, toSandboxPath } from "../workspace/paths.js";
87
87
  import { isChatDataPart } from "../sandbox/sandbox-step-translate.js";
88
88
  import { synthesizeRun } from "../app/synthesize-run.js";
@@ -220,17 +220,30 @@ export function buildChildInput(args) {
220
220
  * rendered any earlier (at plan submission, say) cannot mention them, and the
221
221
  * agent is left to rediscover its own upstream.
222
222
  *
223
- * Everything read here is durable state written by an already-settled child
224
- * (`output/summary.md`, `cortex_artifacts`) or by the profiler
225
- * (`cortex_analysis_state`) — never live in-flight state, which would not
226
- * reproduce.
227
- *
228
223
  * REPLAY: the caller wraps this in a `DBOS.runStep`, so the composed string is
229
224
  * checkpointed and a replay returns it verbatim — the DB and disk are not read
230
225
  * again and cannot drift the seed under a recovered run. Never call it
231
226
  * unwrapped from the workflow body.
232
227
  */
233
228
  export async function composeStepSeed(args) {
229
+ return composeStepBriefing(await gatherStepPackage(args));
230
+ }
231
+ /**
232
+ * Do every read of one step's package and give the data its seed is rendered
233
+ * from. All reads live here, so `composeStepBriefing` stays a pure renderer.
234
+ *
235
+ * Everything read is durable state: written by an already-settled child
236
+ * (`output/summary.md`, `cortex_artifacts`), by the profiler
237
+ * (`cortex_analysis_state`), or by the conversation agent
238
+ * (`cortex_working_memory`). The working memory is the one read that can
239
+ * change while the run is live — it is read per dispatch, not once per run,
240
+ * so an edit during a run reaches each later step, and two steps of one run
241
+ * can carry different copies.
242
+ *
243
+ * A read failure throws (house rules): a swallowed error would be frozen into
244
+ * the checkpointed seed and served to every replay of this step.
245
+ */
246
+ export async function gatherStepPackage(args) {
234
247
  const { input, stepId, runId, deps } = args;
235
248
  const step = input.planStepById[stepId];
236
249
  if (!step) {
@@ -246,9 +259,19 @@ export async function composeStepSeed(args) {
246
259
  analysisId,
247
260
  workingDir: toSandboxPath(workspaceRoot, analysisId, stepWritePrefix({ workspaceRoot, runId, stepId })),
248
261
  };
249
- // A DB failure here throws (house rules): a swallowed error would be frozen
250
- // into the checkpointed seed and served to every replay of this step.
251
262
  const profile = unwrapOrThrow(await loadDataProfileStatus(deps.pool, analysisId));
263
+ // A failed memory read leaves the section out: the step runs without the copy of the memory, not without a seed.
264
+ const memoryRead = await deps.workingMemory.load(analysisId);
265
+ if (memoryRead.isErr()) {
266
+ const log = (deps.logger ?? createNoopLogger()).named("executeAnalysis.seed");
267
+ log.warn("the working-memory read failed, thus the seed has no memory section", {
268
+ analysisId,
269
+ stepId,
270
+ error: describeDbError(memoryRead.error),
271
+ ...log.errorFields(memoryRead.error.cause),
272
+ });
273
+ }
274
+ const memory = memoryRead.isOk() ? memoryRead.value : emptyStepMemory();
252
275
  const upstream = await collectUpstreamHandoffs({
253
276
  analysisId,
254
277
  runId,
@@ -257,12 +280,13 @@ export async function composeStepSeed(args) {
257
280
  agentByStepId: input.agentByStepId,
258
281
  pool: deps.pool,
259
282
  });
260
- return composeStepBriefing({
283
+ return {
261
284
  step,
262
285
  workspace,
263
286
  profile: profile?.result ?? null,
264
287
  upstream,
265
- });
288
+ memory: { goal: memory.goal, constraints: memory.constraints },
289
+ };
266
290
  }
267
291
  /**
268
292
  * Gather what each completed dependency produced. Dependency order is the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inflexa-ai/harness",
3
- "version": "0.41.0",
3
+ "version": "0.41.2",
4
4
  "description": "Host-agnostic bioinformatics agent harness — hand-rolled agent loop, DBOS-durable workflows, sandboxed compute.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -77,6 +77,7 @@
77
77
  "hono": "^4.12.34",
78
78
  "hyparquet": "^1.28.1",
79
79
  "js-tiktoken": "^1.0.21",
80
+ "kysely": "^0.29.6",
80
81
  "mime": "^4.1.0",
81
82
  "nanoid": "^5.1.16",
82
83
  "neverthrow": "^8.2.0",