@lazyingart/agintiflow 0.20.199 → 0.20.201

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.
package/.env.example CHANGED
@@ -22,6 +22,8 @@ DEEPSEEK_API_KEY=
22
22
  OPENAI_API_KEY=
23
23
  AGINTI_ALLOW_HOSTED_IMAGE_PERCEPTION=false
24
24
  AGINTI_ALLOW_HOSTED_WEB_RESEARCH=false
25
+ AGINTI_WEB_SEARCH_PROVIDER=auto
26
+ # BRAVE_SEARCH_API_KEY=only_when_AGINTI_WEB_SEARCH_PROVIDER_is_brave
25
27
  AGINTI_ALLOW_HOSTED_JSON_SPECIALIST=false
26
28
  # A cross-provider writer needs both an explicit target and the permission below.
27
29
  AGINTI_WRITING_PROVIDER=
package/README.md CHANGED
@@ -54,7 +54,7 @@ Most agent tools are either a chat box with hidden state or an expensive one-mod
54
54
  | Disciplined by default | `AGINTI.md` starts with a behavior contract: surface ambiguity, keep edits surgical, avoid speculative complexity, verify outcomes, and respect permission blockers. |
55
55
  | Role-based models | Route, main, spare, wrapper, and auxiliary image roles are separate. LocalLLM supplies the default fast/deep lanes; DeepSeek, OpenAI, OpenRouter, Qwen, and Venice are optional explicit routes. |
56
56
  | Writing without agent noise | `writing_specialist` drafts novels, books, scripts, essays, and paper prose in an isolated writing-only context on the active provider. Cross-provider writing requires explicit permission; ambient keys and model arguments cannot silently switch a LocalLLM session to a hosted model. The main agent then handles files, formatting, citations, checks, and artifacts. |
57
- | Visual and web evidence | `read_image` uses the loopback LocalLLM vision model in local sessions and never falls through to a hosted provider. `web_research` saves sourced snippet artifacts for local synthesis. OpenAI perception/research and wrapper second opinions require explicit provider/tool permission. |
57
+ | Visual and web evidence | `read_image` keeps local pixels local. Fast search has provider fallback; exact page reads preserve hashes and metadata; `deep_research` adds resumable planning, parallel retrieval, exact-quote evidence, gap filling, synthesis, and citation auditing on the active provider. |
58
58
  | Scouts before big work | Parallel scouts can cheaply map architecture, tests, risks, symbols, and integration points before the main executor edits anything. |
59
59
  | SCS by default | Student-Committee-Supervisor mode adds a typed gate: committee drafts, student approves/monitors, supervisor executes. Use `/scs off` or `--no-scs` only when speed matters more than validation. |
60
60
  | AAPS for large workflows | AAPS describes top-down agentic pipeline scripts; AgInTiFlow can act as the interactive backend that validates, compiles, and executes those workflows. |
@@ -174,10 +174,18 @@ aginti --language de
174
174
  | Generate images | `/auxiliary image`, then ask for an image |
175
175
  | Read screenshots/images | `/image-read path/to/screenshot.png "what changed?"` |
176
176
  | Research with sources | `/web-research latest Android Gradle plugin official docs` |
177
+ | Run deep research | `/deep-research standard compare current research-agent citation methods` |
177
178
  | Enable research wrapper | `/research-wrapper gpt-5.4-mini medium` |
178
179
  | Resume current project | `aginti resume` (`1` is newest/latest; Space shows more) |
179
180
  | Browse all sessions | `aginti resume --all-sessions` |
180
181
  | Queue into a running session | `aginti queue <session-id> "extra instruction"` |
182
+ | Inspect durable goal revisions | `aginti sessions list` and `aginti sessions show <session-id>` |
183
+
184
+ The runtime uses durable goal lifecycles, safe-boundary inbox interruption,
185
+ progressive tool/context disclosure, bounded read batching, evidence-gated
186
+ completion, and provider attribution. See
187
+ [State-of-the-Art Agent Runtime](docs/state-of-the-art-agent-runtime.md) for the
188
+ embedding and acceptance contract.
181
189
  | Clean empty sessions | `aginti --remove-empty-sessions` |
182
190
  | Check capabilities | `aginti capabilities`, `aginti doctor --capabilities` |
183
191
  | Sync reviewed skills | `aginti skillmesh status`, `aginti skillmesh sync` |
@@ -249,7 +257,7 @@ The website keeps the visual walkthrough in a carousel so this README can stay f
249
257
  | Writing specialist | A dedicated writing-only LLM call for prose, chapters, scripts, books, essays, research-paper sections, and revisions, with formatter handoff notes for Markdown/LaTeX/Final Draft. |
250
258
  | Patch workflow | Codex-style patch envelopes, unified diffs, exact replacements, hashes, compact diffs, and path guardrails. |
251
259
  | Parallel scouts | Optional scout calls for architecture, implementation, review, tests, git flow, research, symbol tracing, and dependency risk. |
