@inflexa-ai/harness 0.45.0 → 0.45.1

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 (122) hide show
  1. package/dist/agents/conversation-agent.d.ts +10 -0
  2. package/dist/agents/conversation-agent.js +19 -1
  3. package/dist/agents/sandbox/shared.d.ts +23 -2
  4. package/dist/agents/sandbox/shared.js +51 -18
  5. package/dist/agents/sandbox/translational-safety-agent.js +26 -0
  6. package/dist/agents/sandbox/types.d.ts +24 -1
  7. package/dist/agents/sandbox-catalog.d.ts +14 -0
  8. package/dist/agents/sandbox-catalog.js +19 -0
  9. package/dist/app/approve-plan.d.ts +5 -2
  10. package/dist/app/approve-plan.js +1 -1
  11. package/dist/app/chat-turn.js +6 -3
  12. package/dist/config/environment-stores.d.ts +4 -2
  13. package/dist/contracts/chat-events.d.ts +12 -2
  14. package/dist/contracts/chat-events.js +1 -1
  15. package/dist/contracts/chat-frame.js +6 -2
  16. package/dist/contracts/index.d.ts +1 -1
  17. package/dist/contracts/schemas/chat-events.d.ts +25 -0
  18. package/dist/contracts/schemas/chat-events.js +7 -0
  19. package/dist/contracts/schemas/chat-parts.d.ts +39 -0
  20. package/dist/contracts/schemas/chat-parts.js +17 -0
  21. package/dist/contracts/schemas/index.d.ts +1 -1
  22. package/dist/contracts/schemas/index.js +1 -1
  23. package/dist/execution/dbos-workflow-purger.d.ts +2 -0
  24. package/dist/execution/dbos-workflow-purger.js +21 -14
  25. package/dist/execution/run-canceler.d.ts +33 -11
  26. package/dist/execution/run-canceler.js +129 -27
  27. package/dist/execution/run-end-record.d.ts +30 -0
  28. package/dist/execution/run-end-record.js +27 -0
  29. package/dist/index.d.ts +9 -5
  30. package/dist/index.js +11 -1
  31. package/dist/loop/call-guard.d.ts +50 -0
  32. package/dist/loop/call-guard.js +90 -0
  33. package/dist/loop/compaction.d.ts +5 -0
  34. package/dist/loop/compaction.js +17 -0
  35. package/dist/loop/run-agent.d.ts +9 -0
  36. package/dist/loop/run-agent.js +15 -1
  37. package/dist/loop/run-to-terminal.js +4 -1
  38. package/dist/loop/types.d.ts +6 -0
  39. package/dist/memory/conversation-display-recorder.d.ts +0 -2
  40. package/dist/memory/conversation-display-recorder.js +28 -3
  41. package/dist/memory/thread-history.d.ts +34 -7
  42. package/dist/memory/thread-history.js +151 -42
  43. package/dist/prompts/briefing.d.ts +57 -3
  44. package/dist/prompts/briefing.js +129 -2
  45. package/dist/prompts/planner.js +13 -2
  46. package/dist/provenance/seam.d.ts +23 -15
  47. package/dist/provenance/seam.js +7 -5
  48. package/dist/providers/ai-sdk.js +87 -7
  49. package/dist/providers/types.d.ts +6 -0
  50. package/dist/reference-data/catalog.js +141 -2
  51. package/dist/report-model/authoring-grammar.d.ts +26 -26
  52. package/dist/sandbox/image-packages.d.ts +26 -4
  53. package/dist/sandbox/image-packages.js +18 -4
  54. package/dist/schemas/data-profile-schemas.d.ts +12 -12
  55. package/dist/schemas/plan-schemas.d.ts +57 -3
  56. package/dist/schemas/plan-schemas.js +1 -1
  57. package/dist/schemas/workflow-state.d.ts +113 -0
  58. package/dist/schemas/workflow-state.js +54 -0
  59. package/dist/state/artifacts.d.ts +17 -1
  60. package/dist/state/artifacts.js +21 -3
  61. package/dist/state/index.d.ts +2 -2
  62. package/dist/state/index.js +1 -1
  63. package/dist/state/runs.d.ts +43 -9
  64. package/dist/state/runs.js +85 -14
  65. package/dist/state/step-executions.d.ts +9 -0
  66. package/dist/state/step-executions.js +22 -0
  67. package/dist/tools/ad-hoc-router.d.ts +2 -0
  68. package/dist/tools/ad-hoc-router.js +18 -2
  69. package/dist/tools/capability-data.d.ts +36 -0
  70. package/dist/tools/capability-data.js +73 -0
  71. package/dist/tools/execute-analysis.d.ts +37 -9
  72. package/dist/tools/execute-analysis.js +131 -21
  73. package/dist/tools/knowledge/check.d.ts +60 -0
  74. package/dist/tools/knowledge/check.js +92 -0
  75. package/dist/tools/knowledge/client.d.ts +382 -0
  76. package/dist/tools/knowledge/client.js +302 -0
  77. package/dist/tools/knowledge/environment.d.ts +78 -0
  78. package/dist/tools/knowledge/environment.js +105 -0
  79. package/dist/tools/knowledge/index.d.ts +49 -0
  80. package/dist/tools/knowledge/index.js +70 -0
  81. package/dist/tools/knowledge/local-slots.d.ts +62 -0
  82. package/dist/tools/knowledge/local-slots.js +177 -0
  83. package/dist/tools/knowledge/pin.d.ts +14 -0
  84. package/dist/tools/knowledge/pin.js +17 -0
  85. package/dist/tools/knowledge/recommend.d.ts +92 -0
  86. package/dist/tools/knowledge/recommend.js +98 -0
  87. package/dist/tools/knowledge/situation.d.ts +143 -0
  88. package/dist/tools/knowledge/situation.js +164 -0
  89. package/dist/tools/knowledge/skeleton.d.ts +69 -0
  90. package/dist/tools/knowledge/skeleton.js +202 -0
  91. package/dist/tools/knowledge/template.d.ts +137 -0
  92. package/dist/tools/knowledge/template.js +267 -0
  93. package/dist/tools/research/generate-plan.d.ts +23 -0
  94. package/dist/tools/research/generate-plan.js +203 -12
  95. package/dist/tools/research/guarded-address.d.ts +20 -0
  96. package/dist/tools/research/guarded-address.js +148 -0
  97. package/dist/tools/research/searxng-engine.d.ts +40 -0
  98. package/dist/tools/research/searxng-engine.js +120 -0
  99. package/dist/tools/research/web-fetch.d.ts +124 -0
  100. package/dist/tools/research/web-fetch.js +627 -0
  101. package/dist/tools/research/web-search.d.ts +75 -0
  102. package/dist/tools/research/web-search.js +112 -0
  103. package/dist/tools/sandbox/list-available-packages.d.ts +7 -4
  104. package/dist/tools/sandbox/list-available-packages.js +12 -4
  105. package/dist/tools/sandbox/list-available-refs.d.ts +21 -0
  106. package/dist/tools/sandbox/list-available-refs.js +60 -3
  107. package/dist/tools/sandbox/report-blocker.js +5 -1
  108. package/dist/tools/terminal-text.d.ts +11 -0
  109. package/dist/tools/terminal-text.js +19 -0
  110. package/dist/tools/workspace/decision-record.d.ts +81 -0
  111. package/dist/tools/workspace/decision-record.js +117 -0
  112. package/dist/tools/workspace/edit-file.d.ts +3 -1
  113. package/dist/tools/workspace/edit-file.js +20 -2
  114. package/dist/tools/workspace/execute-command.d.ts +17 -0
  115. package/dist/tools/workspace/execute-command.js +28 -1
  116. package/dist/tools/workspace/index.d.ts +1 -0
  117. package/dist/tools/workspace/index.js +1 -0
  118. package/dist/tools/workspace/mutator.d.ts +1 -1
  119. package/dist/workflows/execute-analysis.d.ts +58 -18
  120. package/dist/workflows/execute-analysis.js +273 -58
  121. package/dist/workflows/sandbox-step.d.ts +12 -0
  122. package/package.json +5 -1