252
- | Image reading and web research | LocalLLM sessions send pixels only to the loopback vision endpoint. `web_research` preserves source lists for the active model to synthesize. Hosted OpenAI and wrapper paths are explicit opt-ins, never credential-driven fallbacks. |
260
+ | Image reading and web research | LocalLLM sessions keep pixels on the loopback vision endpoint. `web_search`, `read_web_page`, and `deep_research` provide fast discovery, exact source extraction, resumable evidence gathering, and claim-level citation audits. Hosted paths remain explicit opt-ins. |
253
261
  | SCS mode | Default Student-Committee-Supervisor quality gate with independent planning, execution, and validation roles. |
254
262
  | AAPS adapter | Optional `@lazyingart/aaps` integration for `.aaps` workflow init, validate, parse, compile, dry-run, and run commands. |
255
263
  | AgentLink | Local-first collaboration between AgInTi sessions through boards, typed messages, action contracts, safe summaries, and evidence bundles. |
@@ -397,6 +405,7 @@ More detail:
397
405
  - [docs/model-selection.md](docs/model-selection.md)
398
406
  - [docs/auxiliary-image-generation.md](docs/auxiliary-image-generation.md)
399
407
  - [docs/perception-and-web-research.md](docs/perception-and-web-research.md)
408
+ - [docs/deep-research-engine.md](docs/deep-research-engine.md)
400
409
  - [docs/cli-i18n.md](docs/cli-i18n.md)
401
410
  - [docs/skillmesh.md](docs/skillmesh.md)
402
411
 
@@ -413,6 +422,7 @@ More detail:
413
422
  | Runtime modes and autonomy | [docs/runtime-modes-and-autonomy.md](docs/runtime-modes-and-autonomy.md) |
414
423
  | Skills and tools | [docs/skills-and-tools.md](docs/skills-and-tools.md) |
415
424
  | Image reading and web research | [docs/perception-and-web-research.md](docs/perception-and-web-research.md) |
425
+ | Deep research engine | [docs/deep-research-engine.md](docs/deep-research-engine.md) |
416
426
  | Server-owned text-only fallback | [docs/safe-chat.md](docs/safe-chat.md) |
417
427
  | Skill Mesh | [docs/skillmesh.md](docs/skillmesh.md) |
418
428
  | Housekeeping logs | [docs/housekeeping.md](docs/housekeeping.md) |
@@ -34,6 +34,30 @@ lightweight launcher without loading the full agent and web runtime.
34
34
 
35
35
  When a run is active, the web chat and `aginti queue <session-id> "..."` append messages to the inbox instead of trying to mutate the running process directly. The web API exposes `GET /api/sessions/:id/inbox`, `POST /api/sessions/:id/inbox`, `PATCH /api/sessions/:id/inbox/:itemId`, and `DELETE /api/sessions/:id/inbox/:itemId` so browser users can inspect, edit, or remove pending pipe messages before the runner consumes them. The runner drains the inbox at safe boundaries: before each model step and after tool execution. This mirrors the event-queue style used by mature agent UIs while keeping the backend decoupled from any specific frontend.
36
36
 
37
+ Embedding hosts can continue the same durable context without scraping terminal
38
+ output:
39
+
40
+ ```bash
41
+ printf '%s' 'Follow up using the existing evidence.' \
42
+ | aginti resume SESSION_ID --stdin --json
43
+ ```
44
+
45
+ Machine resume emits the same single JSON object as `aginti run --json`, keeps
46
+ the original session ID, restores the saved provider/model/tool/runtime policy,
47
+ and never starts the web UI or writes interactive status lines. Explicit resume
48
+ options may still patch durable runtime fields, but `--stdin` and `--json` are
49
+ transport flags and are not persisted. This is the supported boundary for
50
+ LabCanvas, chat bridges, schedulers, and other embedding hosts that need one
51
+ isolated reusable agent session per conversation.
52
+
53
+ The object includes `goalRevision` and `goalStatus`. A first request starts at
54
+ revision 1. Every nonempty resume prompt advances the revision while retaining
55
+ the bounded prior-goal ledger. Accepted completion marks that revision
56
+ `completed`; a safe interruption or exhausted bounded run marks it `paused`;
57
+ provider/runtime failure marks it `failed`. The next continuation reactivates
58
+ the same session instead of replaying prior work. `aginti sessions show
59
+ SESSION_ID` exposes both the revision history and lifecycle transitions.
60
+
37
61
  The interactive CLI keeps the input panel visible while a run is working. Enter sends the current draft as an ASAP pipe message and displays it as `→`; the runner drains those messages before normal inbox items and before after-finish queued prompts. Tab stores the draft as an after-finish queue item and displays it as `↳`; those prompts run only after the current run completes. Alt+Up moves the last pending `→` message back into the editor, and Shift+Left moves the last pending `↳` message back into the editor. Idle Esc is ignored so it does not redraw the prompt into the transcript. During a run, Esc waits when `→` pipe messages are still pending and stops the run only when no ASAP pipe message is pending; Ctrl+C always stops. The current command cwd is rendered below the input panel in both idle and running states.
38
62
 
39
63
  The web UI uses a related but browser-appropriate pattern. Enter sends and Shift+Enter adds a newline. `Pipe to run` writes an ASAP inbox item shared with CLI. `Queue after finish` keeps a browser-local next prompt and starts it after the current web-owned run finishes. Both lanes render in a pending panel with Edit and Remove buttons instead of terminal-only keybindings.
@@ -0,0 +1,172 @@
1
+ # Deep Research Engine
2
+
3
+ AgInTiFlow has two deliberately different research paths:
4
+
5
+ - `web_search` is a fast lookup tool.
6
+ - `deep_research` is a bounded, resumable evidence workflow for questions that
7
+ need multiple sources, disagreement analysis, or a durable report.
8
+
9
+ Simple questions should stay on the fast path. A deep-research run spends more
10
+ queries and model calls only when breadth, verification, and traceability add
11
+ real value.
12
+
13
+ ## Architecture
14
+
15
+ The implementation follows the strongest production patterns without making
16
+ every query an unbounded agent swarm:
17
+
18
+ 1. **Plan**: the active provider decomposes the question into non-overlapping
19
+ subquestions, search queries, preferred source types, and exclusions.
20
+ 2. **Search**: queries run with bounded concurrency. The no-key default falls
21
+ back from DuckDuckGo HTML to Bing RSS. An explicitly configured Brave Search
22
+ route is optional. Multi-domain corpora receive separate bounded `site:`
23
+ queries matched to entity-specific subquestions instead of one fragile OR
24
+ expression.
25
+ 3. **Rank, diversify, and deduplicate**: canonical URLs remove tracking state;
26
+ primary, official, scholarly, and high-relevance results rank ahead of
27
+ summaries, while a bounded diversity penalty prevents one domain from
28
+ crowding every selected source.
29
+ 4. **Read exact sources**: `read_web_page` validates every redirect before the
30
+ next request, rejects private DNS resolutions, streams bounded bytes, strips
31
+ scripts/navigation, extracts article/main text and metadata, records hashes,
32
+ and marks all retrieved text as untrusted evidence.
33
+ 5. **Extract evidence**: isolated structured-output calls identify relevant
34
+ subquestions, claims, exact quotations, confidence, and limitations.
35
+ 6. **Verify**: deterministic code checks that quoted passages occur in the
36
+ exact retrieved source. Unverified quotations do not enter synthesis.
37
+ 7. **Fill gaps**: standard/deep runs may issue one bounded follow-up pass for
38
+ uncovered subquestions when query and source budgets remain.
39
+ 8. **Synthesize**: the active provider receives verified evidence rather than
40
+ arbitrary page text. Every substantive paragraph and finding carries source
41
+ IDs.
42
+ 9. **Audit**: deterministic code removes invented source IDs and unsupported
43
+ synthesis statements whose cited sources produced no verified evidence,
44
+ then reports claim, quotation, citation, question, domain, and
45
+ primary-source coverage.
46
+ 10. **Persist**: every stage checkpoints one JSON state file. The final cited
47
+ Markdown report is saved beside it and sent to the canvas.
48
+
49
+ This combines the orchestrator/worker and separate citation-pass lessons
50
+ described by [Anthropic's production research
51
+ system](https://www.anthropic.com/engineering/multi-agent-research-system)
52
+ with the iterative plan/search/read/gap/synthesize and background-resume model
53
+ documented for [Gemini Deep
54
+ Research](https://ai.google.dev/gemini-api/docs/deep-research). AgInTiFlow keeps
55
+ the fan-out explicitly bounded and stays on the active DeepSeek, LocalLLM, or
56
+ other selected provider.
57
+
58
+ ## Research Budgets
59
+
60
+ | Depth | Queries | Sources | Gap passes | Intended use |
61
+ | --- | ---: | ---: | ---: | --- |
62
+ | `quick` | 3 | 6 | 0 | Small comparison or source check |
63
+ | `standard` | 6 | 12 | 1 | Normal multi-source research |
64
+ | `deep` | 10 | 20 | 1 | Broad review, contested topic, or decision report |
65
+
66
+ The caller may reduce these budgets, but hard caps remain 12 queries and 24
67
+ sources. Search/page concurrency is bounded to six and defaults to three or
68
+ four.
69
+
70
+ ## Usage
71
+
72
+ Interactive:
73
+
74
+ ```text
75
+ /deep-research standard Compare current primary-source approaches to citation verification in research agents
76
+ /deep-research deep Review recent optical biosensing methods, emphasizing original papers and unresolved limitations
77
+ ```
78
+
79
+ An agent can call:
80
+
81
+ ```json
82
+ {
83
+ "query": "What evidence supports the current design choices?",
84
+ "depth": "standard",
85
+ "sourcePolicy": "primary",
86
+ "domains": ["docs.example.org", "arxiv.org"]
87
+ }
88
+ ```
89
+
90
+ To resume a partial or completed same-query run, pass the returned
91
+ `researchId`. A completed same-day run is returned from its checkpoint unless
92
+ `refresh=true` is explicit. A transient run that retrieved zero allowed sources
93
+ is marked failed, preserves its attempts, and retries retrieval on resume
94
+ instead of caching an empty report as success. Checkpoint schema changes
95
+ invalidate old cached runs automatically.
96
+
97
+ ## Artifacts
98
+
99
+ Each session stores:
100
+
101
+ ```text
102
+ artifacts/deep-research-RESEARCH_ID.json
103
+ artifacts/deep-research-RESEARCH_ID.md
104
+ ```
105
+
106
+ The JSON includes:
107
+
108
+ - objective, plan, query/source budgets, and source policy;
109
+ - every search attempt and provider failure/fallback;
110
+ - canonical source URLs, metadata, retrieval timestamps, and SHA-256 hashes;
111
+ - readable source text and ranked passages;
112
+ - extracted claims, exact quotations, limitations, and question mappings;
113
+ - missing questions, source diversity, and quote-verification rates;
114
+ - final synthesis and citation audit;
115
+ - stage/status fields used for crash-safe resume.
116
+
117
+ ## Search Providers
118
+
119
+ The default `auto` policy uses public no-key providers:
120
+
121
+ ```text
122
+ DuckDuckGo HTML -> Bing RSS
123
+ ```
124
+
125
+ For an explicitly configured Brave Search account:
126
+
127
+ ```bash
128
+ export AGINTI_WEB_SEARCH_PROVIDER=brave
129
+ export BRAVE_SEARCH_API_KEY=...
130
+ ```
131
+
132
+ An ambient key does not select Brave. The provider must be selected explicitly
133
+ through configuration or a tool argument.
134
+
135
+ ## Safety And Evidence Rules
136
+
137
+ - Only public HTTP/HTTPS URLs are accepted. Embedded credentials, single-label
138
+ internal hosts, loopback, RFC1918, link-local, multicast, `.local`, private
139
+ DNS resolutions, and redirected private targets are rejected before fetch.
140
+ - Domain allowlists and blocklists apply to search results, direct reads, and
141
+ redirect targets.
142
+ - Tracking parameters and fragments are removed before deduplication.
143
+ - Page bytes are bounded while streaming; extracted characters are bounded too.
144
+ - HTML scripts, forms, navigation, footers, and similar noise are removed.
145
+ - Retrieved text is always labeled untrusted and never treated as tool or agent
146
+ instructions.
147
+ - PDFs are hash-verified but not misrepresented as parsed by the dependency-free
148
+ page reader. A document/PDF tool remains responsible for full PDF extraction.
149
+ - Synthesis sees only verified evidence records. Unknown citation IDs and
150
+ citations to sources without verified evidence are removed and reported.
151
+ - Provider selection remains explicit. Deep research uses the active provider;
152
+ it does not silently escape LocalLLM or DeepSeek because another API key is
153
+ present.
154
+
155
+ ## Quality Signals
156
+
157
+ The report audit exposes evidence quality rather than hiding it behind fluent
158
+ prose:
159
+
160
+ - question coverage;
161
+ - readable source count;
162
+ - primary/scholarly source count;
163
+ - independent-domain count;
164
+ - exact-quote verification rate;
165
+ - statement-level citation coverage;
166
+ - unknown/invented citation IDs;
167
+ - unsupported synthesis statements removed before report rendering;
168
+ - contradictions, uncertainties, and unresolved questions.
169
+
170
+ These metrics are diagnostic gates, not a guarantee that a source is correct.
171
+ High-stakes work still requires domain review and, where appropriate, direct
172
+ inspection of the underlying paper, standard, dataset, or official record.
@@ -8,7 +8,9 @@ AgInTiFlow separates visual understanding, web search, and wrapper advice so eac
8
8
  | --- | --- | --- |
9
9
  | `read_image` | Read workspace screenshots, plots, scanned text, diagrams, or allowed remote image URLs. | Saves JSON and Markdown reports under `artifacts/perception/`, records image hashes, and sends the Markdown report to the canvas when used by an agent run. |
10
10
  | `web_search` | Cheap raw search snippets. | Returns compact titles, URLs, snippets, and fallback search URL. |
11
+ | `read_web_page` | Read one exact public source instead of relying on a snippet. | Returns bounded article text, metadata, canonical URL, relevant passages, retrieval time, and content hash. |
11
12
  | `web_research` | Sourced research unit for current or external information. | Saves `artifacts/research/*-web-research.json` with query, mode, source list, and answer. |
13
+ | `deep_research` | Plan, retrieve, verify, synthesize, and audit a genuinely multi-source question. | Saves resumable JSON state and a cited Markdown report with coverage metrics. |
12
14
  | `research_wrapper` | Read-only strict-JSON second opinion from the selected wrapper. | Saves `artifacts/wrappers/*-research-wrapper.json` with wrapper, model, reasoning, metadata, result, and raw fallback output. |
13
15
 
14
16
  ## Defaults
@@ -18,6 +20,8 @@ AgInTiFlow separates visual understanding, web search, and wrapper advice so eac
18
20
  - Codex image reading requires both `provider=codex` and explicitly enabled wrapper tools. It is not an automatic fallback.
19
21
  - OpenAI image reading defaults to `AGINTI_PERCEPTION_MODEL=gpt-5.4-mini` and `AGINTI_PERCEPTION_REASONING=medium`, with fallback models remaining inside the same explicitly selected OpenAI provider.
20
22
  - `web_research` defaults to lightweight snippet mode. The active LocalLLM can synthesize those returned snippets and sources during the next agent step without a second provider call.
23
+ - `web_search` automatically falls back from DuckDuckGo HTML to Bing RSS. Brave Search is available only when explicitly selected and configured.
24
+ - `deep_research` uses the active provider for planning, evidence extraction, and synthesis. It never treats another provider's ambient credentials as permission.
21
25
  - `web_research mode=openai` is accepted only for an active OpenAI session or when `allowHostedWebResearch=true`. A denied or failed hosted synthesis is returned with `ok=false`; any preserved snippets are labeled fallback evidence rather than hosted success.
22
26
  - `json_specialist` stays on the active provider. A different provider requires `allowHostedJsonSpecialist=true`; ambient hosted keys and model-generated provider arguments cannot escalate a LocalLLM session.
23
27
  - `research_wrapper` defaults to `AGINTI_RESEARCH_WRAPPER_MODEL=gpt-5.4-mini` and `AGINTI_RESEARCH_WRAPPER_REASONING=medium`.
@@ -30,6 +34,7 @@ AgInTiFlow separates visual understanding, web search, and wrapper advice so eac
30
34
  /image-read artifacts/screenshots/app.png what looks wrong?
31
35
  /image-read --codex artifacts/screenshots/app.png what looks wrong?
32
36
  /web-research latest Android Gradle plugin official docs
37
+ /deep-research standard compare current citation-verification methods using primary sources
33
38
  /research-wrapper gpt-5.4-mini medium
34
39
  /research-wrapper off
35
40
  ```
@@ -40,6 +45,8 @@ Use `read_image` when pixels matter. Do not guess from filenames or surrounding
40
45
 
41
46
  Use `web_research` when freshness, sources, package docs, standards, or current external information matter. Use `domains` to restrict research to official or primary sources.
42
47
 
48
+ Use `deep_research` when one lookup is insufficient: literature reviews, disputed claims, broad comparisons, technical decisions, or reports that require explicit coverage and citation auditing. See [Deep Research Engine](deep-research-engine.md).
49
+
43
50
  Use `research_wrapper` when a second model should cross-check image/web/research conclusions. The wrapper receives a strict JSON contract and should preserve uncertainty when it cannot directly inspect a source.
44
51
 
45
52
  ## Safety
@@ -47,6 +54,7 @@ Use `research_wrapper` when a second model should cross-check image/web/research
47
54
  - Local image paths must stay inside the workspace unless the run is explicitly trusted host mode.
48
55
  - `.env`, credential files, private keys, and secret-looking paths are blocked.
49
56
  - Remote images require web access and respect domain allowlists.
57
+ - Web page reads reject private/local network targets and private redirect destinations.
50
58
  - Images are capped at 10 MB and four inputs per call.
51
59
  - Artifacts preserve hashes and metadata but never store API keys.
52
60
  - Provider selection is credential-neutral: an ambient key authenticates only a backend that the run already selected and permitted.
@@ -0,0 +1,179 @@
1
+ # State-of-the-Art Agent Runtime
2
+
3
+ AgInTiFlow is designed as an embeddable agent runtime, not a prompt wrapper.
4
+ Its main job is to preserve intent, evidence, and tool progress while providers,
5
+ frontends, and long-running tasks change underneath it.
6
+
7
+ This architecture draws on proven patterns from durable agent systems,
8
+ including the append-only session and lifecycle ideas in
9
+ [`deepseek-ai/deepseek-harness`](https://github.com/deepseek-ai/deepseek-harness),
10
+ while retaining AgInTiFlow's provider-neutral tool and safety boundaries. The
11
+ implementation is local and does not import that repository as a runtime
12
+ dependency.
13
+
14
+ ## Runtime Invariants
15
+
16
+ 1. One logical conversation owns one durable session ID.
17
+ 2. A continuation resumes that session; it does not replay the task from the
18
+ beginning.
19
+ 3. The current user request is authoritative, but prior verified evidence and
20
+ unfinished requirements remain available.
21
+ 4. Tool side effects are accepted only through explicit, validated contracts.
22
+ 5. A final answer is successful only when its required evidence exists.
23
+ 6. Provider failure is not task success and is not silently converted into it.
24
+ 7. Provider handoff preserves the session and goal rather than duplicating
25
+ external work.
26
+
27
+ ## Durable Goal Contract
28
+
29
+ Every session stores a versioned goal contract in `state.json`:
30
+
31
+ - `revision`: advances for every resumed request;
32
+ - `currentHash` and `currentPreview`: identify the authoritative request
33
+ without placing private raw prompts in operational indexes;
34
+ - `history`: bounded revision history with previous-goal and plan hashes;
35
+ - `status`: `active`, `completed`, `paused`, or `failed`;
36
+ - `lifecycle`: bounded status transitions with reason and timestamp.
37
+
38
+ Accepted direct answers, evidence-backed assistant answers, and `finish` tool
39
+ calls mark the current revision completed. User interruption, step exhaustion,
40
+ or a repairable tool-contract stop pauses it. Provider timeout, preflight
41
+ failure, and unexpected runtime errors mark it failed. A new continuation
42
+ reactivates the same session at the next revision.
43
+
44
+ Inspect it without parsing terminal output:
45
+
46
+ ```bash
47
+ aginti sessions list
48
+ aginti sessions show SESSION_ID
49
+ ```
50
+
51
+ Machine responses also expose `goalRevision` and `goalStatus`.
52
+
53
+ ## Append-Only Evidence And Atomic State
54
+
55
+ The canonical session lives under
56
+ `~/.agintiflow/sessions/<session-id>/`. Atomic `state.json` snapshots hold the
57
+ resumable working state. Append-only JSONL events preserve lifecycle, tool,
58
+ model, evidence, inbox, and recovery facts. A project-local index points to the
59
+ canonical session without copying private history.
60
+
61
+ Malformed state is treated as corruption, not as a missing session. Event
62
+ appends are serialized, state saves are atomic and fsynced, and the SQLite
63
+ session index uses WAL plus a bounded busy timeout for multiple frontends.
64
+
65
+ ## Safe Interruption And Inbox
66
+
67
+ `aginti queue SESSION_ID "instruction"`, the CLI composer, and the web app all
68
+ write to the same durable inbox. The runner consumes messages only at safe
69
+ boundaries:
70
+
71
+ - before a model step;
72
+ - after a tool action;
73
+ - before accepting completion.
74
+
75
+ This permits an operator or chat bridge to correct, narrow, extend, or cancel
76
+ the current direction without mutating an in-flight model request or replaying
77
+ completed side effects. ASAP input and after-finish input remain distinct.
78
+
79
+ ## Progressive Context And Tool Disclosure
80
+
81
+ The first model turn receives a focused runtime contract, the current goal,
82
+ relevant project instructions, and only the skills selected for that request.
83
+ It does not receive an indiscriminate dump of every skill or workspace file.
84
+
85
+ Tool access is progressively disclosed:
86
+
87
+ - direct chat can answer without tools;
88
+ - unfamiliar repositories begin with bounded inspection and search;
89
+ - relevant routines are preferred over rebuilding mature workflows;
90
+ - a small batch of up to four independent read-only calls may run in one turn;
91
+ - writes, GUI actions, network writes, and irreversible operations remain
92
+ isolated, ordered calls.
93
+
94
+ Workspace search is bounded by file count, bytes, and elapsed time. Default
95
+ root scans skip generated outputs, artifacts, and private data, while an
96
+ explicit path remains inspectable when the user actually requested it.
97
+
98
+ ## Truthful Completion
99
+
100
+ Completion is checked against an evidence scope. Read-only answers and plans do
101
+ not need irrelevant command or visual evidence. File creation, publication,
102
+ GUI work, and other external actions require the corresponding evidence.
103
+
104
+ The runtime provides:
105
+
106
+ - one bounded retry when a model claims completion without required evidence;
107
+ - one bounded repair for an empty model answer;
108
+ - a concise fallback only when runtime evidence already verifies completion;
109
+ - a resumable stop instead of a false success when evidence remains absent;
110
+ - short-circuiting after a blocked tool so later calls in that batch are not
111
+ dispatched against an invalid state.
112
+
113
+ ## Provider Attribution And Handoff
114
+
115
+ `npm run eval:provider-attribution` compares a raw provider answer with the
116
+ same provider through AgInTiFlow. Results are classified as:
117
+
118
+ - `both_pass`: provider and orchestration both satisfy the contract;
119
+ - `orchestration_loss_or_help`: the runtime changed the outcome, so inspect
120
+ prompting, context, tools, or completion gates;
121
+ - `provider_limit`: the raw model itself failed the contract.
122
+
123
+ This prevents orchestration bugs from being blamed on DeepSeek or a local
124
+ model, and prevents weak model output from triggering unnecessary framework
125
+ rewrites.
126
+
127
+ Embedding hosts should use a provider chain while preserving the same AgInTi
128
+ session. LabCanvas uses DeepSeek first and LocalLLM second. A handoff occurs
129
+ only after a categorized provider failure and must not replay verified side
130
+ effects. Codex and Claude remain explicit opt-in backends rather than hidden
131
+ fallbacks.
132
+
133
+ ## Machine Host Protocol
134
+
135
+ The supported subprocess boundary is:
136
+
137
+ ```bash
138
+ printf '%s' 'Do the task.' | aginti run --stdin --json [runtime options]
139
+ printf '%s' 'Continue with this correction.' \
140
+ | aginti resume SESSION_ID --stdin --json
141
+ ```
142
+
143
+ Exactly one JSON object is emitted. It includes success/failure, session,
144
+ provider, model, resume state, goal revision/status, result, stop state, and
145
+ reason. Interactive banners, update checks, and web startup are suppressed.
146
+ Stopped or failed runs always have `ok: false` even when they contain a useful
147
+ human-facing explanation.
148
+
149
+ ## Established Routines, Not Reinvention
150
+
151
+ AgInTiFlow is the reasoning and supervision layer. Domain work should use the
152
+ existing routine owned by the relevant project:
153
+
154
+ - LazyEdit and AutoPublish for subtitle-aware video publication;
155
+ - LALACHAN/Xiaoyunque for story and video generation;
156
+ - Musia for music and song-first MV workflows;
157
+ - LabCanvas CAD, KiCad, Blender, TeX/PDF, presentation, grant, and figure
158
+ routines;
159
+ - WeChat and WeCom transports for exact-chat delivery.
160
+
161
+ The agent selects, invokes, monitors, and verifies those routines. It does not
162
+ replace them with prompt-specific shell fragments.
163
+
164
+ ## Acceptance Gates
165
+
166
+ A primary-backend release is accepted only after all of these pass:
167
+
168
+ 1. Syntax and deterministic runtime tests.
169
+ 2. Durable run/resume, goal lifecycle, inbox, and session-isolation tests.
170
+ 3. Progressive tool, bounded search, and truthful-completion tests.
171
+ 4. Raw-provider versus agent attribution for DeepSeek and LocalLLM.
172
+ 5. A live read-only established-routine task with no accidental write.
173
+ 6. A live exact artifact-creation task with byte-level verification.
174
+ 7. A live LocalLLM direct-response task.
175
+ 8. Host project tests, chat-bridge self-tests, package dry run, installed
176
+ version check, and existing-runtime restart.
177
+
178
+ These gates keep the architecture fast for ordinary chat, capable for long
179
+ tasks, and honest when a provider or external service is unavailable.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazyingart/agintiflow",
3
- "version": "0.20.199",
3
+ "version": "0.20.201",
4
4
  "type": "module",
5
5
  "description": "AgInTiFlow is a project-aware agent workspace for hybrid wet-dry R&D, hardware-aware intelligence, software automation, and industrial workflows.",
6
6
  "license": "Apache-2.0",
@@ -92,6 +92,7 @@
92
92
  "scripts/smoke-model-roles.js",
93
93
  "scripts/smoke-platform.js",
94
94
  "scripts/smoke-perception-research.js",
95
+ "scripts/smoke-deep-research.js",
95
96
  "scripts/smoke-permission-modes.js",
96
97
  "scripts/smoke-public-research-wrapper.js",
97
98
  "scripts/smoke-safe-chat.js",
@@ -122,7 +123,7 @@
122
123
  "scripts": {
123
124
  "start": "node run.js",
124
125
  "web": "node web.js",
125
- "check": "node --check run.js && node --check web.js && node --check bin/aginti-cli.js && node --check bin/aginti-public-research.js && node --check bin/aginti-safe-chat.js && node --check src/*.js && node --check src/mcp/*.js && node --check public/*.js && node --check scripts/postinstall-webapp.js && node --check scripts/seed-supervised-homework.js && node --check scripts/smoke-agentlink.js && node --check scripts/smoke-execution-policy.js && node --check scripts/smoke-math-rendering.js && node --check scripts/smoke-mcp.js && node --check scripts/smoke-public-research-wrapper.js && node --check scripts/smoke-runtime-core.js && node --check scripts/smoke-safe-chat.js && node --check scripts/smoke-web-ui.js && node --check scripts/smoke-scs-evidence-visibility.js && node --check scripts/fixtures/mcp-stdio-smoke-server.mjs",
126
+ "check": "node --check run.js && node --check web.js && node --check bin/aginti-cli.js && node --check bin/aginti-public-research.js && node --check bin/aginti-safe-chat.js && node --check src/*.js && node --check src/mcp/*.js && node --check public/*.js && node --check scripts/postinstall-webapp.js && node --check scripts/seed-supervised-homework.js && node --check scripts/eval-provider-attribution.js && node --check scripts/smoke-agentlink.js && node --check scripts/smoke-execution-policy.js && node --check scripts/smoke-math-rendering.js && node --check scripts/smoke-mcp.js && node --check scripts/smoke-public-research-wrapper.js && node --check scripts/smoke-runtime-core.js && node --check scripts/smoke-safe-chat.js && node --check scripts/smoke-web-ui.js && node --check scripts/smoke-scs-evidence-visibility.js && node --check scripts/fixtures/mcp-stdio-smoke-server.mjs",
126
127
  "setup:toolchain-docker": "scripts/setup-agent-toolchain-docker.sh",
127
128
  "smoke:coding-tools": "node scripts/smoke-coding-tools.js",
128
129
  "smoke:dynamic-step-budget": "node scripts/smoke-dynamic-step-budget.js",
@@ -154,6 +155,7 @@
154
155
  "smoke:model-roles": "node scripts/smoke-model-roles.js",
155
156
  "smoke:platform": "node scripts/smoke-platform.js",
156
157
  "smoke:perception-research": "node scripts/smoke-perception-research.js",
158
+ "smoke:deep-research": "node scripts/smoke-deep-research.js",
157
159
  "smoke:permission-modes": "node scripts/smoke-permission-modes.js",
158
160
  "smoke:public-research": "node scripts/smoke-public-research-wrapper.js",
159
161
  "smoke:safe-chat": "node scripts/smoke-safe-chat.js",
@@ -168,13 +170,14 @@
168
170
  "smoke:web-port-fallback": "node scripts/smoke-web-port-fallback.js",
169
171
  "smoke:autoupdate": "node scripts/smoke-auto-update.js",
170
172
  "eval:local-first-agent": "node scripts/local-first-agent-eval.mjs",
173
+ "eval:provider-attribution": "node scripts/eval-provider-attribution.js",
171
174
  "real:deepseek": "node scripts/real-deepseek-capabilities.js",
172
175
  "postinstall": "node scripts/postinstall-webapp.js",
173
176
  "supervision:seed": "node scripts/seed-supervised-homework.js",
174
177
  "storage:migrate": "node bin/aginti-cli.js storage migrate",
175
178
  "publish:env": "node scripts/npm-publish-from-env.js publish --access public",
176
179
  "publish:env:whoami": "node scripts/npm-publish-from-env.js whoami",
177
- "test": "npm run check && npm run smoke:localllm-provider && npm run smoke:localllm-model-tiers && npm run smoke:localllm-auto-max && npm run smoke:local-resource-policy && npm run smoke:context-budget-recovery && npm run smoke:session-runtime && npm run smoke:runtime-core && npm run smoke:progressive-tools && npm run smoke:truthful-completion && npm run smoke:writing-specialist-routing && npm run eval:local-first-agent && npm run smoke:runtime-compat && npm run smoke:autoupdate && npm run smoke:web-api && npm run smoke:math-rendering && npm run smoke:web-ui && npm run smoke:web-autostart && npm run smoke:webapp-command && npm run smoke:web-port-fallback && npm run smoke:docker-command && npm run smoke:coding-tools && npm run smoke:dynamic-step-budget && npm run smoke:execution-policy && npm run smoke:aaps-adapter && npm run smoke:auxiliary-tools && npm run smoke:perception-research && npm run smoke:public-research && npm run smoke:safe-chat && npm run smoke:auth && npm run smoke:agentlink && npm run smoke:canvas-artifacts && npm run smoke:capabilities && npm run smoke:mcp && npm run smoke:model-roles && npm run smoke:platform && npm run smoke:permission-modes && npm run smoke:skills && npm run smoke:skillmesh && npm run smoke:tmux-tools && npm run smoke:long-jobs && npm run smoke:run-stdin && npm run smoke:cli-chat && npm run smoke:inbox",
180
+ "test": "npm run check && npm run smoke:localllm-provider && npm run smoke:localllm-model-tiers && npm run smoke:localllm-auto-max && npm run smoke:local-resource-policy && npm run smoke:context-budget-recovery && npm run smoke:session-runtime && npm run smoke:runtime-core && npm run smoke:progressive-tools && npm run smoke:truthful-completion && npm run smoke:writing-specialist-routing && npm run eval:local-first-agent && npm run eval:provider-attribution && npm run smoke:runtime-compat && npm run smoke:autoupdate && npm run smoke:web-api && npm run smoke:math-rendering && npm run smoke:web-ui && npm run smoke:web-autostart && npm run smoke:webapp-command && npm run smoke:web-port-fallback && npm run smoke:docker-command && npm run smoke:coding-tools && npm run smoke:dynamic-step-budget && npm run smoke:execution-policy && npm run smoke:aaps-adapter && npm run smoke:auxiliary-tools && npm run smoke:perception-research && npm run smoke:deep-research && npm run smoke:public-research && npm run smoke:safe-chat && npm run smoke:auth && npm run smoke:agentlink && npm run smoke:canvas-artifacts && npm run smoke:capabilities && npm run smoke:mcp && npm run smoke:model-roles && npm run smoke:platform && npm run smoke:permission-modes && npm run smoke:skills && npm run smoke:skillmesh && npm run smoke:tmux-tools && npm run smoke:long-jobs && npm run smoke:run-stdin && npm run smoke:cli-chat && npm run smoke:inbox",
178
181
  "pack:dry-run": "npm pack --dry-run",
179
182
  "smoke:capabilities": "node scripts/smoke-capabilities.js"
180
183
  },
@@ -918,6 +918,23 @@ try {
918
918
  ) {
919
919
  throw new Error("resume subcommand options after the session id should remain options, not prompt text");
920
920
  }
921
+ const machineResume = parseResumeCommandArgs([
922
+ "web-agent-smoke",
923
+ "--stdin",
924
+ "--json",
925
+ "--provider",
926
+ "mock",
927
+ ]);
928
+ if (
929
+ machineResume.sessionId !== "web-agent-smoke" ||
930
+ !machineResume.stdin ||
931
+ !machineResume.json ||
932
+ machineResume.optionArgv.includes("--stdin") ||
933
+ machineResume.optionArgv.includes("--json") ||
934
+ parseArgs(machineResume.optionArgv).provider !== "mock"
935
+ ) {
936
+ throw new Error("resume machine transport flags should be parsed outside the durable runtime patch");
937
+ }
921
938
  const resumeRuntimeOptions = [
922
939
  "--provider",
923
940
  "mock",