@@ -0,0 +1,124 @@
1
+ /**
2
+ * `web_fetch` — the page-reading step of the conversation agent's web research.
3
+ *
4
+ * One URL in, extracted text out: HTML becomes Markdown (Readability over a
5
+ * `linkedom` DOM, then Turndown, with the body text as the fallback), a PDF
6
+ * becomes the text of its first 100 pages through `pdf-parse`, and a text or
7
+ * JSON body passes through. A bad scheme, a denied approval, an HTTP error, an
8
+ * oversized body, a redirect chain past the limit, and a body the tool cannot
9
+ * extract are all normal results on the ok channel — never a failure of the
10
+ * turn.
11
+ *
12
+ * The address guard reads the address the connection itself uses, because a
13
+ * separate name resolution before a `fetch` races the resolver (DNS rebinding):
14
+ * a literal host classifies before the request is sent — the connection layer
15
+ * runs no name lookup for a literal — and a name classifies inside the `lookup`
16
+ * hook of `node:http`/`node:https`, over every address of the resolution,
17
+ * because the connect layer falls back to a later address after an earlier one
18
+ * fails. A guarded hop is destroyed before the user is asked, and an approval
19
+ * re-sends the hop.
20
+ */
21
+ import { type LookupAddress, type LookupAllOptions } from "node:dns";
22
+ import { type LookupFunction } from "node:net";
23
+ import { type ToolOutputStore } from "../../loop/tool-output.js";
24
+ /** The response head and body stream of one hop, narrowed to what the tool reads. */
25
+ export interface WebFetchHopResponse {
26
+ readonly statusCode?: number;
27
+ readonly headers: Record<string, string | string[] | undefined>;
28
+ on(event: "data", listener: (chunk: Buffer) => void): void;
29
+ on(event: "end", listener: () => void): void;
30
+ on(event: "error", listener: (error: Error) => void): void;
31
+ destroy(error?: Error): void;
32
+ /** A real response holds these; the decode path pauses the encoded side while the decoder drains. */
33
+ pause?(): void;
34
+ resume?(): void;
35
+ }
36
+ /** One hop request, narrowed to what the tool drives. */
37
+ export interface WebFetchHopRequestHandle {
38
+ on(event: "response", listener: (response: WebFetchHopResponse) => void): void;
39
+ on(event: "error", listener: (error: Error) => void): void;
40
+ on(event: "timeout", listener: () => void): void;
41
+ end(): void;
42
+ destroy(error?: Error): void;
43
+ }
44
+ export interface WebFetchHopRequestOptions {
45
+ readonly headers: Record<string, string>;
46
+ readonly lookup?: LookupFunction;
47
+ readonly timeoutMs: number;
48
+ }
49
+ /** One HTTP hop. The default is the real `node:http`/`node:https` request; a test can substitute a recorded hop. */
50
+ export type WebFetchHopRequest = (url: URL, options: WebFetchHopRequestOptions) => WebFetchHopRequestHandle;
51
+ /** A name resolution that answers every address at once, the `all: true` shape of `dns.lookup`. */
52
+ export type WebFetchLookup = (hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void) => void;
53
+ export interface WebFetchKept {
54
+ readonly ref: string;
55
+ readonly keptLength: number;
56
+ }
57
+ export interface WebFetchPdfCut {
58
+ readonly totalPages: number;
59
+ readonly pagesRead: number;
60
+ }
61
+ export interface WebFetchOk {
62
+ readonly status: "ok";
63
+ readonly finalUrl: string;
64
+ readonly contentType: string;
65
+ readonly text: string;
66
+ readonly totalLength: number;
67
+ readonly cut: boolean;
68
+ readonly pdfCut?: WebFetchPdfCut;
69
+ readonly kept?: WebFetchKept;
70
+ readonly remainderNotKept?: boolean;
71
+ }
72
+ export type WebFetchOutput = WebFetchOk | {
73
+ readonly status: "invalid_url";
74
+ readonly text: string;
75
+ } | {
76
+ readonly status: "unsupported_scheme";
77
+ readonly scheme: string;
78
+ readonly text: string;
79
+ } | {
80
+ readonly status: "refused";
81
+ readonly text: string;
82
+ readonly feedback?: string;
83
+ } | {
84
+ readonly status: "http_error";
85
+ readonly httpStatus: number;
86
+ readonly text: string;
87
+ } | {
88
+ readonly status: "redirect_limit";
89
+ readonly text: string;
90
+ } | {
91
+ readonly status: "body_too_large";
92
+ readonly limitBytes: number;
93
+ readonly contentType: string;
94
+ readonly text: string;
95
+ } | {
96
+ readonly status: "unextractable";
97
+ readonly contentType: string;
98
+ readonly text: string;
99
+ readonly detail?: string;
100
+ } | {
101
+ readonly status: "request_failed";
102
+ readonly text: string;
103
+ readonly detail?: string;
104
+ };
105
+ export interface WebFetchToolDeps {
106
+ readonly toolOutputStore?: ToolOutputStore;
107
+ /** Substitutes the name resolution, so a test answers a controlled address set. The default is `dns.lookup`. */
108
+ readonly lookup?: WebFetchLookup;
109
+ /** Substitutes one HTTP hop, so a test serves recorded bodies offline. The default is the real node hop. */
110
+ readonly hopRequest?: WebFetchHopRequest;
111
+ }
112
+ /**
113
+ * Estimate the deepest element nesting of an HTML document in one linear scan, without building a DOM.
114
+ * Deep nesting is the input shape that makes the linkedom/Readability pair burn CPU for minutes on a
115
+ * body under the byte limit, and the extraction is synchronous, so no deadline can interrupt it — the
116
+ * bound must gate the parse, not watch it. The estimate never parses: void elements and self-closing
117
+ * tags open no level, raw-text elements skip to their close, quoted attribute values hide their `<`,
118
+ * and an implied-close family pops its open peers, so a list or a table of any length stays flat and a
119
+ * stray close tag pops to its nearest matching open.
120
+ */
121
+ export declare function htmlNestingDepth(html: string): number;
122
+ export declare function createWebFetchTool(deps?: WebFetchToolDeps): import("../define-tool.js").Tool<{
123
+ url: string;
124
+ }, WebFetchOutput>;